Skip to content

v0.2: adopt an existing repository in place, reuse an empty root, scaffold a declared descendant - #5

Merged
brettheap merged 9 commits into
mainfrom
v0.2/adopt
Sep 3, 2026
Merged

brettheap merged 9 commits into
mainfrom
v0.2/adopt

Conversation

@brettheap

@brettheap brettheap commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What this does

Adds the ADOPT path: a repository that already exists is converted to the
three-repository shape in place, and two smaller things the same day's
rulings need — reusing an EMPTY repository as an assembly root, and
scaffolding a project that DECLARES descent from a neutral product.

  • adopt-project.py — plan walks a source read-only and classifies
    every top-level path; check validates the plan against the source;
    execute creates the two legs, extracts them with git filter-repo, makes
    ONE split commit on a branch of the source, opens the pull request, and then
    VERIFIES every source path by blob sha.
  • contracts/path-classification.yaml + scripts/path_classify.py —
    ordered path globs to spec | code | root | ambiguous, first match wins,
    each with a reason and, where ambiguous, the question to ask.
  • scripts/shape_materialize.py — the scaffold's materializer, extracted
    so the adopt tool calls the same code instead of a second copy of it.
  • scaffold-project.py --reuse-empty-repo and --pin <openProduct>@<sha>
    (with --pin-source for an offline digest).
  • Naming: form: domain-descendant, role: assembly, referent_declared: true
    is now a VALID classification for an assembly root.

The rulings it serves (Brett Heap, 2026-09-02)

MedxEHR converts IN PLACE: it keeps its name, identity and full history and
becomes the assembly root
; MedxEHR-spec and MedxEHR-code are NEW repos
extracted with history-preserving filters. ONE split commit on the default
branch (by PR, since org rulesets are PR-only).

The source is never deleted, never renamed, never force-pushed, and no
surviving file is ever overwritten — a shape file whose name the source
already holds lands under shape/ and becomes a follow-up.

