fix bug-1060 bug-1067

This commit is contained in:
Rongsong Shen 2026-06-24 17:05:43 +08:00
parent 6067ba6c94
commit 61e1391cd0
28 changed files with 7021 additions and 2926 deletions

View file

@ -2579,3 +2579,221 @@
| 21:47 | Edited .kiro/steering/persistence.md | inline fix | ~126 |
| 21:48 | Session end: 294 writes across 37 files (test_term_safety_adapter.c, commit.h, commit.c, ha.c, ha.h) | 66 reads | ~607176 tok |
| 00:04 | Session end: 294 writes across 37 files (test_term_safety_adapter.c, commit.h, commit.c, ha.c, ha.h) | 66 reads | ~607176 tok |
## Session: 2026-06-23 00:14
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 00:29 | Created ../../../../../claude/.claude/plans/piped-mixing-glade.md | — | ~2049 |
| 00:34 | Edited src/controller/config_repl.h | expanded (+10 lines) | ~391 |
| 00:34 | Edited src/controller/config_repl.h | modified struct() | ~91 |
| 00:35 | Edited src/controller/config_repl.c | modified ha_stream_wal_to_standby() | ~64 |
| 00:35 | Edited src/controller/config_repl.c | added error handling | ~285 |
| 00:35 | Edited src/controller/config_repl.c | modified persist_entry_term() | ~140 |
| 00:36 | Edited src/controller/config_repl.c | modified persist_entry_term() | ~110 |
| 00:36 | Edited src/controller/config_repl.c | 3→3 lines | ~47 |
| 00:36 | Edited src/controller/ha.c | modified if() | ~202 |
| 00:37 | Edited src/controller/testsuite/test_config_repl.c | 4→4 lines | ~66 |
| 00:37 | Edited src/controller/testsuite/test_config_repl.c | 4→4 lines | ~66 |
| 00:37 | Edited src/controller/testsuite/test_config_repl.c | 4→4 lines | ~67 |
| 00:38 | Edited src/controller/testsuite/test_coldstart_lsn0.c | 3→3 lines | ~50 |
| 00:38 | Edited src/controller/testsuite/test_coldstart_lsn0.c | 3→3 lines | ~50 |
| 00:39 | Edited src/controller/testsuite/test_config_repl.c | added error handling | ~1034 |
| 00:40 | Edited src/controller/testsuite/test_config_repl.c | 4→5 lines | ~76 |
| 00:44 | Edited src/controller/config_repl.c | 3→3 lines | ~48 |
| 00:45 | Edited src/controller/config_repl.c | modified persist_entry_term() | ~49 |
| 00:46 | Edited src/lib/client.c | added 1 condition(s) | ~188 |
| 00:47 | Edited src/lib/client.c | added 1 condition(s) | ~487 |
| 01:03 | Created repro854.sh | — | ~416 |
| 01:05 | Edited repro854.sh | 3→3 lines | ~45 |
| 01:22 | Created repro_joblist.sh | — | ~201 |
| 08:30 | bug-1028: streamer term-source FIXED (persist_entry_term); bug-854: client rotation FIXED (xce_failover_rotate on non-auth reply); both RED→GREEN, full build 0, unit :FAIL:=0, live committed-prefix identical + wait-primary 92ms | config_repl.c/.h, ha.c, client.c, test_config_repl.c | bugs CLOSED | ~28k |
| 01:29 | Session end: 23 writes across 9 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 16 reads | ~250791 tok |
| 01:33 | Session end: 23 writes across 9 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 16 reads | ~250791 tok |
| 01:44 | Edited src/lib/testsuite/test_wal_wire.c | modified heartbeat() | ~150 |
| 01:46 | Session end: 24 writes across 10 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 18 reads | ~266661 tok |
| 02:15 | Session end: 24 writes across 10 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 19 reads | ~275693 tok |
| 02:44 | Edited src/controller/cluster.c | added 1 condition(s) | ~660 |
| 02:53 | Edited src/lib/xcectx.c | 1→2 lines | ~26 |
| 02:54 | Edited src/lib/xcectx.c | added 2 condition(s) | ~286 |
| 02:58 | Session end: 27 writes across 12 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 22 reads | ~281425 tok |
| 03:07 | Session end: 27 writes across 12 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 22 reads | ~281425 tok |
| 03:25 | Edited src/lib/netio.c | modified iomgr_monitor() | ~240 |
| 03:27 | Session end: 28 writes across 13 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 22 reads | ~282052 tok |
| 03:31 | Created ../../../../../../tmp/xce-ha-verify/test.sh | — | ~291 |
| 03:37 | Edited src/lib/netio.c | modified handle_ssl_handshake() | ~276 |
| 03:40 | Edited src/controller/cluster.c | expanded (+13 lines) | ~282 |
| 03:43 | Edited src/lib/netio.c | inline fix | ~12 |
| 03:44 | Edited src/lib/netio.c | inline fix | ~7 |
| 03:46 | Edited src/include/netio.h | 2→3 lines | ~60 |
| 03:48 | Edited src/controller/cluster.c | inline fix | ~12 |
| 03:49 | Edited src/controller/cluster.c | modified if() | ~290 |
| 03:51 | Edited src/lib/netio.c | modified iomgr_monitor() | ~161 |
| 03:52 | Edited src/lib/netio.c | modified handle_ssl_handshake() | ~202 |
| 03:53 | Edited src/include/netio.h | 3→2 lines | ~37 |
| 03:54 | Edited src/lib/netio.c | inline fix | ~6 |
| 03:58 | Session end: 40 writes across 15 files (piped-mixing-glade.md, config_repl.h, config_repl.c, ha.c, test_config_repl.c) | 23 reads | ~290775 tok |
## Session: 2026-06-23 06:20
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 06:24 | Created .claude/skills/xce-test-ha/run-ha-soak.sh | — | ~2292 |
| 06:25 | Created .claude/skills/xce-test-ha/SKILL.md | — | ~1430 |
| 06:27 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified xtest() | ~112 |
| 06:27 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified code() | ~263 |
| 06:28 | Edited .claude/skills/xce-test-ha/SKILL.md | 7→12 lines | ~194 |
| 06:30 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified discover_primary() | ~199 |
| 06:37 | Edited src/controller/testsuite/waldump.c | 3→4 lines | ~69 |
| 06:37 | Edited src/controller/testsuite/waldump.c | added 1 condition(s) | ~227 |
| 06:37 | Edited src/controller/testsuite/waldump.c | 2→3 lines | ~50 |
| 06:42 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | 7→10 lines | ~158 |
| 06:59 | Edited src/lib/client.c | added 1 condition(s) | ~550 |
| 07:01 | Edited src/lib/client.c | added 2 condition(s) | ~451 |
| 07:04 | Edited .claude/skills/xce-test-ha/SKILL.md | expanded (+33 lines) | ~516 |
| 07:08 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified wait_for_primary_log() | ~503 |
| 07:08 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified 10() | ~770 |
| 07:15 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified logs() | ~790 |
| 07:15 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | expanded (+8 lines) | ~467 |
| 07:23 | Edited src/controller/ha.c | added error handling | ~746 |
| 07:23 | Edited src/controller/ha.h | expanded (+11 lines) | ~214 |
| 07:24 | Edited src/controller/cluster.c | 2→7 lines | ~135 |
| 07:25 | Edited src/controller/testsuite/test_persist_recovery.c | modified test_recovered_member_syncs_raft_log_len() | ~955 |
| 07:39 | Edited src/controller/ha.c | 3→3 lines | ~37 |
| 07:43 | Edited src/controller/ha.c | modified if() | ~516 |
| 07:48 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified wait_for_full_convergence() | ~537 |
| 14:52 | /xce-test-ha skill + 3 failover bug fixes (bug-854 dead-first, bug-1042 rejoin log_len, bug-1043 catch-up apply); 5-round soak PASS zero loss | client.c, ha.c, cluster.c, ha.h, waldump.c, skill | 3 bugs FIXED + skill created | ~60k |
| 07:53 | Edited .claude/skills/xce-test-ha/SKILL.md | expanded (+8 lines) | ~175 |
| 07:54 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified submit_jobs() | ~426 |
| 08:00 | Session end: 26 writes across 8 files (run-ha-soak.sh, SKILL.md, waldump.c, client.c, ha.c) | 13 reads | ~186275 tok |
## Session: 2026-06-23 08:01
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
## Session: 2026-06-23 08:15
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 08:31 | Created ../../../../../claude/.claude/plans/task-notification-task-id-bkkk2llpr-tas-zany-locket.md | — | ~366 |
| 08:31 | Session end: 1 writes across 1 files (task-notification-task-id-bkkk2llpr-tas-zany-locket.md) | 1 reads | ~392 tok |
| 08:47 | Session end: 1 writes across 1 files (task-notification-task-id-bkkk2llpr-tas-zany-locket.md) | 1 reads | ~392 tok |
| 09:01 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | expanded (+13 lines) | ~379 |
| 09:02 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | expanded (+9 lines) | ~286 |
| 09:02 | Edited .claude/skills/xce-test-ha/SKILL.md | "End-to-end HA failover so" → "End-to-end HA failover so" | ~62 |
| 09:02 | Edited .claude/skills/xce-test-ha/SKILL.md | expanded (+8 lines) | ~213 |
| 09:03 | Edited .claude/skills/xce-test-ha/SKILL.md | expanded (+9 lines) | ~153 |
| 09:04 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | 5→9 lines | ~136 |
| 22:11 | enhance /xce-test-ha: add [dir] arg (positional $1 > XCE_HA_TOP > default) + rm-rf safety guard (.xce-ha-deploy marker, fail-loud) | run-ha-soak.sh, SKILL.md | verified: guard refuses unmarked non-empty dir; custom-dir 5-round soak PASS 18 jobs zero loss | ~3k |
| 15:11 | Session end: 7 writes across 3 files (task-notification-task-id-bkkk2llpr-tas-zany-locket.md, run-ha-soak.sh, SKILL.md) | 3 reads | ~7892 tok |
| 15:13 | Session end: 7 writes across 3 files (task-notification-task-id-bkkk2llpr-tas-zany-locket.md, run-ha-soak.sh, SKILL.md) | 3 reads | ~7892 tok |
| 15:50 | Edited src/lib/testsuite/test_hooks.c | modified AND() | ~682 |
| 15:52 | Edited src/lib/hook.c | added 4 condition(s) | ~377 |
| 23:10 | fix bug-845 WAL double-append: xce_add_hook idempotent on (fn,data) | src/lib/hook.c, test_hooks.c | duplicates gone (waldump single-entry), 5/5 hook tests, 343 ctrl tests 0 new fails, 3/3 soaks pass; 1 earlier soak hit known intermittent bug-795/828 loss (pre-existing) | ~9k |
| 16:10 | Session end: 9 writes across 5 files (task-notification-task-id-bkkk2llpr-tas-zany-locket.md, run-ha-soak.sh, SKILL.md, test_hooks.c, hook.c) | 10 reads | ~120437 tok |
## Session: 2026-06-24 10:37
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 19:58 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | modified log() | ~227 |
| 10:58 | Session end: 1 writes across 1 files (run-ha-soak.sh) | 3 reads | ~5079 tok |
| 19:58 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | 3→4 lines | ~44 |
| 19:58 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | 4→5 lines | ~91 |
| 20:00 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | added error handling | ~890 |
| 20:00 | Edited .claude/skills/xce-test-ha/run-ha-soak.sh | expanded (+28 lines) | ~369 |
| 20:01 | Edited .claude/skills/xce-test-ha/SKILL.md | modified nodes() | ~447 |
| 03:04 | enhance /xce-test-ha: force lowest-priority ctrl-3 to lead (freshness-fence maneuver) + assert all 3 nodes led | run-ha-soak.sh, SKILL.md | verified: ctrl-3 elected term 8, zero loss, PASS "all 3 nodes led" | ~7k |
| 20:21 | Session end: 6 writes across 2 files (run-ha-soak.sh, SKILL.md) | 4 reads | ~9263 tok |
## Session: 2026-06-24 11:28
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 11:35 | /xce-test-ha 10 /tmp/xce-test-ha: 10 rounds, 36 jobs, zero job loss, all 3 nodes led | xce-ha-soak.log | PASS (exit 0) | ~50 |
## Session: 2026-06-24 11:50
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 12:05 | Diagnosed prevote deadlock after soak test: ctrl-3 incorrectly truncated committed entries 45-47 (term=12) on becoming primary (safe_committed_lsn=44 from voter quorum, not honoring own ack knowledge); ctrl-2 received term=13 NOOP at LSN=45 (conflicts with ctrl-1 term=12 job); 2-node deadlock permanent — restart ctrl-3 to resolve | ctrl-*.log, WALs | ANALYZED: bug-795 class | ~1200 |
## Session: 2026-06-24 21:15
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 21:20 | Edited src/controller/testsuite/test_ha_election.c | added error handling | ~841 |
| 21:20 | Edited src/controller/testsuite/test_ha_election.c | 3→6 lines | ~78 |
| 21:21 | Edited src/controller/ha.h | expanded (+20 lines) | ~362 |
| 21:21 | Edited src/controller/ha.c | modified ha_promotion_truncate_floor() | ~195 |
| 21:21 | Edited src/controller/ha.c | modified 1060() | ~356 |
| 21:30 | Edited src/controller/ha.c | expanded (+15 lines) | ~308 |
| 21:30 | Edited src/controller/ha.c | 6→10 lines | ~188 |
| 21:31 | Edited src/controller/ha.c | added error handling | ~738 |
| 21:31 | Edited src/controller/ha.c | modified ha_promotion_truncate_floor() | ~195 |
| 21:31 | Edited src/controller/ha.c | modified 1060() | ~356 |
| 21:32 | Edited src/controller/ha.h | expanded (+11 lines) | ~235 |
| 21:32 | Edited src/controller/ha.h | expanded (+19 lines) | ~383 |
| 21:33 | Edited src/controller/testsuite/test_ha_election.c | added error handling | ~841 |
| 21:33 | Edited src/controller/testsuite/test_ha_election.c | 3→6 lines | ~78 |
| 21:36 | Edited src/controller/CLAUDE.md | inline fix | ~239 |
| 21:37 | Edited src/controller/CLAUDE.md | inline fix | ~147 |
| 21:37 | Edited src/controller/CLAUDE.md | inline fix | ~63 |
## Session: 2026-06-24 12:38
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 18:05 | fix bug-1060: new leader truncated its own committed entries (Raft Leader Completeness violation) → divergent WALs + prevote deadlock + job loss | src/controller/ha.c, ha.h, testsuite/test_ha_election.c | added ha_promotion_truncate_floor=max(safe_lsn,durable_tip); raft_cb_become_leader truncates at clamped floor (no-op on own log); unit test GREEN, 0 failures | ~60k |
| 18:06 | steering + bookkeeping for bug-1060 | src/controller/CLAUDE.md, .wolf/buglog.json, .wolf/cerebrum.md | updated Leader Completeness/Post-Election/checklist; bug-1060 marked FIXED; Key Learning + Do-Not-Repeat (clang-format whole-file recurrence) | ~8k |
| 21:39 | Created ../../../../../claude/.claude/projects/-home-rshen-projects-xce-xce/memory/project_bug1060_leader_completeness.md | — | ~553 |
| 21:39 | Session end: 1 writes across 1 files (project_bug1060_leader_completeness.md) | 0 reads | ~593 tok |
## Session: 2026-06-24 14:50
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
## Session: 2026-06-24 15:03
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
## Session: 2026-06-24 15:36
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 01:17 | Edited src/controller/testsuite/test_term_safety_adapter.c | modified test_intake_crossterm_catchup_uses_leader_current_term() | ~1730 |
| 01:17 | Edited src/controller/testsuite/test_term_safety_adapter.c | 2→4 lines | ~68 |
| 01:17 | Edited src/schema/controller.capnp | added error handling | ~260 |
| 01:17 | Edited src/lib/request.c | added error handling | ~139 |
| 01:18 | Edited src/lib/request.c | 4→7 lines | ~112 |
| 01:18 | Edited src/controller/config_repl.c | modified ha_stream_wal_to_standby() | ~70 |
| 01:18 | Edited src/controller/config_repl.c | added error handling | ~190 |
| 01:18 | Edited src/controller/config_repl.c | modified if() | ~121 |
| 01:18 | Edited src/controller/ha.c | modified if() | ~292 |
| 01:19 | Edited src/controller/config_repl.h | added error handling | ~166 |
| 01:19 | Edited src/controller/testsuite/test_config_repl.c | 3→5 lines | ~95 |
| 01:20 | Edited src/controller/ha.c | added error handling | ~256 |
| 01:21 | Edited src/include/typemap.h | added error handling | ~222 |
| 01:22 | Edited src/controller/testsuite/test_config_repl.c | 3→4 lines | ~63 |
| 01:22 | Edited src/controller/testsuite/test_config_repl.c | 3→4 lines | ~62 |
| 01:22 | Edited src/controller/testsuite/test_config_repl.c | 3→4 lines | ~67 |
| 01:23 | Edited src/controller/testsuite/test_coldstart_lsn0.c | 2→3 lines | ~48 |
| 01:32 | Edited src/controller/CLAUDE.md | added error handling | ~136 |
| 20:10 | fix bug-1067: cross-term WAL catch-up stalled — AE header term conflated with entry's stored term → ae_reject_stale on every historical entry | src/schema/controller.capnp, src/include/typemap.h, src/lib/request.c, src/controller/config_repl.c, ha.c, config_repl.h | added leader_current_term field (wire @8 + C struct); streamer stamps ha->term; receiver uses it as AE header term w/ fallback. 2 new tests GREEN (cross-term accept + stale-leader reject); 185+80+6 PASS, 0 fail | ~95k |
| 20:11 | bookkeeping for bug-1067 | .wolf/buglog.json, .wolf/cerebrum.md, src/controller/CLAUDE.md | bug-1067 FIXED; Key Learning (AE two-term distinction; capnp struct hand-defined in typemap.h); steering checklist item added | ~6k |
| 01:33 | Created ../../../../../claude/.claude/projects/-home-rshen-projects-xce-xce/memory/project_bug1067_ae_two_terms.md | — | ~743 |
| 01:34 | Session end: 19 writes across 11 files (test_term_safety_adapter.c, controller.capnp, request.c, config_repl.c, ha.c) | 13 reads | ~244235 tok |
## Session: 2026-06-24 16:35
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|
| 16:45 | xce-test-ha soak regression: 10 rounds, 36 jobs, zero loss, all 3 nodes led; bug-1060 (leader-completeness truncation fix) + bug-1067 (cross-term AE header fix) both GREEN | src/controller/ha.c, config_repl.c, request.c, typemap.h | PASS | ~50 |
## Session: 2026-06-24 02:00
| Time | Action | File(s) | Outcome | ~Tokens |
|------|--------|---------|---------|--------|