Repository navigation
fix(bin): read status file identity and size with one stat call in the wake drain - #6271
Conversation
[Medium impact] The reviewed changes appear safe to merge. Reviews (4) · Last reviewed commit: "fix(bin): cut stat forks in the wake dra..." · Reviewed by Greptile |
|
Speaking as Kun's firstmate: first stamp vs tip HEAD contract-class: restore — wake drain already incremental; one-stat identity+size restores intended drain completion under load (timeouts at 15–100s). Lint default address-space 12→16 GiB and CI fork-free count 6→7 are supporting CI envelope for growing ShellCheck roots / new test — not a new captain-facing surface (not #4627 new-default). VISION (per-rule)
Waiting on you: re-run |
9d3ab97 to
0185e9a
Compare
|
Speaking as Kun's firstmate: thanks for the rebase and the fresh no-mistakes raise, @Marsjohn-11. I re-read head Delta since my 10-01 stamp: attestation now binds this head (MATCH) and "PR must be raised via no-mistakes" is green. CI is green except Behavior portable serial 2, which was cancelled at the 30-minute shard limit, a known CI flake family (#6790), not your code. I re-ran the failed job. contract-class: restore (my own read). One VISION: One captain: aligns (no captain surface). Authority: aligns (no new autonomy). Scripts/mechanics + token efficiency: aligns (fewer forks, same semantics). Restart non-event: aligns (cursor/identity format unchanged). Delegation: aligns. Vendor: aligns (Darwin + GNU stat both handled). Scope: aligns. One gentle ask, so this is waiting on you: the PR body says the Test step ran out of budget before live validation, so there's no live evidence for this head. When you have a moment, could you live-test the wake drain on a real home (for example, a drain with several status files, confirming identities and cursors carry over and fewer stat forks run) and post what you saw? Or re-raise through |
…ze together Local cherry-pick of kunchenguid#6271 pending upstream merge.
0185e9a to
65166e9
Compare
|
Rebased onto current main and revalidated through no-mistakes. Full suite awaits the maintainer's full-ci label; no full-suite lane failed (see CONTRIBUTING.md, The full-ci label). |
|
Speaking as Kun's firstmate: thank you @Marsjohn-11 for the rebase and the fresh no-mistakes run. I re-read head The live evidence I asked for on 10-10 is in: 5 of 6 scenarios were driven live, with byte-identical identities and sizes against base and a missing file still failing the read. The no-mistakes attestation binds this head with no skipped steps, the quick checks pass, and Greptile's thread is resolved. I've added Contract-class: restore (my own read): no new surface or default, just fewer forks with the same semantics. VISION: every rule aligns, as in my 10-10 note. |
|
Speaking as Kun's firstmate: this is merged. Thank you @Marsjohn-11 — really appreciate you taking the time on this. |
What Changed
_fm_status_stat_fieldstobin/fm-classify-lib.sh. It runs onestatper status file and sets both_FM_STAT_IDENTITYand_FM_STAT_SIZE. Before this change, every identity-plus-size read ran up to fourstatcalls._fm_open_decisions_file_identnow uses the new helper, and thestrong:/weak:identity format stays the same._fm_status_read_ident_size, which honors the injectedFM_STATUS_IDENTITY_READER/FM_STATUS_SIZE_READERtest hooks. The five drain paths that used to call the identity and size helpers separately now call it: incremental open-decisions, the outcome cursor, the backstop cursor, the presentation snapshot commit, and the open-decisions cursor. A failed read still takes each path's existing fallback.test_status_identity_and_size_read_with_one_stattotests/fm-fork-free-helpers.test.sh. It checks that the paired read matches the single helpers and fails on a missing file. It also checks that the injected readers are honored. On non-Darwin hosts it also checks that the paired read runsstatexactly once and that a zero birth epoch produces aweak:identity.Risk Assessment
✅ Low: The change folds two stat execs into one. It keeps the same strong/weak identity and size semantics on Darwin and Linux, honors injected test readers, and every caller still fails closed on a read error; it contains no Amazon-internal content.
Testing
The fork-free helper suite passed all 7 cases on stock Bash 3.2. A base-vs-target check on real files showed the identity and size values are byte-identical, so persisted cursors stay valid. The missing-file failure is unchanged, and the target is about 2.4x faster on this loaded host. All four wake-drain suites passed in disposable state. They drive the real cursor, outcome-backstop, presentation-snapshot and open-decision paths. The Linux weak-identity branch can't run on macOS and no Docker is available, so Linux CI covers that branch.
Evidence: fork-free helper suite transcript
Source: fork-free helper suite transcript
Evidence: base vs target identity/size equivalence
Source: base vs target identity/size equivalence
Evidence: stat fork benchmark
Source: stat fork benchmark
old: 200 identity+size reads in 52s new: 200 identity+size reads in 22sEvidence: wake-drain suite exit codes
Source: wake-drain suite exit codes
Evidence: wake-drain open-decisions-cursor log
Source: wake-drain open-decisions-cursor log
Evidence: wake-drain open-decisions log
Source: wake-drain open-decisions log
Evidence: wake-drain outcome-backstop log
Source: wake-drain outcome-backstop log
Evidence: wake-drain unread-status log
Source: wake-drain unread-status log
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-classify-lib.sh:1240- _fm_open_decisions_file_ident still declareslocal f=$1 epoch birth ident, but epoch, birth and ident are no longer used now that parsing moved into _fm_status_stat_fields. Trim the declaration tolocal f=$1.✅ **Test** - passed
✅ No issues found.
bash tests/fm-fork-free-helpers.test.sh(all 7 cases pass, including the new test_status_identity_and_size_read_with_one_stat, run under stock /bin/bash 3.2)Manual equivalence check: sourced bin/fm-classify-lib.sh from base 095db3bc and target 65166e9e under /bin/bash 3.2 and compared identity and size for a non-empty file, an empty file and a missing fileManual benchmark: 200 identity+size reads, base pair of helpers vs target _fm_status_read_ident_sizebash tests/fm-wake-drain-open-decisions-cursor.test.sh(rc=0, 9 ok)bash tests/fm-wake-drain-open-decisions.test.sh(rc=0, 9 ok)bash tests/fm-wake-drain-outcome-backstop.test.sh(rc=0, 18 ok)bash tests/fm-wake-drain-unread-status.test.sh(rc=0, 14 ok)✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → no changes applied ✅
🔧 No changes applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.