Skip to content

Add cross-language qualified reference diagnostics - #240

Merged
flyingrobots merged 133 commits into
mainfrom
feature/python-import-resolution
Aug 5, 2026
Merged

flyingrobots merged 133 commits into
mainfrom
feature/python-import-resolution

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Repairs cold-WARP review impact counts with an exact-ref fallback, adds first-party qualified reference inference for Python, TypeScript/JavaScript, Rust, and Go, and reports lexical-shadow confidence through review and import-diagnostic surfaces.

The bounded WARP indexing policy remains unchanged. Exact committed scans take precedence over stale graph evidence; unsupported dynamic and interprocedural aliases are deliberately excluded and reported as partial confidence.

Validation

Validated code head e8dd3011; final evidence head b3862c7a.

  • pnpm test — 252 files, 1,968 tests
  • focused qualified-reference acceptance suite — 15 files, 200 tests
  • pnpm lint
  • pnpm typecheck
  • pnpm build
  • structural-history schema and Echo package parity checks
  • agent-worktree and whitespace guards
  • disposable SalesOS cold-graph witness: direct qualified caller plus unchanged direct test caller, complete confidence, no WARP pre-index
  • GraphQL audit — 84 review threads, zero unresolved at the validated code head

Import diagnostics fail closed on this repository intentionally malformed tracked fixture instead of returning a false empty result; clean disposable-repository CLI/MCP/schema tests cover successful empty and non-empty payloads. Exact commands and synthetic witness SHAs are recorded in the committed verification witness.

Summary by CodeRabbit

  • New Features
    • Added import diagnostics through CLI and MCP interfaces, with optional Git reference selection.
    • Detects shadowed and qualified imports across Python, TypeScript, JavaScript, Rust, and Go.
    • Reports affected locations, warning details, and reference confidence.
    • Structural reviews now include reference warnings and partial-confidence explanations.
    • Added version 2.0.0 output schemas for review responses.
  • Bug Fixes
    • Reduced false caller results caused by shadowed bindings and improved dynamic-reference limitation reporting.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds cross-language qualified reference analysis, committed-reference scanning, import-shadow diagnostics, confidence reporting, and MCP and CLI interfaces.

Changes

Reference diagnostics

