Skip to content

Commit f6ad7c4

Browse files
chore: use realistic v3 ticket paths in review gate test data (merge worktree-20260324-211622)
2 parents 19ca193 + 1990bd9 commit f6ad7c4

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

tests/hooks/test-merge-conflict-regression.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# During the sprint implementing the two-layer review gate (epic gju5), we
77
# repeatedly hit a failure pattern (bug 50is):
88
# 1. Developer makes code changes and gets a valid review
9-
# 2. A git merge main is run, creating conflicts in .tickets-tracker/ticket-data.json
9+
# 2. A git merge main is run, creating conflicts in .tickets-tracker/test-abc1/001-create.json
1010
# 3. Developer resolves the conflict and stages only .tickets/ files
1111
# 4. The pre-commit hook BLOCKS with "diff hash mismatch" because
1212
# the review-status diff_hash was stale (computed before the merge)
@@ -85,12 +85,12 @@ make_two_branch_repo() {
8585
git -C "$tmpdir" config user.name "Test"
8686

8787
# Create initial commit on main
88-
mkdir -p "$tmpdir/.tickets-tracker"
88+
mkdir -p "$tmpdir/.tickets-tracker/test-abc1"
8989
cat > "$tmpdir/mycode.py" << 'PYEOF'
9090
def compute(x):
9191
return x * 2
9292
PYEOF
93-
cat > "$tmpdir/.tickets-tracker/ticket-data.json" << 'JSONEOF'
93+
cat > "$tmpdir/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
9494
{"version": 1, "tickets": []}
9595
JSONEOF
9696

@@ -112,12 +112,12 @@ PYEOF
112112
git -C "$tmpdir" add "mycode.py"
113113
git -C "$tmpdir" commit -q -m "feat: add new_feature"
114114

115-
# Go back to main and make a conflicting change to .tickets-tracker/ticket-data.json
115+
# Go back to main and make a conflicting change to .tickets-tracker/test-abc1/001-create.json
116116
git -C "$tmpdir" checkout -q main
117-
cat > "$tmpdir/.tickets-tracker/ticket-data.json" << 'JSONEOF'
117+
cat > "$tmpdir/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
118118
{"version": 1, "tickets": ["lockpick-abc1"]}
119119
JSONEOF
120-
git -C "$tmpdir" add ".tickets-tracker/ticket-data.json"
120+
git -C "$tmpdir" add ".tickets-tracker/test-abc1/001-create.json"
121121
git -C "$tmpdir" commit -q -m "chore: update ticket index on main"
122122

123123
# Return to feature branch (the branch the developer is working on)
@@ -191,9 +191,9 @@ write_valid_review_status() {
191191
# 1. Developer stages code changes (mycode.py) on feature branch
192192
# 2. A valid review is recorded for that staged diff hash
193193
# 3. git merge main --no-commit creates MERGE_HEAD (merge in progress)
194-
# The conflict is ONLY in .tickets-tracker/ticket-data.json (allowlisted file)
194+
# The conflict is ONLY in .tickets-tracker/test-abc1/001-create.json (allowlisted file)
195195
# 4. Developer resolves by accepting the main version of the index
196-
# 5. Developer stages ONLY the resolved .tickets-tracker/ticket-data.json
196+
# 5. Developer stages ONLY the resolved .tickets-tracker/test-abc1/001-create.json
197197
# 6. pre-commit hook runs: ALL staged files are allowlisted (.tickets/)
198198
# → Should exit 0 WITHOUT checking the (now-stale) diff hash
199199
#
@@ -222,17 +222,17 @@ test_ticket_only_merge_conflict_commit_passes() {
222222
#
223223
# Simulate git merge --no-commit (which would be interrupted by conflict):
224224
# Manually create MERGE_HEAD (pointing to main's HEAD) and stage the
225-
# conflict resolution of .tickets-tracker/ticket-data.json only.
225+
# conflict resolution of .tickets-tracker/test-abc1/001-create.json only.
226226
local main_sha
227227
main_sha=$(git -C "$_repo" rev-parse main)
228228
echo "$main_sha" > "$_repo/.git/MERGE_HEAD"
229229

230230
# Step 4: Resolve the conflict — stage ONLY the ticket index (allowlisted)
231231
# Write the resolved version of the conflicted file
232-
cat > "$_repo/.tickets-tracker/ticket-data.json" << 'JSONEOF'
232+
cat > "$_repo/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
233233
{"version": 1, "tickets": ["lockpick-abc1"]}
234234
JSONEOF
235-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
235+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
236236

237237
# Sanity check: MERGE_HEAD is present (in-progress merge state)
238238
local merge_head_present=0
@@ -302,11 +302,11 @@ def another_from_main(z):
302302
PYEOF
303303
git -C "$_repo" add "mycode.py"
304304

305-
# - .tickets-tracker/ticket-data.json: merge resolution (ticket metadata)
306-
cat > "$_repo/.tickets-tracker/ticket-data.json" << 'JSONEOF'
305+
# - .tickets-tracker/test-abc1/001-create.json: merge resolution (ticket metadata)
306+
cat > "$_repo/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
307307
{"version": 1, "tickets": ["lockpick-abc1", "lockpick-abc2"]}
308308
JSONEOF
309-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
309+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
310310

311311
# Sanity check: both code and ticket files are staged
312312
local staged_files
@@ -364,11 +364,11 @@ test_multiple_sequential_merge_conflicts_pass() {
364364
main_sha=$(git -C "$_repo" rev-parse main)
365365
echo "$main_sha" > "$_repo/.git/MERGE_HEAD"
366366

367-
# Resolve: update .tickets-tracker/ticket-data.json (allowlisted)
368-
cat > "$_repo/.tickets-tracker/ticket-data.json" << 'JSONEOF'
367+
# Resolve: update .tickets-tracker/test-abc1/001-create.json (allowlisted)
368+
cat > "$_repo/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
369369
{"version": 1, "tickets": ["lockpick-abc1"]}
370370
JSONEOF
371-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
371+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
372372

373373
# First commit after merge conflict: should pass (ticket-only staged)
374374
local exit_code_1
@@ -387,10 +387,10 @@ JSONEOF
387387
echo "$main_sha_2" > "$_repo/.git/MERGE_HEAD"
388388

389389
# Resolve: another ticket index update (allowlisted)
390-
cat > "$_repo/.tickets-tracker/ticket-data.json" << 'JSONEOF'
390+
cat > "$_repo/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
391391
{"version": 1, "tickets": ["lockpick-abc1", "lockpick-abc2"]}
392392
JSONEOF
393-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
393+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
394394

395395
# Second commit after merge conflict: should also pass (ticket-only staged)
396396
local exit_code_2
@@ -436,10 +436,10 @@ test_allowlist_gate_fires_before_stale_hash_check() {
436436
echo "$main_sha" > "$_repo/.git/MERGE_HEAD"
437437

438438
# Stage ONLY an allowlisted file (the merge conflict resolution for tickets)
439-
cat > "$_repo/.tickets-tracker/ticket-data.json" << 'JSONEOF'
439+
cat > "$_repo/.tickets-tracker/test-abc1/001-create.json" << 'JSONEOF'
440440
{"version": 1, "tickets": ["lockpick-abc1"]}
441441
JSONEOF
442-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
442+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
443443

444444
# Sanity check: the stale hash is definitely different from the current hash
445445
local current_hash

tests/hooks/test-pre-commit-review-gate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ test_tickets_only_commit_passes() {
167167

168168
mkdir -p "$_repo/.tickets-tracker"
169169
echo "# Task: My task" > "$_repo/.tickets-tracker/lockpick-test-abc1.md"
170-
echo '{"version":1}' > "$_repo/.tickets-tracker/ticket-data.json"
170+
echo '{"version":1}' > "$_repo/.tickets-tracker/test-abc1/001-create.json"
171171
git -C "$_repo" add ".tickets-tracker/"
172172

173173
local exit_code
@@ -473,10 +473,10 @@ test_cross_worktree_merge_commit_passes() {
473473
head_sha=$(git -C "$_repo" rev-parse HEAD 2>/dev/null)
474474
echo "$head_sha" > "$_repo/.git/MERGE_HEAD"
475475

476-
# Stage only allowlisted files (merge resolution of ticket index)
477-
mkdir -p "$_repo/.tickets-tracker"
478-
echo '{"version":2}' > "$_repo/.tickets-tracker/ticket-data.json"
479-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
476+
# Stage only allowlisted files (merge resolution of ticket event)
477+
mkdir -p "$_repo/.tickets-tracker/test-abc1"
478+
echo '{"version":2}' > "$_repo/.tickets-tracker/test-abc1/001-create.json"
479+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
480480

481481
# Hook runs in worktree B's context — MERGE_HEAD is natively visible
482482
local exit_code

tests/hooks/test-two-layer-review-gate.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ test_merge_head_present_allowlisted_commit_passes() {
416416
head_sha=$(git -C "$_repo" rev-parse HEAD 2>/dev/null)
417417
echo "$head_sha" > "$_repo/.git/MERGE_HEAD"
418418

419-
# Stage only allowlisted files (ticket index merge resolution)
420-
mkdir -p "$_repo/.tickets-tracker"
421-
echo '{"version":2}' > "$_repo/.tickets-tracker/ticket-data.json"
422-
git -C "$_repo" add ".tickets-tracker/ticket-data.json"
419+
# Stage only allowlisted files (ticket event merge resolution)
420+
mkdir -p "$_repo/.tickets-tracker/test-abc1"
421+
echo '{"version":2}' > "$_repo/.tickets-tracker/test-abc1/001-create.json"
422+
git -C "$_repo" add ".tickets-tracker/test-abc1/001-create.json"
423423

424424
local exit_code
425425
exit_code=$(run_pre_commit_hook "$_repo" "$_artifacts")

0 commit comments

Comments
 (0)