Repository navigation
feat(bin): add rework signals section to Wake daily records - #53
Merged
Merged
Conversation
…test.sh but gives it no duration hint in bin/fm-test-run.sh. That leaves 44 of 292 portable serial scripts without a hint (15.07%), over the coverage guard's 15% cap. Rule that broke: no more than 15% of portable serial scripts may lack a duration hint. The rule is checked in one place, the hint table in bin/fm-test-run.sh, so that is the one place to fix. Fix: I added `tests/fm-wake-daily-rework.test.sh 1600` to the hint table, just before `tests/fm-wake-daily.test.sh 1600`. The table's comment allows a new test to use a local sample until CI has measured it, and PR #50 added the sibling test's hint the same way. The new test took about 1.6s locally. Verified: - `bin/fm-test-run.sh --check-coverage` passes (`FM_TEST_COVERAGE ok`, serial_unhinted=43). - tests/fm-wake-daily-rework.test.sh and tests/fm-wake-daily.test.sh pass. - tests/fm-test-run.test.sh, the shard 2 test that runs the real coverage check, now passes every coverage subtest. That includes "portable shard union, disjointness, and coverage guard hold" and "coverage guard bounds the unmeasured share and serial packing within twenty minutes", so the shard 2 failure was almost certainly this missing hint. - **Test coverage guard:** fixed directly by this change. - **Full suite:** a summary check that fails when any lane fails, so it should clear once the other two pass. - **Behavior portable parallel 2:** its coverage subtests pass locally, but tests/fm-test-run.test.sh still exits 1 here. Its "--jobs on a proven family" subtest runs tests/fm-session-lock-ancestry.test.sh, which fails with "not ok - the fixture hook never finished". That script also fails when run on its own on this host. This PR does not change it or the session-lock code (its diff against base is empty), so I treat it as a local host problem and made no change for it. I could not finish a full local run of the portable-parallel-2 lane: it was stopped at the 10-minute background limit, and that run had also started before the fix
clarsen
force-pushed
the
fm/wake-story3-rework
branch
from
November 22, 2026 18:00
6e66945 to
ba80bcf
Compare
…l 1". It failed because of today's date, not because of the PR's code. "Full suite" only fails when another lane fails, so it should clear once serial 1 passes. **What failed:** `tests/fm-wake-daily.test.sh` reported `not ok - incomplete day wrote a record`. This test came from the base branch and the PR doesn't change it. **Why:** the test collects records for a fixed day, `POST=2026-11-22`, and writes `data/wake/daily/2026-11-22.json`. At the end it runs the collector for today's date, which it expects to be rejected as not yet complete, and then asserts that no file exists for today. CI ran on 2026-11-22, so today was the same day as `POST`. The collector correctly rejected the run, but the file written earlier by the same test was already there, so the assertion failed. The test would fail on any day that matches one of its fixed fixture days. **Rule broken:** the "incomplete day wrote no record" check must only see what the incomplete-day run itself writes. That check, on that one path, is the only place that depends on it. **Fix:** in `tests/fm-wake-daily.test.sh`, one `rm -f "$CASE_HOME/data/wake/daily/$TODAY.json"` line (plus a comment) right before the incomplete-day call. The check still fails if the collector ever writes a record for an incomplete day. `tests/fm-wake-daily-rework.test.sh` doesn't use the current date, so nothing else needed the same change. No product code changed. **Verified on 2026-11-22, the date that broke CI:** - `tests/fm-wake-daily.test.sh` failed before the change with the same message as CI, and now passes (`ok: Wake daily collector`). - `tests/fm-wake-daily-rework.test.sh` still passes. - shellcheck reports only an info-level SC1091 note about sourcing `tests/lib.sh`, which was already there. I did not run the full serial 1 lane locally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
I approve the wake question.
Story 3, Rework signals from the forge and project clones: The record's rework section lists reverts in project clones and, for each of the fleet's task PRs/MRs, closed-unmerged state and failed pipelines, each with its time, read-only. These are the three rework signals the captain marked useful (13, 14, 15). Stories 15 and 16 reuse its forge reads.
Verify: For 2026-11-19 the record lists the lblnet_hostupdate revert a83fbcb64; for a day with a known task MR closed unmerged and a known red task-MR pipeline, it lists both with their URLs; the section has no relaunch field; a forge that cannot be reached is named in coverage, not counted as zero.
Context: the captain approved Wake on 2026-11-21 ("I approve the wake question"), a firstmate throughput retrospective built as a deterministic daily collector plus a thin /wake judgment skill. The collector's first slice is merged (#50, bin/fm-wake-daily.py writing data/wake/daily/.json with one section per signal). The captain kept 7 signals: 2, 3, 5, 6, 13, 14, 15. Product-owner tickets: ~/src/therealfirstmate/data/wake-value-model-revise/tickets (value-model.md, initiative-wake.md, epic-wake-daily-record/tickets/tickets.toml). Changes land only in the fork github.com/clarsen/firstmate.
What Changed
bin/fm-wake-daily.pyadds areworksection to the daily record, with three lists:reverts: commits whose subject starts withRevertin localprojects/clone history (read withgit log --all), with the commit time and a commit URL built from the clone's origin.closed_unmerged: fleet task PRs/MRs that were closed without a merge on that Pacific day.failed_pipelines: failed GitLab MR pipelines and failed GitHub pull request workflow runs, each with its own URL and the task PR/MR URL.state/*.metafiles, and reduces each to its canonical URL. It reads only tasks that were in flight that day. A done task with no recorded start is assumed to have started 14 days before its done day, andcoverage.forge_candidatesreports how many tasks used that assumption. Forge reads are read-onlyglab api/gh apicalls. If a clone or forge can't be read, or a response hits a page limit, that signal is markednot_measurableincoverage.signals, and the clone or forge URL that failed is named incoverage.inputs, so it never shows up as a measured zero.tests/fm-wake-daily-rework.test.shand gives it a duration hint inbin/fm-test-run.sh. Updatesdocs/wake-daily.mdto describe the new section, its inputs and the coverage behaviour.Risk Assessment
✅ Low: The rework collector only reads data and adds a section. The fixes from earlier rounds are in the current code: canonical PR/MR URL keys, the no-origin fallback, a per-day candidate window with a 14-day assumed start, skipping already-merged PRs for closed_unmerged, and unreadable PRs named in coverage only on their candidate days. Tracing the fixture days (2026-11-19, 11-18, 11-17, 10-20) gave the expected candidates, events, and coverage, and nothing else turned up as a wrong result that intended usage would reach.
Testing
I drove the real collector CLI against a disposable home in /tmp, using a real lblnet_hostupdate clone and the live lsg-git GitLab and GitHub APIs with the machine's existing logins. Read-only checks only: no forge or clone state was changed. The real revert a83fbcb64, the closed-unmerged MR 3977 and MR 3968's failed pipelines all appeared on 2026-11-19 with their URLs, and an independent glab query returned the same pipelines. The failed run on GitHub PR #53 appeared on 2026-11-21. There is no relaunch field. The unreachable forge was named in coverage, and both forge signals were marked not_measurable rather than zero. The focused rework test also passed. I removed the disposable home afterward, and the worktree is clean. This is a CLI that writes JSON records, so there is no UI to screenshot; the evidence is the JSON records it wrote.
Evidence: Live 2026-11-19 record (real clone and forge, plus unreachable forge)
Evidence: Live 2026-11-19 rework and coverage excerpt
Evidence: Live 2026-11-19 measured record
Evidence: Live 2026-11-19 measured summary
{"rework_keys":["closed_unmerged","failed_pipelines","reverts"],"reverts":["a83fbcb6410e1857fc9dd49e91509f09f1bda445"],"closed":["https://lsg-git.lbl.gov/lblnet/lblnet_hostupdate/-/merge_requests/3977"],"failed_n":6,"sig":{"reverts":{"count":1,"status":"measured"},"closed_unmerged":{"count":1,"status":"measured"},"failed_pipelines":{"count":6,"status":"measured"}}}Evidence: Live 2026-11-21 GitHub failed run
{"failed":[{"url":"https://github.com/clarsen/firstmate/actions/runs/44991191376","at":"2026-11-22T06:13:52Z"}],"gh_input":{"status":"readable"},"sig":{"count":1,"status":"measured"}}Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 4 issues found → auto-fixed (2) ✅
bin/fm-wake-daily.py:212- task_prs keys forge reads by the loose PR_URL match (http allowed, plus any trailing[^\s)<>]*), but forge_rework only accepts the strict https GITLAB_MR/GITHUB_PR fullmatch. Any other form is marked 'unsupported forge URL' (line 341), and that makes closed_unmerged and failed_pipelines not_measurable for every day. Example: a Done row in done-archive.md that says... https://github.com/clarsen/firstmate/pull/7, follow-upor.../pull/7/filesor.../merge_requests/42#note_1. PR_URL capturespull/7,,pull/7/filesor the#notefragment, GITHUB_PR/GITLAB_MR fail to match, and from then on both forge rework signals are permanently not_measurable even though the PR is readable. A row that has both.../pull/7and.../pull/7/already dedups, but these variants don't. Fix: in task_prs, normalize each candidate to the canonical PR/MR URL by searching with GITHUB_PR/GITLAB_MR prefixes (no anchors, stop at the number) before inserting. Other sites with the same rule: line 215 (ledgerpr) and line 231 (meta pr=/anchor_pr=/member.*.pr=).bin/fm-wake-daily.py:285- Every run re-reads the forge for every ship PR ever recorded in backlog.md and done-archive.md, plus ledger and meta PRs. That is 2 glab calls per MR, and 2+N gh calls per GitHub PR (one actions/runs call per commit), each with a 30s timeout, whatever the requested day. As the archive grows to hundreds of PRs, one run makes hundreds to thousands of API calls and can hit the gh rate limit. Also, any one historical PR that can no longer be read (repo deleted or renamed, old forge, lost token scope, rate limit) marks closed_unmerged and failed_pipelines not_measurable for every day from then on, including days unrelated to that PR. The remedy is a product decision: which PRs count as candidates for a given day (for example only tasks open or done within a window around the day, or skipping merged PRs for closed_unmerged). That scope choice is what needs authorization, not the defect itself.bin/fm-wake-daily.py:258- clone_reverts treats a failedgit remote get-url originas a failed history read. As a result, one local-only clone under projects/ with no origin remote makes the reverts signal not_measurable for every day. The code already has a fallback for this case (evidence: projects/<name>@<sha>when base is None). Fix: only gate coverage on the log read's returncode, and when the remote lookup fails, use base=None.tests/fm-wake-daily-rework.test.sh:34- The glab and gh stubs return small handwritten JSON (for example MR detail with only state/closed_at/merged_at, and pipelines with only id/status/updated_at/web_url). The user's CLAUDE.md says mock data MUST be based on actual API calls and stored centrally with documentation. Replace these with trimmed real GitLab MR/pipelines and GitHub pulls/commits/actions-runs responses kept in a documented fixture location. That way field-name drift (for example finished_at vs updated_at, conclusion vs status) would be caught.🔧 Fix applied.
5 issues (1 error, 3 warnings, 1 info) still open:
bin/fm-wake-daily.py:212- task_prs keys forge reads by the loose PR_URL match (http allowed, plus any trailing[^\s)<>]*), but forge_rework only accepts the strict https GITLAB_MR/GITHUB_PR fullmatch. Any other form is marked 'unsupported forge URL' (line 341), and that makes closed_unmerged and failed_pipelines not_measurable for every day. Example: a Done row in done-archive.md that says... https://github.com/clarsen/firstmate/pull/7, follow-upor.../pull/7/filesor.../merge_requests/42#note_1. PR_URL capturespull/7,,pull/7/filesor the#notefragment, GITHUB_PR/GITLAB_MR fail to match, and from then on both forge rework signals are permanently not_measurable even though the PR is readable. A row that has both.../pull/7and.../pull/7/already dedups, but these variants don't. Fix: in task_prs, normalize each candidate to the canonical PR/MR URL by searching with GITHUB_PR/GITLAB_MR prefixes (no anchors, stop at the number) before inserting. Other sites with the same rule: line 215 (ledgerpr) and line 231 (meta pr=/anchor_pr=/member.*.pr=).bin/fm-wake-daily.py:285- Every run re-reads the forge for every ship PR ever recorded in backlog.md and done-archive.md, plus ledger and meta PRs. That is 2 glab calls per MR, and 2+N gh calls per GitHub PR (one actions/runs call per commit), each with a 30s timeout, whatever the requested day. As the archive grows to hundreds of PRs, one run makes hundreds to thousands of API calls and can hit the gh rate limit. Also, any one historical PR that can no longer be read (repo deleted or renamed, old forge, lost token scope, rate limit) marks closed_unmerged and failed_pipelines not_measurable for every day from then on, including days unrelated to that PR. The remedy is a product decision: which PRs count as candidates for a given day (for example only tasks open or done within a window around the day, or skipping merged PRs for closed_unmerged). That scope choice is what needs authorization, not the defect itself.bin/fm-wake-daily.py:258- clone_reverts treats a failedgit remote get-url originas a failed history read. As a result, one local-only clone under projects/ with no origin remote makes the reverts signal not_measurable for every day. The code already has a fallback for this case (evidence: projects/<name>@<sha>when base is None). Fix: only gate coverage on the log read's returncode, and when the remote lookup fails, use base=None.tests/fm-wake-daily-rework.test.sh:34- The glab and gh stubs return small handwritten JSON (for example MR detail with only state/closed_at/merged_at, and pipelines with only id/status/updated_at/web_url). The user's CLAUDE.md says mock data MUST be based on actual API calls and stored centrally with documentation. Replace these with trimmed real GitLab MR/pipelines and GitHub pulls/commits/actions-runs responses kept in a documented fixture location. That way field-name drift (for example finished_at vs updated_at, conclusion vs status) would be caught.bin/fm-wake-daily.py:247- Introduced by the round-1 fix for unbounded-forge-scan. When task_spans has no start for a task, it uses the done day as the start:spans[task] = (starts.get(task) or end, end)(docs/wake-daily.md:33 says 'A done task with no recorded start is read only on its done day'). On historical days that fallback is almost always what runs, because start days come from only two places. (1) A row's(since D)tag: Done/archive rows carry(merged D)/(done D), and no Done fixture in the repo keeps asincetag. (2) Ledgertask.dispatchedevents: build() loads the ledger only whenday >= LEDGER_CUTOFF(2026-11-21), so before that date the ledger list is always empty. Concrete case: a task MR has a failed pipeline on 2026-11-18, the worker fixes it, and the row reads(merged 2026-11-19). Collecting 2026-11-18 skips the MR at line 342 because day < start == 2026-11-19. Nothing is read and no coverage input is recorded, so failed_pipelines reportsmeasuredwith the red pipeline left out. Red pipelines normally happen before the merge or done day, so historical failed_pipelines counts are undercounted with no visible failure. That conflicts with the intent's check that 'for a day with a known red task-MR pipeline, it lists [it] with [its] URL'. An MR closed unmerged on a day other than its row's done day (for example archived later) is dropped the same way. The test only covers rows whose events fall on their done day, plus an open task with asincetag, so it cannot catch this. Possible remedies: treat an unknown start as unbounded (start=None), use a fixed lookback before the done day, or read the ledger's dispatch events for span purposes regardless of the cutoff. Choosing among them changes the candidate scope the user decided on, so the remedy, not the defect, needs authorization.🔧 Fix applied.
1 info still open:
tests/fm-wake-daily-rework.test.sh:34- The glab and gh stubs return small handwritten JSON (for example MR detail with only state/closed_at/merged_at, and pipelines with only id/status/updated_at/web_url). The user's CLAUDE.md says mock data MUST be based on actual API calls and stored centrally with documentation. Replace these with trimmed real GitLab MR/pipelines and GitHub pulls/commits/actions-runs responses kept in a documented fixture location. That way field-name drift (for example finished_at vs updated_at, conclusion vs status) would be caught.✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git clone --filter=blob:none --no-checkout https://lsg-git.lbl.gov/lblnet/lblnet_hostupdate.git $LAB/projects/lblnet_hostupdate(disposable lab home)python3 bin/fm-wake-daily.py 2026-11-19 --home $LABwith backlog ship rows for real MRs !3979 (closed unmerged), !3989 (red pipelines, merged 2026-11-20) and GitHub PR clarsen/firstmate#50jqcheck that the rework section has only reverts/closed_unmerged/failed_pipelines and no relaunch key anywhere in the recordRepeat run with the same inputs;cmpshowed the record file is byte-identicalpython3 bin/fm-wake-daily.py 2026-11-19 --home $LAB-unreachwith an extra MR row on unresolvable host gitlab.fm-lab.invalid (real glab call fails)Read-only check: the clone's refs and config and the source data hashes are unchanged after a runbash tests/fm-wake-daily-rework.test.sh✅ No issues found.
python3 bin/fm-wake-daily.py 2026-11-19 --home <disposable home>with a real lblnet_hostupdate clone, real MRs 3977 and 3968, and a gitlab.invalid MR rowpython3 bin/fm-wake-daily.py 2026-11-19 --home <disposable home>rerun with the unreachable row removed and an empty done-archive.md, to show all three signals measuredpython3 bin/fm-wake-daily.py 2026-11-21 --home <disposable home>with real GitHub PR clarsen/firstmate#53 and an empty fleet ledgerCross-checked against independent read-onlyglab apiandgh apiqueries for closed MRs and failed pipelines and runsbash tests/fm-wake-daily-rework.test.sh(printsok: Wake daily rework collector)✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.