Skip to content

Walk-target-sourced alias codemod - #6984

Merged
briansrls merged 16 commits into
mainfrom
session/royal-crab-274
Jul 21, 2026
Merged

briansrls merged 16 commits into
mainfrom
session/royal-crab-274

Conversation

@briansrls

@briansrls briansrls commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Plan-only phase of the §13 walk-target-sourced alias codemod — the relief valve for the unique-on-chain refusal flip.

  • Adds walk_target_alias_plan binary: consumes silent-pick telemetry (resolution divergence census slice 2 (read-only telemetry) #6967), grounds each site via SymbolIndex qualified-path lookup (never import lists), dedupes to AliasBindingRow-shaped plan rows.
  • Scope: global_bare_lcp + fn_parent_first_hit with a chosen winner; global_bare_lcp_tie refused (no mechanical target).
  • Oracle primary key: qualified_path (node_ptr secondary within-run only).

Apply phase (mechanical alias insertion + executed binding-identity oracle) lands in this same PR per parent ruling.

Dry-run command

cargo run -p v1-compiler --bin walk_target_alias_plan
# optional: --source-root dag --source-root src/v2

Output: [walk-target-alias-plan] summary + ALIAS_ROW / REFUSED tsv lines. Generated + re-runnable.

Test plan

  • cargo fmt --all --check
  • cargo build -p v1-compiler --bin walk_target_alias_plan
  • cargo test -p v1-compiler --lib walk_target_alias_plan_positive_control_global_bare_lcp — planted global_bare_lcp fixture, walk_verified + qualified_path oracle green

@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 21, 2026 11:37
@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Addressed review 40704 in 8ac7915142:

  • format_walk_target_alias_plan now prints plan.source_scope_label (falls back to unknown only when unset by _from_census); the hardcoded scope=dag+src/v2 string is removed.
  • Fixed release-build compile error: WalkTargetAliasPlan { source_scope_label: String::new(), ... } in _from_census.
  • Added walk_target_alias_plan_positive_control_fn_parent_first_hit (empty-import closure fixture + replay oracle) alongside the existing global_bare_lcp control.

Tests: cargo test -p v1-compiler --lib walk_target_alias_plan_positive_control — 2/2 green.

— sent from royal-crab-274

Brian Searls and others added 2 commits July 21, 2026 12:23
The global_bare_lcp_tie REFUSED-row test needs a minimal ResolvedGraph
with im::Vector fields and proper imports in the nested test module.

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

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40709 (APPROVE): Verified against 78d819ab0c — plan-only codemod grounds walk targets through symbol_index_lookup, dedupes by key, fail-closes on ground failures with typed REFUSED rows, and ships positive-control fixtures with same-run replay oracles. No action required.

Review 40711 (REQUEST_CHANGES): Addressed in 19192e17 + 78d819ab0c:

  • silent_pick_global_bare_lcp_tie_rows now emit typed REFUSED rows (WalkTargetAliasPlanClass::GlobalBareLcpTie) instead of being silently dropped; global_bare_lcp_tie_events counted in plan summary.
  • CLI_RUN_WALK_TARGET_ALIAS_PLAN_SCAFFOLD_MARKER + dissolve-on comment block added per interim-scaffold convention.
  • walk_target_alias_plan_refuses_global_bare_lcp_tie_sites unit test added (minimal InterpContext + synthetic census row).

Tests: cargo test -p v1-compiler --lib walk_target_alias_plan — 4/4 green.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40711 (REQUEST_CHANGES): Already addressed at 19192e17 + 78d819ab0c (verified still present on HEAD bb04e269 after main merge):

  1. Tie sites → typed REFUSED — walk_target_alias_plan_from_census now iterates census.silent_pick_global_bare_lcp_tie_rows and emits WalkTargetAliasPlanClass::GlobalBareLcpTie refused rows with located reason strings; global_bare_lcp_tie_events is counted in the plan summary formatter. Covered by walk_target_alias_plan_refuses_global_bare_lcp_tie_sites.

  2. Hand-Rust scaffold receipt — CLI_RUN_WALK_TARGET_ALIAS_PLAN_SCAFFOLD_MARKER + 🟡 dissolve-on block at cli_run.rs (authority: namespace-resolution-design §13, grep-until-deletion receipt, ROADMAP deferral). Drift-gate: walk_target_alias_plan_scaffold_marker_is_declared.

Superseded on same provider by review 40717 (APPROVE on 78d819ab0c).

Review 40717 (APPROVE): Verified — no further changes. Plan-only scope, SymbolIndex grounding, tie refusal, scaffold marker + tests all match the approval read-back on 78d819ab0c/bb04e269.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Verified reviews 40719, 40724, and 40725 against bb04e269 — all APPROVE, no code changes required:

  • 40719 / 40725 (claude): Scaffold marker (CLI_RUN_WALK_TARGET_ALIAS_PLAN_SCAFFOLD_MARKER), dissolve-on trigger, SymbolIndex walk-target grounding, typed REFUSED rows for global_bare_lcp_tie, positive-control replay oracles, and terminal sort on (class,module,binding,walk_target) all present as described.
  • 40724 (cursor): Confirms plan-only scope, tie refusals, and scaffold/tests — matches current tree.
  • 40719 minor note (walk_target_alias_plan.rs:74-76): exit code 2 when zero global_bare_lcp/fn_parent_first_hit events is intentional — diagnostic refuses when the planner has no actionable silent-pick work (consistent with resolution_divergence_census transport discipline); not changing.

Merge readiness: ≥2 distinct approvals (claude + cursor), no open REQUEST_CHANGES, mergeable=MERGEABLE. Waiting on ci floor job.

— sent from royal-crab-274

Brian Searls and others added 2 commits July 21, 2026 13:20
Include global_bare_lcp_tie_events in the empty-corpus check so
tie-only runs print refused rows and exit 0 instead of a false
"no silent-pick events" refusal (review 40745).

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

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40741 (APPROVE): Verified against 54934bdcd4 — plan-only bin, scaffold marker, SymbolIndex grounding, typed tie refusals, positive-control replay oracles, and infer_fixture.dag import fix all match the approval. No action required.

Review 40745 (APPROVE): Addressed the tie-only exit-guard finding in 54934bdcd4 — empty-corpus check now includes global_bare_lcp_tie_events, so tie-only corpora print refused rows and exit 0 instead of the false "no silent-pick events" message.

PR-body scope note (40745): Intentional — this PR lands plan-only (read-only planner + oracle fixtures + infer_fixture import fix). Mechanical alias apply is deferred to stern-owl-401 Phase 3 per the in-code scaffold (CLI_RUN_WALK_TARGET_ALIAS_PLAN_SCAFFOLD_MARKER dissolve-on). PR description will be reconciled at merge if still mis-stated.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40765 (APPROVE): Verified against 54934bdcd4 — plan-only §13 tooling, scaffold marker + dissolve-on, SymbolIndex grounding (not import lists), typed tie refusals, exit guard including global_bare_lcp_tie_events, positive-control/replay oracles, and infer_fixture.dag import hygiene all match the approval. No code changes required.

CI note: run 29835553010 ci job failed at Setup Rust (rustup rename flake on srv3-08, 15s) — not a floor/code failure; build passed. Re-running failed jobs.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40767 (APPROVE): Verified against 54934bdcd4 — plan-only §13 tool with scaffold marker + dissolve-on, typed/located WalkTargetAliasPlanRefused rows (tie + ground failures), replay-oracle positive controls, tie refusal RED control, fail-closed zero-events exit (ExitCode(2)), and infer_fixture.dag import hygiene. No code changes required.

Merge readiness: ≥2 approvals (claude + cursor on HEAD), no REQUEST_CHANGES, mergeable=MERGEABLE, CI green (build + ci pass on run 29835553010).

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40816 (APPROVE): Verified against 55510a607b — plan-only §13 tooling intact after main merge: scaffold marker + dissolve-on (cli_run.rs:18901-18908), SymbolIndex-grounded walk targets, typed tie refusals (19068-19077), fail-closed zero-events exit including tie events (walk_target_alias_plan.rs:74-80), positive-control/replay oracles, and infer_fixture.dag import hygiene. No code changes required.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40860 (APPROVE): Verified against 9dae357fa4 — plan-only §13 alias codemod intact after #6995 main merge: scaffold at cli_run.rs:18971-18978, SymbolIndex-grounded walk targets, typed tie refusals, positive-control/replay oracles, and infer_fixture.dag imports all match the approval. No code changes required.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40863 (APPROVE): Verified against 9dae357fa4 — scaffold marker + dissolve-on (cli_run.rs:18971-18978), SymbolIndex symbol_index_lookup grounding (not import lists), typed GlobalBareLcpTie refusals, and infer_fixture.dag additive imports all match the approval. Zero-events ExitCode(2) (walk_target_alias_plan.rs:74-80) is intentional diagnostic refusal during §13 rollout telemetry — already addressed in review 40745/40719 as non-blocking. No code changes required.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40907 (APPROVE): Verified against 9c7468ff26 — plan-only §13 alias codemod, typed global_bare_lcp_tie refusals, SymbolIndex symbol_index_lookup grounding, scaffold marker + dissolve-on, qualified-path catalog authority references (extdeps.color.*.extdeps_external_authority_anchor), and positive-control/tie-refusal tests all match the approval. No code changes required.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40909 (APPROVE): Verified against 9c7468ff26 — plan-only scaffold with CLI_RUN_WALK_TARGET_ALIAS_PLAN_SCAFFOLD_MARKER + dissolve-on, SymbolIndex walk grounding, typed tie refusals, authority-anchor convergence (okabe_ito/solarized → extdeps_external_authority_anchor with qualified catalog.dag consumers), and infer_fixture.dag import hygiene all match the approval. No code changes required.

— sent from royal-crab-274

Brian Searls and others added 2 commits July 21, 2026 18:43
Resolve catalog.dag formatting conflict; keep main's single-line
CitedUpstream provenance rows (same authority anchors as branch).

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

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Merged latest main (d5472412) — resolved one conflict in dag/gunbc/design/catalog.dag (formatting-only; same extdeps_external_authority_anchor provenance as main). cli_run.rs auto-merged cleanly.

Pushed 09a200ac21. PR is mergeable again; CI pending on new SHA.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40935 (APPROVE): Verified against 09a200ac21 — all claims match current tree:

  • Plan-only walk_target_alias_plan bin mirrors resolution_divergence_census pattern; SymbolIndex walk grounding (not import lists).
  • Scaffold marker + dissolve-on at cli_run.rs:19001-19008; deletion receipt rg walk_target_alias_plan src/v1/stage0.
  • Tie-only silent picks counted in exit guard (walk_target_alias_plan.rs:74-79).
  • Positive controls for global_bare_lcp / fn_parent_first_hit plus tie-refusal unit test present.
  • infer_fixture.dag import fix remains appropriate for default src/v2 source roots.

No code changes required.

— sent from royal-crab-274

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review 40936 (APPROVE): Verified against 09a200ac21 — all claims match current tree:

  • Plan-only bin with SymbolIndex symbol_index_lookup grounding; deduped WalkTargetAliasPlan rows.
  • Hand-Rust scaffold: CLI_RUN_WALK_TARGET_ALIAS_PLAN_SCAFFOLD_MARKER + §13 authority, 🟡 dissolve-on, rg receipt (cli_run.rs:19001-19008).
  • Typed/located refusals via WalkTargetAliasPlanRefused; tie class refuses per site (no absorbing fallback).
  • Zero-events ExitCode(2) is fail-closed diagnostic refusal, not a widen (walk_target_alias_plan.rs:74-79).
  • Positive controls replay census→plan with qualified-path equality oracles for both classes.
  • infer_fixture.dag imports are additive fixture hygiene only.

No code changes required.

— sent from royal-crab-274

@briansrls
briansrls merged commit fa4f903 into main Jul 21, 2026
3 checks passed
@briansrls
briansrls deleted the session/royal-crab-274 branch July 21, 2026 21:09
briansrls added a commit that referenced this pull request Jul 22, 2026
Move apply authority to dag/tools (oracles, tree insert anchor, grammar emit,
dry-run effect plan, #6979 write gate) with claim witnesses; extract plan
types to walk_target_alias_plan.dag and add Phase 7 equivalence harness.
Delete walk_target_alias_apply bin and cli_run apply block (#6984 plan Rust
retained until dual-run equivalence lands).

Co-authored-by: Cursor <cursoragent@cursor.com>
gunbai-bot Bot pushed a commit that referenced this pull request Jul 23, 2026
…in (no more unconsumed scaffolding)

The apply workflow previously computed nothing: the pure fold returned an
empty edit list behind a module_path_index seed-gap refusal and had no
consumer. This assembles the full pipeline in .dag and gives it a live
consumer, per operator direction (finish the branch; nothing useless).

.dag (tools.walk_target_alias_apply):
- walk_target_alias_apply_module_fold: per-module inputs (module, storage
  rel path, source text, plan rows) -> write gate -> static binding-identity
  oracle -> parse (v2 tokenize/parse_module, span index kept) -> row-conflict
  check -> existing-alias skip -> splice offset -> grammar-spelled alias
  lines -> typed splice-edit report. Per-module refusals typed and counted;
  siblings continue.
- Splice offset: max span-extent end over module_header/import_decl nodes
  anywhere in the parse tree (probed topology: the module is a nested
  sequence spine, so the old flat-children anchor scan mis-anchored; it also
  placed no-import modules BEFORE the header). The proven-wrong child-index
  anchor + node-insertion machinery is deleted, not kept as a lying witness.
- Alias line: ConcreteSyntaxToken list (kw_alias, bound ident, eq, dotted
  QN) spelled through serialize_concrete_syntax_tokens_to_source with the
  DeclaredNormalized whitespace rendering scoped to the alias token classes
  (grammar-owned spellings, no hand formatting). Fixed the latent
  String-into-Symbol bug in alias_apply_binding_row_from_plan_row.
- Existing-alias detection: DFS atom scan (binding ident is the atom right
  after each dag_token_kw_alias - probed by execution), replacing the flat
  children walk that never matched.
- Corpus write gate re-grounded on the executed fact: the v1 seed parser has
  no alias-decl arm (compile probe red), so --write refuses with that reason;
  dissolve-on the v1 parse arm. The module_path_index seed gap dissolved into
  the host-boundary input shape (code references modules; only host
  boundaries project paths).

Driver (walk_target_alias_apply bin, thin transport like gunbc converge):
plan rows via the seed-retained #6984 planner, module->path->text projection
at the host boundary, in-process interpreter call, typed report decode (both
list carriers: native List and modeled Cons/Empty), TSV projection, char-safe
splice realization (unit-tested) reachable only when the gate lifts, and
--marshal-probe: a transport self-test proving argv->Value->fold->decode on
the witness fixture without the whole-corpus planner.

Proven by execution: fast witnesses 10/10 (oracle reds, write-gate red,
conflict red/green, fold-level oracle gate, dry-run receipt), long-lane 6/6
(parse, tree fact, splice offsets 82/48 incl. the no-import fixture,
end-to-end fold edit, skip-existing), driver unit tests 4/4, marshal probe
green (alias_line + offset 82).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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