myxce/.wolf/bugs/bug-1623.md
Rongsong Shen d26ff8870d
feat(buglog): one Markdown record per bug, checked against a record standard
The buglog was one 27K-line JSON file whose fields covered only symptom,
root cause and fix, as free text: 2% of entries named the code version a
bug was found on, 12% the build profile, 36% a way to reproduce, and 58% of
the file was OpenWolf hook auto-detections ("Missing guard clause",
"Function not marked async" on .md files).

- .claude/skills/buglog/bug-record.md: the record standard. Eight
  sections (Summary as the title, Description, Environment, Reproduction;
  Root cause, Fix, Verification, References once fixed), each with the
  content it must contain -- e.g. Environment needs the OS, the libc the
  failing binary loads (from its ELF interpreter: glibc 2.42 in the nix
  shell vs 2.40 on the host), toolchain, build profile and commit.
- .wolf/bugs/<id>.md: 500 records migrated from buglog.json; every field
  verified to round-trip. They carry legacy: true and an explicit "not
  recorded" where the old log had no such field; component derived from
  file paths, severity from keywords (else unknown), fix_commits from
  hashes in status_note/fix that git resolves (91 of 463 fixed).
- .wolf/buglog-archive.json: the 710 hook auto-detections, verbatim.
- .wolf/buglog.json is now an index generated from the records, keeping
  the fields OpenWolf's hooks and `openwolf bug search` read.
- scripts/buglog.py rewritten: new (template + Environment collected from
  the machine and --binary), check, status (refuses a status the record
  doesn't support; fixed needs Root cause, Fix, Verification and
  --commit hashes git resolves), note, recur, set, show, list, triage,
  env, index. 29 unittest cases in scripts/tests/test_buglog.py.
- scripts/git-hooks/pre-commit runs `check --staged`: incomplete staged
  records, a legacy record hand-changed to fixed without the fix-time
  sections, a new record claiming legacy: true, or a stale index refuse
  the commit.
- scripts/gitea-sync.py reads the records: issue body = the record's
  sections plus linked fix commits (origin remote, GITEA_COMMIT_REPO to
  override), and a body hash so an issue's text is refreshed when the
  record changes.
- bug-1866 rewritten to the full standard as the worked example.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 03:40:11 +00:00

38 lines
3.8 KiB
Markdown

---
id: "bug-1623"
status: "fixed"
status_updated: "2026-09-24"
status_note: ""
component: "scheduler"
severity: "unknown"
timestamp: "2026-08-22T12:40:00Z"
last_seen: "2026-09-19T09:00:00Z"
occurrences: 1
files: ["src/scheduler/testsuite/test_sim_e2e_original_motivation.c"]
tags: ["scheduler", "sim", "replay", "reconciliation", "test-authoring", "scheduler-sim-decision-parity"]
related: ["bug-1611", "bug-1613"]
legacy: true
---
# bug-1623: Test-authoring bug while building scheduler-sim-decision-parity task 4.3…
## Description
Test-authoring bug while building scheduler-sim-decision-parity task 4.3 (test_sim_e2e_original_motivation.c): initial version asserted resInUse checkpoints of 17.00/18.00/20.00/12.00 (derived from the RECORDING driver own in-memory resInUse arithmetic) but the actual replay-side info worker output showed only 12.00 (ANCHOR own charge) at every checkpoint -- the first three assertions failed.
## Environment
_Not recorded (migrated from buglog.json)._
## Reproduction
_Not recorded (migrated from buglog.json)._
## Root cause
Recorded-Decision Reconciliation (sim_reconcile_unaccounted_jobs(), sim_loop.c, scheduler-sim-decision-parity tasks 2.2-2.4/3) matches a RUN-state, unaccounted job against a DISPATCH decision recorded in THAT SAME replayed round only -- never an earlier or later round (each round decoded_session is decoded fresh and freed immediately after that round own processing). A job that arrives PEND and is genuinely live-dispatched by a real allocator in round K, then confirmed RUN via a JOB_STATE_CHANGE event in a LATER round K+1, can never be reconciled during replay: round K+1 own decoded decisions do not contain a match (the real DISPATCH is in round K own data), so the job stays RUN+unaccounted forever (Requirement 4 graceful degradation, correctly, not a bug in production). This is structurally impossible to avoid for ANY organically-arriving job, since a job cannot simultaneously be a fresh PEND candidate for a live picker (required to ever get a real DISPATCH decision) AND already-RUN-before-the-picker-runs (required for reconciliation to even consider it) in the same round -- confirmed by direct source read of sim_loop.c/driver.c/builtin_fcfs.c before writing any test code, then independently reconfirmed empirically by running the real test binary. Only ONE job in the whole fixture (ANCHOR_ID) was deliberately engineered so its arrival+RUN-confirmation events AND its own injected DISPATCH decision land in the exact same round (round 1) -- every other churn job (J2-J12) arrives and is genuinely live-dispatched by the test own capacity-aware allocator thread in ITS OWN arrival round, so its dispatch can never be reconciled later, exactly like every other real production job whose confirmation lags its dispatch by more than zero rounds.
## Fix
Changed all four info-worker checkpoint assertions from the RECORDING-side arithmetic (17.00/18.00/20.00/12.00, i.e. what a normal-mode continuation of the same session would show) to the REPLAY-side reality: a constant used=12.00 (ANCHOR_ID own charge only) at all four checkpoints spanning the 24-round replay, since no churn job dispatch is ever reconciled. Added an explicit non-tautology guard (used=0.00 never appears) and an extensive header-comment/round-table-comment explanation of why churn-job charges never surface during replay, so a future reader does not mistake this for an oversight. Also independently reconfirmed via a live discriminating-power check: commenting out sim_loop.c own sim_reconcile_unaccounted_jobs() call site made the ANCHOR_ID DISPATCH-visibility assertion fail for the right reason; restoring it (git diff clean on production files afterward) made the whole suite green again.
## Verification
_Not recorded (migrated from buglog.json)._
## References
- Related: bug-1611, bug-1613