Layer / File(s) Summary
Diagnostics commands and contracts
src/cli/*, src/contracts/*, src/mcp/*, src/warp/import-diagnostic.ts, test/unit/cli/*, test/unit/contracts/*, test/unit/mcp/import-diagnostics.test.ts, tests/playback/*
Adds struct import-diagnostics and graft_import_diagnostics. Registers capabilities, burden classification, response schemas, schema versioning, and command/tool tests.
Qualified reference resolution and indexing
src/warp/python-import-resolver.ts, src/warp/qualified-reference-resolver.ts, src/warp/go-reference-context.ts, src/warp/ast-import-resolver.ts, src/warp/index-head.ts, test/unit/warp/*resolver.test.ts, test/unit/warp/qualified-reference-index.test.ts, test/unit/warp/python-import-resolver.test.ts, test/unit/warp/go-reference-context.test.ts, test/unit/warp/index-head.test.ts
Adds cross-language import binding resolution, qualified access analysis, lexical shadow detection, Go module context, Python import edges, TypeScript reference analysis, shared HEAD reads, and WARP reference edges.
Committed scanning and review propagation
src/warp/committed-reference-scan.ts, src/warp/structural-reading-adapter.ts, src/mcp/tools/structural-review.ts, src/operations/structural-review.ts, src/ports/structural-reading.ts, src/echo/*, src/cli/structural-review-render.ts, test/unit/mcp/structural-review-cold-warp.test.ts, test/unit/warp/committed-reference-scan.test.ts, test/unit/warp/structural-reading-adapter.test.ts, test/unit/cli/structural-review-render.test.ts, test/unit/echo/generated-model-parity.test.ts
Scans committed files at a Git ref, reports warnings and complete or partial confidence, combines scan and graph evidence, and renders reference warnings in structural reviews.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StructuralReview
  participant WARPGraph
  participant CommittedReferenceScan
  participant QualifiedReferenceResolver
  participant GitRef
  StructuralReview->>WARPGraph: Query reference edges
  StructuralReview->>CommittedReferenceScan: Scan qualified references at ref
  CommittedReferenceScan->>GitRef: Read committed files
  GitRef-->>CommittedReferenceScan: Return source contents
  CommittedReferenceScan->>QualifiedReferenceResolver: Analyze bindings and accesses
  QualifiedReferenceResolver-->>CommittedReferenceScan: Return references, warnings, confidence
  CommittedReferenceScan-->>StructuralReview: Return scan result
  StructuralReview-->>StructuralReview: Propagate warnings and confidence
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.30% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding cross-language qualified reference diagnostics.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/python-import-resolution

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51976aec0e

ℹ️ 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".

Comment thread src/warp/committed-reference-scan.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/committed-reference-scan.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/contracts/output-schema-mcp.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🧹 Nitpick comments (5)
src/warp/go-reference-context.ts (1)

65-72: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Derive imported package directories from the parsed import block, not a whole-file string regex.

Lines 65-72 scan the entire file source for any double-quoted substring. A struct tag, a string constant, or a comment containing the module path is treated as an import. The result is extra entries in packageDirectories, which widens the candidate set at lines 73-79 and causes extra file reads and parses.

The result is not wrong, because goBindings in src/warp/qualified-reference-resolver.ts re-derives the directory from real import_spec nodes at lines 265-274. The cost is wasted work and a fragile heuristic.

Parse importingSource once and read the import_declaration nodes, or accept the tree from the caller, which already parses the file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/warp/go-reference-context.ts` around lines 65 - 72, Replace the
whole-file importPattern scan in the relevant go-reference-context flow with
import_declaration nodes from the parsed source (or reuse the caller’s existing
syntax tree). Derive packageDirectories only from actual import specs,
preserving the modulePath matching behavior while excluding strings, struct
tags, and comments.
test/unit/warp/qualified-reference-resolver.test.ts (1)

172-196: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a Go case with a grouped var or const declaration.

Every Go fixture in this file declares exported names with func. declarationNames in src/warp/go-reference-context.ts handles func through a dedicated branch, and handles var, const, and type through a separate branch that reads only the first name field per spec.

A fixture such as package sources\nvar Alpha, Beta int would exercise that second branch and would show whether Beta resolves. The gap is the reason the multi-name defect flagged on src/warp/go-reference-context.ts lines 34-40 is not caught here.

Do you want me to write this test case?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/warp/qualified-reference-resolver.test.ts` around lines 172 - 196,
Add a Go fixture case covering a grouped declaration such as “var Alpha, Beta
int” in the existing qualified-reference resolver test, and reference both
exported names from the source so resolution of the non-first name is exercised.
Update the expected accesses to verify Beta resolves correctly, preserving the
existing checks for shadowing and duplicate declarations.
src/contracts/output-schema-mcp.ts (1)

89-95: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The import-binding diagnostic object is defined four times. The shared root cause is that no named schema exists for this shape, so each surface inlines its own copy. A new language value, a new field, or a change to shadowKind must be applied in four places, and any missed copy causes a strict-validation failure at runtime instead of a type error at build time.

  • src/contracts/output-schema-mcp.ts#L89-L95: define importBindingDiagnosticSchema once in this file, then set diagnostics: z.array(importBindingDiagnosticSchema).
  • src/contracts/output-schemas.ts#L966-L966: replace the inline object with a reference to mcpOutputBodySchemas.graft_import_diagnostics, matching how lines 1469 and 1549 already reuse it.
  • src/contracts/output-schemas.ts#L1359-L1365: replace the inline referenceWarnings element object with the shared diagnostic schema.
  • src/contracts/output-schema-mcp.ts#L484-L490: replace the inline referenceWarnings element object with the shared diagnostic schema.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/contracts/output-schema-mcp.ts` around lines 89 - 95, Define a shared
importBindingDiagnosticSchema in src/contracts/output-schema-mcp.ts at lines
89-95 and use it for graft_import_diagnostics.diagnostics; replace the inline
graft diagnostic at src/contracts/output-schemas.ts:966-966 with
mcpOutputBodySchemas.graft_import_diagnostics, and replace the inline
referenceWarnings element schemas at src/contracts/output-schemas.ts:1359-1365
and src/contracts/output-schema-mcp.ts:484-490 with the shared diagnostic
schema.
src/warp/qualified-reference-resolver.ts (1)

336-480: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Split collectShadowRegions into per-language strategies.

The function spans 145 lines. A single walk callback carries the rules for five languages, and the per-language node-type lists are rebuilt on every visited node. Lines 398-405, 409-413, 418-422, and 461-465 each allocate a fresh Set or array for every node in the tree. For a large file that is one allocation set per AST node.

The structure also hides the behavioral differences. The Python branch returns early at line 395, so the shared parameter and local rules below never apply to Python, which is correct but not obvious from the layout.

Extract one shadow-rule module per language behind a small interface, and hoist the node-type sets to module constants. That removes the per-node allocations and makes each language's rules reviewable on its own.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/warp/qualified-reference-resolver.ts` around lines 336 - 480, Refactor
collectShadowRegions into separate per-language strategy helpers/modules behind
a small shared interface, while preserving all existing shadow-region behavior.
Move Python, Rust, Go, and TypeScript/JavaScript rules out of the single walk
callback, hoist every language-specific node-type Set/array (including
functionTypes, blockTypes, parameterTypes, localTypes, and ancestor-type sets)
to reusable module-level constants, and have collectShadowRegions select the
appropriate strategy without allocating these collections per AST node.
src/warp/python-import-resolver.ts (1)

5-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a single AST anchor helper across the resolvers.

astNodeId/emitAstAnchor are duplicated in src/warp/python-import-resolver.ts, src/warp/ast-import-resolver.ts, and src/warp/qualified-reference-resolver.ts. Move them to the existing src/warp/ast-emitter.ts or a focused shared module, and import the helper from all three resolvers. Also use a non-cryptographic hash implementation instead of createHash("sha1") for this ID namespace if the static-analysis CWE-327/328 finding should be addressed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/warp/python-import-resolver.ts` around lines 5 - 34, Centralize astNodeId
and emitAstAnchor in the existing ast-emitter module or a focused shared module,
then remove the duplicate implementations from python-import-resolver.ts,
ast-import-resolver.ts, and qualified-reference-resolver.ts and import the
shared helpers. Replace the SHA-1 createHash usage with a non-cryptographic hash
suitable for generating these IDs, preserving the existing ID format and anchor
properties.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/mcp/tools/structural-review.ts`:
- Around line 9-24: Update countReviewReferences so scanQualifiedReferencesAtRef
is not invoked when graph.referenceCount already provides a positive result,
unless scan warnings or confidence are explicitly required; alternatively,
create and reuse one ref-analysis context across all countReferences calls
within detectBreakingChanges. Preserve the existing graph and scan result fields
while eliminating repeated full-repository scans per symbol.
- Around line 9-24: Update countReviewReferences to wrap the
scanQualifiedReferencesAtRef call in try/catch; if the committed-reference scan
fails, return the usable graph result instead of propagating the exception and
failing the structural review. Preserve the existing scan warnings, confidence,
and scan result behavior when the call succeeds.

In `@src/warp/committed-reference-scan.ts`:
- Around line 138-197: Update scanQualifiedReferencesAtRef and its supporting
analysis so direct imported identifier uses in Python, Rust, and Go are
detected, not only qualified accesses. Resolve direct calls such as imported
function or symbol references against opts.filePath and opts.symbolName, add
their files to referencingFiles, and ensure unresolved direct-import evidence
cannot produce a complete zero-reference result; classify it as partial or
resolve it fully.

In `@src/warp/go-reference-context.ts`:
- Around line 83-102: Cache the result of buildGoReferenceContext in
indexHeadFile and reuse that single context throughout the indexing pass,
including commitDiagnosticsAtRef, scanQualifiedReferencesAtRef, and
importDiagnosticsAtRef. Ensure the context is built once per manifest/indexing
operation rather than re-reading and re-parsing the same first-party Go files
for each head.
- Around line 34-40: Update the declaration-name collection loop in the
reference-context builder to retrieve every name child from each spec, adding
all returned names to names before applying the existing exported-name filter;
do not rely on childForFieldName("name"), which only captures the first name in
grouped declarations.

In `@src/warp/index-head.ts`:
- Around line 173-181: Route the initial HEAD content fetch in the file-indexing
flow through readHeadFile instead of a direct git.run call, preserving the
resulting content in the headContent cache for buildGoReferenceContext to reuse.
Update prepareFileSemanticEnrichment and estimatePatchPayloadBytes to use the
returned content value rather than contentResult.stdout, while leaving the
existing Go reference-context behavior unchanged.

In `@src/warp/qualified-reference-resolver.ts`:
- Around line 423-437: Update the loop detection in the local-binding handling
around nearestAncestor so it only identifies a loop when the declaration node
belongs to that loop’s initializer or range clause, not merely its body or
another nested location. Keep body-local declarations using their enclosing
block scope and local_binding classification, while preserving loop_binding and
loop scope behavior for genuine loop-header declarations.
- Around line 344-348: The targetByBinding construction in the
qualified-reference resolution flow assigns an arbitrary Go declaration file to
diagnostics. For Go bindings, use the package directory as the diagnostic
target, or rebuild the published diagnostics from the per-access targets
resolved in the accesses flow around the existing per-member override. Ensure
the diagnostics returned by the resolver no longer retain the first
declaration-map file while preserving accurate targets for non-Go bindings.
- Around line 116-121: Update the candidates array in resolveRelativeModule to
include extensionless `.mts` and `.cts` file candidates, plus `.jsx`, `.mts`,
and `.cts` index candidates alongside the existing extensions. Preserve the
current raw and compiledSpecifierSourceCandidates entries and candidate
ordering.

In `@test/unit/warp/python-import-resolver.test.ts`:
- Around line 150-160: Replace the JSON.stringify assertion in the “preserves
the TypeScript resolver edge vocabulary byte-for-byte” test with structural
toEqual assertions for result.edges and result.metadata, following the patterns
used by other tests in the file. Preserve validation of the expected edge and
metadata contents while avoiding dependence on serialization order or hardcoded
AST anchor hashes.

In
`@tests/playback/0078-three-surface-capability-baseline-and-parity-matrix.test.ts`:
- Around line 50-54: Replace the exact markdown bullet assertions in the
capability matrix test with a formatting-independent check that parses the
published numeric counts from docs/three-surface-capability-matrix.md and
compares them with counts derived from CAPABILITY_REGISTRY. Ensure the
registry-derived keys include the CLI-only category by validating the
corresponding surfaceCount("api+cli") value, while preserving checks for the
other documented capability categories.

---

Nitpick comments:
In `@src/contracts/output-schema-mcp.ts`:
- Around line 89-95: Define a shared importBindingDiagnosticSchema in
src/contracts/output-schema-mcp.ts at lines 89-95 and use it for
graft_import_diagnostics.diagnostics; replace the inline graft diagnostic at
src/contracts/output-schemas.ts:966-966 with
mcpOutputBodySchemas.graft_import_diagnostics, and replace the inline
referenceWarnings element schemas at src/contracts/output-schemas.ts:1359-1365
and src/contracts/output-schema-mcp.ts:484-490 with the shared diagnostic
schema.

In `@src/warp/go-reference-context.ts`:
- Around line 65-72: Replace the whole-file importPattern scan in the relevant
go-reference-context flow with import_declaration nodes from the parsed source
(or reuse the caller’s existing syntax tree). Derive packageDirectories only
from actual import specs, preserving the modulePath matching behavior while
excluding strings, struct tags, and comments.

In `@src/warp/python-import-resolver.ts`:
- Around line 5-34: Centralize astNodeId and emitAstAnchor in the existing
ast-emitter module or a focused shared module, then remove the duplicate
implementations from python-import-resolver.ts, ast-import-resolver.ts, and
qualified-reference-resolver.ts and import the shared helpers. Replace the SHA-1
createHash usage with a non-cryptographic hash suitable for generating these
IDs, preserving the existing ID format and anchor properties.

In `@src/warp/qualified-reference-resolver.ts`:
- Around line 336-480: Refactor collectShadowRegions into separate per-language
strategy helpers/modules behind a small shared interface, while preserving all
existing shadow-region behavior. Move Python, Rust, Go, and
TypeScript/JavaScript rules out of the single walk callback, hoist every
language-specific node-type Set/array (including functionTypes, blockTypes,
parameterTypes, localTypes, and ancestor-type sets) to reusable module-level
constants, and have collectShadowRegions select the appropriate strategy without
allocating these collections per AST node.

In `@test/unit/warp/qualified-reference-resolver.test.ts`:
- Around line 172-196: Add a Go fixture case covering a grouped declaration such
as “var Alpha, Beta int” in the existing qualified-reference resolver test, and
reference both exported names from the source so resolution of the non-first
name is exercised. Update the expected accesses to verify Beta resolves
correctly, preserving the existing checks for shadowing and duplicate
declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8bd49da2-c8f0-47ec-8f95-4f06b66061e2

📥 Commits

Reviewing files that changed from the base of the PR and between c3885da and 51976ae.

⛔ Files ignored due to path filters (9)
  • CHANGELOG.md is excluded by !**/*.md
  • docs/CLI.md is excluded by !**/*.md
  • docs/MCP.md is excluded by !**/*.md
  • docs/design/CORE_continuum-structural-reading-port.md is excluded by !**/*.md
  • docs/design/WARP_cross-language-qualified-reference-resolution.md is excluded by !**/*.md
  • docs/method/backlog/bad-code/committed-reference-scan-repeats-repository-analysis.md is excluded by !**/*.md
  • docs/method/retro/WARP_cross-language-qualified-reference-resolution/WARP_cross-language-qualified-reference-resolution.md is excluded by !**/*.md
  • docs/method/retro/WARP_cross-language-qualified-reference-resolution/witness/verification.md is excluded by !**/*.md
  • docs/three-surface-capability-matrix.md is excluded by !**/*.md
