Skip to content

Commit 12d74a1

Browse files
chore: auto-commit ticket changes before merge (merge worktree-20260321-144840)
2 parents df84567 + e355807 commit 12d74a1

File tree

6 files changed

+69
-6
lines changed

6 files changed

+69
-6
lines changed

.tickets/.index.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,13 @@
492492
"title": "Add dev-onboarding and design-onboarding to setup",
493493
"type": "epic"
494494
},
495+
"dso-ptct": {
496+
"deps": [],
497+
"priority": 1,
498+
"status": "closed",
499+
"title": "Bug: stat -f || stat -c fallback pattern broken on Linux \u2014 stat -f succeeds with wrong semantics",
500+
"type": "bug"
501+
},
495502
"dso-pxos": {
496503
"deps": [],
497504
"priority": 1,

.tickets/dso-ptct.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
id: dso-ptct
3+
status: closed
4+
deps: []
5+
links: []
6+
created: 2026-03-21T23:55:41Z
7+
type: bug
8+
priority: 1
9+
assignee: Joe Oakhart
10+
---
11+
# Bug: stat -f || stat -c fallback pattern broken on Linux — stat -f succeeds with wrong semantics
12+
13+
14+
## Notes
15+
16+
<!-- note-id: w3rqlnay -->
17+
<!-- timestamp: 2026-03-21T23:55:53Z -->
18+
<!-- origin: agent -->
19+
<!-- sync: unsynced -->
20+
21+
Classification: mechanical. Root cause: stat -f '%m' on Linux does not fail — it returns filesystem metadata (block counts, inode info). The || fallback to stat -c '%Y' never triggers. Fix: use uname-based OS detection (same pattern as health-check.sh _file_mtime). Fixed in 5 locations across 4 files: test-compact-sync-precondition.sh, test-sync-roundtrip.sh, worktree-cleanup.sh, REVIEW-WORKFLOW.md. Test gate gap: the test gate correctly requires test-compact-sync-precondition.sh for changes to ticket-compact.sh, but the stat bug was in the TEST file itself (not the source file it covers). The test gate can't catch bugs in tests that only manifest on a different OS — this is a fundamental limitation addressed by CI, not the gate.
22+
23+
<!-- note-id: a7f6sjyk -->
24+
<!-- timestamp: 2026-03-21T23:59:45Z -->
25+
<!-- origin: agent -->
26+
<!-- sync: unsynced -->
27+
28+
CLOSE REASON: Fixed: replaced broken stat -f || stat -c fallback with uname-based OS detection in 4 files

plugins/dso/docs/workflows/REVIEW-WORKFLOW.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ mkdir -p "$ARTIFACTS_DIR"
5151
VALIDATION_STATUS="$ARTIFACTS_DIR/validation-status"
5252
if [ -f "$VALIDATION_STATUS" ]; then
5353
status_content=$(head -n 1 "$VALIDATION_STATUS")
54-
status_age=$(( $(date +%s) - $(stat -f %m "$VALIDATION_STATUS" 2>/dev/null || stat -c %Y "$VALIDATION_STATUS" 2>/dev/null || echo 0) ))
54+
if [ "$(uname)" = "Darwin" ]; then
55+
status_age=$(( $(date +%s) - $(stat -f %m "$VALIDATION_STATUS" 2>/dev/null || echo 0) ))
56+
else
57+
status_age=$(( $(date +%s) - $(stat -c %Y "$VALIDATION_STATUS" 2>/dev/null || echo 0) ))
58+
fi
5559
if [ "$status_content" = "passed" ] && [ "$status_age" -lt 60 ]; then
5660
# Validation is fresh — skip to Step 2
5761
fi

plugins/dso/scripts/worktree-cleanup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ is_old_enough() {
223223

224224
if [[ "$created_epoch" -eq 0 ]]; then
225225
# Fall back to mtime of the directory
226-
created_epoch=$(stat -f %m "$wt_path" 2>/dev/null || stat -c %Y "$wt_path" 2>/dev/null || echo "0")
226+
if [[ "$(uname)" == "Darwin" ]]; then
227+
created_epoch=$(stat -f %m "$wt_path" 2>/dev/null || echo "0")
228+
else
229+
created_epoch=$(stat -c %Y "$wt_path" 2>/dev/null || echo "0")
230+
fi
227231
fi
228232

229233
local now_epoch

tests/plugin/test-sync-roundtrip.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,24 @@ _issue8='{"key":"TEST-8","fields":{"summary":"Idempotent pull","description":"bo
454454
pull_ticket_direct "$_T8" "$_ledger8" "$_issue8" "${ACLI_PATH_PREFIX:-}" >/dev/null 2>&1 || true
455455
_ticket8=$(ls "$_T8"/*.md 2>/dev/null | head -1)
456456
_mtime8_before=""
457-
[[ -n "$_ticket8" ]] && _mtime8_before=$(stat -f "%m" "$_ticket8" 2>/dev/null || stat -c "%Y" "$_ticket8" 2>/dev/null || echo "")
457+
if [[ -n "$_ticket8" ]]; then
458+
if [[ "$(uname)" == "Darwin" ]]; then
459+
_mtime8_before=$(stat -f "%m" "$_ticket8" 2>/dev/null || echo "")
460+
else
461+
_mtime8_before=$(stat -c "%Y" "$_ticket8" 2>/dev/null || echo "")
462+
fi
463+
fi
458464
sleep 1
459465
# Second pull: same JSON → skip
460466
_out8=$(pull_ticket_direct "$_T8" "$_ledger8" "$_issue8" "${ACLI_PATH_PREFIX:-}" 2>&1) || true
461467
_mtime8_after=""
462-
[[ -n "$_ticket8" ]] && _mtime8_after=$(stat -f "%m" "$_ticket8" 2>/dev/null || stat -c "%Y" "$_ticket8" 2>/dev/null || echo "")
468+
if [[ -n "$_ticket8" ]]; then
469+
if [[ "$(uname)" == "Darwin" ]]; then
470+
_mtime8_after=$(stat -f "%m" "$_ticket8" 2>/dev/null || echo "")
471+
else
472+
_mtime8_after=$(stat -c "%Y" "$_ticket8" 2>/dev/null || echo "")
473+
fi
474+
fi
463475
if echo "$_out8" | grep -qiE "skip(ped)?|unchanged"; then
464476
echo " PASS: pull_second_call_skips_unchanged"
465477
((PASS++))

tests/scripts/test-compact-sync-precondition.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,17 @@ test_compact_calls_sync_before_compacting() {
177177
snapshot_file=$(find "$ticket_dir" -maxdepth 1 -name '*-SNAPSHOT.json' 2>/dev/null | head -1)
178178
if [ -n "$snapshot_file" ]; then
179179
local snapshot_mtime
180-
snapshot_mtime=$(stat -f '%m' "$snapshot_file" 2>/dev/null || stat -c '%Y' "$snapshot_file" 2>/dev/null || echo "0")
180+
if [[ "$(uname)" == "Darwin" ]]; then
181+
snapshot_mtime=$(stat -f '%m' "$snapshot_file" 2>/dev/null || echo "0")
182+
else
183+
snapshot_mtime=$(stat -c '%Y' "$snapshot_file" 2>/dev/null || echo "0")
184+
fi
181185
local sync_log_mtime
182-
sync_log_mtime=$(stat -f '%m' "$call_log" 2>/dev/null || stat -c '%Y' "$call_log" 2>/dev/null || echo "0")
186+
if [[ "$(uname)" == "Darwin" ]]; then
187+
sync_log_mtime=$(stat -f '%m' "$call_log" 2>/dev/null || echo "0")
188+
else
189+
sync_log_mtime=$(stat -c '%Y' "$call_log" 2>/dev/null || echo "0")
190+
fi
183191
# call_log was written DURING sync (before SNAPSHOT creation).
184192
# If sync ran first, call_log mtime <= snapshot mtime.
185193
assert_eq "sync logged before SNAPSHOT creation" "ordered" \

0 commit comments

Comments
 (0)