Skip to content

fix: stop a colon in a status tag value from hanging the live-board snapshot - #72

Merged
doitdigital0495 merged 1 commit into
mainfrom
fm/firstmate-status-parser-loop
Oct 12, 2026
Merged

doitdigital0495 merged 1 commit into
mainfrom
fm/firstmate-status-parser-loop

Conversation

@doitdigital0495

Copy link
Copy Markdown
Owner

Intent

Stop a colon inside a status tag value (such as a PR URL) from hanging status_last_meaningful_event and freezing the live-board snapshot; the tag loop now ends when a token strips nothing, with a regression test.

What Changed

  • status_last_meaningful_event in bin/fm-classify-lib.sh used to loop forever on a status line whose tag value contained a colon, for example [pr=https://...], so the live-board snapshot froze. The tag-parse loop now stops when a token strips nothing from the line, and that line is not counted as a tag line.
  • Added a regression case to tests/fm-live-board-snapshot.test.sh. It appends a status line with a PR URL in a tag and runs --live-board-input with a 30s timeout. It then checks that the last meaningful event is still the earlier note.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change adds a one-line guard to the tag loop. It fires only when the bracket case invents a closing ] that is not in the head, which happens exactly when the head split at the first colon cuts a tag value. The documented status format puts [pr=<url>] after the colon, so dropping these head-tag lines does not hide real board events, and the regression test would time out without the fix.

Testing

I ran the targeted live-board snapshot test, which drives the real fleet --live-board-input CLI against a fixture home. It passes on the fix. With the pre-fix lib swapped in it hangs until the 30s timeout and fails, so the test reproduces the bug. I then called the parser directly with adversarial inputs: every call returned at once. A line whose tag value holds a colon is skipped as a non-tag line, so the earlier event is kept. Normal tag lines are still returned as the latest event. There is no UI change, so there are no screenshots; the evidence is test logs and a function probe transcript.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Live-board snapshot with a PR-URL tag in history.status finishes and keeps the previous meaningful event ✅ pass live after-fix-test.log: 'ok - a URL in a status tag value ends the tag parse instead of hanging the snapshot'
Regression test reproduces the hang on pre-fix code ✅ pass live before-fix-test.log: 'not ok - a status line with a colon in a tag value hung or failed the live-board snapshot', exit 1 after the 30s timeout
Adversarial: several colon-bearing tag values on one line do not hang the parser ✅ pass live direct-function-probe.txt: '[x=a:b] [y=c:d:e]' line returned rc=0 right away, previous event kept
Normal tag lines ([at=N] [pr=7], [k=v]) are still recognised as the latest meaningful event ✅ pass live direct-function-probe.txt: 'done [at=300] [pr=7]: merged' and 'working [at=100] [k=v]: plain tag line' returned
Evidence: Regression test after fix (pass)

Source: Regression test after fix (pass)

ok - empty home is explicit, not an all-fleet clear verdict
ok - registry enumeration reuses mechanical posture, preserves idle projects and discloses duplicates
ok - full open inventory retains programs, queued work, conflicting repo/id, current-state provenance and recent finishes
ok - more than twenty holds retain all buckets with structured priority and oldest-first order
ok - strict append-order history accepts milestones and resolutions, skips malformed tails, preserves unknown time
ok - a URL in a status tag value ends the tag parse instead of hanging the snapshot
ok - unregistered keyed calls remain owner-registration warnings, not another answer path
ok - allowlisted replay strips raw paths/bodies, rejects unsafe links and qualifies ids by home
ok - unknown or malformed input fails closed without partial board output
ok - default canonical and original Bearings contracts remain separate from the live board
ok - canonical owner context preserves explicit modes and summaries; legacy, stale, duplicate and malformed calls stay read-only
ok - pull request summaries are short plain manager notes, or the cleaned title when the description cannot give one
ok - deploy outcomes cover failed, running, succeeded, none, waiting, unreadable, too old, open and closed without guessing
ok - a missing, malformed or unsupported pull request document is disclosed and never fails the snapshot
ok - only a well-formed environment place leaves the snapshot, and older pull requests keep their title without a manager note
ok - registered homes contribute their workers and queued work through their own input; remote, invalid, malformed and unread homes are named, and a home that stops reading keeps its last good input with its age

real	0m16.381s
user	0m15.430s
sys	0m3.307s
Evidence: Regression test against pre-fix lib (hang -> fail)

Source: Regression test against pre-fix lib (hang -> fail)

ok - empty home is explicit, not an all-fleet clear verdict
ok - registry enumeration reuses mechanical posture, preserves idle projects and discloses duplicates
ok - full open inventory retains programs, queued work, conflicting repo/id, current-state provenance and recent finishes
ok - more than twenty holds retain all buckets with structured priority and oldest-first order
ok - strict append-order history accepts milestones and resolutions, skips malformed tails, preserves unknown time
not ok - a status line with a colon in a tag value hung or failed the live-board snapshot

real	0m33.511s
user	0m3.517s
sys	0m1.053s
Evidence: Direct parser probe with colon-bearing tags

Source: Direct parser probe with colon-bearing tags

--- input:
  working [at=100]: started
  working [at=200] [pr=https://forge.invalid/org/repo/pullrequest/1452]: PR opened
  => working [at=100]: started
rc=0
--- input:
  working [at=100]: started
  done [at=300] [pr=7]: merged
  => done [at=300] [pr=7]: merged
rc=0
--- input:
  working [at=100]: started
  working [at=200] [x=a:b] [y=c:d:e]: weird
  => working [at=100]: started
rc=0
--- input:
  working [at=100] [k=v]: plain tag line
  => working [at=100] [k=v]: plain tag line
rc=0
- Outcome: ⚠️ 1 info across 1 run (1m28s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ℹ️ bin/fm-classify-lib.sh:318 - A status line whose tag value holds a colon (such as a PR URL) is now skipped as a non-tag line, not parsed, so that event (for example 'PR opened') never becomes the last meaningful event. This matches the stated intent and the test's assertion; parsing URL-valued tags would be a separate change.
  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Live-board snapshot with a PR-URL tag in history.status finishes and keeps the previous meaningful event ✅ pass live after-fix-test.log: 'ok - a URL in a status tag value ends the tag parse instead of hanging the snapshot'
Regression test reproduces the hang on pre-fix code ✅ pass live before-fix-test.log: 'not ok - a status line with a colon in a tag value hung or failed the live-board snapshot', exit 1 after the 30s timeout
Adversarial: several colon-bearing tag values on one line do not hang the parser ✅ pass live direct-function-probe.txt: '[x=a:b] [y=c:d:e]' line returned rc=0 right away, previous event kept
Normal tag lines ([at=N] [pr=7], [k=v]) are still recognised as the latest meaningful event ✅ pass live direct-function-probe.txt: 'done [at=300] [pr=7]: merged' and 'working [at=100] [k=v]: plain tag line' returned
  • bash tests/fm-live-board-snapshot.test.sh on target commit 2c67c5b (exit 0, all ok, including the new URL-tag case)
  • bash tests/fm-live-board-snapshot.test.sh with bin/fm-classify-lib.sh temporarily swapped to base 9695b55 (exit 1: 'not ok - a status line with a colon in a tag value hung or failed the live-board snapshot'), file then restored, worktree clean
  • Direct probe: sourced bin/fm-classify-lib.sh and called status_last_meaningful_event under timeout 10 on a PR-URL tag line, several colon-bearing tags, a plain numeric tag and a plain k=v tag line
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@doitdigital0495
doitdigital0495 merged commit 3f115f3 into main Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants