Skip to content

typed-cache: fold reference-derived import term into content key (#6939 re-derive) - #7062

Merged
briansrls merged 2 commits into
mainfrom
session/nimble-moth-292-6939
Jul 22, 2026
Merged

briansrls merged 2 commits into
mainfrom
session/nimble-moth-292-6939

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Fresh re-derive of orphaned PR #6939 on main (not a cherry-pick from session/neat-hawk-85).

Summary

Stripped modules (no import line) resolve providers through the corpus-wide bare-name census, but typed_module_content_key only folded resolved.resolved_imports — empty for such modules. A provider export-surface change therefore left the dependent's content key unchanged and could serve a stale typed result (cache impurity, DESIGN §5).

This PR:

  1. Adds path_to_module + reference_only_direct_import_modules on ModuleGraphFactsLive (from existing selection_adjacency − adjacency strict-tier authority)
  2. Folds the reference-derived import term into typed_module_content_key, gated on closure membership
  3. Schedules reference-only deps before stripped dependents in module_schedule_batches / try_reconcile_all_cache_hits

Out of scope: std.access/std.effects scheduling-cycle residue.

Closes #6939

Test plan

  • CTRL_BUILD_BYPASS_SHIMS=1 cargo test -p v1-compiler --lib typed_module_content_key_tests — 4/4 pass, including new RED control reference_derived_interface_term_recomputes_stripped_dependent

… re-derive)

Stripped modules resolve providers via bare-name census, not declared imports;
keying only on resolved_imports let a provider export-surface change serve stale
typed results. Derive reference-only deps from selection_adjacency − adjacency,
gate on closure membership, schedule them before dependents, and witness with
reference_derived_interface_term_recomputes_stripped_dependent.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls
briansrls force-pushed the session/nimble-moth-292-6939 branch from 18d3b05 to a70b07d Compare July 22, 2026 14:11
@gunbai-bot gunbai-bot Bot changed the title Floor batch-2: dissolve once-per-entry bare-reference fixpoint (~640s vs 202s PRE) typed-cache: fold reference-derived import term into content key (#6939 re-derive) Jul 22, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 22, 2026 14:11
@gunbai-bot

gunbai-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Review 41389 (claude/claude-opus-4-7 — APPROVE): Verified against HEAD a70b07d259; no code change requested.

Spot-checked the approval claims on current tree:

  • reference_only_direct_import_modules derives from selection_adjacency − adjacency with path_to_module built once in build_module_graph_facts_live_uncached (no second edge producer)
  • typed_module_content_key folds reference-derived interface hashes for stripped modules, skipping targets outside closure_names (structural exclusion, not a widen)
  • module_schedule_batches + try_reconcile_all_cache_hits dependency-order pass precede key derivation; Pass 2 preserves resolver-order assembly
  • RED control reference_derived_interface_term_recomputes_stripped_dependent present and green locally (4/4 typed_module_content_key_tests)

Merge readiness: 1/2 approvals (claude only), CI build pending — waiting on second approval + green checks before stopping per lane bar.

— sent from nimble-moth-292

@gunbai-bot

gunbai-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Review 41392 (cursor/composer-2.5 — APPROVE): Verified against HEAD a70b07d259; no findings, no code change requested.

The approval's characterization matches current tree: single-file scope on cli_run.rs, selection_adjacency − adjacency authority via reference_only_direct_import_modules, fail-closed missing-interface-hash refuses, module_schedule_batches + two-pass try_reconcile_all_cache_hits for ordering, and RED control reference_derived_interface_term_recomputes_stripped_dependent parallel to the import-bearing control.

Merge readiness: 2/2 approvals (claude, cursor), MERGEABLE, no RC — CI build still pending on run 29927418681; lane stops here pending green checks (operator merges manually).

— sent from nimble-moth-292

Regen failed because stripped modules in the import+reference schedule
cycle residue (291-module antichain on ci_floor_plan) could not satisfy
reference-derived interface-hash prerequisites before keying. Match
schedule edges and key lookups at repo-path grain, defer within-batch
ordering gaps for declared imports, and skip the reference-derived key
term only for cycle-residue slots (pre-PR behavior there; acyclic
closures including the RED fixture keep the new term).

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Review 41432 (cursor/composer-2.5 — APPROVE): Verified on HEAD 4cff039c2c; no merge-blocking findings, no code change requested.

Spot-check on the CI-fix commit confirms the approval claims: selection_adjacency − adjacency path-grain authority (reference_only_direct_import_paths), schedule edges + within-batch defer for ordering gaps, cycle-residue slots excluded from the reference-derived key term (291-module antichain on regen), fail-closed refuse on true deadlocks, and RED control reference_derived_interface_term_recomputes_stripped_dependent still green (4/4). Companion review 41434 (claude) also APPROVE on same SHA.

Merge readiness: 2/2 approvals (claude, cursor on 4cff039c2c), MERGEABLE, no RC — CI build still pending (run 29932147045).

— sent from nimble-moth-292

@gunbai-bot

gunbai-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Review 41434 (claude/claude-opus-4-7 — APPROVE): Verified on HEAD 4cff039c2c; no code change requested.

Approval claims match current tree: Rust-only cli_run.rs slice; reference-derived term in typed_module_content_key from reference_only_direct_import_paths (selection_adjacency − adjacency, path-grain); schedule edges + within-batch defer; cycle-residue slots structurally detected in module_schedule_batches and excluded via include_reference_derived_term: !cycle_residue_slots.contains(&slot) (not a heuristic widen); fail-closed refuse on unresolvable ordering deadlock; RED control reference_derived_interface_term_recomputes_stripped_dependent green. Regen floor passes locally on this SHA.

Merge readiness: 2/2 approvals (claude, cursor on 4cff039c2c), MERGEABLE, no RC — CI build still pending (run 29932147045).

— sent from nimble-moth-292

@briansrls
briansrls merged commit f678a6b into main Jul 22, 2026
3 checks passed
@briansrls
briansrls deleted the session/nimble-moth-292-6939 branch July 22, 2026 16:34
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