Skip to content

read a root before any item when a key from $params sits next to the item's key - #957

Draft
jbpros wants to merge 15 commits into
mainfrom
b8-root-before-item
Draft

jbpros wants to merge 15 commits into
mainfrom
b8-root-before-item

Conversation

@jbpros

@jbpros jbpros commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Removes two type 1 differences from spec/OPEN.md (tally.walk, for.roots). A root read through the item's named by key is now read once, before any item, whatever key from $params comes before or after the item's key.

  • count of tests whose v equals $params.m named by key named by $params.k is 0 (no m in the params, tests []): ergo.rego now fails as absent with $params.m is missing, as the Rust engine already did. The case passes in ergo.rego, so its row leaves known_differences. The fix is in one place: _whose_reads_keyed_root no longer asks for the item's key to be the last step.
  • count of tests whose v equals $params.m named by $params.k named by key is 0, and the forms with pr.key next to $params.k: both engines now fail as absent with $params.m is missing. The fix is in one place per engine, _keyed_read_before in Rego and subject_keys_then_an_items_key / base_of in Rust. Each one now accepts a $params key that reads as text before the item's key. The case still fails in both engines, because neither lists the root and $params.k in the row's inputs. Both engines show them only in $refs. So the case's rows stay in both lists, and the OPEN.md entry is now type 2.

Changes the report: these checks over an empty list used to pass, and now fail as absent, null or unusable, naming the root. Under for: every xs, if any, as x, ergo.rego now fails count of tests whose v equals $params.m named by x named by key is 0 (and the chains with $params.k beside x) as absent with item 1 of xs: $params.m is missing when xs holds ["a"] and the params have no m, where it passed, and the Rust engine now passes count of tests whose v equals $params.m named by key named by x is 0 when xs holds [], where it failed as absent. Both engines now agree on these forms, as for.roots says.

New cases, in spec/cases/sentences/cases.json (rules for.roots, for.if_any, tally.walk): count of tests whose v equals $params.m named by x named by key is 0 and the same with named by key named by x, under for: every xs, if any, as x with no m in the params. With xs holding ["a"] the check fails as absent with item 1 of xs: $params.m is missing, and with xs holding [] it passes. The verdict, cause and message are written from the rules. The rows' inputs and failures copy the Rust engine, as spec/OPEN.md now says. Both engines pass them. The oracle has the two sentences.

cuts: Rust 27 to 27, Rego 82 to 82 (message-cuts.sh --against origin/main passes).

Run on this branch: opa check --strict (all three forms), opa fmt --list, regal lint, spec/check_rules.py, rego-layers.py, no-inline-tests.sh, the no-comments listing (prints nothing), the full opa test (2625 pass, timeout 900 s), opa eval --strict-builtin-errors (true), cargo test --workspace (2794 pass), cargo clippy -D warnings, cargo fmt --check, the oracle check (0 differ).

Wasm budgets (limit in brackets): 28.9 MB (29), 19.4 MB (20), 42.0 MB (45), for 114.4 MB (118, 114.4 on main), 52.3 MB (53).

Sweep (spec/sweep.py --limit 500): the output on this branch and on origin/main is the same apart from the Rust commit line: 296 of 477 cells differ between the engines on both, 0 type 1, 15 type 2, 281 type 3. No cell changes between main and the branch, so the sweep grid doesn't reach these shapes.

Rust report changes

1 case report changed between origin/main and the working tree.

  • sentences 629

Passing cases whose report changed: 0 (information only: a case compares the fields it lists, so a passing case can change a field it doesn't list).

Cases only on one side: 2 new, 0 removed.

Known failures

known-failures.txt had 573 lines and has 573 now.

No case started or stopped passing.

Not run: opa test --target wasm (paused in CI), the Wasm JS test run (budgets only), coverage, the Docker image checks, spec-schemas.py and check_grammar.py (need the virtual environment), docs-run.sh.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn

jbpros and others added 2 commits December 5, 2026 01:05
…m $params is read before any item

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
… comes after it

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
@jbpros jbpros added this to the 26.ac milestone Dec 5, 2026
@jbpros jbpros added bug Something isn't working core Relates to the ergo library or format themselves. labels Dec 5, 2026
jbpros and others added 5 commits December 5, 2026 01:07
…he root read before any item

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…nt of the item's key

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…tem's key has its base read before any item

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…nt of the item's key

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
… spec/OPEN.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
@jbpros jbpros added the rust label Dec 5, 2026
jbpros and others added 8 commits December 5, 2026 01:29
…he root before any item of the walked list

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
… of the item's key

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…d line alias is not read before any item

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…line alias

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…m's key, and a bound alias in front of it (guards)

Guards that pass as they are: `m` null and 3, `k` missing, null, 3
and empty in both engines, and a bound line alias in the chain in the
Rust engine.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…puts entry in spec/OPEN.md

The entry for a root read through a key from $params and then the
item's key no longer says the row's inputs are settled: no rule decides
them, and two cases expect different inputs. The entry on a one-line
every with if any names the chain forms, and the entry on roots said
again for each item drops the count form, which ergo.rego now says once.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
… key, in either order

With xs holding an item and no m in the params the check fails as absent naming item 1 of xs, and with xs empty and if any it passes, since the root is read with each item and not at all when there is none.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn
…st rows in spec/OPEN.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzW4N4nUhpU9sV5yVyXkyn

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core Relates to the ergo library or format themselves. rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant