Skip to content

feat(capabilities): compound capability predicates (66b) - #289

Merged
discreteds merged 5 commits into
developfrom
feature/compound-capability-predicates
Aug 15, 2026
Merged

feat(capabilities): compound capability predicates (66b)#289
discreteds merged 5 commits into
developfrom
feature/compound-capability-predicates

Conversation

@discreteds

Copy link
Copy Markdown
Member

Backlog item 66b — compound capability predicates. Adds a structured, enumerable predicate over the bound operation call to CapabilityFact, evaluated by a new collecting API violations_for(bound_call) -> frozenset[CapabilityFact], alongside an unchanged capability_for.

What

  • Predicate model (schema.py): ClauseOp (EQ/IN/IS_SET/IS_NULL/IS_LITERAL/MATCHES_CLASS), Clause, Predicate (canonical-ordered, order-insensitive eq/hash), and CapabilityFact.predicate with registration validation (BUILD-only, value-agnostic, GATE-only, UNSUPPORTED/EXPR_CAPABLE only, param-is-a-clause-root).
  • Predicate engine (predicates.py): BoundCall, bind_expression_call, path resolution (declared-field/enum/mapping traversal, loud ValueError on missing, root LiteralNode unwrap), clause evaluation (§4.4 dynamic-arg semantics), and a sound subsumption/overlap lattice.
  • Registry (registry.py): a separate _predicate_facts store (predicate facts carry option_value=None/value_class=None and must not collide with value-agnostic facts), violations_for, a registration-time conflict check (block-vs-permit, dialect-scope-compatible, strict-subsumption resolves), and snapshot/restore/reset coverage.
  • Gate integration: both unified visitors call violations_for once per call, in addition to the existing per-param loops.
  • Consumer audit: fact_sort_key totals over predicate facts; the argument-probe filter excludes them.

Design decisions (spec rev 3, post adversarial review)

  • IS_SET is pure §4.2 value semantics (the §5 "reads supplied" conjunction made the subsumption lattice unsound); BoundCall.supplied is still recorded.
  • violations_for collects only UNSUPPORTED GATE predicate facts; EXPR_CAPABLE participates in the conflict check only.
  • §6 cross-product compound-cell enumeration deferred per §7 (no consumer yet) — flagged, not hidden; an invariant test documents zero production predicate facts.

Verification

  • Full suite: 22348 passed, 0 failed (81 skipped, 3708 xfailed).
  • ruff:check clean.
  • mypy: 97 pre-existing import-untyped errors, none in changed files.

Spec: 2026-07-28-compound-capability-predicates-design.md; plan: 2026-08-15-compound-capability-predicates.md.

@discreteds
discreteds merged commit d2553a0 into develop Aug 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant