You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Several related booleans represent richer state #5
Timing: Follow-up after trial/3 merges into main; defer implementation until then.
Review baseline: Local trial/3 at a094418baf6388e3eeca23821df481a7f0a8751c. This branch is not yet on the remote. Source locations below refer to that snapshot and should be rechecked after merge.
Problem
account_keys accepts separate object, array, added, and removed booleans. Valid combinations depend on caller knowledge, while the signature permits contradictory combinations. No incorrect current call was established; this is a maintainability and invariant-expression concern.
Evidence
crates/lib/src/data/mutation.rs:190-198: call assembled from several state flags.
crates/lib/src/data/mutation.rs:231-288: branching over four booleans and container-transition state.
Acceptance criteria
Express meaningful container shape and mutation outcome through enums or another representation that makes invalid combinations difficult to construct.
Then replace the boolean bundle with meaningful inputs:
fnaccount_keys(before:ContainerBefore,membership:MembershipChange,final_length:usize,step:&Step,change:&mutChange,) -> Result<()>{// Port the existing accounting rules through an exhaustive match.// The body must be implemented from the current decision table.}
The signature is a design sketch, not complete compilable replacement code. Scalar traversal must still fail before accounting.
Deferred until trial/3 is merged into main. Recheck the merged source and tests first. The snippets are examples/proposals, not an approved patch or a change to frozen contracts.
Derive a decision table from Preparation::inspect before replacing flags: existing object/array/missing intermediate; membership added/removed/unchanged; final object/array; leaf versus ancestor; root versus nested container.
Confirm what Unchanged means: membership can be unchanged even when a payload is replaced. Preserve separate payload accounting.
Construct the enums where facts become known and pass them into account_keys. Avoid an enum-to-booleans-to-enum round trip or new validation that changes existing error precedence.
Port rules one transition at a time. In particular, dense object→array removes numeric-key bytes; array→sparse object adds retained numeric-key bytes; missing removal must not create containers.
Retain read-only planning followed by commit. Overflow/limit errors must leave both tree and cached totals unchanged.
Observable regression example:
use stackpress_lib::{Nest,Result};fnsparse_transition() -> Result<()>{letmut data = Nest::new();
data.set_path("items.0","a")?;
data.set_path("items.1","b")?;assert!(data.path("items").unwrap().as_array().is_some());
data.remove_path("items.0")?;assert!(data.path("items.0").is_none());assert_eq!(data.path_as::<String>("items.1")?,Some("b".into()));Ok(())}
Add boundary/accounting cases to existing data_contracts; run cargo test -p stackpress-lib --test data_contracts --locked. Independent capability booleans elsewhere are outside this focused refactor.
Implementation workflow: After the merge, follow .agents/workflows/rust-programming.md: prove the affected behavior, complete the three test-verified review rounds, and record relevant formatting/lints/docs, feature/platform scope, and applicable development coverage. Preserve unrelated changes.
Fixed on trial/3 in 644795f (merged as 64a5b70, task 00010 lane 1; not yet on main, so leaving open).
Mutation accounting now uses private container-shape and membership-change enums instead of four related booleans; checked-arithmetic order, atomic mutation plans and dense/sparse behavior are unchanged (existing budget-oracle tests rerun throughout).
Activity
cblanquera commentedon Oct 26, 2026
Suggested investigation and fix notes
Deferred until
trial/3is merged intomain. Recheck the merged source and tests first. The snippets are examples/proposals, not an approved patch or a change to frozen contracts.Preparation::inspectbefore replacing flags: existing object/array/missing intermediate; membership added/removed/unchanged; final object/array; leaf versus ancestor; root versus nested container.Unchangedmeans: membership can be unchanged even when a payload is replaced. Preserve separate payload accounting.account_keys. Avoid an enum-to-booleans-to-enum round trip or new validation that changes existing error precedence.Observable regression example:
Add boundary/accounting cases to existing
data_contracts; runcargo test -p stackpress-lib --test data_contracts --locked. Independent capability booleans elsewhere are outside this focused refactor.Implementation workflow: After the merge, follow
.agents/workflows/rust-programming.md: prove the affected behavior, complete the three test-verified review rounds, and record relevant formatting/lints/docs, feature/platform scope, and applicable development coverage. Preserve unrelated changes.cblanquera commentedon Oct 26, 2026
Fixed on
trial/3in 644795f (merged as 64a5b70, task 00010 lane 1; not yet onmain, so leaving open).Coordinator-verified: fmt, Clippy -D warnings, Rustdoc -D warnings,
cargo +1.96.0 check, 454 workspace tests, 856 doctests pass; lib production coverage 93.64%.Fix owner review issues #11, #1, #2, #5 and lib parts of #4, #7 (task…