Skip to content

Review rule conflicts that only appear at generated dimension values - #48

Merged
EonHao merged 2 commits into
mainfrom
fix/review-generated-witnesses
Nov 1, 2026
Merged

EonHao merged 2 commits into
mainfrom
fix/review-generated-witnesses

Conversation

@EonHao

@EonHao EonHao commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #36. Builds on #47 (merged).

Behavior

The bug. For allow/deny rule pairs, the review gate searched for overlap witnesses only in each seed scenario's state, never in the dimension values a build samples. Example:

  • manager-approves: allow approve when role == manager, priority 5.
  • cap-large: deny approve when amount > 1000.
  • The seed amount is 200, and a dimension sweeps the amount over [200, 5000].

The generated amount = 5000 episode was labeled approve with both rules matching, and no reviewer was ever asked.

The fix.

  • Exact witnesses. family_variants is extracted from generate_family, so the gate searches exactly the situations the build samples. Generation and review cannot drift apart.
  • A conservative disjointness proof. policy.conditions_disjoint proves that two conditions can never hold together, using the interpreter's own predicate semantics: mismatched eq/in, non-overlapping numeric bounds, exists: false against any predicate that needs a value, ordering against contains, and any_of branches that are all ruled out.
  • The new queueing rule. An allow/deny pair enters review unless it is provably disjoint:
Overlap Meaning Item content
observed A generated situation has a candidate both rules govern witness_count plus up to five witnesses (scenario, candidate, dimension values)
possible No generated situation exercises the pair, but synthesis could Empty witness list
(none) Conditions are provably disjoint No item

The override and conflict kinds and the shadowed-rule check are unchanged. docs/organization-compiler.md explains the three cases.

No false-positive flood. The fictional example and both archived experiment projects produce exactly the same review queue as before.

Validation

New tests/test_review_conflicts.py (8 tests):

  • the reported scenario becomes an override item with the amount = 5000 witness, and blocks the build until reviewed;
  • an unexercised but overlapping pair is queued as possible;
  • provably disjoint rules add nothing;
  • witness lists are capped at five but fully counted;
  • after acceptance, the higher-priority allow governs as reviewed;
  • soundness properties: across every pair of 28 predicate shapes (784 combinations) and every any_of combination (10,584), conditions_disjoint never claims "disjoint" for conditions that a concrete value satisfies together.

Checks:

  • pytest: 295 passed, 4 skipped.
  • ruff, strict mypy, mkdocs build --strict, and pre-commit pass.

Compatibility and data

  • Existing conflict reviews must be recorded again. Conflict items now carry overlap, witness_count, and witnesses instead of seed_witnesses, so their fingerprints change.
  • New items can appear in projects with overlapping allow/deny pairs that were previously missed. That is the point of the fix.

🤖 Generated with Claude Code

Fixes #36. Witnesses for allow/deny pairs were searched only in each
seed scenario's state, so an override that appeared only at a sampled
dimension value (for example a manager allow outranking an amount cap)
was labeled without ever reaching review.

- Extract `family_variants` from `generate_family`, so the review gate
  searches exactly the situations a build samples.
- Add `conditions_disjoint` to the policy module: a conservative proof
  that two conditions can never hold together, derived from the
  interpreter's own predicate semantics.
- Queue an allow/deny pair unless its conditions are provably disjoint.
  Items report `overlap` ("observed" or "possible"), `witness_count`, and
  up to five witnesses with their dimension values.

The example and archived experiment projects produce the same review
queue as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added area/compiler Ingestion, extraction, evidence binding, review gates area/policy Rule semantics, priority, conflict analysis area/generation Scenarios, quotas, synthesis, deduplication area/docs Site, README, and reference material labels Nov 1, 2026
@EonHao
EonHao changed the base branch from fix/stable-family-splits to main November 1, 2026 19:00
@EonHao
EonHao merged commit 15fddcb into main Nov 1, 2026
15 checks passed
@EonHao
EonHao deleted the fix/review-generated-witnesses branch November 22, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compiler Ingestion, extraction, evidence binding, review gates area/docs Site, README, and reference material area/generation Scenarios, quotas, synthesis, deduplication area/policy Rule semantics, priority, conflict analysis

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review gate misses allow/deny overrides that only occur at dimension values

1 participant