feat(CC-264a): add brief-validate.sh shell pre-dispatch validator#163
Merged
Conversation
…spatch protocol docs - scripts/brief-validate.sh: pure-shell brief field validator (schema_version/ working_dir/goal/files required; self_verify required for file-writing briefs; working_dir existence check). Exit 0=VALID, 1=REJECT, 2=usage. - scripts/test-brief-validate.sh: 12 cases covering happy paths, all reject conditions, and edge cases (read-only brief, empty file, missing file). - scripts/run-all-tests.sh: add test-brief-validate suite (31 total). - scripts/test-run-all-tests.sh: mirror SUITE_NAMES update. - .github/workflows/lint.yml: add test-brief-validate CI job. - docs/dispatch-brief.md: append "## Dispatch protocol" section documenting the 3-phase shell pipeline (validate → dispatch → post-verify). - BACKLOG.md: CC-264 area fix (ux/arch/process → arch/process, max 2 tokens). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- brief-validate.sh: add acceptance: required-field check (5th required field, after files: and before self_verify constraint). Uses grep -Eq '^acceptance:' pattern (block key, not inline value). - test-brief-validate.sh: update 5 existing fixtures to include acceptance:; add 3 new cases: reject-missing-acceptance, reject-edit-no-self-verify, reject-untagged-no-self-verify. Total: 12 → 15 cases. - docs/dispatch-brief.md: Phase 1 field list now includes acceptance; Phase 2 removes PR-B output-contract claim (latest.last sentence). Gate findings addressed: critic [high], qa-tester [critical+high], architecture-reviewer [high] from gate-20260526-095937. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add three missing test cases to scripts/test-brief-validate.sh: - help-exits-zero: --help exits 0 with usage text - no-args-exits-usage: zero args exits 2 with usage text - extra-args-exits-usage: two args exits 2 with usage text Total: 15 → 18 cases. Gate finding: qa-tester [high] x2, critic [medium] from gate-20260526-101405. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- brief-validate.sh: add has_files_entries() and has_acceptance_entries() awk helpers; require at least one list entry under each section. Check order: header exists → entries exist → (then self_verify). Empty sections now reject with same message as missing header. - test-brief-validate.sh: add reject-empty-files-section and reject-empty-acceptance-section cases. Total: 18 → 20. Gate findings addressed: qa-tester [high] x2, critic [medium] x2 from gate-20260526-102204. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- brief-validate.sh: schema_version must equal "1" (reject "invalid field 'schema_version': expected 1" for any other value). working_dir must be absolute path starting with "/" (reject "working_dir must be an absolute path" before existence check). - test-brief-validate.sh: add case_reject_invalid_schema_version and case_reject_relative_working_dir. Total: 20 → 22 cases. Add AGENT.md Step 3 structured docstrings to all 22 test case functions. Gate findings addressed: qa-tester [high] x3, critic [medium] x2 from gate-20260526-103007. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SC2154 shellcheck warning: \$tmp_root referenced but never assigned. Variable was copied from test-portable.sh template but not needed here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All test scripts that source lib/test-harness.sh are excluded from shellcheck scanning (SC1091 cannot follow dynamic source paths). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
scripts/brief-validate.sh: pure-shell brief field validator. Checks 5 required fields (schema_version==1,working_direxists and is absolute,goal,filesnon-empty,acceptancenon-empty); enforcesself_verifyfor file-writing entries (write:,new:,edit:, untagged); rejects empty sections. Exit 0=VALID, 1=REJECT, 2=usage.scripts/test-brief-validate.sh: 22 test cases with AGENT.md Step 3 docstrings — happy paths, all reject conditions, CLI branches, and boundary edge cases.scripts/run-all-tests.sh+scripts/test-run-all-tests.sh: registertest-brief-validatesuite (30 → 31 suites)..github/workflows/lint.yml: addtest-brief-validateCI job.docs/dispatch-brief.md: append## Dispatch protocolsection documenting the 3-phase shell pipeline (Phase 1 validate → Phase 2 dispatch → Phase 3 post-verify [CC-264b]).Part of CC-264 (dispatch overhead reduction). PR B will add
dispatch-post-verify.sh+ executor output contract.Test plan
bash scripts/test-brief-validate.sh→ 22 passed, 0 failedbash scripts/run-all-tests.sh→ 31 suites passed, 0 failedgate-20260526-104409.md)install.sh --dry-run,doctor.sh,uninstall.sh --dry-runall clean🤖 Generated with Claude Code