📒 Files selected for processing (35)
  • src/cli/cli-error.ts
  • src/cli/command-parser.ts
  • src/cli/structural-review-render.ts
  • src/contracts/capabilities.ts
  • src/contracts/output-schema-cli.ts
  • src/contracts/output-schema-mcp.ts
  • src/contracts/output-schemas.ts
  • src/echo/structural-reading-generated-model.ts
  • src/mcp/burden.ts
  • src/mcp/tool-registry.ts
  • src/mcp/tools/import-diagnostics.ts
  • src/mcp/tools/structural-review.ts
  • src/operations/import-reference-impact.ts
  • src/operations/structural-review.ts
  • src/ports/structural-reading.ts
  • src/warp/committed-reference-scan.ts
  • src/warp/go-reference-context.ts
  • src/warp/import-diagnostic.ts
  • src/warp/index-head.ts
  • src/warp/python-import-resolver.ts
  • src/warp/qualified-reference-resolver.ts
  • src/warp/structural-reading-adapter.ts
  • test/unit/cli/command-parser.test.ts
  • test/unit/cli/structural-review-render.test.ts
  • test/unit/contracts/capabilities.test.ts
  • test/unit/contracts/output-schemas.test.ts
  • test/unit/echo/generated-model-parity.test.ts
  • test/unit/mcp/import-diagnostics.test.ts
  • test/unit/mcp/structural-review-cold-warp.test.ts
  • test/unit/warp/committed-reference-scan.test.ts
  • test/unit/warp/python-import-resolver.test.ts
  • test/unit/warp/qualified-reference-index.test.ts
  • test/unit/warp/qualified-reference-resolver.test.ts
  • test/unit/warp/structural-reading-adapter.test.ts
  • tests/playback/0078-three-surface-capability-baseline-and-parity-matrix.test.ts
