Skip to content

feat(CC-264a): add brief-validate.sh shell pre-dispatch validator#163

Merged
screenleon merged 7 commits into
mainfrom
cc-264a-brief-validate
May 26, 2026
Merged

feat(CC-264a): add brief-validate.sh shell pre-dispatch validator#163
screenleon merged 7 commits into
mainfrom
cc-264a-brief-validate

Conversation

@screenleon
Copy link
Copy Markdown
Owner

Summary

  • scripts/brief-validate.sh: pure-shell brief field validator. Checks 5 required fields (schema_version==1, working_dir exists and is absolute, goal, files non-empty, acceptance non-empty); enforces self_verify for 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: register test-brief-validate suite (30 → 31 suites).
  • .github/workflows/lint.yml: add test-brief-validate CI job.
  • docs/dispatch-brief.md: append ## Dispatch protocol section 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 failed
  • bash scripts/run-all-tests.sh → 31 suites passed, 0 failed
  • Gate: full tier, all 5 reviewers — GO (gate-20260526-104409.md)
  • Install smoke test: install.sh --dry-run, doctor.sh, uninstall.sh --dry-run all clean

🤖 Generated with Claude Code

screenleon and others added 7 commits May 26, 2026 09:59
…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>
@screenleon screenleon merged commit 526f173 into main May 26, 2026
23 checks passed
@screenleon screenleon deleted the cc-264a-brief-validate branch May 26, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant