fix: collapse context-block validation error cascade#88
Merged
Conversation
Removing all items from a context block surfaced ~25 raw AJV union-branch errors in the editor popover (and issues sheet) instead of the one real constraint. The cause was a stale validator (0.1.0-alpha.0, pre-collapse) paired with an error-grouping parser written for that version's path format. - Bump @tightknitai/slack-block-kit-validator 0.1.0-alpha.0 -> 0.1.7, which collapses the AJV oneOf cascade via per-type focus validators. - Rewrite error-grouping for 0.1.7's `blocks[N]...` path format so errors stay attributed to their block; the new format would otherwise fall into the General bucket, blanking the per-block popover and the row indicator. - Add a calm empty-state hint to the context editor that guides the user to add an item or delete the block, rather than only showing a red error. - Add error-grouping tests, including one that runs the real validator to pin the validator/parser format coupling so future drift fails loudly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
block-kitchen | 7d46d1a | Commit Preview URL Branch Preview URL |
Jun 01 2026, 06:01 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Removing all items from a context block produced a wall of ~25 raw AJV errors in the editor popover (and the issues sheet) —
must be equal to constant,must have required property 'hero_image',must match a schema in anyOf, etc. Only one of them was real: the block needs ≥1 element.Root cause
Two compounding issues:
@tightknitai/slack-block-kit-validatorwas pinned at0.1.0-alpha.0— the first alpha, which predates theformatAjvErrorsfocus-validator collapse. When a block fails its branch in the undiscriminated block-typeoneOf, that version reports failures from every branch./N/...→blocks[N]..., with caveat messages using a space rather than a colon).error-grouping.tsparsed the old/N/...shape, so a naive bump alone would route every error into the "General" bucket — blanking the per-block popover and the row's error indicator.Changes
@tightknitai/slack-block-kit-validator^0.1.0-alpha.0→^0.1.7. Verified API-compatible (identical exports/signatures/result shape); schema diff is 5 additive lines (one optionallevelfield), nothing that newly flags valid blocks.error-grouping.tsfor theblocks[N]...path format — strips theblocks[N]prefix while keeping sub-paths as context, handles space-separated caveat-helper messages,(root)errors, and out-of-range indices.context-editor.tsx: when the block has no items, show a calm guiding hint ("add an item, or delete the block") instead of relying solely on a red error. Empty is allowed — Send is already gated onerrorCount > 0— rather than fighting the user mid-edit.test/error-grouping.test.ts, 13 cases) including an integration test that runs the real validator on an empty context block, pinning the validator/parser format coupling so future drift fails loudly instead of silently emptying the popover.Result
The same action now yields a single, correctly-attributed error —
elements: fewer than 1 items— plus the empty-state hint. Toolbar shows "1 issue" instead of a wall.Verification
pnpm test— 230/230 pass (13 new)pnpm typecheck— cleanpnpm lint— clean🤖 Generated with Claude Code