feat(value): introduce Set storage abstraction - #60
Conversation
|
@copilot Review this PR using the review skills in the repo. Use a separate agent for each skill. |
Completed both requested reviews using separate agents per skill:
Key surviving findings:
Reports were written to:
|
|
Thanks. Quick triage: Findings 1 & 2 (unchecked accumulation in A note on the intersection/union/difference bound: the output cardinality is strictly ≤ If we want fallible variants returning Finding 3 ( No changes on this PR. Happy to file a tracking issue for "fallible accumulation across |
70882a8 to
2dd9c43
Compare
|
@copilot Review this PR using the review skills in the repo. Use a separate agent for each skill. |
Completed both requested reviews using separate agents ( Results: no new actionable regressions specific to this PR after adversarial verification. The main flagged items were either already triaged as intentional staging / non-regression or mirrored existing Full reports were written to:
|
2dd9c43 to
39fff42
Compare
…rosoft#742) `run_opa_tests` builds `path_dir_str` from `path.strip_prefix(...).to_string_lossy()`, which on Windows yields strings with backslash separators (e.g. `v0\aggregates`). The folder filter then does an exact-string comparison against the CLI arguments: let run_test = folders.is_empty() || folders.iter().any(|f| &path_dir_str == f); CLI arguments use forward slashes (`v0/aggregates`), so on Windows the comparison never matches, no tests are selected, and the function bails with `"no matching tests found"`. This blocks the `cargo xtask pre-push` hook for any Windows contributor. Normalize `path_dir_str` to use forward slashes at construction time. Reproduces before the fix as `cargo test ... --test opa -- v1/aggregates` exiting 1 with `no matching tests found`; after the fix the same command runs 72 cases and the full hook command runs 2861 / 0 across 188 folders. The duplicate platform check at the `is_rego_v0_test` site (`path_dir_str.starts_with("v0/") || path_dir.starts_with("v0\\")`) is left intact to keep the change minimal — the backslash branch becomes redundant but is harmless. Co-authored-by: Mark Birger <markbirger@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icrosoft#736) Builds on #57. Swap Value::Object's payload from Rc<BTreeMap<Value, Value>> to Rc<Object> and migrate all call sites to the Object API. as_object / as_object_mut keep their names but return &Object / &mut Object. The mutable accessor handles Rc::make_mut internally, so callers no longer do it themselves. Object grows into_value() and From<Object> for Value. Value's serializer now delegates to Object::serialize, dropping a duplicate non-string-key stringification path. RVM IterationState::Object is rewritten around ObjectCursor: O(log n) steps over a shared Rc<Object>, no eager pair snapshot. Snapshot independence is preserved by Rc copy-on-write; setup_next_iteration advances the cursor inline and advance() becomes a no-op for this variant. A new iteration_state_object_is_snapshot_independent_of_source test covers CoW against a mutated alias. Value::Set still wraps Rc<BTreeSet<Value>>; the matching Set abstraction and its swap ship in follow-up PRs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add an opaque `Set` newtype paralleling `Object`, living under `src/value/set/` with the same module structure (`mod.rs` / `iter.rs` / `serde.rs`). `Set` wraps `BTreeSet<Value>` today but exposes only a curated surface: `contains`, `insert`, `remove`, `iter`, `iter_sorted`, `cursor` (resumable), `is_subset`, `intersection`, `difference`, serde, and a hand-written `Ord`. The cursor types are re-exported behind the `rvm` feature so the follow-up `IterationState::Set` swap can land additively. To free the `Set` name for the new public type, the crate-internal `BTreeSet as Set` / `HashSet as Set` aliases in `lib.rs` are renamed to `MapSet`. All in-tree consumers of the old alias are updated in lockstep. `Value::Set` is unchanged in this commit (still wraps `Rc<BTreeSet<Value>>`); the payload swap and call-site migration ship in the next PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
39fff42 to
923da90
Compare
Adds an opaque
Setnewtype parallelingObject, living undersrc/value/set/with the same module structure assrc/value/object/(mod.rs/iter.rs/serde.rs).SetwrapsBTreeSet<Value>today but exposes only a curated surface:contains,insert,remove,iter/iter_sorted,cursor(resumable),is_subset,intersection,difference, serde, and a hand-writtenOrd. The cursor type is re-exported behind thervmfeature so the follow-upIterationState::Setswap can land additively.To free the
Setname for the new public type, the crate-internalBTreeSet as Set/HashSet as Setalias inlib.rsis renamed toMapSet. Only one in-tree consumer existed (compiled_policy::CompiledPolicy::rule_paths) and is updated in lockstep.Value::Setis unchanged in this PR (stillRc<BTreeSet<Value>>); the payload swap and call-site migration ship in the next PR.Tests live in
src/value/tests.rsalongside the Object tests.