💤 Files with no reviewable changes (1)
  • src/operations/import-reference-impact.ts

Comment thread src/mcp/tools/structural-review.ts Outdated
Comment thread src/warp/committed-reference-scan.ts Outdated
Comment thread src/warp/go-reference-context.ts
Comment thread src/warp/go-reference-context.ts Outdated
Comment thread src/warp/index-head.ts
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread test/unit/warp/python-import-resolver.test.ts
Comment thread tests/playback/0078-three-surface-capability-baseline-and-parity-matrix.test.ts Outdated

Copy link
Copy Markdown
Owner Author

Code Lawyer self-audit findings

The branch audit found the following issues in addition to the existing review threads. These are now part of the same P0-P5 repair queue.

ID File / lines Infraction Severity Evidence Recommended mitigation
SELF-01 src/warp/committed-reference-scan.ts:32-79,138-219 Determinism / ref race P1 ls-tree and every later show re-read the caller-supplied symbolic ref. If HEAD or a branch moves during the scan, one result can mix tree and blob data from different commits. Resolve the requested ref to one commit OID before listing or reading and retain the requested ref only as response evidence.
SELF-02 src/warp/qualified-reference-resolver.ts:509-523; src/warp/committed-reference-scan.ts:141-203 False complete confidence P1 Unresolved bindings are filtered out entirely, and that absence never affects confidence. A deleted declaring file can therefore have syntactic callers at the reviewed head while the fallback reports a confident zero. Admit the queried historical target as a scan-only first-party candidate where path resolution is exact; otherwise propagate a target-specific unresolved limitation as partial confidence.
SELF-03 src/warp/qualified-reference-resolver.ts:300-307,360-470 Incorrect lexical binding analysis P1 The recursive matcher searches expressions as if they were binding patterns and returns only one name. A Python default such as def f(x=source.value): ... falsely shadows source in the body, while TS destructuring such as const {api, svc} = local misses both namespace shadows. Replace expression-wide recursion with language-specific binding-pattern extraction that returns every imported binding and never traverses initializer/default/type expressions.
SELF-04 src/warp/qualified-reference-resolver.ts:358-395 Missing Python shadow scopes P1 Python match pattern bindings and with ... as ... bindings are not modeled, so affected qualified accesses still become confident symbol references despite the design's pattern/local-binding criterion. Add AST-scoped pattern and context-manager binding regions with focused sibling/outer-scope regressions.
SELF-05 src/warp/qualified-reference-resolver.ts:236-258,461-470 Missing Rust shadow scopes P1 Only root use declarations are collected and block item shadows omit const, static, and nested use bindings. Those items can shadow an imported module for the block while the resolver emits a symbol edge. Model nested Rust item bindings with Rust item scope semantics and cover const/static/local-use cases.
SELF-06 src/warp/python-import-resolver.ts:55-56,95-106 Non-goal violation P2 A Python wildcard import emits a references edge to the module file even though the design explicitly says wildcard imports are ignored. Skip wildcard import reference emission and assert that it creates neither file nor symbol evidence.
SELF-07 src/warp/committed-reference-scan.ts:123-135 False partial confidence P2 Unsupported-dynamic detection is raw whole-source substring matching, so comments and string literals mentioning importlib, a target, and a symbol downgrade an otherwise complete result. Detect supported dynamic constructs from syntax nodes, or exclude comments/string-only mentions before changing confidence.
SELF-08 src/mcp/tools/import-diagnostics.ts:11-13 Observability gap P3 The repository-wide diagnostic tool returns paths but never records them in the MCP footprint, unlike peer structural/diagnostic surfaces. Record unique diagnostic file paths and affected bindings before responding.

