myxce/.wolf/bugs/bug-1762.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

4.7 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related legacy
bug-1762 fixed 2026-09-24 scheduler unknown 2026-09-02T07:50:00Z 2026-09-19T09:00:00Z 1
src/scheduler/testsuite/meson.build (sched_repl_output_compression_test)
src/scheduler/src/repl.c
repl
scheduler-sim
build-wiring
meson
jobid-range-compression
test-infrastructure
true

bug-1762: scheduler-sim-repl-verbosity task 1.2 (Jobid Range Compressor, repl_fmt_jobid_range()): task 1.1's…

Description

scheduler-sim-repl-verbosity task 1.2 (Jobid Range Compressor, repl_fmt_jobid_range()): task 1.1's approved RED-phase meson.build target sched_repl_output_compression_test (src/scheduler/testsuite/meson.build) lists ONLY test_repl_output_compression.c as its source, with no source providing the function's implementation -- so even after adding a correct repl_fmt_jobid_range() definition to src/scheduler/src/repl.c (as design.md's File Structure Plan literally directs: 'implements the new shared jobid-range-compression helper ... in repl.c'), the target still fails to link: undefined reference to repl_fmt_jobid_range.

Environment

Not recorded (migrated from buglog.json).

Reproduction

Not recorded (migrated from buglog.json).

Root cause

CONFIRMED empirically, but the FIRST fix attempt below drew the wrong conclusion from it. Adding repl.c itself as a bare extra SOURCE FILE to the test target's sources does not fix the link -- it trades one undefined reference for five: repl_dispatch() (a function in repl.c, never called by this test) references repl_cmd_break/repl_cmd_delete/repl_cmd_info/repl_cmd_snapshot/repl_cmd_set, implemented in sibling files repl_break.c/repl_info.c/repl_params.c that this deliberately-lightweight test target does not build. A directly-linked .o file (unlike an archive/static-library member) requires ALL of its undefined symbols resolved regardless of whether the calling code path is ever exercised at runtime -- there is no dead-code elimination at the object-file granularity without -ffunction-sections + -Wl,--gc-sections, which this build does not use. HOWEVER: this only rules out the narrow 'bare .c file in the source list' fix -- it does NOT mean repl_fmt_jobid_range() must live in its own translation unit. sched_scheduler_connect_test (src/scheduler/testsuite/meson.build) already establishes the correct alternative for exactly this shape of problem: link the target against the REAL scheduler_srcs object list (a foreach f : scheduler_srcs loop over the production source list, minus src/main.c) instead of hand-picking source files, which resolves repl_dispatch()'s cross-file externs for real (repl_break.c/repl_info.c/repl_params.c are simply also linked in) rather than needing them excluded. This alternative was available and untried at the time of the original fix below, which additionally violated design.md's explicit Architecture Integration commitment ('no new production .c file needed') by introducing repl_jobid_range.c.

Fix

REMEDIATED (superseding the original fix below, which was reviewed and rejected for violating design.md's 'no new production .c file needed' commitment). repl_fmt_jobid_range() and its private helpers now live in src/scheduler/src/repl.c itself, exactly as design.md's File Structure Plan directs, with only one new #include (<stdarg.h>, for the internal repl_jr_appendf() vararg helper) -- no new production .c file. sched_repl_output_compression_test (src/scheduler/testsuite/meson.build) now links the real scheduler_srcs object list via a foreach f : scheduler_srcs loop (mirroring sched_scheduler_connect_test's own established technique) instead of hand-picking source files, so repl_dispatch()'s cross-file externs resolve for real; no -Wl,--wrap= or -DXCE_SCHEDULER_C_PATH needed since this test never calls sched_init() or reaches networking code. repl_jobid_range.c deleted; 'src/repl_jobid_range.c' removed from scheduler_srcs (src/scheduler/meson.build); repl_internal.h's doc comment on repl_fmt_jobid_range() updated to drop the now-false 'lives in its own translation unit' rationale. Verified: xce-build.sh scheduler --incremental succeeds with zero linker errors; sched_repl_output_compression_test's own binary output shows all 5 Unity tests PASS (5 Tests 0 Failures 0 Ignored); full scheduler suite still 55/56, the one failure being the pre-existing unrelated test_job_rusage_reconciles_mem_reservation_against_usage (test_core_events.c, mem-reservation subsystem, untouched by this change); repl.c stays at 794/800 lines after the addition (up from 531 before this task).

Verification

Not recorded (migrated from buglog.json).

References

Not recorded (migrated from buglog.json).