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

3.4 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related legacy
bug-1484 fixed 2026-09-24 controller unknown 2026-07-29T21:10:00Z 2026-09-19T09:00:00Z 1
src/controller/ha.c (~6690-6711 heartbeat-reply vector
~6805-6814 WAL-NACK vector); no test file drives either
ha.c
raft_on_higher_term_observed
repl_ack_decode_and_dispatch
term-discovery
bug-1421
coverage-gap
raft-adapter-conformance
task-7.2
found-not-yet-fixed
pre-existing
requirement-7.1
requirement-7.2
requirement-7.5
bug-1421
true

bug-1484: No test anywhere in src/controller/testsuite/ drives the real production dispatch path for either…

Description

No test anywhere in src/controller/testsuite/ drives the real production dispatch path for either term-discovery vector bug-1421 introduced (heartbeat-reply state-report term adoption, ha.c:6690-6711; WAL-NACK reply_term adoption inside repl_ack_decode_and_dispatch, ha.c:6805-6814) and asserts raft_on_higher_term_observed actually fires. The look-alike test_intake_higher_term_heartbeat_adopts_term (test_term_safety_adapter.c:1232) drives a different code path (ha_consume_append_entries -> raft_on_append_entries_request library-level UpdateTerm, an AE-request vector, not the AE-reply/state-report fallback bug-1421 added). test_persist_recovery.c (cited by design.md line 146 as covering this) has zero term-adoption content -- pure recovery mechanics. test_config_repl.c only covers the NEW config-push term vector added by this feature (Req 7.4), not the pre-existing heartbeat/WAL-NACK vectors.

Environment

Not recorded (migrated from buglog.json).

Reproduction

Not recorded (migrated from buglog.json).

Root cause

bug-1421 (heartbeat-reply term-discovery fallback) shipped without a dedicated regression test asserting raft_on_higher_term_observed fires through the real repl_ack_decode_and_dispatch path for either vector -- found during raft-adapter-conformance task 7.2s regression-confirmation sweep, which searched the whole test suite (not just its own 8-file boundary) for raft_on_higher_term_observed/higher_term callers and found none exercising these two vectors end-to-end.

Fix

FIXED (2026-08-01) -- test-coverage gap closed, no production logic change (the underlying bug-1421 term-adoption code was already correct, just unverified end-to-end). Added test_term_adoption_vectors.c with two tests driving the real peer_ctrl_msg_handler -> repl_ack_decode_and_dispatch path (via peer_ctrl_msg_handler_for_test + standby_ep_ctx_build_for_test, c=NULL -- every c-dependent step downstream of the term check is already guarded): (a) test_heartbeat_state_report_higher_term_adopts_and_steps_down builds a wire-shape StateReport reply carrying a higher term and asserts raft_on_higher_term_observed adopts it and steps the node down from RAFT_LEADER (ha.c:6690-6711 vector); (b) test_wal_nack_higher_term_adopts_and_steps_down does the same for a WalAckReply{success=0} carrying a higher reply_term (ha.c:6805-6814 vector). Both went GREEN immediately, confirming Requirement 7.5's 'already verified' claim was correct in substance, just previously unverified by any test. Registered in meson.build controller_unit_test_src and controller_test.c. Full suite: 1071 -> 1073 Tests, 0 Failures.

Verification

Not recorded (migrated from buglog.json).

References

  • Related: bug-1421