Skip to content

The optional MedxEHR clone comes from SHAPE_MEDXEHR_CLONE, and a guard keeps host paths out of the tree (#61) - #64

Merged
brettheap merged 2 commits into
mainfrom
fix/medxehr-clone-env
Sep 6, 2026
Merged

brettheap merged 2 commits into
mainfrom
fix/medxehr-clone-env

Conversation

@brettheap

@brettheap brettheap commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Lane: xfactory-2 (xFactory-2)
Claim: #61 (claim comment on the issue)

Closes #61.

What this changes

The optional MedxEHR clone comes from an environment variable, and a guard keeps host paths out of the tree. Brett Heap, 2026-09-05, in session: "file the env var fix as a follow-up", then "pick up #61 and merge on green too".

  • tests/test_adopt_plan.py read a hard-coded /tmp/claude-1000/…/adopt-inventory/MedxEHR — one machine's scratchpad from one session (6013a5b, 2026-09-02) — for the optional read-only clone the MedxEHR-backed plan test copies before use. It now reads SHAPE_MEDXEHR_CLONE (the SHAPE_* family is this repository's convention), with deliberately no default, and skips with a message naming the variable when it is unset or names no directory. What the test checks is unchanged.
  • tests/test_repo_hygiene.py gains a guard: no committed text file contains a host-absolute path (/home/<user>/, /tmp/claude-, /Users/<name>/, C:\Users\). Rule 1 of the estate's agent instructions says why — a path baked into a committed file breaks silently when the repository moves — and tests/test_adopt_plan.py names one machine's scratchpad; the optional MedxEHR clone should come from an environment variable #61 was the one instance this tree had. The guard was shown to bite on an injected path before landing.

No shipped code changes; README and AGENTS.md untouched, caps unchanged.

Evidence

Linux: python3 -m pytest tests -q — 611 passed, 1 skipped (612 collected: the new guard passes; the MedxEHR-backed test now skips here because SHAPE_MEDXEHR_CLONE is unset, where before it ran against a leftover scratchpad directory that happened to exist on this machine, which is the point) (611 on main at 6942d83; the MedxEHR-backed test skips as before, now naming the variable). macOS and Windows: the tests-macos and tests-windows jobs on this PR.

Merge word: Brett Heap, 2026-09-05, "pick up #61 and merge on green too".

🤖 Generated with Claude Code

Summary by Sourcery

Remove the machine-specific MedxEHR test path and enforce repository hygiene against committed host-absolute paths.

Bug Fixes:

  • Make the optional MedxEHR-backed test use the SHAPE_MEDXEHR_CLONE environment variable and skip clearly when the clone is unavailable.
  • Prevent committed text files from containing host-absolute paths.

Tests:

  • Add repository hygiene coverage that detects host-specific absolute paths in tracked text files.

…d keeps host paths out of the tree (#61)

Brett Heap, 2026-09-05: "file the env var fix as a follow-up", then "pick up
#61 and merge on green too".

tests/test_adopt_plan.py read a hard-coded scratchpad path from one machine
and one session (6013a5b, 2026-09-02) for the optional read-only clone of
MedxSoft/MedxEHR that the plan test copies before use; the test skipped
everywhere else, so the suite stayed green and nobody else could ever opt in.
It now reads SHAPE_MEDXEHR_CLONE, this repository's SHAPE_* convention, with
deliberately no default, and skips with a message naming the variable when
it is unset or names no directory. What the test checks is unchanged.

tests/test_repo_hygiene.py gains a guard: no committed text file names a
host-absolute path (/home/<user>/, the Claude scratchpad tmp prefix,
/Users/<name>/, C:\Users\<name>\). Rule 1 of the estate's agent instructions
is the reason, and #61 was the one instance this tree had. Tightened against
what the tree legitimately carries: the Windows examples with a space in the
username, and the GitHub-hosted runner's own account; the guard spells its
own trigger prefix in two pieces so it does not flag itself. Shown to bite on
an injected path before landing.

No shipped code changes; README and AGENTS.md untouched. 611 passed, 1
skipped on Linux (612 collected).

Lane: xfactory-2 (xFactory-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 6, 2026 02:34
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@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, you've used your own review budget of 250,000 diff characters for the last 7 days.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sourcery-ai

sourcery-ai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR removes a machine-specific MedxEHR fixture path in favor of the SHAPE_MEDXEHR_CLONE environment variable and adds a hygiene test that prevents host-absolute paths from being committed in tracked text files.

File-Level Changes

Change Details Files
Make the optional MedxEHR-backed test portable by sourcing its clone location from an explicit environment variable.
  • Import the environment API and read SHAPE_MEDXEHR_CLONE without a fallback path.
  • Skip the integration-style test when the variable is unset or does not name an existing directory, with an actionable reason.
  • Preserve the existing copy-before-use behavior and test assertions.
tests/test_adopt_plan.py
Add repository hygiene coverage that rejects committed text containing host-specific absolute paths.
  • Define a regex for Unix, Claude scratchpad, macOS, and non-runner Windows user paths.
  • Enumerate tracked files via git, scan UTF-8-decoded contents, and report offending files.
  • Ignore undecodable files and structure the detector to avoid matching its own documented examples.
tests/test_repo_hygiene.py

Assessment against linked issues

Issue Objective Addressed Explanation
#61 Use the SHAPE_MEDXEHR_CLONE environment variable, with no default path, to locate the optional MedxEHR clone. ✅
#61 Skip the MedxEHR-backed test with a message naming SHAPE_MEDXEHR_CLONE when the variable is unset or the specified directory is missing, while leaving the test's behavior otherwise unchanged. ✅
#61 Remove the committed host-specific absolute path and prevent similar host-absolute paths from being added to tracked text files. ✅

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

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 MedxEHR test skip condition checks exists() rather than is_dir(), so an env var pointing at an existing file would run the test and fail at copytree().

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

Pull request overview

This PR addresses #61 by removing a machine-specific hardcoded MedxEHR clone path from the test suite and adding a repository hygiene guard to prevent committing host-absolute paths into tracked text files.

Changes:

  • Make the optional MedxEHR-backed adoption-plan test read its clone location from SHAPE_MEDXEHR_CLONE and skip when unavailable.
  • Add a hygiene test that scans git ls-files tracked UTF-8 text for common host-absolute path patterns (Linux/macOS/Windows), excluding known safe cases.
File summaries
File Description
tests/test_adopt_plan.py Replaces a hardcoded scratchpad path with SHAPE_MEDXEHR_CLONE and updates the skip logic/message.
tests/test_repo_hygiene.py Adds a new hygiene test and regex guard to prevent host-absolute paths from being committed in tracked UTF-8 text files.
Review details
  • Files reviewed: 2/2 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.

Comment thread tests/test_adopt_plan.py Resolved
…says (Copilot on #64)

Copilot's one finding on PR #64: the skip condition tested exists() while
its reason said the variable must name a directory; a SHAPE_MEDXEHR_CLONE
pointing at a file would have run the test into copytree() instead of
skipping. One word. Verified: a variable naming a regular file now skips
with the same message.

Lane: xfactory-2 (xFactory-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 6, 2026 02:41
@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 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.

🟢 Approval recommended

The changes are confined to tests, align with the stated issue/requirements, and the added guard appears consistent with existing repository content and CI portability goals.

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

@brettheap
brettheap merged commit b17ede6 into main Sep 6, 2026
6 checks passed
@brettheap
brettheap deleted the fix/medxehr-clone-env branch September 6, 2026 02:47
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.

tests/test_adopt_plan.py names one machine's scratchpad; the optional MedxEHR clone should come from an environment variable

2 participants