Skip to content

Commit 9e85be3

Browse files
docs: document RED test gate tolerance in CLAUDE.md (dso-4mlr)
Add .test-index RED marker format, TDD workflow for agents (add/remove markers), and epic closure enforcement to the test gate architecture section. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6193ac4 commit 9e85be3

4 files changed

Lines changed: 68 additions & 3 deletions

File tree

.tickets/dso-0u2q.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: dso-0u2q
3+
status: open
4+
deps: []
5+
links: []
6+
created: 2026-03-22T04:46:14Z
7+
type: bug
8+
priority: 4
9+
assignee: Joe Oakhart
10+
---
11+
# Fix: add comment clarifying TESTED_FILES_LIST append-before-run ordering is intentional in record-test-status.sh
12+

.tickets/dso-4mlr.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-4mlr
3-
status: open
3+
status: in_progress
44
deps: [dso-fj1t, dso-4u0s]
55
links: []
66
created: 2026-03-22T03:27:46Z
@@ -27,6 +27,17 @@ parent: dso-d3gr
2727
← Satisfies: "Epic closure is blocked until all RED markers are removed"
2828

2929

30+
## ACCEPTANCE CRITERIA
31+
32+
- [ ] CLAUDE.md documents .test-index RED marker format `[first_red_test_name]`
33+
Verify: grep -q '\[.*red.*test.*\]\|RED marker\|first_red_test' CLAUDE.md
34+
- [ ] CLAUDE.md documents the convention that RED tests go at the end of test files
35+
Verify: grep -q 'RED test.*end\|end.*test file\|appended.*end' CLAUDE.md
36+
- [ ] CLAUDE.md documents epic closure enforcement of RED marker removal
37+
Verify: grep -q 'epic.*closure.*RED\|RED.*marker.*removed\|blocked.*RED' CLAUDE.md
38+
- [ ] No new documentation files created (update existing only)
39+
Verify: test "$(git ls-files --others --exclude-standard | grep -c '\.md$')" -eq 0
40+
3041
## Notes
3142

3243
<!-- note-id: 8xcam8ba -->
@@ -35,3 +46,45 @@ parent: dso-d3gr
3546
<!-- sync: unsynced -->
3647

3748
Follow .claude/docs/DOCUMENTATION-GUIDE.md for documentation formatting, structure, and conventions.
49+
50+
<!-- note-id: l74qj0tr -->
51+
<!-- timestamp: 2026-03-22T05:42:41Z -->
52+
<!-- origin: agent -->
53+
<!-- sync: unsynced -->
54+
55+
CHECKPOINT 1/6: Task context loaded ✓
56+
57+
<!-- note-id: qek6vova -->
58+
<!-- timestamp: 2026-03-22T05:43:24Z -->
59+
<!-- origin: agent -->
60+
<!-- sync: unsynced -->
61+
62+
CHECKPOINT 2/6: Code patterns understood ✓
63+
64+
<!-- note-id: cl7rln3b -->
65+
<!-- timestamp: 2026-03-22T05:43:33Z -->
66+
<!-- origin: agent -->
67+
<!-- sync: unsynced -->
68+
69+
CHECKPOINT 3/6: Tests written (none required) ✓
70+
71+
<!-- note-id: vjj0aec1 -->
72+
<!-- timestamp: 2026-03-22T05:43:33Z -->
73+
<!-- origin: agent -->
74+
<!-- sync: unsynced -->
75+
76+
CHECKPOINT 4/6: Implementation complete ✓
77+
78+
<!-- note-id: dxeiuii7 -->
79+
<!-- timestamp: 2026-03-22T05:43:43Z -->
80+
<!-- origin: agent -->
81+
<!-- sync: unsynced -->
82+
83+
CHECKPOINT 5/6: Validation passed ✓
84+
85+
<!-- note-id: x6welsg3 -->
86+
<!-- timestamp: 2026-03-22T05:43:55Z -->
87+
<!-- origin: agent -->
88+
<!-- sync: unsynced -->
89+
90+
CHECKPOINT 6/6: Done ✓

.tickets/dso-4u0s.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-4u0s
3-
status: in_progress
3+
status: closed
44
deps: [dso-fj1t]
55
links: []
66
created: 2026-03-22T03:27:34Z

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Priority: 0-4 (0=critical, 4=backlog). Never use "high"/"medium"/"low".
5454
## Architecture
5555

