Version / build tested against
origin/main @ e235fe5 (2026-09-29)
Deployment mode
Origin — single node (local)
Engine(s) involved
Not engine-specific / unsure
Summary
SharedState is constructed by two near-identical struct-literal tails (test path init.rs, prod path server/open.rs). Every new field must be added twice; the two already diverge in field order and shuffle staging, so a missed field is a live risk — a test-only field silently changes what the test exercises.
Steps to reproduce
diff the two constructor tails; add a field to one and observe the other drifts. (static verification at the pin.)
Expected behavior
One shared assembler used by both constructors.
Actual behavior
Duplicated struct-literal tails that have already drifted.
What actually happened? (severity facts)
Proposed severity
SEV-4 — Low: maintenance hazard, no current user-visible defect.
Reproducibility
Always — every attempt
Last known-good version / commit (if a regression)
(unknown / not a regression)
Environment & logs
Linux x86_64; Verified by static code reading at the pin above; runtime reproduction pending.
Code references:
- (see prior-art line below)
Before submitting
Additional evidence (origin/main @ e235fe55c)
- What: the 21-line
SharedState { ... } tail from audit_dml_cache to startup is duplicated in the test constructor and the production constructor.
- Where:
nodedb/src/control/state/init.rs:375-395 (new_inner); nodedb/src/control/state/init_prod/open.rs:376-396 (open).
- Evidence:
diff of the two extracted tails differs only in lsn_ms_map position (init.rs:374 vs open.rs:383) and shuffle_registry staging path (prod: catalog_path.parent(); test: std::env::temp_dir()/nodedb-shuffle-{pid}-{test_id}).
- Impact: every new
SharedState field must be added in two places; the two constructors already diverge in field order and shuffle staging, so a missed field is a live risk. A test-only field added to one path silently changes what the test exercises.
- Fix: extract a shared assembler (e.g.
SharedStateParts::assemble(...) taking the two differing values as parameters) used by both constructors.
- Prior-art: no open issue matches (searched: SharedState, init.rs duplication).
Why: every new SharedState field must be added in two places; the two constructors already diverge in field order and shuffle staging, so a missed field is a live risk (and a test-only field silently changes what the test exercises).
Steps to verify: diff the two constructor tails (.../init.rs visit vs .../server/open.rs), then extract a shared assembler and run cargo test -p nodedb.
Version / build tested against
origin/main @ e235fe5 (2026-09-29)
Deployment mode
Origin — single node (local)
Engine(s) involved
Not engine-specific / unsure
Summary
SharedStateis constructed by two near-identical struct-literal tails (test pathinit.rs, prod pathserver/open.rs). Every new field must be added twice; the two already diverge in field order and shuffle staging, so a missed field is a live risk — a test-only field silently changes what the test exercises.Steps to reproduce
diffthe two constructor tails; add a field to one and observe the other drifts. (static verification at the pin.)Expected behavior
One shared assembler used by both constructors.
Actual behavior
Duplicated struct-literal tails that have already drifted.
What actually happened? (severity facts)
Proposed severity
SEV-4 — Low: maintenance hazard, no current user-visible defect.
Reproducibility
Always — every attempt
Last known-good version / commit (if a regression)
(unknown / not a regression)
Environment & logs
Linux x86_64; Verified by static code reading at the pin above; runtime reproduction pending.
Code references:
Before submitting
mainbuild (pending) — code path verified ate235fe55c.Additional evidence (origin/main @
e235fe55c)SharedState { ... }tail fromaudit_dml_cachetostartupis duplicated in the test constructor and the production constructor.nodedb/src/control/state/init.rs:375-395(new_inner);nodedb/src/control/state/init_prod/open.rs:376-396(open).diffof the two extracted tails differs only inlsn_ms_mapposition (init.rs:374vsopen.rs:383) andshuffle_registrystaging path (prod:catalog_path.parent(); test:std::env::temp_dir()/nodedb-shuffle-{pid}-{test_id}).SharedStatefield must be added in two places; the two constructors already diverge in field order and shuffle staging, so a missed field is a live risk. A test-only field added to one path silently changes what the test exercises.SharedStateParts::assemble(...)taking the two differing values as parameters) used by both constructors.Why: every new
SharedStatefield must be added in two places; the two constructors already diverge in field order and shuffle staging, so a missed field is a live risk (and a test-only field silently changes what the test exercises).Steps to verify:
diffthe two constructor tails (.../init.rsvisit vs.../server/open.rs), then extract a shared assembler and runcargo test -p nodedb.