feat(ir): per-rule target scope via params.target_scope (closes #279) - #289
Merged
Conversation
Owner
|
@codex please review this PR |
gate-keeper dogfooding
Tokens: in=7425 out=614, latency: 8335 ms, model: gpt-5.4, prompt_version: v7 See |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5024d4c9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
S3 of umbrella #277 (incremental audit trunk). Rules may declare params.target_scope (a list of repo-relative globs); the engine computes a per-rule effective set (scope ∩ run-level candidate set) and dispatches each rule against its own TargetSpec. Engine-side only per docs/design/multi-target.md §9 — backends are untouched and a rule without a scope dispatches byte-for-byte as before. - targets.resolve_rule_scope: grammar validation, memoized repo-wide expansion (§9.6), scope ∩ candidate on repo-relative POSIX paths, discriminated outcome. - validator: per-rule scope planning in both sequential and concurrent loops; scope_effective_set evidence rides on dispatched verdicts; scope_empty (PASS), scope_invalid (UNAVAILABLE), scope_file_limit_exceeded (per-rule UNAVAILABLE). - #178 target_kind precheck stays run-level and untouched (§9.7); llm-rubric multi-file effective sets stay multi_target_unsupported until S5 (§9.10). - target_scope rides inside params (opaque passthrough dict) so the IR schema is unchanged and --rules-format ir round-trips it (§9.9). - Docs: rule-ir.md params.target_scope, cli-reference.md per-rule scope section, multi-target.md §9 status flipped to implemented. Quality gates: uv run pytest (1652 passed), uvx ruff check (clean), uv run pyright (0 errors). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wx8qUs1ipy6Nf82hu2eDhg
…format Addresses codex P2 review on #289: - Concurrent dispatch now appends scope_effective_set evidence to the ERROR diagnostic when a scoped rule's backend raises, matching the sequential path's auditability contract. Regression test covers both paths. - Apply `ruff format` to the new files (the CI `lint` job runs `ruff format --check`, which was the failing check). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wx8qUs1ipy6Nf82hu2eDhg
The #288 eval-cache and #279 per-rule scope both dispatch through the validator loop. After rebasing on #288, the cache is keyed on the rule's dispatched target (the per-rule effective set) and a cache hit still carries scope_effective_set evidence. Regression test covers both sequential and concurrent paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wx8qUs1ipy6Nf82hu2eDhg
uda-lab-agent
force-pushed
the
issue-279-target-scope
branch
from
July 4, 2026 14:41
f5024d4 to
e8f0c4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements S3 of umbrella #277 (incremental audit trunk): rules declare their own target domain via a new
params.target_scopekey, and the engine computes a per-rule effective set sovalidate rules.md --target-changedbecomes a full incremental audit without the caller enumerating which rules care about which files.Binding contract:
docs/design/multi-target.md§9 (ratified in #287).Engine-side only (CLI /
validator.py); backends are untouched and a rule without a scope dispatches byte-for-byte as before.What changed
targets.resolve_rule_scope— grammar validation (§9.1), memoized repo-wide glob expansion keyed by(pattern, repo_root)(§9.6),scope ∩ candidateon normalized repo-relative POSIX paths (§9.2), returning a discriminatedScopeResolution.validator— per-rule scope planning wired into both the sequential and bounded-concurrent dispatch loops. A non-empty effective set dispatches a per-ruleTargetSpecand appendsscope_effective_setevidence to the verdict; empty/invalid/over-cap short-circuit without a backend call.scope_effective_set(rides on the verdict),scope_empty→ PASS,scope_invalid→ UNAVAILABLE,scope_file_limit_exceeded→ per-rule UNAVAILABLE (one over-broad rule never sinks the run, §9.5).target_kindprecheck stays run-level (§9.7); anllm-rubricmulti-file effective set staysmulti_target_unsupporteduntil S5 (§9.10).target_scoperides insideparams(opaque passthrough dict), so--rules-format irround-trips it andvalidate()'s public contract is backward compatible (§9.9, AC5). A new optionalrepo_rootkeyword onvalidate()is additive; it is resolved lazily from cwd when omitted.docs/rule-ir.md(params.target_scopesection),docs/cli-reference.md(per-rule target scope + refreshed S3 forward-references),docs/design/multi-target.md§9 status flipped to implemented.Acceptance criteria (#279)
docs/**/*.md,src/**/*.py) against--target .evaluate disjoint subsets; per-rule effective set in evidence. (tests/test_cli_scope.py::test_ac1_two_scopes_disjoint_subsets)--target-changedend-to-end. (tests/test_cli_scope.py::test_ac2_scope_intersects_changed_set)scope_emptyPASS, not a run abort. (tests/test_validator_scope.py::TestScopeEmpty)DEFAULT_FILE_LIMITbreach → per-rule diagnostic; other rules unaffected. (tests/test_validator_scope.py::TestPerRuleFileLimit)validate()unchanged; IR round-tripstarget_scope. (tests/test_validator_scope.py::TestUnscopedByteIdentical,TestIrRoundTrip)Validation
uv run pytest— 1652 passed (37 new acrosstest_scope_resolution.py,test_validator_scope.py,test_cli_scope.py)uvx ruff check .— cleanuv run pyright— 0 errors, 0 warningsCloses #279
🤖 Generated with Claude Code
https://claude.ai/code/session_01Wx8qUs1ipy6Nf82hu2eDhg