Skip to content

source_reference_repoint: a 'retire member' mode on the same token-stream reader - #13483

Merged
gunbai-bot[bot] merged 4 commits into
mainfrom
session/silent-wren-814-retire-member
Oct 7, 2026
Merged

gunbai-bot[bot] merged 4 commits into
mainfrom
session/silent-wren-814-retire-member

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

XL-2 (lively-crane-656). This lands before the filter/any retirement, which will use it.

Why

tools.source_reference_repoint (landed with #13388) REPOINTS a reference from one module to another. Retiring v2.std.algebra filter/any onto the collection roster's callback form (calm-boar-904's ruling B') needs the other operation: DROP a member from every import list naming it from that module. There is nothing to repoint it to, because the bare head resolves through the roster. The ~145 import sites must be rewritten by the generated instrument, never by hand. So this extends the one instrument rather than adding a second tool, which would be a §3 fork.

What

  • ImportMemberRetirement { module_path, member }, and the roster source_import_member_retirements. It starts empty; its first rows land with the filter/any PR.
  • import_member_retirement_edits: reads the same seed token stream (parsed_import_observation_live) and finds each import <module_path> { ... } statement.
    • Each retired entry is deleted with exactly one adjacent comma, so single-line lists, multi-line lists and trailing commas keep their layout.
    • Overlapping deletions (adjacent retired members) are merged before apply_source_edits, which requires disjoint spans.
    • A statement left empty loses its whole line.
  • Comments are not tokens, and a string is one token, so neither is touched. The same name imported from a DIFFERENT module is a different reference and is kept.
  • rewritten_source_text = moves, then retirements. The repoint and repoint_pending entries use it, so the walk, idempotence and pending report are shared, not duplicated.

Controls (test.claim.source_reference_repoint_witness_test, supplied text at the instrument's interface)

  • { filter, X } → { X }; { X, filter } → { X }.
  • An import of only { filter } loses its line.
  • A comment, a string, and filter imported from another module are all untouched.
  • A multi-line list keeps its layout, including a trailing comma.
  • Two adjacent retired members become one deletion.
  • A second run is a no-op.

15/15 PASS (8 existing + 7 new): https://app.buildbuddy.io/invocation/a7665d2e-bed8-4f8c-8bd0-ffd710fa0a73

🤖 Generated with Claude Code

gunbc-ci-auto-heal and others added 4 commits October 6, 2026 15:14
…ream reader

An import member that no longer lives in its module (nothing to repoint it to) is
deleted from every import list naming it from that module, with exactly one
adjacent comma, keeping single-line, multi-line and trailing-comma layouts; a
statement left empty loses its line. Same applier, walk, idempotence and pending
report as the repoint. Roster starts empty; its first rows land with filter/any.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…mpares 10

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit bbb5fc1 Oct 7, 2026
5 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/silent-wren-814-retire-member branch October 7, 2026 12:23
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.

0 participants