Cc: @codex — please provide a second opinion on these additional findings, especially SELF-01 through SELF-05.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51976aec0e

ℹ️ 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".

Comment thread src/warp/committed-reference-scan.ts
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/mcp/tools/structural-review.ts Outdated
Comment thread src/warp/go-reference-context.ts
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts Outdated
@flyingrobots

flyingrobots commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Activity Summary — exact-head closure

Issue Severity File Commit SHA Outcome
Preserve Python dotted dynamic-import segments P2 src/warp/committed-reference-scan.ts d1bfa91d Python module segments such as pkg.go no longer lose their final component.
Preserve unresolved Rust inline paths P2 src/warp/qualified-reference-resolver.ts 5b4127b5 Inline-module qualifiers now yield partial confidence without inventing caller edges.
Enforce the full adapter contract in tests P5 test/unit/warp/qualified-reference-language-adapters.test.ts a1ed5539 isUnsupportedWrite is covered by the adapter contract fixture.
Narrow shadow-scope ancestor lookups P5 src/warp/qualified-reference-shadows.ts 1fa58364 TypeScript and Go avoid unused per-node ancestor walks.
Make the adapter registry exhaustive P3 src/warp/qualified-reference-language-adapters.ts 2f87c062 Missing language adapters are compile-time failures.
Pin incomplete diagnostics evidence P3 src/warp/committed-reference-scan.ts 1565d0ff Errors identify the exact analyzed commit.
Share Python import traversal P3 src/warp/qualified-reference-bindings.ts d6f1675f Binding and direct-reference analysis share one import-clause decoder.
Retain exact-scan failure evidence P3 src/warp/structural-reading-adapter.ts e9c0c427 WARP fallback evidence carries the committed-scan failure reason.
Assert structured review confidence P5 test/unit/operations/structural-review.test.ts 2b9fd230 The regression anchors confidence and warnings to structured result fields.
Deduplicate unresolved Go accesses P5 src/warp/qualified-reference-resolver.ts d0ac4f38 Repeated selectors no longer multiply identical uncertainty records.
Resolve Python loop iterables before assignment P2 src/warp/qualified-reference-shadows.ts 7e638412 Module/class/global iterables resolve before assignment while function locals remain lexical.
Remove duplicate registry authority P3 src/warp/qualified-reference-language-adapters.ts e8dd3011 The public language list is derived from the exhaustive registry.
Refresh verification witness Docs docs/method/retro/WARP_cross-language-qualified-reference-resolution/witness/verification.md b3862c7a Exact heads, 84/84 thread closure, and final validation totals are recorded.