5656
**Jira integration**: `tk sync` (incremental default, `--full` to force, `--check` for dry-run). Requires `JIRA_URL`, `JIRA_USER`, `JIRA_API_TOKEN`.
57-
**Hook architecture**: Consolidated dispatchers (2 processes per Bash tool call: `pre-bash.sh` + `post-bash.sh`). All hooks are jq-free — use `parse_json_field`, `json_build`, and `python3` for JSON parsing. Hook optimization: `tool_logging` and `tool_use_guard` removed from per-call dispatchers; `validation_gate` removed from Edit/Write dispatchers (kept in pre-bash.sh); early-exit guards skip narrow hooks when command keywords don't match. Review workflow timing fix: hash capture occurs after auto-fix passes to prevent drift. On review gate mismatch, diagnostic dump writes to `$ARTIFACTS_DIR/mismatch-diagnostics-<timestamp>.log`; breadcrumb trail in `$ARTIFACTS_DIR/commit-breadcrumbs.log`. See `plugins/dso/hooks/dispatchers/` and `plugins/dso/hooks/lib/`. **Review gate (two-layer defense-in-depth)**: Layer 1 — `pre-commit-review-gate.sh` is a git pre-commit hook (registered in `.pre-commit-config.yaml`); uses `git diff --cached --name-only` for reliable staged-file detection (no command-string parsing); default-deny allowlist from `review-gate-allowlist.conf`; checks review-status file + diff hash; writes JSONL telemetry to `$ARTIFACTS_DIR/review-gate-telemetry.jsonl`; formatting-only hash mismatches self-heal by re-running `ruff format`. Layer 2 — `review-gate.sh` is a PreToolUse hook (thin wrapper around `review-gate-bypass-sentinel.sh`); blocks bypass vectors: `--no-verify`, `-n` on git commit, `core.hooksPath=` override, `git commit-tree`, direct `.git/hooks/` writes, direct writes/deletions to `test-gate-status` and `test-exemptions` (only `record-test-status.sh` and `record-test-exemption.sh` are authorized writers). Test suite: `bash tests/hooks/test-two-layer-review-gate.sh` (or via `bash tests/run-all.sh`). **test gate (two-layer defense-in-depth)**: Layer 1 — `pre-commit-test-gate.sh` is a git pre-commit hook (registered in `.pre-commit-config.yaml`); for each staged source file with an associated test (found via fuzzy matching or `.test-index`), verifies that `test-gate-status` in `$ARTIFACTS_DIR` is present, has `passed` on line 1, and has a matching `diff_hash`; files with no associated test are exempt. Test directories are configurable via `test_gate.test_dirs` in `.claude/dso-config.conf` (default: `tests/`). `.test-index` — a repo-root file for mapping source files to unconventionally-named tests; format: `source/path.ext: test/path1.ext, test/path2.ext` (one entry per line; `#` comments and blank lines ignored); associations from `.test-index` are unioned with fuzzy-match results; the hook self-heals by pruning stale entries (test paths that no longer exist on disk) atomically before each commit and auto-staging the result; `.test-index` is excluded from the diff hash (via `review-gate-allowlist.conf`) to prevent mismatch loops when pruning modifies it. Layer 2 — `review-gate-bypass-sentinel.sh` blocks direct writes/deletions to `test-gate-status` and `test-exemptions`; only `record-test-status.sh` (authorized by COMMIT-WORKFLOW.md Step 3.5) and `record-test-exemption.sh` (for inherently slow tests, exit 124) may write these files.
57+
**Hook architecture**: Consolidated dispatchers (2 processes per Bash tool call: `pre-bash.sh` + `post-bash.sh`). All hooks are jq-free — use `parse_json_field`, `json_build`, and `python3` for JSON parsing. Hook optimization: `tool_logging` and `tool_use_guard` removed from per-call dispatchers; `validation_gate` removed from Edit/Write dispatchers (kept in pre-bash.sh); early-exit guards skip narrow hooks when command keywords don't match. Review workflow timing fix: hash capture occurs after auto-fix passes to prevent drift. On review gate mismatch, diagnostic dump writes to `$ARTIFACTS_DIR/mismatch-diagnostics-<timestamp>.log`; breadcrumb trail in `$ARTIFACTS_DIR/commit-breadcrumbs.log`. See `plugins/dso/hooks/dispatchers/` and `plugins/dso/hooks/lib/`. **Review gate (two-layer defense-in-depth)**: Layer 1 — `pre-commit-review-gate.sh` is a git pre-commit hook (registered in `.pre-commit-config.yaml`); uses `git diff --cached --name-only` for reliable staged-file detection (no command-string parsing); default-deny allowlist from `review-gate-allowlist.conf`; checks review-status file + diff hash; writes JSONL telemetry to `$ARTIFACTS_DIR/review-gate-telemetry.jsonl`; formatting-only hash mismatches self-heal by re-running `ruff format`. Layer 2 — `review-gate.sh` is a PreToolUse hook (thin wrapper around `review-gate-bypass-sentinel.sh`); blocks bypass vectors: `--no-verify`, `-n` on git commit, `core.hooksPath=` override, `git commit-tree`, direct `.git/hooks/` writes, direct writes/deletions to `test-gate-status` and `test-exemptions` (only `record-test-status.sh` and `record-test-exemption.sh` are authorized writers). Test suite: `bash tests/hooks/test-two-layer-review-gate.sh` (or via `bash tests/run-all.sh`). **test gate (two-layer defense-in-depth)**: Layer 1 — `pre-commit-test-gate.sh` is a git pre-commit hook (registered in `.pre-commit-config.yaml`); for each staged source file with an associated test (found via fuzzy matching or `.test-index`), verifies that `test-gate-status` in `$ARTIFACTS_DIR` is present, has `passed` on line 1, and has a matching `diff_hash`; files with no associated test are exempt. Test directories are configurable via `test_gate.test_dirs` in `.claude/dso-config.conf` (default: `tests/`). `.test-index` — a repo-root file for mapping source files to unconventionally-named tests; format: `source/path.ext: test/path1.ext, test/path2.ext` (one entry per line; `#` comments and blank lines ignored); associations from `.test-index` are unioned with fuzzy-match results; the hook self-heals by pruning stale entries (test paths that no longer exist on disk) atomically before each commit and auto-staging the result; `.test-index` is excluded from the diff hash (via `review-gate-allowlist.conf`) to prevent mismatch loops when pruning modifies it. **RED marker format**: `source/path.ext: test/path.ext [first_red_test_name]` — the optional `[marker]` after a test path marks the boundary between GREEN tests (already passing) and RED tests (not yet implemented); failures at or after `first_red_test_name` are tolerated (non-blocking), failures before it still block. RED tests must be placed at the end of the test file. **TDD workflow for agents**: When writing a TDD test for a not-yet-implemented feature, add the test at the end of the test file and add a `[test_name]` marker to the `.test-index` entry — e.g., `source/foo.sh: tests/test_foo.sh [test_new_feature]`. After implementation passes, remove the `[marker]` from `.test-index`. **Epic closure enforcement**: `tk close <epic-id>` is blocked while any `[marker]` entries remain in `.test-index` — remove all RED markers before closing an epic. Layer 2 — `review-gate-bypass-sentinel.sh` blocks direct writes/deletions to `test-gate-status` and `test-exemptions`; only `record-test-status.sh` (authorized by COMMIT-WORKFLOW.md Step 3.5) and `record-test-exemption.sh` (for inherently slow tests, exit 124) may write these files.
5858
**Validation gate**: `validate.sh` writes state; hooks block sprint/epic if validation hasn't passed. `--verbose` for real-time progress.
5959
**Agent routing** (dynamic discovery): `discover-agents.sh` resolves routing categories (e.g., `test_fix_unit`, `complex_debug`) to the best available agent using `agent-routing.conf`. Optional plugins (feature-dev, error-debugging, playwright) are preferred when installed; all categories fall back to `general-purpose` with category-specific prompts from `prompts/fallback/<category>.md`. See `plugins/dso/docs/INSTALL.md` for optional plugin documentation. **Named-agent dispatch** (distinct from routing-category dispatch): two dedicated plugin agents are dispatched directly via `subagent_type``dso:complexity-evaluator` (haiku; dispatched by `/dso:sprint` and `/dso:brainstorm`, read inline by `/dso:fix-bug` due to nesting constraints) and `dso:conflict-analyzer` (sonnet; dispatched by `/dso:resolve-conflicts`). These agents are defined in `plugins/dso/agents/` and are not resolved through `discover-agents.sh`.
6060
**Conflict avoidance** (multi-agent): Static file impact analysis, shared blackboard, agent discovery protocol, semantic conflict check — integrated into `/dso:sprint` and `/dso:debug-everything`.

0 commit comments

Comments
 (0)