Skip to content

Name the Hub From Its Constant Everywhere, and Say Which Checkout the Menu Filters For - #1427

Merged
ptr727 merged 3 commits into
developfrom
fix/hub-name-and-menu-grammar
Sep 7, 2026
Merged

ptr727 merged 3 commits into
developfrom
fix/hub-name-and-menu-grammar

Conversation

@ptr727

@ptr727 ptr727 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Answers three findings raised on promotion PR #1426, whose head is develop, so they land here
first.

The hub's name, in five places rather than one

The finding was that carry.py's tree-carry guard tests name == HUB_NAME and then names the hub
as a literal in the message it raises. Fixing that line alone would have left the worse instance
standing: verify_hub resolved the registry entry by literal too, so renaming the hub would have
failed there, in every mode, before ever reaching the guard the finding was about. The
origin-mismatch message beside it had the same shape.

Both menus hard-coded the slug in a section header while holding it in HUB_REPO two lines above,
so any fork would render two different hub names on one screen. Verified by rendering the menu
rather than by reading it:

Hub:        ptr727/ProjectTemplate (/home/pieter/repos/worktrees/ProjectTemplate-menu-grammar)
...
Hub, ptr727/ProjectTemplate:

A guard with no test

The guard whose message this change edits had none, because it sits behind verify_hub and a unit
test would have needed a real hub checkout to reach it. It is now refuse_hub_tree_target,
exercised directly, and the test fails when the guard is removed. Its sibling in run_sections
already had one, so this was the untested half of a matched pair.

The usage sentence, rewritten once more

"Each is shown the tasks that apply to it" leaves "each" pointing at nothing the preceding sentence
named, which is what the reviewer read as a missing subject. It now names the referent: "Only the
tasks that apply to that checkout are shown." The local review pass was asked specifically whether
this wording is correct and unambiguous rather than for another variant, since the sentence has now
been rewritten twice, and it confirmed the referent binds and that the claim matches what the
menus actually do.

🤖 Generated with Claude Code

… Menu Filters For

Two findings from the promotion pull request's review, and the class behind them.

The tree-carry guard tested `name == HUB_NAME` and then named the hub as a
literal in the message it raised. Fixing only that line would have left the
worse instance standing: `verify_hub` resolved the registry entry by literal
too, so a rename would have died there, in every mode, before reaching the guard
the finding was about. Both now read the constant, as does the origin-mismatch
message beside them. Both menus hard-coded the slug in a section header while
holding it in `HUB_REPO` two lines above, which rendered two different hub names
on one screen for any fork. They read the variable now, verified by rendering
the menu.

The guard itself had no test, since it sits behind `verify_hub` and a unit test
would have needed a hub checkout to reach it. It is now
`refuse_hub_tree_target`, exercised directly, and the test fails when the guard
is removed.

Both menus close their usage text on a sentence whose subject a reader cannot
resolve. "Each is shown the tasks that apply to it" leaves "each" pointing at
nothing the preceding sentence named, which is what the reviewer read as a
missing subject. It now says which checkout is meant.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings September 7, 2026 21:43
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 4e5b8725-976a-4e3e-9f76-8708cdc01e40


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are small, well-scoped, and add test coverage for the newly extracted guard without introducing risky behavior.

Pull request overview

This PR removes hard-coded references to the hub name by routing lookups and user-facing messages through shared constants, adds a direct unit test for the hub-tree target refusal guard, and updates the host-setup menus to show which tasks apply to the current checkout.

Changes:

  • Use HUB_NAME consistently for hub registry resolution and related error messages in scripts/carry.py.
  • Factor the hub tree-target refusal into refuse_hub_tree_target() and add a unit test covering the opt-in behavior.
  • Update the Bash and PowerShell menus to use the hub repo variable in the “Hub, …” section header and clarify the usage sentence.
File summaries
File Description
scripts/tests/test_carry.py Adds a focused unit test for the hub-as-tree-target refusal logic.
scripts/carry.py Replaces hub-name literals with HUB_NAME and extracts the hub tree-target guard into a testable helper.
host-setup/menu.sh Clarifies usage text and uses $HUB_REPO in the hub menu header.
host-setup/menu.ps1 Clarifies usage text and uses the hub repo variable in the hub menu header.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread host-setup/menu.ps1 Resolved
`menu.ps1` runs under `Set-StrictMode -Version Latest` and every other reference
to this variable inside a function qualifies it, including the header line
twenty-five lines above this one. The unqualified form resolves the same today
and stops resolving the moment any local of that name is introduced.

Demonstrated rather than assumed, since the menu itself does not start on this
host:

    unqualified   -> Hub, local-shadow/wrong:
    script-scoped -> Hub, ptr727/ProjectTemplate:

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings September 7, 2026 21:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The newly added unit test reintroduces a hard-coded hub name string instead of deriving it from carry.HUB_NAME, which makes the test fragile to the renaming this PR is standardizing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread scripts/tests/test_carry.py Resolved
The test added for `refuse_hub_tree_target` pinned the hub's name as a literal
in the message it expects, which is the hard-coded name the guard's own message
was changed to stop carrying. It reads the constant now, escaped, since the
expectation is a regular expression rather than a plain string.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings September 7, 2026 21:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes consistently remove hard-coded hub naming, add direct regression coverage for the extracted guard, and keep behavior changes narrowly scoped to messaging and menu rendering.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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.

2 participants