Validation at code head e8dd3011: 15 focused files / 200 tests; 252 Docker-isolated files / 1,968 tests; lint, typecheck, build, structural-history parity, agent-worktree hygiene, and whitespace checks all green. All 84 inline review threads are resolved.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@coderabbitai review please

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

@flyingrobots I will review the current pull request head and the final remediation changes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@coderabbitai review please

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

@flyingrobots I will review the current pull request head and the final remediation changes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@codex review please

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3862c7a0c

ℹ️ 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".

Comment thread src/warp/qualified-reference-bindings.ts
Comment thread src/warp/qualified-reference-bindings.ts
Comment thread src/warp/qualified-reference-bindings.ts Outdated
Comment thread src/warp/qualified-reference-resolver.ts
Comment thread src/warp/qualified-reference-language-adapters.ts Outdated
@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer exact-head audit addition

ID File / lines Infraction Severity Evidence Required repair
SELF-26 src/warp/qualified-reference-resolver.ts:256-258 Duplicate registry authority P3 isQualifiedReferenceLanguage independently hardcodes the same six languages already owned by the exhaustive adapter registry. Adding a future adapter can compile while the predicate still rejects that language, silently skipping both committed-scan and indexing analysis. Derive the predicate from registeredQualifiedReferenceLanguages (or an adapter-owned membership function) and add a regression proving the predicate accepts every registered adapter language.