contracts/*.yaml go to the SPEC leg; code that reads them (validate.py)
must read across via the assembly root mount (../spec/contracts relative to
code/), so the plan records a required follow-up code change and the root
Makefile wires a CONTRACTS_DIR.

plan finds those files with git grep and names them
(code/scripts/validate.py among them); the materialized root Makefile
exports CONTRACTS_DIR ?= $(CURDIR)/spec/contracts. The tool does not make
the edit — naming it is the honest half.

.specify/ and the AI-assistant stub files/dirs stay in the ASSEMBLY ROOT
(project-level workflow tooling spanning both legs).

An assistant reading CLAUDE.md from inside the code leg would be told about
specifications it cannot see.

A declared domain descendant MAY be a three-repo project — the naming
classification must accept form: domain-descendant, role: assembly, referent_declared: true as VALID for an assembly root when the pin is
declared, and the scaffold must be able to REUSE an existing EMPTY
repository
as the assembly root instead of refusing because it exists.

The descendant family declares no roles of its own and now ADMITS the declared
assembly role, in the data (admits_declared_role: [assembly]). The refusal
kept: referent_declared: true with no contracts/<referent>-pin.yaml in the
tree is still a finding. --reuse-empty-repo takes a zero-commit repository;
one with commits is refused and the message names adopt-project.py.

The git filter-repo dependency

execute REQUIRES git filter-repo and preflights for it with an exact
install hint (pip install git-filter-repo, or apt, or brew). It is
deliberately NOT vendored: history extraction has one correct implementation,
and a copy of it is a second one that drifts. CI installs it; the end-to-end
suite skips without it, so the refusal path stays testable on a bare machine
while the real path never quietly stops running.

MedxEHR dry run (local copy of a read-only clone; nothing was pushed)

167 files, 25 commits. Shares by file: spec 13.8%, code 40.7%, root 39.5%,
review 6.0%. .specify/ (43 files) root, contracts/ spec, medx_ehr/ code
by extension majority, openspec/+specs/ spec, .github/ descended into
(workflows to code, CODEOWNERS and copilot-instructions to root), and
examples/golden-run/ + .claude/ flagged for review with their questions.
A local-only end-to-end run into bare repositories verified 29 spec + 68 code

  • 70 root = 167 paths by blob sha, and the adopted root passed its own
    validate-repository-naming.py, validate-manifest.py and validate-pins.py.

Tests

python3 -m pytest tests -q → 215 passed. Everything is local: bare
repositories in a temporary directory, --local-remote-dir for remotes and
--pin-source for pin digests. No gh, no network, no real repository.

Hardening, after the first SonarCloud run

The gate failed on the security rating and it was pointing at something real,
so: git/gh are an allowlist (check_program), every caller-supplied value
that becomes a command argument is validated (checked_value — a leading -
is refused, because git reads its own arguments and --upload-pack=… is a
command, not a branch), the commit message goes in on stdin rather than argv,
CI pins both pip installs, and the two actions are pinned BY COMMIT — which is
the rule this repository spends a whole README section on. Gate now passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ

brettheap and others added 5 commits September 2, 2026 22:22
Ruled by Brett Heap on 2026-09-02, beside the referent rule: descent and the
three-repository shape are INDEPENDENT facts. `MedxGlass` descends from
`openGlass` AND is the assembly root mounting `MedxGlass-spec` and
`MedxGlass-code`. Read as exclusive, the two rulings would have forced every
declared descendant into a one-repository project.

The descendant family still declares no roles of its own — `MedxGlass` and
`MedxGlass-spec` are not the same form — but it ADMITS the declared `assembly`
role, in the data, as `admits_declared_role: [assembly]`. `classify()` reads
that list, so `form: domain-descendant, role: assembly, referent_declared:
true` is now a valid classification for an assembly root, and only when the
pin is DECLARED: the classification is never reached by a claim.

`accepts_role()` in repo_shape is the ONE definition of which forms may serve
a declared role; the scaffold and `validate-manifest.py` both consult it
rather than each carrying their own copy of the answer. `answer()` learned
which matched entry an answer CONSUMES, so a descendant taking the declared
role no longer lists its own family among the forms it did not choose.

KEPT UNCHANGED, deliberately: `referent_declared: true` with no
`contracts/<referent>-pin.yaml` in the tree is still a finding. A pin that is
not in the tree is a claim wearing the costume of a referent.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
THREE THINGS, ONE FILE, because they are the same change to the scaffold.

ONE MATERIALIZER, TWO CALLERS. `scripts/shape_materialize.py` now owns the
copy lists, the renderer, the collision policy and the shape-pin `files:`
block; `scaffold-project.py` calls it and `adopt-project.py` will call the
same code rather than a second copy of it. A second copy is how a project's
shape pin starts digesting a different set of files than the scaffold writes.
It learned ONE thing the scaffold never needed: a template file whose name the
target already holds is written BESIDE the original under `shape/` and
reported, never over it. The scaffold passes no collision directory, so a
collision there still raises — it builds the directory itself, and a
collision would be a defect.

--reuse-empty-repo. An organisation that creates `<org>/<Project>` first and
asks for the shape second is the ordinary case, not a mistake: an EMPTY
repository is a reserved name, and reserving a name is not starting a project.
With the flag, a zero-commit assembly root is used as-is. Without it, the
refusal now NAMES the flag. A repository with commits is still refused — and
the refusal sends the reader to `adopt-project.py`, which is the tool for a
live repository and keeps its name, its identity and its history. The two legs
are never reused: they are created and seeded here, so one that exists is
somebody else's.

--pin <openProduct>@<40 hex> declares a neutral-product pin, writes
`contracts/<openproduct>-pin.yaml` from a new template, and lists the product
in the manifest. That is what turns a `<Domainx><Product>` name from a claim
into a descendant — and, since the ruling that a descendant may carry legs,
`MedxGlass --pin openGlass@<sha>` scaffolds as a descendant WITH `MedxGlass-spec`
and `MedxGlass-code`. The digest is the same `sorted-ls-tree-r-v1` number as
every other pin here, read either from `gh api`'s recursive tree listing (the
same four columns `git ls-tree -r -z` emits, so the two readings agree) or,
with `--pin-source`, from a clone on this machine and no network at all. A
truncated forge listing is refused rather than digested: a digest over a
partial tree is a wrong answer with a confident tone.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
Ruled by Brett Heap on 2026-09-02, for the MedxEHR conversion: the repository
being adopted KEEPS ITS NAME, ITS IDENTITY AND ITS FULL HISTORY and becomes
the assembly root; the two legs are NEW repositories extracted with
history-preserving filters; the only change to the source is ONE split commit,
arriving on a branch and by pull request because these organisations are
pull-request only.

  plan     walks the source read-only, classifies every top-level path
           against `contracts/path-classification.yaml`, and writes
           `adoption-plan.yaml` with a rule, a reason, file and byte counts
           per entry, the follow-ups the split makes necessary, and shares
           per leg.
  check    every source path covered exactly once, no null legs, leg names
           against the naming policy, and what will happen.
  execute  creates the legs, `git filter-repo --paths-from-file`, pushes each
           leg, makes the split commit (git rm the moved paths, mount the two
           legs, write the manifest and the three pins, materialize the shape
           beside anything already holding the name), opens the pull request
           — and then VERIFIES.

AMBIGUOUS IS AN ANSWER, and it is the reason there are three commands rather
than one. The classifier is right about `openspec/` and cannot be right about
`examples/golden-run/` without knowing whether the specification cites it, so
those entries carry `leg: null`, `review_required: true` and the QUESTION to
ask. A human or an AI answers by editing the plan; `execute` REFUSES while any
remain, because an unanswered question is never an implicit `root`.

THE VERIFICATION IS THE PART THAT MAKES THE REST TRUSTWORTHY. Every source
path at the source commit must be in exactly one of {spec leg, code leg, root
tree after the split} BY BLOB SHA, or listed as `drop`. Counting paths would
pass a split that truncated a file; comparing blob shas cannot. A path in two
places is as much a finding as a path in none.

`git filter-repo` is a hard requirement, preflighted with an exact install
hint and deliberately NOT vendored: history extraction has one correct
implementation, and a copy of it is a second one that drifts.

WHAT IS NEVER DONE: the source is never deleted, never renamed, never
force-pushed, and no surviving file is ever overwritten — a shape file whose
name the source already holds is written under `shape/` and the collision
becomes a follow-up the human merges.

The path policy encodes the other two rulings as data: `contracts/**` to the
SPEC leg even though the code reads it (across the root mount, which the plan
records as a required follow-up and the root Makefile wires as CONTRACTS_DIR),
and `.specify/**` plus the ten AI-assistant stubs in the ASSEMBLY ROOT, because
an assistant reading CLAUDE.md from inside the code leg would be told about
specifications it cannot see.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
… moved

AGENTS.md gains the two procedures an assistant is actually asked for. The
adopt one is seven steps and step 4 is the load-bearing one: the AI resolves
every `review_required` entry IN THE PLAN, in writing, with a reason; the
human sees the plan and the follow-ups and says yes; only then `execute`; and
the verification table is read back to them. `--yes` is the human's word, not
the assistant's convenience. The descendant one carries its own refusal: do
not declare a pin the human has not asked for, because a declaration is a
claim about what this project descends from and inventing one puts a false
fact in their tree.

README gains "Adopting an existing repository" with MedxEHR as the worked
example — the three decisions as a table, the cost of the contracts decision
named (`scripts/validate.py` must read across the root, and the tool says so
instead of doing it), the `git filter-repo` dependency, the in-place posture,
and the blob-sha verification.

BOTH CAPS MOVED, and the tests say why: AGENTS.md 80 -> 140 because the file
carries three procedures now, and an adopt procedure living outside the file
an assistant is told to read is an adopt procedure performed from memory;
README 172 -> 245 for a second tool, a second policy file and a worked
example. A cap that never moves for a rule the standard actually gained
pushes the rule into tribal memory; a cap that moves for prose is not a cap.
The README was trimmed back to 245 rather than the cap raised to fit it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
Two halves of one property: the end-to-end adoption tests must RUN, and they
must not fail on a machine that has not installed the tool they exercise.

The suite skips `tests/test_adopt_e2e.py` when `git-filter-repo` is not on
PATH — the refusal it produces is tested separately, in a file that needs no
such tool — and the workflow installs it, so "skipped everywhere" can never
become the quiet steady state. It is a test-environment dependency here in
exactly the way it is a runtime dependency in `adopt-project.py`.

`adopt-project.py` is also chmod +x: the docs say `./adopt-project.py` and a
file that cannot be run that way makes a liar of them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
Copilot AI lite review requested due to automatic review settings September 3, 2026 02:47

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @brettheap, your pull request is larger than the review limit of 150,000 diff characters

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new shared materializer can overwrite files inside the collision directory, and the path-classifier ignores default.leg from the policy data.

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

Pull request overview

Adds v0.2 support for converting an existing repository into the three-repo “assembly/spec/code” shape in place, plus two related features: reusing a zero-commit assembly root repository and scaffolding a project that declares descent from a pinned neutral product.

Changes:

  • Introduce adopt-project.py with plan, check, and execute (including history-preserving leg extraction via git filter-repo and blob-SHA verification).
  • Add neutral-product pin scaffolding (--pin, optional --pin-source) and allow declared descendants to serve as an assembly root carrying legs.
  • Add shared assembly-root materialization (scripts/shape_materialize.py) and path-classification policy + classifier for adoption planning.
File summaries
File Description
tests/test_scaffold_pin_and_reuse.py New tests for --reuse-empty-repo and declared neutral-product pins (--pin, --pin-source).
tests/test_repo_hygiene.py Includes new shipped scripts/modules and updates documentation size caps.
tests/test_naming_policy.py Adds tests for “declared descendant may carry legs” and accepts_role().
tests/test_manifest_validator.py Updates manifest validation expectations for descendant assembly roots and pin-file requirements.
tests/test_adopt_plan.py New tests covering path policy semantics, plan generation, and check refusals.
tests/test_adopt_e2e.py New end-to-end adoption tests (skipped locally without git-filter-repo).
tests/conftest.py Adds synthetic source repo fixture + helpers for adoption tests.
templates/assembly-root/scripts/validate-manifest.py Allows domain-descendant/assembly via shared accepts_role() logic.
templates/assembly-root/project.yaml Makes neutral_product_pins templated.
templates/assembly-root/contracts/neutral-product-pin.yaml New template for per-product neutral pin files.
scripts/shape_materialize.py New shared materializer used by both scaffold and adopt flows.
scripts/repo_shape.py Enhances naming classification and adds accepts_role() helper.
scripts/path_classify.py New policy-driven path classifier backing adopt-project.py plan.
scaffold-project.py Refactors to use shared materializer; adds --reuse-empty-repo, --pin, --pin-source, and GH-based tree digesting.
README.md Documents adoption-in-place and descendant-with-legs behavior.
contracts/repository-naming.yaml Extends naming policy data to admit declared descendant assembly roots.
contracts/path-classification.yaml New data policy defining ordered path classification rules for adoption.
AGENTS.md Updates agent procedures to include adopt + declared descent scaffolding.
adopt-project.py New adoption tool implementing plan/check/execute and verification.
.github/workflows/tests.yml Installs git-filter-repo so adoption E2E tests run in CI.
Review details
  • Files reviewed: 20/20 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +285 to +297
path = target / rel
if path.exists():
if collision_dir is None:
raise Refusal(
"materialize-collision",
f"{path} already exists and this materializer was given no "
"collision directory",
"Remediation: scaffold into an empty directory, or call "
"with collision_dir set (which is what adopt does).")
actual = f"{collision_dir}/{rel}"
result.collisions.append((rel, actual))
path = target / actual
path.parent.mkdir(parents=True, exist_ok=True)
Comment thread scripts/path_classify.py
Comment on lines +178 to +179
return Verdict(None, "default", self.default.get("reason", ""), "low",
self.default.get("question"))
Copilot AI review requested due to automatic review settings September 3, 2026 02:56
…functions

SonarCloud's quality gate failed the first push on the SECURITY rating, and
two of the three findings were worth fixing rather than waving through.

WHAT EXECUTES IS NOW AN ALLOWLIST. `shape_materialize.run()` and
`env_commit()` take argument lists built from values a caller supplies — a
repository name, a path, a commit, and in the adopt tool a plan file an AI may
have written. `shell=False` already kept those values out of a shell; the new
`check_program()` keeps the PROGRAM out of the caller's hands too: `git` and
`gh`, or a refusal that says the fault is in the tool rather than in the
invocation. Two constraints, not one.

CI PINS BOTH INSTALLS (`pytest==8.3.4`, `git-filter-repo==2.47.0`). A job that
resolves "latest" on every run is a job whose result depends on the day it
ran, which is the same objection this standard makes to pinning a tag instead
of a commit.

FOUR FUNCTIONS SPLIT, at the boundaries they already had comments for:
`cmd_check` sheds `_coverage_findings`, `_leg_findings` and
`_print_what_will_happen`; `cmd_execute` sheds `_refuse_an_unrunnable_plan`,
`_create_leg_remotes`, `_extract_leg` and `_mount_the_legs`; `_verify` sheds
`_account_for`; `PathPolicy.__init__` sheds `_compiled_rule`. Each extracted
piece is one answerable question, and the ones that were only readable because
a `# ----` comment said where to look now say it in their names.

Also: two duplicated literals became the constants they should have been
(`VALIDATE_NAMING`, `NAMING_POLICY`/`PATH_POLICY`), an f-string with no fields
lost its `f`, a slice comparison became the equality it was, and a composite
test assertion became two.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
…commit

ARGUMENT INJECTION, NOT SHELL INJECTION. Every command these tools run is a
list with `shell=False`, so there is no shell to inject into — but git reads
its OWN arguments, and a `--tracking-branch` of `--upload-pack=…` is a command
rather than a branch. `repo_shape.checked_value()` refuses a leading `-`
outright and then requires the value to be spellable as a branch name, a path,
a repository name or a commit.

WHERE IT IS APPLIED, and why each one is a real source: `--project`, `--org`,
`--id`, `--tracking-branch`, `--spec-path` and `--code-path` on both tools —
and, in `adopt-project.py`, the leg names, the branch, the paths and the
organisation READ OUT OF THE PLAN. The plan is untrusted input by
construction: it is written by `plan`, edited between `plan` and `execute` by
a human or by an AI assistant, and every path in it becomes an argument to
`git rm` and to `git filter-repo`. That is exactly why this is a check in the
code and not a note in the README.

THE ACTIONS ARE PINNED BY COMMIT, which is the rule this repository spends a
whole README section on: a tag can be moved and a commit cannot. `@v4` and
`@v5` became their commits with the tag kept as a trailing comment, so the
next reader can still see which release it is.

Three tests: a branch name that is a git option, a leg path with a shell
metacharacter, and a plan path rewritten to `--output=/tmp/pwned` — all three
refused before any repository is created.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

scripts/shape_materialize.py can overwrite an existing shape/<rel> collision target because it doesn’t guard against collisions inside collision_dir, contradicting the “nothing is overwritten” guarantee.

Review details

Suppressed comments (1)

scripts/shape_materialize.py:334

  • When a template path collides, the materializer writes under collision_dir (e.g. shape/README.md) but it does not check whether that collision target already exists. If the source repo already has shape/<rel>, this would overwrite an existing file even though the docs guarantee “nothing is overwritten.”
        path = target / rel
        if path.exists():
            if collision_dir is None:
                raise Refusal(
                    "materialize-collision",
                    f"{path} already exists and this materializer was given no "
                    "collision directory",
                    "Remediation: scaffold into an empty directory, or call "
                    "with collision_dir set (which is what adopt does).")
            actual = f"{collision_dir}/{rel}"
            result.collisions.append((rel, actual))
            path = target / actual
        path.parent.mkdir(parents=True, exist_ok=True)
  • Files reviewed: 20/20 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 3, 2026 03:00
`git commit -q -F -` reads the message from STDIN, so every argument of the
one remaining command that carried a caller-supplied value is now a literal.

The value in question is the commit message: a project's display name in the
scaffold, and in an adoption every moved path, read out of a plan file that a
human or an AI edited. `-m <message>` was already safe — these commands are
lists with `shell=False`, and the value sat after `-m` where git cannot read
it as an option — but "safe because of where it sits in argv" is an argument
the next reader has to re-derive, and not putting it there at all is one
fewer thing to be right about. It is also what SonarCloud's taint analysis
was pointing at, and the analyser was pointing at something real even though
the exploit was not.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

There are confirmed security/correctness issues in the new shared materializer and adoption planner that can overwrite existing files and mishandle git-argument safety unless fixed.

Review details

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

adopt-project.py:305

  • git grep is invoked with the pattern passed positionally. If a source directory name ever begins with - (allowed by git), it can be interpreted as an option (argument injection) rather than a pattern. Also, errors from git grep (return code > 1) are currently ignored, which can silently drop required follow-ups.

scripts/shape_materialize.py:334

  • place() redirects a colliding template path to collision_dir, but it doesn’t check whether the redirected destination already exists (e.g., the source repo already contains shape/README.md). In that case, this would overwrite an existing file, contradicting the “nothing was overwritten” guarantee and potentially losing history/context.
        """Write `rel`, or, if it is taken, the same name under `collision_dir`."""
        path = target / rel
        if path.exists():
            if collision_dir is None:
  • Files reviewed: 20/20 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 3, 2026 03:04
`_scaffold` is a linear procedure and reads top to bottom on purpose, but the
two blocks added here — resolving every `--pin` to a digest, and deciding
which existing remotes may be reused — are each one answerable question and
neither is part of that line. `declared_pin_values()` and
`_reusable_remotes()` now hold them, and the reuse rule (only the assembly
root, only with the flag, only with zero commits) is stated where it is
enforced rather than three screens above.

The local and the GitHub branches of the existence check were also the same
loop written twice, differing only in how they ask "does this exist and is it
empty". They are one loop now, and a third way to answer that question would
have made the duplicate cost real.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HGKwdQsmvRZx4fGQESdFGZ
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A few confirmed issues (silent duplicate --pin overwrite, misleading reuse output in local mode, and a hard-coded developer-specific test path) should be addressed before approval.

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

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

tests/test_adopt_plan.py:30

  • This test hard-codes a developer-specific absolute path (/tmp/claude-1000/-home-brett-…) for the optional MedxEHR clone. Even though it’s guarded by skipif, it bakes personal/local machine details into the repo and makes it hard for others to opt into running the test on their own clones.
  • Files reviewed: 20/20 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread scaffold-project.py
Comment on lines +262 to +265
else:
digest = pin_digest_from_gh(repository, commit)
digest_source = "gh-api-tree-recursive"
pins[product] = {
Comment thread scaffold-project.py
Comment on lines 511 to +515
for role in ("spec", "code", "assembly"):
if role in reused:
print(f" reused {repositories[role]} (created by somebody else, "
"zero commits)")
continue
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