Skip to content

Commit 7366630

Browse files
feat(w21-24kl): batch 15 — RED health guard tests + tk→ticket doc migration
Add RED tests for CLI-native ticket health guards (dso-bdk5): shared helpers, transition guards (bug-close-reason, open-children), create guard (closed parent), and link guard (depends_on closed target). Update 73 documentation and skill files replacing tk command references with ticket CLI equivalents (dso-hu14). Fix test assertions that checked for old tk command strings. Remove erroneous .test-index entry for .md file treated as bash test. Revert accidental tk→ticket change in error-sweep.sh (executable script, not documentation). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 60ca86d commit 7366630

File tree

85 files changed

+1174
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1174
-362
lines changed

.test-index

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ plugins/dso/docs/decisions/adr-config-system.md:tests/scripts/test-adr-config-sy
1515
plugins/dso/docs/workflow-config-schema.json:tests/scripts/test-workflow-config-schema.sh
1616
plugins/dso/docs/workflows/COMMIT-WORKFLOW.md:tests/scripts/test-commit-workflow-step-1-5.sh
1717
plugins/dso/docs/workflows/REVIEW-WORKFLOW.md:tests/workflows/test-review-workflow-no-snapshot.sh,tests/workflows/test-review-workflow-size-thresholds.sh
18-
plugins/dso/docs/workflows/TEST-FAILURE-DISPATCH.md:plugins/dso/skills/sprint/prompts/test-failure-dispatch-protocol.md
1918
plugins/dso/hooks/dispatchers/pre-bash.sh:tests/hooks/test-pre-bash-dispatcher.sh
2019
plugins/dso/hooks/dispatchers/pre-edit.sh:tests/hooks/test-pre-edit-write-dispatcher.sh
2120
plugins/dso/hooks/dispatchers/pre-write.sh:tests/hooks/test-pre-edit-write-dispatcher.sh
@@ -35,7 +34,7 @@ plugins/dso/scripts/merge-ticket-index.py:tests/scripts/test-merge-ticket-index.
3534
plugins/dso/scripts/pre-commit-format-fix.sh:tests/scripts/test-precommit-format-fix-config-paths.sh
3635
plugins/dso/scripts/project-detect.sh:tests/scripts/test-ci-generator-integration.sh
3736
plugins/dso/scripts/ticket-bridge-status.sh:tests/scripts/test_bridge_status.py
38-
plugins/dso/scripts/ticket-lib.sh:tests/scripts/test_revert_event.py,tests/scripts/test-ticket-lib.sh
37+
plugins/dso/scripts/ticket-lib.sh:tests/scripts/test_revert_event.py,tests/scripts/test-ticket-lib.sh,tests/scripts/test-ticket-health-guards.sh [test_ticket_read_status_returns_current_status]
3938
plugins/dso/scripts/ticket-list.sh:tests/scripts/test-ticket-list.sh,tests/scripts/test_bridge_alert_display.py
4039
plugins/dso/scripts/ticket-revert.sh:tests/scripts/test_revert_event.py
4140
plugins/dso/scripts/ticket-show.sh:tests/scripts/test-ticket-show.sh,tests/scripts/test_bridge_alert_display.py

