|
| 1 | +--- |
| 2 | +id: dso-mck2 |
| 3 | +status: closed |
| 4 | +deps: [] |
| 5 | +links: [] |
| 6 | +created: 2026-03-22T03:54:29Z |
| 7 | +type: task |
| 8 | +priority: 1 |
| 9 | +assignee: Joe Oakhart |
| 10 | +parent: dso-fj1t |
| 11 | +--- |
| 12 | +# Write failing tests for .test-index RED marker parsing in record-test-status.sh |
| 13 | + |
| 14 | +Write failing tests (RED phase) in tests/hooks/test-record-test-status.sh that verify the new RED marker behavior. These tests must fail before the implementation in the next task exists. |
| 15 | + |
| 16 | +## TDD Requirement |
| 17 | + |
| 18 | +Write these 5 test functions FIRST. All 5 must fail (non-zero exit from their assertions) before the implementation task is done. Use the existing create_test_repo helper pattern and RECORD_TEST_STATUS_RUNNER mock for pytest-unavailable environments. |
| 19 | + |
| 20 | +Test functions to add: |
| 21 | +- test_red_marker_tolerates_failure_after_marker: When .test-index entry has [test_red_function] and the test file has failing tests at/after test_red_function, record-test-status.sh exits 0 and writes 'passed' to test-gate-status |
| 22 | +- test_red_marker_blocks_failure_before_marker: When .test-index entry has [test_red_function] and a test BEFORE test_red_function fails, record-test-status.sh exits 1 and writes 'failed' |
| 23 | +- test_no_marker_backward_compat: When .test-index entry has no marker (existing format), behavior is identical to current — failures always block |
| 24 | +- test_marker_not_found_falls_back_to_blocking: When the marker name in [brackets] does not match any function in the test file, record-test-status.sh warns to stderr and exits 1 (blocking, not silent tolerance) |
| 25 | +- test_red_zone_bash_test_file: RED marker detection works for bash test files (function/marker patterns), not only Python |
| 26 | + |
| 27 | +## Files |
| 28 | +- tests/hooks/test-record-test-status.sh — edit (append new test functions) |
| 29 | + |
| 30 | +## Test Filename Fuzzy Match |
| 31 | +Source: plugins/dso/hooks/record-test-status.sh — normalized: recordteststatussh |
| 32 | +Test: tests/hooks/test-record-test-status.sh — normalized: testrecordteststatussh |
| 33 | +recordteststatussh IS a substring of testrecordteststatussh — auto-detected, no .test-index entry needed. |
| 34 | + |
| 35 | +## ACCEPTANCE CRITERIA |
| 36 | + |
| 37 | +- [ ] `bash tests/run-all.sh` passes (exit 0) |
| 38 | + Verify: cd $(git rev-parse --show-toplevel) && bash tests/run-all.sh |
| 39 | +- [ ] `ruff check plugins/dso/scripts/*.py` passes (exit 0) |
| 40 | + Verify: cd $(git rev-parse --show-toplevel) && ruff check plugins/dso/scripts/*.py |
| 41 | +- [ ] `ruff format --check plugins/dso/scripts/*.py` passes (exit 0) |
| 42 | + Verify: cd $(git rev-parse --show-toplevel) && ruff format --check plugins/dso/scripts/*.py |
| 43 | +- [ ] Test file contains all 5 new test functions |
| 44 | + Verify: grep -c 'test_red_marker_tolerates_failure_after_marker\|test_red_marker_blocks_failure_before_marker\|test_no_marker_backward_compat\|test_marker_not_found_falls_back_to_blocking\|test_red_zone_bash_test_file' $(git rev-parse --show-toplevel)/tests/hooks/test-record-test-status.sh | awk '{exit ($1 < 5)}' |
| 45 | +- [ ] All 5 new test functions fail pre-implementation (RED phase — verify manually before implementation task) |
| 46 | + Verify: # Manually confirm assertions fail before implementation exists (RED gate) |
| 47 | +- [ ] Test file remains executable |
| 48 | + Verify: test -x $(git rev-parse --show-toplevel)/tests/hooks/test-record-test-status.sh |
| 49 | + |
| 50 | + |
| 51 | +## Notes |
| 52 | + |
| 53 | +<!-- note-id: h43xx9p1 --> |
| 54 | +<!-- timestamp: 2026-03-22T03:58:56Z --> |
| 55 | +<!-- origin: agent --> |
| 56 | +<!-- sync: unsynced --> |
| 57 | + |
| 58 | +CHECKPOINT 1/6: Task context loaded ✓ |
| 59 | + |
| 60 | +<!-- note-id: 28lr1lhq --> |
| 61 | +<!-- timestamp: 2026-03-22T03:59:37Z --> |
| 62 | +<!-- origin: agent --> |
| 63 | +<!-- sync: unsynced --> |
| 64 | + |
| 65 | +CHECKPOINT 2/6: Code patterns understood ✓ |
| 66 | + |
| 67 | +<!-- note-id: wql08s4w --> |
| 68 | +<!-- timestamp: 2026-03-22T04:00:53Z --> |
| 69 | +<!-- origin: agent --> |
| 70 | +<!-- sync: unsynced --> |
| 71 | + |
| 72 | +CHECKPOINT 3/6: Tests written ✓ |
| 73 | + |
| 74 | +<!-- note-id: a05cp5a9 --> |
| 75 | +<!-- timestamp: 2026-03-22T04:00:58Z --> |
| 76 | +<!-- origin: agent --> |
| 77 | +<!-- sync: unsynced --> |
| 78 | + |
| 79 | +CHECKPOINT 4/6: Implementation complete ✓ (no implementation needed — this is a test-writing task) |
| 80 | + |
| 81 | +<!-- note-id: qyhw1i6q --> |
| 82 | +<!-- timestamp: 2026-03-22T04:13:43Z --> |
| 83 | +<!-- origin: agent --> |
| 84 | +<!-- sync: unsynced --> |
| 85 | + |
| 86 | +CHECKPOINT 5/6: Validation passed ✓ — 5 new tests fail as expected (RED phase: PASSED 27 FAILED 5) |
| 87 | + |
| 88 | +<!-- note-id: pcrs2hm8 --> |
| 89 | +<!-- timestamp: 2026-03-22T04:13:58Z --> |
| 90 | +<!-- origin: agent --> |
| 91 | +<!-- sync: unsynced --> |
| 92 | + |
| 93 | +CHECKPOINT 6/6: Done ✓ — all 5 AC checks pass; 5 new RED tests fail as expected; 27 existing tests pass |
| 94 | + |
| 95 | +**2026-03-22T04:18:06Z** |
| 96 | + |
| 97 | +CHECKPOINT 6/6: Done ✓ — Files: tests/hooks/test-record-test-status.sh. Tests: 27 passed, 5 RED tests fail as expected. |
0 commit comments