Repository navigation
adopt execute and family init set the xf-project-<id> topic, as the scaffold does - #24
Conversation
…caffold does README promises that every repository of a project carries the GitHub topic `xf-project-<id>`, and only one of the three creating tools kept the promise. `scaffold-project.py` prints a `topics` plan line and runs `gh repo edit --add-topic` on all three repositories, guarded by `not local`. `adopt-project.py execute` recorded `TOPIC` in the manifest — so `validate-manifest.py` was satisfied — and set the topic on nothing; `scripts/family.py init` created the holder and set no topic at all. Verified on 2026-09-04: the SCAFFOLDED MedxSoft/MedxGlass carries `xf-project-medxglass`, while the adopted MedxSoft/MedxEHR, InkRouter/IRRS, InkRouter/IRSS and the family holder InkRouter/InkRouter carry none — exactly the scaffold/other split. Both tools now mirror the scaffold and nothing more: - adopt `execute` prints the `topics` plan line before it asks for the human's yes, and after the split branch is pushed and the pull request is opened it sets the topic on the assembly root and both legs. The adopted root pre-existed, and it gets the topic too: it IS the project's assembly root and its own `project.yaml` already claims the topic. `check` prints the same line in WHAT WILL HAPPEN, so the human reads it before saying yes. - family `init` prints the plan line and sets `xf-project-<family-id>` on the holder after the push, via the `NamingPolicy` it already loaded. The topic is derived in one place — `Plan.project_id` feeds both the manifest's `TOPIC` and the `gh` call — so the two can never disagree. No template and no manifest change; the family manifest still has no `topic` field. Four tests, none of which calls `gh`: the local adopt execute and the local family init print `topics ... skipped for local remotes` and invoke nothing, and the two paths that reach a plan print with no network — `adopt check` against a local source, and `family init --dry-run` with no `--local-remote-dir` — assert the real `gh repo edit --add-topic xf-project-<id>` line. 349 -> 353 tests, all passing. Closes #21. The four repositories that exist without a topic today (MedxEHR, IRRS, IRSS, InkRouter) still need theirs set by hand. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
Reviewer's GuideThe PR brings adopt-project.py and family.py init into alignment with the scaffold by deriving and planning xf-project- topics, applying them to the appropriate repositories only for real remotes, and adding offline tests covering the plans and guards. Sequence diagram for applying project topics during adoptionsequenceDiagram
participant Operator
participant AdoptProject
participant GitHub
Operator->>AdoptProject: execute
AdoptProject->>AdoptProject: Plan.project_id
AdoptProject->>AdoptProject: NamingPolicy.topic_for(project_id)
AdoptProject-->>Operator: topics gh repo edit --add-topic topic on all three
Operator->>AdoptProject: confirm
AdoptProject->>GitHub: gh repo edit assembly --add-topic topic
AdoptProject->>GitHub: gh repo edit spec --add-topic topic
AdoptProject->>GitHub: gh repo edit code --add-topic topic
AdoptProject-->>Operator: topic set on all three
Sequence diagram for family holder topic initializationsequenceDiagram
participant Operator
participant FamilyInit
participant GitHub
Operator->>FamilyInit: init
FamilyInit->>FamilyInit: NamingPolicy.topic_for(family_id)
FamilyInit-->>Operator: topics gh repo edit --add-topic topic
FamilyInit->>GitHub: gh repo edit holder --add-topic topic
FamilyInit-->>Operator: topic set on the holder
Flow diagram for skipping topic updates on local remotesflowchart TD
Start[adopt execute or family init] --> Plan[Print topic plan]
Plan --> Remote{local remotes?}
Remote -->|Yes| Skip[Skip gh repo edit]
Remote -->|No| Apply[Apply xf-project-id topic]
Skip --> Done[Continue without network calls]
Apply --> Done
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="adopt-project.py" line_range="1267-1269" />
<code_context>
f"--base {tracking} --head {branch}", file=sys.stderr)
return 2
+ # ---- the topic, on all three --------------------------------------
+ # The assembly root pre-existed and is still a repository OF THIS
+ # PROJECT: `project.yaml` claims `topic: <topic>` either way, and a
+ # claim the organisation cannot see is the defect being fixed here.
+ for role in ("assembly", "spec", "code"):
+ run(["gh", "repo", "edit", repositories[role], "--add-topic",
+ topic])
+ print(f" topic {topic} set on all three")
+
</code_context>
<issue_to_address>
**issue (bug_risk):** A failure from any new `gh repo edit` call raises `CommandFailed` uncaught, so `execute` terminates with a traceback after the pull request is created, stops before updating the remaining repositories, and never reaches verification.
**Triggers:** When GitHub rejects one topic update, such as because of insufficient permission or a transient API failure.
**Suggested fix:** Catch `CommandFailed` around the topic-update loop, report which repository failed, and return the command's documented failure status without an uncaught traceback.
```suggestion
try:
for role in ("assembly", "spec", "code"):
run(["gh", "repo", "edit", repositories[role], "--add-topic",
topic])
except CommandFailed as exc:
print(exc.loudly(
f"updating the topic on {repositories[role]}"),
file=sys.stderr)
return 2
```
</issue_to_address>
### Comment 2
<location path="scripts/family.py" line_range="506-508" />
<code_context>
return 2
head = git_out(["rev-parse", "HEAD"], cwd=work)[:12]
print(f" holder {head} -> {url}")
+ if not local:
+ run(["gh", "repo", "edit", repository, "--add-topic", topic])
+ print(f" topic {topic} set on the holder")
if not local and args.visibility in ("private", "internal"):
print(f"NOTE {repository} is {args.visibility} and its members will "
</code_context>
<issue_to_address>
**issue (broader_impact):** `init --no-push` still runs `gh repo edit --add-topic` for a real remote even though it deliberately skipped pushing the holder commit, so the command performs a remote mutation despite its no-push mode and diverges from the scaffold's topic guard.
**Triggers:** When `family.py init` is run with `--no-push` and without a local remote directory.
**Suggested fix:** Guard the topic update with `if not local and not args.no_push:` and report that it was skipped when pushing is disabled.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if the derived topic is wrong or the GitHub commands partially fail, repository metadata can be left inconsistent across the three repositories and will remain after reverting this code. The topic can be removed or corrected with another repository-metadata operation, so the impact is bounded and repairable.
Blocking findings: adopt-project.py:1269, scripts/family.py:508
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if not local: | ||
| run(["gh", "repo", "edit", repository, "--add-topic", topic]) | ||
| print(f" topic {topic} set on the holder") |
There was a problem hiding this comment.
issue (broader_impact): init --no-push still runs gh repo edit --add-topic for a real remote even though it deliberately skipped pushing the holder commit, so the command performs a remote mutation despite its no-push mode and diverges from the scaffold's topic guard.
Triggers: When family.py init is run with --no-push and without a local remote directory.
Suggested fix: Guard the topic update with if not local and not args.no_push: and report that it was skipped when pushing is disabled.
There was a problem hiding this comment.
🟡 Changes recommended
Plan.project_id reads an editable plan id without re-validating it, which can produce invalid topics/manifest values despite the tool treating the plan as untrusted input.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR aligns adopt-project.py execute and scripts/family.py init with scaffold-project.py by planning and (when not using local remotes) applying the xf-project-<id> GitHub topic via gh repo edit --add-topic, ensuring repositories can be listed/grouped by project consistently with the README promise.
Changes:
- Add a “topics …” plan line to
adopt check/executeandfamily initoutput, mirroring the scaffold behavior and preserving offline/no-network testability via local-remote guards. - Set the
xf-project-<id>topic on GitHub afteradopt executeopens the PR (assembly + spec + code) and afterfamily initpushes the holder (holder repo). - Add offline tests asserting the plan-line behavior and local-remote “skipped” behavior without invoking
gh.
File summaries
| File | Description |
|---|---|
| adopt-project.py | Adds topic planning output and applies the topic to all three repos post-PR creation; centralizes topic derivation via Plan.project_id. |
| scripts/family.py | Plans and applies the holder topic (xf-project-<family-id>) when not using local remotes. |
| tests/test_adopt_plan.py | Verifies adopt check prints the topic plan line (“… on all three”) offline. |
| tests/test_adopt_e2e.py | Verifies local-remote adopt execute prints “topics skipped…” and never mentions gh repo edit. |
| tests/test_family.py | Verifies family init topic plan line behavior for local remotes and real-org dry runs without network calls. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @property | ||
| def project_id(self) -> str: | ||
| """The lowercase machine name. The GitHub topic is derived from it, | ||
| both for the manifest's `TOPIC` and for `gh repo edit --add-topic`, | ||
| so it is read in ONE place rather than spelled out at each.""" | ||
| return str(self.get("id", self.names()["assembly"].lower())) |
Sourcery, on #24: the new `gh repo edit --add-topic` loop raised `CommandFailed` out of `cmd_execute`. `main()` catches it and exits 2 with the loud command report, so it was never a traceback — but by then the split is pushed and the pull request is open, and what the failure DID cost is the blob-sha verification table, which is the report AGENTS.md step 7 tells the human to read back. Losing the accounting for every source path because GitHub rate-limited a metadata call is the more expensive failure. So the loop is caught: the failure is reported loudly with the three commands to finish it by hand, verification still runs and still prints, and the run still exits non-zero afterwards. A verification mismatch outranks a missing topic and keeps exit 1. Left as it stands, from the same review: `family.py init --no-push` sets the topic on a real remote. `gh repo create` has already made the repository by then whether or not the commit is pushed, and `scaffold-project.py` — the tool both of these mirror — sets its topics guarded by `not local` alone. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
There was a problem hiding this comment.
🔵 Needs a closer look
adopt-project.py currently allows an unvalidated plan id to flow into gh repo edit argv (topic argument), and family.py init should provide a clearer remediation message on topic-setting failures.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/family.py:508
- If
gh repo edit --add-topicfails (permissions, rate limit, etc.),cmd_initcurrently exits via the generic top-levelCommandFailedhandler and does not tell the user that the holder has already been created/pushed and how to finish setting the topic manually.
adopt-project.py:737
Plan.project_idcan come from an edited YAML plan (id:) but is not validated before it is used to build the GitHub topic that is passed as an argv element togh repo edit. A crafted value (e.g. starting with '-') can be interpreted as an extra flag bygh, contradicting the nearby guarantee that plan values are validated before reaching git/gh.
def project_id(self) -> str:
"""The lowercase machine name. The GitHub topic is derived from it,
both for the manifest's `TOPIC` and for `gh repo edit --add-topic`,
so it is read in ONE place rather than spelled out at each."""
return str(self.get("id", self.names()["assembly"].lower()))
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
Copilot, on #24: `Plan.project_id` read the plan's editable `id:` without re-checking it, and the value now reaches a `gh repo edit --add-topic` command line as well as the rendered manifest. `plan` refuses a bad `--id`, but the plan is edited between `plan` and `execute` on purpose — which is the tool's own stated reason for validating every plan value where it is USED rather than trusting the file it wrote. So the property refuses an `id:` that is not `^[a-z0-9][a-z0-9-]*$`, in the spelling `plan` already uses, and says the topic is derived from it. It is a refusal rather than a finding, exactly as an unsafe leg name in the same file already is. A topic that disagrees with contracts/repository-naming.yaml is one the project's OWN gate refuses later, in `validate-repository-naming.py`, long after the run that set it. One test, offline as ever: an `id:` edited to `Northwind` after `plan` wrote `northwind` is refused by `check` with `plan-bad-id`. Lane: repo-shape Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
|
|
(lane repo-shape, 2026-09-04T05:11:59Z) The by-hand follow-on this body mentions is already DONE: the manifest-declared topic was set on MedxEHR, IRRS, IRSS and their six legs and on the InkRouter holder before this PR opened — see #21 (comment). This PR is what keeps the gap from reopening. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, guarded for offline/local operation, and includes targeted tests that validate the new planning behavior without introducing network dependencies.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
| command line and a written manifest, and a topic that does not match | ||
| `contracts/repository-naming.yaml` is one `validate-repository-naming.py` | ||
| will refuse in the project's own gate, long after the run that set it. |
…dex-first) into fix/reference-by-election-date One conflict, in adopt-project.py _template_values: main derives project_id via plan.project_id (#24); this branch reads elected_on once beside it. Both kept. Lane: codex-intake-shape Co-Authored-By: Claude Fable 5.1 <[email protected]>



Lane: repo-shape
Claim: #21 (comment)
README line 99 promises that every repository of a project "carries the GitHub topic
xf-project-<id>". One of the three creating tools kept that promise.What the scaffold does.
scaffold-project.pyprints atopicsline in its plan and, after the pushes, runsgh repo edit <repo> --add-topic xf-project-<id>on the assembly root and both legs, guarded bynot localso the offline test path calls nothing.What the other two did not.
adopt-project.py executerecordedTOPICin the assembly root'sproject.yaml— sovalidate-manifest.pywas satisfied — and set the topic on nothing: not on the adopted root, not on the two legs it creates.scripts/family.py initcreated the holder and set no topic at all. Verified on 2026-09-04 withgh repo view --json repositoryTopics: the SCAFFOLDEDMedxSoft/MedxGlasscarriesxf-project-medxglass, while the adoptedMedxSoft/MedxEHR,InkRouter/IRRS,InkRouter/IRSSand the family holderInkRouter/InkRoutercarry none — exactly the scaffold/other split.What changed. Both tools mirror the scaffold, and nothing more.
adopt-project.py:executeprints thetopicsplan line before it asks for the human's yes, and after the split branch is pushed and the pull request is opened it sets the topic on assembly + spec + code and printstopic <topic> set on all three. The adopted root pre-existed and gets the topic too — it IS the project's assembly root, and its own manifest already claims the topic.checkprints the same line inside WHAT WILL HAPPEN, so the human reads it before saying yes. The id is derived in ONE place (Plan.project_id), which feeds both the manifest'sTOPICand theghcall, so the two cannot disagree. The top-of-file docstring'sexecutestep now says so.scripts/family.py:initprints the plan line and, after the holder is pushed, setsxf-project-<family-id>on the holder via theNamingPolicyit had already loaded. Both new calls are guarded bynot local.topicfield.What the tests prove. Four new tests, none of which calls
ghor touches the network:test_execute_plans_the_topic_and_skips_it_against_local_remotes— the local adoption printstopics skipped for local remotesand never spellsgh repo edit.test_init_plans_the_topic_and_skips_it_against_local_remotes— the same for the family holder.test_check_plans_the_topic_on_all_three—adopt checkruns against a local source and calls nothing, so the REAL plan line is assertable offline:topics gh repo edit --add-topic xf-project-northwind on all three.test_init_dry_run_plans_the_gh_topic_command_for_a_real_org—family.py init --dry-runwith no--local-remote-dirreaches the plan print before anything is created, so it assertstopics gh repo edit --add-topic xf-project-contoso.python3 -m pytest tests -q: 354 passed (349 before), the way CI runs it, withgit-filter-repoinstalled so the adoption suite actually runs.Two review follow-ups on this branch.
b6cbdd9: agh repo editthat fails no longer suppresses the blob-sha verification table — the failure is reported loudly with the commands to finish by hand, verification still prints, and the run still exits non-zero (a verification mismatch outranks a missing topic).e3012c0:Plan.project_idre-validates the plan's editableid:against^[a-z0-9][a-z0-9-]*$where the topic is derived from it, since the value now reaches aghcommand line — plus the test for it, which is the 354th.One finding left as it stands:
family.py init --no-pushsets the topic on a real remote.gh repo createhas already made the repository by then whether or not the commit is pushed, andscaffold-project.py— the tool both of these mirror — guards its own topic block withnot localalone.Closes #21.
Still needed by hand (the issue's own follow-on, not this PR): the four repositories that exist without a topic today —
MedxSoft/MedxEHR,InkRouter/IRRS,InkRouter/IRSSandInkRouter/InkRouter— get theirs set by an operator. This PR changes code only and touched no real repository.🤖 Generated with Claude Code
https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T