.tickets/.sync-state.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@
449449
"last_synced": "2026-03-19T18:38:35Z",
450450
"local_hash": "14c516947a151a3db8bdec4010e2fd6e"
451451
},
452-
"last_pull_timestamp": "2026-03-23T17:18:21Z",
453-
"last_sync_commit": "0bd13575cbd72c95cc937af7ce2a2082576e9cab",
452+
"last_pull_timestamp": "2026-03-23T18:21:21Z",
453+
"last_sync_commit": "60ca86de64edef8ef759878b2471445152fe6145",
454454
"w21-5cqr": {
455455
"jira_hash": "bce29d76f01c58613ee99cb1dd03920d",
456456
"jira_key": "DIG-61",

.tickets/dso-1459.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
id: dso-1459
3+
status: open
4+
deps: [dso-bdk5, dso-sroj]
5+
links: []
6+
created: 2026-03-23T17:34:49Z
7+
type: task
8+
priority: 1
9+
assignee: Joe Oakhart
10+
parent: dso-k4sw
11+
---
12+
# Add closed-parent guard to ticket-create.sh
13+
14+
15+
## Notes
16+
17+
**2026-03-23T17:35:42Z**
18+
19+
## Description
20+
Add closed-parent guard to ticket-create.sh. After validating parent_id exists (lines 60-70), add: read parent status via ticket_read_status(). If status='closed', exit 1 with error: 'Cannot create child of closed ticket <parent_id>. Reopen the parent first.'
21+

.tickets/dso-1cje.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-1cje
3-
status: in_progress
3+
status: closed
44
deps: [dso-5fbs]
55
links: []
66
created: 2026-03-23T15:19:45Z

.tickets/dso-9p30.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
id: dso-9p30
3+
status: open
4+
deps: [dso-bdk5, dso-sroj]
5+
links: []
6+
created: 2026-03-23T17:34:49Z
7+
type: task
8+
priority: 1
9+
assignee: Joe Oakhart
10+
parent: dso-k4sw
11+
---
12+
# Add closed-parent guard to ticket-link.sh for depends_on
13+
14+
15+
## Notes
16+
17+
**2026-03-23T17:35:42Z**
18+
19+
## Description
20+
Add closed-parent guard to ticket-link.sh. In _write_link_event(), after validating both tickets exist, add: if relation='depends_on' AND target ticket status is 'closed' (via ticket_read_status on target_id, NOT source_id), exit 1 with error. Other relation types (relates_to, blocks) pass through unchanged.
21+
22+
Note: _write_link_event is called for reciprocal relates_to links — guard must only fire when relation=depends_on.
23+

.tickets/dso-b25k.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
id: dso-b25k
3+
status: open
4+
deps: [dso-jyob, dso-1459, dso-9p30]
5+
links: []
6+
created: 2026-03-23T17:34:49Z
7+
type: task
8+
priority: 1
9+
assignee: Joe Oakhart
10+
parent: dso-k4sw
11+
---
12+
# Remove hook_bug_close_guard and delete closed-parent-guard.sh
13+
14+
15+
## Notes
16+
17+
**2026-03-23T17:35:42Z**
18+
19+
## Description
20+
Remove old hook-based guards:
21+
1. Remove hook_bug_close_guard function from pre-bash-functions.sh (lines 498-583)
22+
2. Remove its call from dispatchers/pre-bash.sh (line 102)
23+
3. Remove its entry from the function table comment (line 17)
24+
4. Delete closed-parent-guard.sh (dead code — not registered in plugin.json)
25+
5. Delete bug-close-guard.sh (thin wrapper calling hook_bug_close_guard)
26+
6. Update tests/hooks/test-pre-bash-functions-ticket-guards.sh — remove hook-specific tests
27+
7. Clean .test-index RED markers for removed test entries
28+
8. Check plugins/dso/hooks/rollback/settings-pre-task2.json for bug-close-guard references
29+
30+
Pre-T6 verification: confirm that tk close routes through tk cmd_status (writes .tickets/ flat files, NOT ticket-transition.sh). The enforcement gap for tk close is acceptable — tk is being removed in story w21-gy45 (cleanup). Document this in the commit message.
31+

.tickets/dso-bdk5.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
id: dso-bdk5
3+
status: in_progress
4+
deps: []
5+
links: []
6+
created: 2026-03-23T17:34:42Z
7+
type: task
8+
priority: 1
9+
assignee: Joe Oakhart
10+
parent: dso-k4sw
11+
---
12+
# RED tests for CLI-native ticket health guards
13+
14+
15+
## Notes
16+
17+
**2026-03-23T17:35:13Z**
18+
19+
## Description
20+
TDD RED task. Write failing tests that assert the post-implementation state BEFORE guard logic is added.
21+
22+
## Files to Create/Edit
23+
1. tests/scripts/test-ticket-health-guards.sh (CREATE) — tests for shared helpers only:
24+
- test_ticket_read_status_returns_current_status
25+
- test_ticket_find_open_children_lists_children
26+
27+
2. tests/scripts/test-ticket-transition.sh (EDIT — append RED tests):
28+
- test_transition_bug_close_requires_reason
29+
- test_transition_bug_close_with_reason_succeeds
30+
- test_transition_close_blocked_with_open_children
31+
32+
3. tests/scripts/test-ticket-create.sh (EDIT — append RED test):
33+
- test_create_with_closed_parent_blocked
34+
35+
4. tests/scripts/test-ticket-link.sh (EDIT — append RED tests):
36+
- test_link_depends_on_closed_target_blocked
37+
- test_link_relates_to_closed_target_allowed
38+
39+
## .test-index
40+
APPEND to existing ticket-lib.sh entry (do NOT replace):
41+
plugins/dso/scripts/ticket-lib.sh: <existing entries>, tests/scripts/test-ticket-health-guards.sh [test_ticket_read_status_returns_current_status]
42+
43+
All tests must FAIL (RED) before T2-T5 run.
44+
45+
## ACCEPTANCE CRITERIA
46+
47+
- [ ] tests/scripts/test-ticket-health-guards.sh exists
48+
Verify: test -f tests/scripts/test-ticket-health-guards.sh
49+
- [ ] test-ticket-health-guards.sh contains at least 2 test functions
50+
Verify: grep -c "^test_" tests/scripts/test-ticket-health-guards.sh | awk '{exit ($1 < 2)}'
51+
- [ ] test-ticket-transition.sh contains RED guard tests
52+
Verify: grep -q "test_transition_bug_close_requires_reason" tests/scripts/test-ticket-transition.sh
53+
- [ ] test-ticket-create.sh contains RED guard test
54+
Verify: grep -q "test_create_with_closed_parent_blocked" tests/scripts/test-ticket-create.sh
55+
- [ ] test-ticket-link.sh contains RED guard tests
56+
Verify: grep -q "test_link_depends_on_closed_target_blocked" tests/scripts/test-ticket-link.sh
57+
- [ ] .test-index entry appended for ticket-lib.sh with RED marker
58+
Verify: grep -q "test-ticket-health-guards" .test-index
59+
60+
61+
**2026-03-23T17:38:45Z**
62+
63+
CHECKPOINT 1/6: Task context loaded ✓
64+
65+
**2026-03-23T17:39:13Z**
66+
67+
CHECKPOINT 2/6: Code patterns understood ✓
68+
69+
**2026-03-23T17:41:10Z**
70+
71+
CHECKPOINT 3/6: Tests written ✓
72+
73+
**2026-03-23T17:41:11Z**
74+
75+
CHECKPOINT 4/6: Implementation complete ✓ (TDD RED task — tests ARE the implementation)
76+
77+
**2026-03-23T17:41:35Z**
78+
79+
CHECKPOINT 5/6: Validation passed ✓ — all 4 files syntactically valid; health-guards runs RED (0 passed, 2 failed)
80+
81+
**2026-03-23T17:41:40Z**
82+
83+
CHECKPOINT 6/6: Done ✓ — All 6 acceptance criteria met. Files created/modified: tests/scripts/test-ticket-health-guards.sh (new), tests/scripts/test-ticket-transition.sh (appended tests 12-14), tests/scripts/test-ticket-create.sh (appended test 7), tests/scripts/test-ticket-link.sh (appended tests 10-11), .test-index (appended RED marker for ticket-lib.sh entry)

.tickets/dso-hu14.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-hu14
3-
status: open
3+
status: in_progress
44
deps: [dso-1cje, dso-yv90]
55
links: []
66
created: 2026-03-23T15:20:45Z
@@ -91,3 +91,38 @@ After all documentation updates complete:
9191
5. Test suite:
9292
bash tests/run-all.sh
9393

94+
## ACCEPTANCE CRITERIA
95+
96+
- [ ] No enumerable tk refs remain in skills/docs/CLAUDE.md
97+
Verify: { grep -rn '\btk show\b\|\btk create\b\|\btk close\b\|\btk add-note\b\|\btk status\b\|\btk transition\b\|\btk dep tree\b' plugins/dso/skills/ plugins/dso/docs/ CLAUDE.md; test $? -ne 0; }
98+
- [ ] All surviving tk refs are tk-wrapper-only commands
99+
Verify: grep -rn '\btk\b' plugins/dso/skills/ plugins/dso/docs/ CLAUDE.md | grep -vE 'tk sync|tk ready|tk blocked|tk dep |tk wrapper|tk CLI|tk commands|the tk|using tk' | head -1 | { read line; test -z "$line"; }
100+
- [ ] Bash syntax validation passes
101+
Verify: bash -n plugins/dso/hooks/lib/pre-bash-functions.sh
102+
103+
104+
## Notes
105+
106+
**2026-03-23T17:38:49Z**
107+
108+
CHECKPOINT 1/6: Task context loaded ✓
109+
110+
**2026-03-23T17:45:02Z**
111+
112+
CHECKPOINT 2/6: Code patterns understood ✓
113+
114+
**2026-03-23T17:45:06Z**
115+
116+
CHECKPOINT 3/6: Tests written (none required) ✓
117+
118+
**2026-03-23T17:58:40Z**
119+
120+
CHECKPOINT 4/6: Implementation complete ✓
121+
122+
**2026-03-23T18:03:36Z**
123+
124+
CHECKPOINT 5/6: Validation passed ✓ — AC1: no banned tk refs, AC2: surviving refs are wrapper-only, AC3: bash syntax OK, AC4: python syntax OK, AC5: test suite passes (pre-existing failures unchanged)
125+
126+
**2026-03-23T18:03:59Z**
127+
128+
CHECKPOINT 6/6: Done ✓

.tickets/dso-hx5n.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
id: dso-hx5n
3+
status: open
4+
deps: []
5+
links: []
6+
created: 2026-03-23T18:04:16Z
7+
type: task
8+
priority: 3
9+
assignee: Joe Oakhart
10+
---
11+
# Update hooks and scripts to use ticket CLI commands instead of tk commands
12+
13+
14+
## Notes
15+
16+
**2026-03-23T18:04:29Z**
17+
18+
Discovered while implementing dso-hu14 (docs/CLAUDE.md tk reference update). Files in plugins/dso/hooks/ and plugins/dso/scripts/ still use banned tk commands: closed-parent-guard.sh uses 'tk status', classify-task.sh uses 'tk show', dedup-tickets.sh uses 'tk close', issue-quality-check.sh uses 'tk add-note', issue-batch.sh and sprint-next-batch.sh use 'tk show', release-debug-lock.sh uses 'tk show'. These are outside the scope of dso-hu14. Requires coordinated update with hook behavioral changes per dso-yv90.

.tickets/dso-jyob.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
id: dso-jyob
3+
status: open
4+
deps: [dso-bdk5, dso-sroj]
5+
links: []
6+
created: 2026-03-23T17:34:49Z
7+
type: task
8+
priority: 1
9+
assignee: Joe Oakhart
10+
parent: dso-k4sw
11+
---
12+
# Add bug-close-reason and open-children guards to ticket-transition.sh
13+
14+
15+
## Notes
16+
17+
**2026-03-23T17:35:42Z**
18+
19+
## Description
20+
Add guard logic to ticket-transition.sh. CRITICAL: guard logic must run INSIDE the Python flock block (lines 118-197), after reading state via the reducer but before building the STATUS event JSON. This matches the existing optimistic concurrency pattern.
21+
22+
When target_status='closed':
23+
1. Read ticket type from reducer state. If type='bug', require --reason flag with 'Fixed:' or 'Escalated to user:' prefix. Exit 1 with instructive error if missing.
24+
2. Call ticket_find_open_children. If any open children, exit 1 listing them with instruction to close children first.
25+
26+
Shell must parse --reason from remaining args before passing to Python block as additional sys.argv.
27+
28+
Also update plugins/dso/docs/ticket-cli-reference.md with --reason flag documentation.
29+

0 commit comments

Comments
 (0)