Commit a8e2cf5
committed
fix(kv/fsm): kvFSM directly satisfies raftengine.AppliedIndexReader (codex P2)
Codex round-4 P2 on kv/fsm.go:145 caught a real wiring bug: the
round-1 method was named AppliedIndexReader() returning the interface
(factory pattern), intended to be called through a separate
AppliedIndexReporter interface. But that AppliedIndexReporter was
never added to the raftengine package, and the planned Branch 3
cold-start skip gate type-asserts fsm.(raftengine.AppliedIndexReader)
directly. A factory method with a different signature does NOT
satisfy the interface, so the skip would always fall back to full
restore even after meta keys are populated on every apply.
Fix: rename kvFSM.AppliedIndexReader() to LastAppliedIndex() and
inline the type-assert forward. kvFSM now directly satisfies
raftengine.AppliedIndexReader.
Added kv/fsm_applied_index_iface_check.go with compile-time guards:
var _ raftengine.AppliedIndexReader = (*kvFSM)(nil)
var _ raftengine.AppliedIndexWriter = (*kvFSM)(nil)
so a future rename or signature drift fails at build time rather
than silently degrading the skip optimisation to full-restore-always.
No production callers of the old AppliedIndexReader() factory exist
(verified by grep) — the consumer is the future Branch 3 skip gate
which is not yet wired. Safe rename.
Tests: go vet + golangci-lint clean across all touched packages;
go test ./kv/ ./store/ ./internal/raftengine/... -short ok 56s.
Refs PR #915 round-4 codex P2 (kv/fsm.go:145). Codex P2 on
engine.go:4077 (snapshot artifact does not contain post-bump
metaAppliedIndex) is acknowledged but out of B2 scope — push-back
explanation in the PR comment.1 parent 5684857 commit a8e2cf5
2 files changed
Lines changed: 38 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
143 | 156 | | |
144 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
145 | 162 | | |
146 | 163 | | |
147 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments