Skip to content

swapped names a lane by the register row's spelling, not the log file's (#55) - #201

Merged
brettheap merged 3 commits into
mainfrom
fix/swapped-canonical-lane-name-55
Oct 18, 2026
Merged

brettheap merged 3 commits into
mainfrom
fix/swapped-canonical-lane-name-55

Conversation

@brettheap

@brettheap brettheap commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What was wrong

lanes-edit.sh swapped's first field is what its callers hand to tmux rename-window, to --name, to lane <name> and to a read of the register, so it has to be the register row's spelling. It was the raw name the swap record is read under. swapped_candidates took it from nm[k] = $2, and the comment beside it called that "the spelling the register row carries".

It is not. LOG_AWK keys every line to its log FILE (Amendment 16(c): lane = FL, the file's base name), so field 2 is the base name of lanes/log/<name>.md. A lane whose log was written before Amendment 15 still has a lowercase file beside a mixed-case row (the code's own example is lanes/log/openxfactory-4.md beside openXfactory-4), and swapped printed the lowercase name. window-lane already canonicalised its answer (canon_lane, then ${wl_can:-$wl_l}); swapped did not.

Evidence, run in a temp HOME with a temp bare origin and the fixture below, against origin/main's lanes-edit.sh (f87fd5a):

stdout=reposwlow-1	2026-09-12T09:30:00Z	lowwin:5
FIELD1 repoSwLow-1 (window lowwin:5, file reposwlow-1.md) = [reposwlow-1]

A note on the issue's framing: it names the log LINE's spelling. The parser never lets a line's own spelling reach this read; the raw name is the log FILE's base name. So a row whose log file already carries the row's spelling but whose PAUSED line is lowercase (the existing repoWin-1 fixture) reads correctly today. The bug is the lowercase file beside a mixed-case row.

What changed

  • swapped_lanes takes canon_lane of the raw name and prints ${sw_can:-$sw_l} as the first field, the same pattern as window-lane. Where the register cannot answer (the 15(d) pair, an unreadable alias table) it keeps the raw name, as window-lane does.
  • The raw name stays what log_path_for and the pickaxe key use, because they read the log. (With a lowercase file, canonicalising first would have pointed the pickaxe at lanes/log/<Mixed>.md, which does not exist on origin, and degraded the landing rank.)
  • The comment in swapped_candidates that said the raw name is the row's spelling is corrected, and swapped_lanes gets a header paragraph saying which spelling the first field is and why.
  • docs/README-lanes.md, ### swapped: one sentence saying the lane is the row's spelling, with the lowercase-file case.
  • Callers checked: lane-start compares with tolower; lane-handoff takes the first field and runs canon_lane on it; nothing else parses the output (git grep -n swapped -- lane lane-start lane-end lane-handoff lanes skills).

Functions and regions edited:

  • lanes-edit.sh: swapped_lanes (the loop body and the closing printf, plus its header comment)
  • lanes-edit.sh: swapped_candidates (the comment above the final printf in the awk program, no code change)
  • docs/README-lanes.md: the ### swapped [<workstation>] section
  • tests/test_lane_helpers.sh: the seed block beside repoSwap-1 (new repoSwLow-1 row and reposwlow-1.md log), and the assertions after the window-lane Raven casewin:3 cases

Tests

  • New fixture repoSwLow-1 (Raven, PAUSED ... swap; window lowwin:5) whose only log is the lowercase file reposwlow-1.md, and run "$E" swapped Raven asserting its row's first field is repoSwLow-1. Rows are picked by window, because Raven holds other swapped lanes.
  • The existing repoWin-1 fixture gets an assertion too (casewin:3 row reads repoWin-1). It passes with or without the fix, and the comment says so.

Fail-before and pass-after, by a scratch script that builds the two Raven fixtures above in a temp HOME and temp bare origin, and runs lanes-edit.sh swapped Raven with LANES_EDIT, LANES_WORKSPACE_ROOT, LANES_REPO, LANES_LANE unset:

BEFORE (origin/main):  FIELD1 repoSwLow-1 = [reposwlow-1]   FIELD1 repoWin-1 = [repoWin-1]
AFTER  (this branch):  FIELD1 repoSwLow-1 = [repoSwLow-1]   FIELD1 repoWin-1 = [repoWin-1]

bash -n passes on lanes-edit.sh and tests/test_lane_helpers.sh. The full suite was not run locally (AGENTS.md ruling of 2026-09-16); CI's tests job is the record.

Closes #55

🤖 Generated with Claude Code

Summary by Sourcery

Report canonical register-row lane names from swapped while preserving log-file names for log lookups and landing-order calculations.

Bug Fixes:

  • Ensure swapped reports the lane spelling from the register row instead of the log file name, including lanes with legacy lowercase log files.

Enhancements:

  • Document the spelling contract for swapped and clarify the distinction between register names and log file names.

Documentation:

  • Update the swapped command documentation with its register-row spelling behavior and legacy lowercase-log example.

Tests:

  • Add coverage for swapped lanes whose lowercase log file differs in case from the register row, while retaining coverage for matching log and row spellings.

brettheap and others added 2 commits October 11, 2026 16:56
…55)