Cc: @codex — please confirm the adapter registry should be the sole runtime language-membership authority.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer exact-head audit addition

ID File / lines Infraction Severity Evidence Required repair
SELF-27 src/warp/qualified-reference-bindings.ts:38-62,185-217 Cross-language resolution ambiguity P2 resolveRelativeModule does not receive the caller language and always probes .ts/.tsx before .js/.jsx. For an extensionless JavaScript namespace import in a mixed-source tree, the resolver can attribute api.member to api.ts even when api.js is the JavaScript module. Make candidate ordering language-aware, preserve explicit-specifier behavior and compiled .js-to-TypeScript mapping, and add a mixed .ts/.js regression proving JavaScript and TypeScript callers resolve to their own language targets.

Cc: @codex — please verify the intended source-kind precedence for extensionless JavaScript imports.

@flyingrobots

Copy link
Copy Markdown
Owner Author

Activity Summary — Code Lawyer exact-head closure

Issue Severity File Commit SHA Outcome
Preserve crate-root inline Rust uncertainty P1 src/warp/qualified-reference-bindings.ts fe40b98b lib.rs, main.rs, ambiguous dual-root, and workspace-crate owners now receive partial unresolved evidence; both duplicate threads resolved.
Resolve TypeScript import-equals aliases P1 src/warp/qualified-reference-bindings.ts 5d289827 import api = require("./api") participates in qualified first-party resolution.
Resolve direct Rust qualified paths P1 src/warp/qualified-reference-resolver.ts bf538f76 Direct crate::, self::, and super:: value/type callers resolve without a local use binding.
Exclude namespace-member mutations P2 src/warp/qualified-reference-language-adapters.ts 3da6989e TS/TSX/JS assignments, augmented assignments, updates, and deletes no longer inflate caller counts.
Respect JavaScript module precedence P2 src/warp/qualified-reference-bindings.ts 1b6cbc8b Extensionless JS callers prefer JS source in mixed trees while compiled TypeScript specifiers remain supported.
Centralize qualified-language membership P3 src/warp/qualified-reference-resolver.ts 3ced7293 Runtime membership now derives from the exhaustive adapter registry; mutation-style contract proof prevents drift.
Record exact-head verification witness Docs docs/method/retro/WARP_cross-language-qualified-reference-resolution/witness/verification.md d022feb2 Current commits, 89/89 thread closure, and final validation totals are recorded.

