Skip to content

next-free counts the alias table's keys as taken positions, and a table it cannot read offers no position (batch 8 Q47 on opensoft/openRepoTools#165) - #33

Merged
brettheap merged 1 commit into
mainfrom
fix/next-free-counts-alias-keys
Nov 10, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/next-free-counts-alias-keys

Conversation

@brettheap

@brettheap brettheap commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openRepoTools-3
Claim: none (lane 3's own lane-tooling fix; opensoft/openRepoTools#165 6780753157, batch 8 Q47)

What and why

lanes-edit.sh rename-lane A B appends A, B and the UTC to lanes/aliases.tsv, and Amendment 16(e) says the old name resolves for ever. rename-lane already refuses a <new> that is an alias key, because a row under a former name takes precedence over the alias and would end that name's resolution.

lane_next_free was the one reader that disagreed. It counted only rows, current and retired, so it offered the position A freed. lane then offered f for it, and lane-start resolved A through canon-lane to the renamed lane B rather than starting a new one. A probe on a throwaway register, with rows repoX-1 to repoX-3 and repoX-4 renamed to repoX-3, shows both halves on fbda9d1: next-free repoX answers 4, and canon-lane repoX-4 answers repoX-3 with "'repoX-4' is a FORMER name of lane repoX-3". On this branch next-free repoX answers 5.

Lane 3's ruling is batch 8 Q47 (opensoft/openRepoTools#165, comment 6780753157):

  • lane_next_free reads lane_alias_keys after lane_position_rows, and each key joins the names it counts under the rows' own rule. The whole name before the last hyphen is the repository, compared case-insensitively, and the position is the digits after it, a trailing letter dropped.
  • A table that exists and cannot be read is its 1, as a register or an archive it cannot read is (Amendment 7(d)). The note names lanes/aliases.tsv and lane_alias_err's reason, and nothing goes to stdout. An absent table changes nothing.
  • Its stdin rows and lane_position_rows are unchanged.

Five comments said lane_next_free hands a former name's position out, or called a row minted there legitimate. Each keeps its history and now says the row-wins rule is the defence for such rows minted in the past, or by hand or by add-row, which reads no alias key:

  • the LOG_AWK file rule;
  • lane_alias_hop;
  • lane_alias_keys, which now names all three callers (rename-lane, lane_checkout_old and lane_next_free);
  • rows_named_ci_alias;
  • rename-lane's alias-key refusal.

No operator text on main tells anyone to take a former name's position, and sr_known_die is not on main.

Tests

Seven cases in tests/test_register_scan_hardening_138.py, beside the existing next-free cases and on the same Register fixture. The stdin rows are repoA-1 and repoA-2, so the answer is 3 until a former name holds that position.

case branch fbda9d1
key repoA-3: answers 4 pass fail (3)
key REPOA-3: answers 4 pass fail (3)
key repoA-3b: answers 4 pass fail (3)
key repoA-foo-3 (another repository): answers 3 pass pass
no table: answers 3 pass pass
unreadable local table: exit 1, the note, no number pass fail (exit 0)
published table git cannot show: exit 1, the note, no number pass fail (exit 0)

The bite was shown by copying fbda9d1's lanes-edit.sh over the branch's, running the seven cases (5 failed, 2 passed), and restoring it with git checkout. Its sha256 matched the fix's afterwards, and the seven passed again. Only these cases were run, by node id. The shell suite and the rest of the pytest suite were not run, so CI is owed.

Selectors: the seven new ids are in tests/test_register_scan_hardening_138.py, so any -k word that selects that module, or register_scan, now selects seven more. No id is renamed or removed.

🤖 Generated with Claude Code

…le it cannot read offers no position (batch 8 Q47 on opensoft/openRepoTools#165)

`lanes-edit.sh rename-lane A B` appends `A<TAB>B<TAB><UTC>` to
`lanes/aliases.tsv`, and Amendment 16(e) says the old name resolves for
ever. `rename-lane` already refuses a `<new>` that is an alias key, because
a row under a former name takes precedence over the alias. But
`lane_next_free` counted only rows, current and retired, so it offered the
position `A` freed: `lane` printed "f = a new lane at the next free
position" for it, and `lane-start` then resolved `A` to the renamed lane `B`
rather than starting a new one.

Lane 3's ruling, batch 8 Q47 (opensoft/openRepoTools#165, comment
6780753157): `lane_next_free` treats each alias key of the repository as a
taken position, and a table it cannot read is its 1, as a register or an
archive it cannot read is (Amendment 7(d)).

- `lane_next_free` reads `lane_alias_keys` after `lane_position_rows`. On a
  failed read it notes the table and `lane_alias_err`'s reason and returns 1
  with nothing on stdout. Otherwise each key joins the names it counts,
  under the rows' own rule: the whole name before the last hyphen is the
  repository, compared case-insensitively, and the position is the digits
  after it, a trailing letter dropped. Its stdin rows and
  `lane_position_rows` are unchanged.
- Five comments that said `lane_next_free` hands a former name's position
  out, or called a row minted there legitimate, keep their history and now
  say the row-wins rule is the defence for such rows minted in the past, or
  by hand or by `add-row`, which reads no alias key: LOG_AWK's file rule,
  `lane_alias_hop`, `lane_alias_keys` (which now names all three of its
  callers), `rows_named_ci_alias` and `rename-lane`'s alias-key refusal.
- No operator text on main tells anyone to take a former name's position,
  and `sr_known_die` is not on main.

Tests, seven cases in tests/test_register_scan_hardening_138.py: a key
`repoA-3`, `REPOA-3` or `repoA-3b` makes `next-free repoA` answer 4 over
rows `repoA-1` and `repoA-2`; a key `repoA-foo-3` leaves it 3; an absent
table leaves it 3; an unreadable local table, and a published one git cannot
show, give exit 1, the note and no number. With fbda9d1's lanes-edit.sh the
five key and unreadable cases fail (3, exit 0) and the other two pass.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Update lane_next_free to count alias keys as occupied positions and fail closed when the alias table cannot be read, while revising related comments to explain the row-wins rule and preserve the history of the earlier behavior.

  • lanes-edit.sh L4532-4540, L6793-6802, L10314-10329 (+4 small edits)

Tests

Add coverage for alias keys occupying positions under the rows’ matching rules, absent tables leaving results unchanged, and unreadable tables producing no position.

  • tests/test_register_scan_hardening_138.py L3-4, L381-456

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

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review November 10, 2026 23:45
@sourcery-ai

sourcery-ai Bot commented Nov 10, 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 3 days and 21 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit 749e969 into main Nov 10, 2026
14 checks passed
@brettheap
brettheap deleted the fix/next-free-counts-alias-keys branch November 10, 2026 23:45
brettheap added a commit that referenced this pull request Nov 11, 2026
…eeping both test blocks, #27's first

The merge brings #28, #29, #31 and #33 onto this
branch, on top of the #27 that lane 3 checked at 10799a5.

One conflict, at the end of tests/test_a23_lane_handoff.py: #27
appended its test_the_no_tmux_refusal_names_its_mode_not_both_words block
there, and this branch appended the #118 block (the _closed and _held helpers
and the three test_118 cases) at the same place. Resolved by keeping both,
unchanged and with two blank lines between them: code#27's block first, then
this branch's. No other file conflicted; lane-handoff merged by itself.

The resolved tests/test_a23_lane_handoff.py is blob
3927b53, the blob lane 3 computed on 10799a5.
No commit after 10799a5 on code main touches that file or lane-handoff
(git diff 10799a5 749e969 -- tests/test_a23_lane_handoff.py is empty), so the
blob is the same.

Checked before this commit: bash -n lane-handoff passes; each of the five test
ids of the two blocks passes, run one at a time (2 for code#27's block, 3 for
this branch's).

Lane: openRepoTools-5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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