Work in progress, stopped for an account swap. `swapped_lanes` now takes
`canon_lane` of the lane it was handed and prints `${sw_can:-$sw_l}` as the
first field, the way `window-lane` already does, keeping the log's own
spelling for `log_path_for` and the pickaxe key. A docs sentence and a
`repoWin-1` assertion are added.

Not finished: the comments in this commit say the raw name is the log LINE's
spelling, which is wrong (the parser keys every line to its log FILE, so the
raw name is the file's base name); and the `repoWin-1` assertion passes before
the fix too, because that fixture's log file already carries the row's
spelling. The regression case needs a row whose log FILE is lowercase.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…le's (#55)

`swapped`'s first field is what a caller hands to `tmux rename-window`, to
`--name`, to `lane <name>` and to a read of the register, so it has to be the
register row's spelling. It was the raw name the record is read under, and the
log parser keys every line to its log FILE (Amendment 16(c)), so that name is
the file's base name: a lane whose log was written before Amendment 15 is still
`lanes/log/reposwlow-1.md` beside the row `repoSwLow-1`, and `swapped` printed
`reposwlow-1`. `window-lane` already canonicalised its answer the same way.

`swapped_lanes` now prints `${sw_can:-$sw_l}` as the first field, taking
`canon_lane` of the raw name and keeping the raw name where the register cannot
answer (the 15(d) pair, an unreadable alias table), as `window-lane` does. The
raw name is still what `log_path_for` and the pickaxe key use, because those
read the log. The comments that called the raw name "the spelling the register
row carries" are corrected, and the lane manual's `swapped` section says which
spelling the first field is.

The regression case seeds `repoSwLow-1` with a lowercase log file and asserts
the first field of its row; it fails on the previous `lanes-edit.sh`. The
existing `repoWin-1` fixture keeps an assertion too, but its log file already
carries the row's spelling, so that one passes either way.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fix swapped so its first field is the canonical register-row lane name rather than the raw log-file basename, without changing log reads or landing ranking, and document and test both spelling scenarios.

Sequence diagram for canonical swapped lane output

sequenceDiagram
    participant Caller
    participant swapped_lanes
    participant canon_lane
    participant Log
    Caller->>swapped_lanes: swapped_lanes
    swapped_lanes->>canon_lane: canon_lane(sw_l)
    canon_lane-->>swapped_lanes: register row spelling
    swapped_lanes->>Log: log_path_for(sw_l)
    Log-->>swapped_lanes: log data and landing key
    swapped_lanes-->>Caller: first field = sw_can or sw_l
Loading

File-Level Changes

Change Details Files
Canonicalize the first swapped output field to the lane spelling stored in the register while preserving the log-file spelling for log lookups and landing-order ranking.
  • Resolve each raw swapped-lane name through canon_lane, falling back to the raw name when canonicalization is unavailable.
  • Continue using the raw log-derived name for log_path_for and the pickaxe key.
  • Document the distinction between register-row and log-file spellings in implementation comments and the lane documentation.
lanes-edit.sh
docs/README-lanes.md
Add regression coverage for mixed-case register rows backed by lowercase log files and retain coverage for logs that already use the row spelling.
  • Seed a swapped lane with a mixed-case register row and lowercase-only log file.
  • Assert swapped Raven emits the register spelling for that lane.
  • Assert the existing matching-file case remains correctly spelled.
tests/test_lane_helpers.sh

Assessment against linked issues

Issue Objective Addressed Explanation
#55 Make swapped print the register row’s canonical lane spelling as its first field, rather than the raw spelling used to read the log. ✅
#55 Document the first-field spelling contract and add regression coverage for a lane whose log name differs in case from its register row. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai

sourcery-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 hours and 49 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap brettheap added ready landing gate: runs tests-macos once before the squash and removed ready landing gate: runs tests-macos once before the squash labels Oct 17, 2026
…ests this PR on today's main

GitHub's refs/pull/201/merge stayed on aaa7bc8 after main moved, so a re-labelled run tested the old base. A head that contains main is tested on it whatever base the run merges with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit d424b64 into main Oct 18, 2026
5 checks passed
brettheap pushed a commit that referenced this pull request Oct 18, 2026
…R on today's main

Main moved through files this PR also changes (#199 or #216, and #201) after the last green run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brettheap pushed a commit that referenced this pull request Oct 18, 2026
…so CI tests this PR on today's main

Main moved through files this PR also changes (#199 or #216, and #201) after the last green run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brettheap pushed a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
brettheap pushed a commit that referenced this pull request Oct 18, 2026
Brings in d424b64 (#201), 61a7378 (#215, the lane-start clause (c)
TAIL fix), 19c2e25 (#232, tests/run.sh's lock owner), f685866 (#233,
the openRepoShape pin at v1.1.0, 190133d) and f595e44 (#229 item 22,
the hygiene rule on bench-root host paths) on top of 83d2690.

Both sides change lanes-edit.sh and docs/README-lanes.md, in disjoint
hunks: main's are `swapped`'s row spelling (Amendment 15) and its
manual paragraph, the branch's are project-legs, lane-reconcile's leg
and paired-root reads and the T018 section. git merged both with no
conflict. bash -n passes on lanes-edit.sh, lane-handoff, lane-start,
lane-end, tests/run.sh and tests/test_lane_helpers.sh.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Oct 18, 2026
…olders verifies it, not on kill -0 (#56) (#203)

Landed on Brett Heap's word "land #200 #201 #203 when green" (2026-10-17), by lane openRepoTools-5. Required Linux CI (guard-launch-mode, tests, tests-no-submodule; run 39089234266) was green on head 6952a3a with main f595e44 in its tree.

Independent review (lane 5, Opus, of c855985; the merges of main add nothing to the PR's diff): LAND, no blocking defect.

Closes #56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brettheap pushed a commit that referenced this pull request Oct 18, 2026
…58, so CI tests this PR on today's main

The branch last merged aaa7bc8; main has since landed #195, #229, the openRepoShape v1.1.0 pin, and #201/#215/#203 in files this PR shares.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Oct 18, 2026
…rename the only act there is (#78, #79) (#200)

Landed on Brett Heap's word "land #200 #201 #203 when green" (2026-10-17), by lane openRepoTools-5. Required Linux CI (guard-launch-mode, tests, tests-no-submodule; run 39089233488) was green on head d745325 with main f595e44 in its tree. Main has since moved to cb3a2c7 only through files this PR does not change.

Independent review (lane 5, Opus, of 28937d2; the merges of main add nothing to the PR's diff): LAND, no blocking defect.

Closes #78
Closes #79

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready landing gate: runs tests-macos once before the squash

Projects

None yet

Development

Successfully merging this pull request may close these issues.

swapped's first field is the LOG's spelling, not the register row's — Amendment 15's canonical-name claim is made where the register is not read

1 participant