Validation at code head 3ced7293: 15 focused files / 206 tests; 252 Docker-isolated files / 1,974 tests; lint, typecheck, build, Wesley 0.1.0 structural-history/schema parity, agent-worktree hygiene, and whitespace checks all green. Full GraphQL audit: 89 threads, 0 unresolved.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf538f765b

ℹ️ 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".

Comment thread src/warp/qualified-reference-bindings.ts Outdated
Comment thread src/warp/qualified-reference-bindings.ts Outdated
Comment thread src/warp/qualified-reference-bindings.ts Outdated
@flyingrobots

flyingrobots commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

Code Lawyer Activity Summary — final closure

Final published head: e43300ea074353e1190c815ef582bdc69dee26ce

# Source Severity File / surface Issue Commit Outcome
1 PR P1 qualified-reference-bindings.ts Crate-root inline Rust uncertainty named only one possible owner fe40b98b Fixed; both duplicate threads resolved
2 PR P1 qualified-reference-bindings.ts TypeScript import-equals aliases were omitted 5d289827 Fixed; thread resolved
3 PR P1 qualified-reference-resolver.ts Direct Rust crate / self / super paths were omitted bf538f76 Fixed; thread resolved
4 PR P2 TypeScript / TSX / JavaScript adapters Namespace-member mutations were counted as callers 3da6989e Fixed; thread resolved
5 Self P2 qualified-reference-bindings.ts Extensionless JavaScript imports used TypeScript-first precedence 1b6cbc8b Fixed
6 Self P3 Qualified-language registry Runtime membership duplicated the adapter registry 3ced7293 Fixed
7 PR P2 qualified-reference-bindings.ts Late extensionless-JavaScript report duplicated issue 5 1b6cbc8b Proven fixed at current head; thread resolved without duplicate code
8 PR P2 Committed Python reference scan First-party wildcard imports produced false complete confidence 5bbbda28 Fixed; thread resolved
9 PR P2 TypeScript / JavaScript module resolution Leading-slash imports resolved relative to the caller 32a8a084 Fixed; thread resolved

Verification witness: e43300ea.

  • Focused acceptance: 15 files, 208 tests passed.
  • Isolated repository suite: 252 files, 1,976 tests passed.
  • pnpm lint, pnpm typecheck, pnpm build, schema artifact parity with Wesley 0.1.0, agent-worktree hygiene, and git diff --check: passed.
  • Full GraphQL thread audit at the final code head: 92 total, 0 unresolved.

@codex Please confirm the final head has no remaining actionable issue.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@flyingrobots
flyingrobots merged commit 55df56b into main Aug 5, 2026
3 checks passed
@flyingrobots
flyingrobots deleted the feature/python-import-resolution branch August 5, 2026 04:01
@flyingrobots
flyingrobots restored the feature/python-import-resolution branch August 5, 2026 04:02
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