Skip to content

fix(boundary): distinguish trait methods and forwarding edges - #160

Merged
randlee merged 1 commit into
fix/reference-impl-ownerfrom
fix/trait-method-identity
Sep 20, 2026
Merged

randlee merged 1 commit into
fix/reference-impl-ownerfrom
fix/trait-method-identity

Conversation

@randlee

@randlee randlee commented Sep 19, 2026

Copy link
Copy Markdown
Owner

A type can legitimately have an inherent method and multiple trait implementations with the same method name. The boundary graph previously assigned all of them <owner>::<method>, discarded subsequent nodes, and combined forwarding edges under whichever implementation appeared first. For example, sc-observability's Telemetry::emit_span and SpanEmitter::emit_span became one node, producing misleading inherent self-loop attribution.

This child of draft PR159 distinguishes trait methods by implementation identity and preserves qualified forwarding edges. Trait and self generic arguments participate in implementation keys, so distinct generic implementations do not collapse. Unqualified calls retain existing inherent targets, then resolve within the current trait or to a unique candidate; ambiguous calls remain unresolved. Resolved duplicate edges are removed.

Graph compatibility: inherent method IDs remain <owner>::<method>. Trait method IDs change to <impl-id>::<method>, and generic implementation IDs gain their arguments/self-type discriminator. Downstream graph consumers should follow metadata and containment/target edges rather than assume the old trait method ID shape. JSON fields/schema remain unchanged; the graph schema guide documents the identity correction.

Cycle policy is unchanged. This fixes method identity and attribution; it does not suppress owner-level cycles or claim that valid forwarding patterns are lint-clean.

Validation at the reviewed local checkpoint:

  • cargo test -p sc-lint-boundary: 91 passed. Regressions cover both declaration orders; inherent/typed/legacy coexistence; correct forwarding edges; generic trait/self argument separation; current-trait calls; edge deduplication; preserved type ownership; and continued cycle findings.
  • Required just lint and just test: passed. git diff --check: passed.
  • Actual unchanged sc-observability PR185 source 7246f6796a52ecb2d026d735426ae726968a1eb6: graph export now has separate inherent/trait Telemetry emit methods and separate typed/legacy projector and sink methods.
  • The consumer lint report remains fail, scanning nine crates with 43 findings: 22 SCB-MANIFEST-001, one SCB-MANIFEST-002, six SCB-CYCLE-001, one SCB-CYCLE-002, and 13 SCB-CYCLE-003. More precise trait attribution changes the count from 41; no finding was waived. Successful CLI execution is not a clean lint result.

Base: frozen PR159 commit ba2d9bf622c1604e3f017c728040906b90e71bce. Beads lint-pxe, review pending. No consumer source/config edits, publication, tags, or merges. Draft for independent J2 QA.

CI status: automatic CI does not run for this child base. The existing workflow filters PR bases to develop, main, integrate/*, integration/*, and sprint/*, excluding fix/reference-impl-owner; it has no manual-dispatch trigger. No CI configuration changes are included. Local aggregate proof above passed; hosted cross-platform CI is not claimed.

@randlee
randlee marked this pull request as ready for review September 19, 2026 17:41
@randlee
randlee added this pull request to stack #165 September 19, 2026 20:09
@randlee
randlee force-pushed the fix/trait-method-identity branch from 99b7ef7 to cda2487 Compare September 20, 2026 17:47
@randlee
randlee requested a review from rand-lee September 20, 2026 17:53
@rand-lee
rand-lee force-pushed the fix/trait-method-identity branch from cda2487 to 355ed75 Compare September 20, 2026 18:27
@randlee
randlee force-pushed the fix/trait-method-identity branch from 355ed75 to 0e6bbb2 Compare September 20, 2026 18:42
@randlee
randlee removed this pull request from stack #165 September 20, 2026 18:42
@randlee
randlee added this pull request to stack #172 September 20, 2026 18:43
@randlee
randlee force-pushed the fix/trait-method-identity branch from 0e6bbb2 to 89ee19f Compare September 20, 2026 18:48
@randlee
randlee removed this pull request from stack #172 September 20, 2026 20:19
@randlee
randlee added this pull request to stack #183 September 20, 2026 20:19
@randlee
randlee merged commit e2477c3 into develop Sep 20, 2026
12 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