Skip to content

fix(011): only direct local-inference edges skip own-graph confirmation - #444

Merged
bartekus merged 1 commit into
mainfrom
impl/011-boundaries-confirm
Nov 3, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/011-boundaries-confirm

Conversation

@bartekus

@bartekus bartekus commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #442's review finding on own_graph_of (spec 011, increment 2).

own_graph_of skipped own-graph confirmation for every length-2 ForbiddenTransitive path. It now skips it only for a direct edge from a pure crate to a local-inference package; every other direct family path (for example rustev-core to tokio) goes back to needing confirmation from the crate's own graph.

The review's dev-dependency scenario does not arise: the dependency loop filters dev edges, and the resolved graph forbidden_path walks contains no dev edges either. A test pins that a direct dev dependency on ort from rustev-contract or rustev-core produces no violation.

Tests added:

  • a_direct_dev_local_inference_dependency_of_a_pure_crate_is_allowed
  • a_resolved_direct_local_inference_edge_stands_unconfirmed
  • a_direct_path_to_another_family_still_needs_confirmation

Spec: a dated "Increment 2 follow-up" paragraph in 011's implementation record (required by spec coupling; approved spec text, so it ratifies on merge).

Checks: cargo test -p rustev-boundaries (50 passed), clippy -D warnings, fmt, make boundaries, make gate.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (no-findings)

The diff makes a targeted change to own_graph_of in the boundary checker. I'll walk through the logic carefully.

Old behavior:

  • path.len() > 2 → Some(...) (own-graph confirmation required)
  • path.len() <= 2 → falls to _ => None (stands as found, no confirmation)

New behavior:

  • path.len() == 2 && is_local_inference(path[1]) → None (direct local-inference edge stands as found)
  • Any other ForbiddenTransitive → Some((krate, "all")) (confirmation required)
  • WasmGraph and remaining variants → unchanged

The key behavioral changes:

  1. Direct edges to non-local-inference crates (e.g., tokio) now require own-graph confirmation — previously they didn't. The motivation (feature unification via optional deps, while dev edges are excluded from the resolved graph) is sound.
  2. Degenerate paths (len < 2) also now require confirmation instead of standing as found. These are likely impossible states in practice, and the change is conservative rather than permissive.

Indexing safety: path[1] is accessed only inside the guard path.len() == 2, so this is safe.

Test coverage: The three new tests cover the three distinct cases introduced: dev deps don't generate violations, direct local-inference non-dev deps produce unconfirmed violations (own_graph_of → None), and direct non-local-inference deps require confirmation (own_graph_of → Some). All assertions are consistent with the new logic.

Match arm ordering: The new first arm for ForbiddenTransitive is guarded; the second arm is a catch-all for that variant. No overlap, no unreachable arms.

No concrete defects found.

{"head": "c66cae4d6d5893a55d9ea56c6611c8c0bb37a8d7", "verdict": "no-findings", "findings": []}

Subject: a49e40f...c66cae4, diff digest 0c51a2e9a37c9a34b0a5cd3dfcf53cc4ae0e3e74734d29db01275a7080e7df8c, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/011-boundaries-confirm branch from c66cae4 to 2ffe699 Compare November 2, 2026 04:34
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the two changed files:

tools/rustev-boundaries/src/lib.rs — own_graph_of refactor

Old logic:

  • path.len() > 2 → Some((krate, "all")) (requires own-graph confirmation)
  • path.len() <= 2 → falls to _ => None (no confirmation)

New logic:

  • path.len() == 2 && is_local_inference(path[1]) → None (stands without confirmation)
  • All other ForbiddenTransitive → Some((krate.as_str(), "all")) (requires confirmation)

The behavioral change: a direct non-inference path (e.g. rustev-core → tokio, path length 2) previously required no confirmation and now requires own-graph confirmation. The spec text added in the same PR explicitly documents exactly this change: "every other direct family path (for example rustev-core to tokio) is confirmed against the crate's own graph." The code and spec are consistent.

The path[1] access is guarded by path.len() == 2, so no out-of-bounds risk.

Tests

Three new tests cover the three behavioral cases cleanly:

  1. Dev dependency → no ForbiddenTransitive violation at all (correct: dev edges are excluded from the resolved graph).
  2. Resolved direct local-inference edge → violation present, own_graph_of returns None.
  3. Direct path to tokio (len=2, non-inference) → own_graph_of returns Some(("rustev-core", "all")).

All three assertions match the new code logic.

Spec update

The added prose is confined to the ## Decisions at approval preamble area and describes exactly what the code implements. No frontmatter or ownership-unit declarations change, so derived artifact regeneration is not required.

No defects found.

{"head": "2ffe699b0695f56e5ec85484d7166412c7814276", "verdict": "no-findings", "findings": []}

Subject: a49e40f...2ffe699, diff digest 42158b0a448160d56863838667b5aa80d40329cfad64840a5af8096e12e39a25, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 2, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 2, 2026
@bartekus
bartekus force-pushed the impl/011-boundaries-confirm branch from 2ffe699 to b4112ae Compare November 2, 2026 17:12
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (no-findings)

Looking at the two changed files:

specs/011-semantic-backend/spec.md — The added prose describes three behavioral points:

  1. A direct edge from rustev-contract/rustev-core to a local-inference family member stands without own-graph confirmation.
  2. All other direct family paths (e.g. rustev-core → tokio) are confirmed against the crate's own graph.
  3. Direct dev dependencies produce no violation.

tools/rustev-boundaries/src/lib.rs — The own_graph_of function is restructured:

Old: path.len() > 2 → confirmation needed; path.len() <= 2 → falls to _ => None, no confirmation.

New:

  • path.len() == 2 && is_local_inference(path[1]) → None (no confirmation; stands as found).
  • Any other ForbiddenTransitive → Some((krate, "all")) (confirmation needed), which now includes direct deps to non-local-inference targets like tokio — a tightening vs. the old code.
  • WasmGraph and all others unchanged.

Checking the three new tests against the logic:

  1. Dev-dep test — builds metadata with Some("dev") kind, asserts no ForbiddenTransitive from check. Tests pre-existing behavior of check filtering dev edges; correct.

  2. a_resolved_direct_local_inference_edge_stands_unconfirmed — direct non-dev dep on ort from rustev-core, confirms a violation IS found and own_graph_of returns None. Matches the new first arm. Correct.

  3. a_direct_path_to_another_family_still_needs_confirmation — path ["rustev-core", "tokio"], len == 2 but tokio is not local inference, falls to second arm, returns Some. Correct; this is the newly tightened case.

The comment's claim that "feature unification cannot have introduced" a direct dep is sound for pure crates: any optional dep of a pure crate on local-inference is itself a violation regardless of which feature activates it, so confirming against the crate's own graph adds nothing.

One observation: the first arm matches ANY krate with a direct local-inference dep, not just rustev-contract/rustev-core as the spec text specifies. However, check only generates ForbiddenTransitive violations for pure crates against forbidden families, so no other crate would reach this arm in practice. The code is broader than the spec's stated restriction but harmlessly so.

No concrete defects found.

{"head": "b4112aed4a9f09acf4fc4c97225bbee50e6458d6", "verdict": "no-findings", "findings": []}

Subject: 50ca9ad...b4112ae, diff digest 2a57583191b397735d11bf6aeaabc82e131b9fb83a90c29ed5518e36934d6f9c, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 2, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 2, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 41b490d Nov 3, 2026
30 checks passed
@bartekus
bartekus deleted the impl/011-boundaries-confirm branch November 3, 2026 00:09
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