Skip to content

fix: stage nested feature dirs and deleted test cases - #114

Open
Benkapner wants to merge 4 commits into
mainfrom
fix/publish-nested-feature-dir
Open

Benkapner wants to merge 4 commits into
mainfrom
fix/publish-nested-feature-dir

Conversation

@Benkapner

@Benkapner Benkapner commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

publish-artifacts joined the git root with the feature basename. Skills pass basename "$feature_dir", so the default ~/Code/opendatahub-test-plans/plans/<feature> layout looks for <repo>/<feature>/TestPlan.md and fails. The same helper only git adds files that still exist, so a deleted test case never lands in the commit and the next safe-checkout dies on a dirty tree.

Accept a basename, repo-relative path, or absolute path inside the repo, and stage deleted test_cases/*.md files as well as added/modified ones. The three calling skills now pass $feature_dir.

The GitLab generator publish path is unchanged. This is the local skill flow.

Related Issue

None — opened directly as a bug fix.

Changes

  • Resolve the feature argument relative to the git root in stage_artifacts.
  • Stage direct-child <feature>/test_cases/*.md additions, modifications, and deletions (tracked deleted files via git ls-files --deleted). Non-Markdown files and nested directories under test_cases/ are never staged.
  • Pass $feature_dir from test-plan-publish, test-plan-case-implement, and test-plan-resolve-feedback.

Testing

  • Focused tests: tests/unit/test_repo_stage.py, including a regression test that debug.json and draft/secret.env stay unstaged while a deleted TC is staged.
  • Full suite: 1,616 passed, 2 skipped.
  • uv run --extra dev pre-commit run --all-files
  • make lint

Verified the new nested-path and deleted-TC tests fail before the fix.

Full suite command:
uv run pytest tests/ -q --cov=scripts --cov-report=term-missing --cov-fail-under=70

make lint passes with an existing warning about the removed content-critical-position rule in .skillsaw.yaml.

Checklist

  • PR title follows Conventional Commits
  • Commits are signed off (DCO)
  • I wrote this contribution myself and can explain all changes in it

publish-artifacts treated the feature argument as a basename under the
git root, so plans/<feature> was missed. git add skipped deleted TCs,
leaving a dirty tree for the next safe-checkout.

Signed-off-by: Benjamin Kapner <bkapner@redhat.com>
@Benkapner
Benkapner requested a review from fege December 1, 2026 15:16
@qodo-code-review

qodo-code-review Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

fix: stage nested feature dirs and deleted test cases

🐞 Bug fix 🕐 20-40 Minutes

Grey Divider

AI Description

• publish-artifacts and stage now accept a basename, repo-relative path, or absolute path inside
 the repo, so nested plans/ directories resolve correctly.
• Test case changes are staged with git add -A -- /test_cases/, so deleted TCs land in the commit
 and the tree stays clean.
• test-plan-publish, test-plan-case-implement, and test-plan-resolve-feedback pass
 $feature_dir instead of its basename.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The CLI resolves the feature path, selects files, stages them, and commits them; the three changed skill workflows invoke that same operation for publishing.
  • These are one bounded end-to-end publication behavior rather than separate technical capabilities.
Sources

scripts/repo.py[179-190]

def _feature_dir_and_rel(repo_path, feature_name):
    """Resolve a feature basename or path to (dir, repo-relative posix path, error)."""
    repo = Path(repo_path).expanduser().resolve()
    raw = Path(os.path.expanduser(str(feature_name)))
    feature_dir = raw.resolve() if raw.is_absolute() else (repo / raw).resolve()
    try:
        rel = feature_dir.relative_to(repo)
    except ValueError:
        return None, None, f"feature path is outside the repository: {feature_name}"
    if rel == Path("."):
        return None, None, "feature path must be a subdirectory of the repository"
    return feature_dir, rel.as_posix(), None
Behavioral complexity 🟡 Medium 🧩 Interacting branches

  • Before: callers supplied a feature basename and existing direct markdown files were staged, while tracked deletions were handled through broader test_cases staging.
  • After: callers can supply normalized full paths, path containment is validated, direct-child markdown files are selected, and deleted tracked markdown files are discovered separately.
  • New correctness conditions are consistent absolute/relative normalization, repository-boundary rejection, and agreement between filesystem and Git index state for existing and deleted files.
  • The follow-up adds selective filename and depth filtering that removes the previously supported unintended-file inclusion path; the commit pipeline remains unchanged.
Sources

scripts/repo.py[179-190]

def _feature_dir_and_rel(repo_path, feature_name):
    """Resolve a feature basename or path to (dir, repo-relative posix path, error)."""
    repo = Path(repo_path).expanduser().resolve()
    raw = Path(os.path.expanduser(str(feature_name)))
    feature_dir = raw.resolve() if raw.is_absolute() else (repo / raw).resolve()
    try:
        rel = feature_dir.relative_to(repo)
    except ValueError:
        return None, None, f"feature path is outside the repository: {feature_name}"
    if rel == Path("."):
        return None, None, "feature path must be a subdirectory of the repository"
    return feature_dir, rel.as_posix(), None

skills/test-plan-case-implement/SKILL.md[547-550]

repo_root=$(git -C "$feature_dir" rev-parse --show-toplevel)
if ! publish_result=$(cd "$(cd -P "${CLAUDE_SKILL_DIR}/../.." && pwd -P)" && uv run python scripts/repo.py publish-artifacts "$repo_root" "$feature_dir" "test-plan(<source_key>): mark TCs as implemented"); then
    echo "ERROR: publish-artifacts failed"; exit 1
fi

skills/test-plan-publish/SKILL.md[337-338]

   if ! publish_result=$(cd $(git -C ${CLAUDE_SKILL_DIR} rev-parse --show-toplevel) && uv run python scripts/repo.py publish-artifacts "$repo_root" "$feature_dir" "test-plan(<source_key>): publish <feature> v<version>"); then
       echo "ERROR: publish-artifacts failed"; exit 1

skills/test-plan-resolve-feedback/SKILL.md[218-220]

   repo_root=$(git -C "$feature_dir" rev-parse --show-toplevel)
   if ! publish_result=$(cd "$(cd -P "${CLAUDE_SKILL_DIR}/../.." && pwd -P)" && uv run python scripts/repo.py publish-artifacts "$repo_root" "$feature_dir" "test-plan(<source_key>): <short summary of changes> (PR #<PR_NUMBER>)"); then
       echo "ERROR: publish-artifacts failed"; exit 1
Potential damage 🟢 Low 🩹 Reversible

  • If this bounded staging capability regresses, a test-plan branch or PR could omit intended artifacts, include an incorrectly selected artifact, or leave a tracked markdown deletion unpublished.
  • The current source specifically excludes non-markdown and nested files, so the prior broad-inclusion fault is disproved.
  • Equal business importance is assumed.
  • Reverting the code prevents subsequent incorrect staging, but an already-created branch or commit may require a corrective commit or manual cleanup; no automatic repair beyond staging and commit is shown.
Sources

skills/test-plan-case-implement/SKILL.md[547-550]

repo_root=$(git -C "$feature_dir" rev-parse --show-toplevel)
if ! publish_result=$(cd "$(cd -P "${CLAUDE_SKILL_DIR}/../.." && pwd -P)" && uv run python scripts/repo.py publish-artifacts "$repo_root" "$feature_dir" "test-plan(<source_key>): mark TCs as implemented"); then
    echo "ERROR: publish-artifacts failed"; exit 1
fi
Assessed commit 64ddb87
Diagram

graph TD
    A["Skills: publish, implement, resolve"] --> B["publish-artifacts CLI"]
    B --> C["_feature_dir_and_rel"] --> D["stage_artifacts"]
    D --> E["git add -A test_cases/"] --> F[("Git index")]
    D --> G["git add plan files"] --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Require absolute paths only
  • ➕ Removes basename/relative ambiguity entirely
  • ➕ Simpler helper with one code path
  • ➖ Breaks existing callers that pass a root-level basename
  • ➖ Less convenient for manual CLI use
2. Stage the whole feature directory with git add -A
  • ➕ One command covers TestPlan.md, README.md, and TCs, including deletions
  • ➕ Less per-file logic
  • ➖ Would also stage unrelated untracked files inside the feature directory, such as scratch or generated files
  • ➖ Loses the explicit allowlist of artifacts

Recommendation: The PR's approach (resolve the feature argument against the git root, then stage the TC directory with git add -A) is reasonable for a local-only skill flow. Passing the absolute $feature_dir from callers removes the ambiguity that caused the bug. A stricter alternative would be to require absolute paths only and drop basename support, which reduces ambiguity but breaks the existing CLI contract for root-level features.

Files changed (5) +127 / -30

Bug fix (4) +60 / -30
repo.pyResolve nested feature paths and stage TC deletions via git add -A +57/-24

Resolve nested feature paths and stage TC deletions via git add -A

• Adds '_feature_dir_and_rel' to resolve a basename, relative, or absolute feature path against the repo root and reject paths outside it. 'stage_artifacts' now uses the repo-relative path for all git commands and stages 'test_cases/' with 'git add -A', then reports staged paths from 'git diff --cached'. CLI help and examples are updated to match.

scripts/repo.py

SKILL.mdPass feature_dir to publish-artifacts +1/-2

Pass feature_dir to publish-artifacts

• Removes the basename computation and passes '$feature_dir' directly to 'publish-artifacts' when committing updated TC files.

skills/test-plan-case-implement/SKILL.md

SKILL.mdPass feature_dir to publish-artifacts +1/-2

Pass feature_dir to publish-artifacts

• Removes the basename computation and passes '$feature_dir' to 'publish-artifacts' in the stage-and-commit step.

skills/test-plan-publish/SKILL.md

SKILL.mdPass feature_dir to publish-artifacts +1/-2

Pass feature_dir to publish-artifacts

• Removes the basename computation and passes '$feature_dir' to 'publish-artifacts' in the feedback-resolution commit step.

skills/test-plan-resolve-feedback/SKILL.md

Tests (1) +67 / -0
test_repo_stage.pyAdd tests for nested paths, outside-repo rejection, and TC deletion +67/-0

Add tests for nested paths, outside-repo rejection, and TC deletion

• Adds four tests covering a nested feature via full absolute path, a repo-relative nested path, rejection of a feature directory outside the repo, and staging of a deleted test case with a 'D' status in the index.

tests/unit/test_repo_stage.py

@qodo-code-review

qodo-code-review Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Publishing can expose non-test-case files ✓ Resolved Bug Security

Resolving commit: 64ddb87

Resolution reason
Staging is restricted to direct-child test_cases/*.md files and tracked Markdown deletions; other
files and nested directories are no longer staged, so publishing cannot commit them. A test covers
the new behavior.
Description
stage_artifacts runs git add -A over the entire test_cases directory instead of staging only
its direct-child *.md files. If the directory contains an unignored non-Markdown file or a file in
a nested draft directory, publish_artifacts commits it and the publishing skill pushes it to the
target repository.

Grey Divider

Context sources
✅ Compliance rules (platform): 1 rule
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/fullsend (sha: 66d79188) — View relationship
Review mode: Auto: ⚖️ Balanced: Localized staging fix with path resolution and Git index behavior risks.

Grey Divider

Tip of the day
💡 Did you know, you can see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread scripts/repo.py Resolved
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:19 PM UTC · Completed 3:28 PM UTC

Commit: cfd8ab5 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.95

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Dec 1, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change modifying protected script and skill paths with accompanying unit tests, low recent churn, and no security or CI workflow changes.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] scripts/repo.py — The PR modifies protected paths (scripts/repo.py, skills/test-plan-case-implement/SKILL.md, skills/test-plan-publish/SKILL.md, skills/test-plan-resolve-feedback/SKILL.md) and has no linked issue ("Related Issue: None"), so it lacks justification for touching governance/infrastructure files. Human approval is required for protected-path changes.
    Remediation: Link a tracking issue that authorizes the change and explain the rationale; a human maintainer must approve.

Medium

  • [api-contract] scripts/repo.py:253 — git add -A -- <feature>/test_cases stages every non-ignored file under test_cases/ recursively, not just the previous test_cases/*.md. An untracked debug.json or editor backup is now staged and committed by publish-artifacts, contradicting the selective-publication contract still documented in skills/test-plan-publish/SKILL.md.
    Remediation: Restrict staging (additions, modifications, deletions) to direct-child test_cases/*.md — e.g. a <tc_rel>/*.md pathspec with git add -A so tracked deleted Markdown cases are still staged. Add a regression test that a non-Markdown file stays unstaged while a deleted TC is staged.

  • [secret-exposure] scripts/repo.py:253 — The same directory-wide git add -A can stage unignored credential files, kubeconfigs, or private execution output under test_cases/, which the calling skills then push; these were previously excluded by the *.md allowlist. Top-level artifacts still use explicit filename allowlists and the feature dir is containment-checked, but neither limits what is staged recursively under test_cases/.
    Remediation: Keep the direct-child *.md allowlist while also staging deletions, and add a regression test proving non-Markdown and nested files remain unstaged.

Low

  • [missing-authorization] scripts/repo.py — Non-trivial change (~127 added / 30 deleted lines) with no referenced tracking issue; AGENTS.md scope discipline expects the change to be bounded by one.
    Remediation: Link or create a tracking issue and reference it (Closes #NN).

  • [backward-incompatible] scripts/repo.py:241 — staged_files for test_cases/ now comes from git diff --cached --name-only, so it lists only paths changed relative to HEAD (previously every test_cases/*.md that was added). Key names and shape are unchanged and in-repo skills only read .committed.
    Remediation: Document the new meaning of staged_files, or keep the old semantics if external callers depend on it.


Labels: PR is a bug fix to the artifact staging helper.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the kind/bug Something isn't working label Dec 1, 2026
@Benkapner

Copy link
Copy Markdown
Member Author

/fs-fix Fix only the test_cases staging scope. Do not add a tracking issue, do not address protected-path, and do not change staged_files JSON semantics.

Quote from the review:

Using the entire test_cases directory as the pathspec (git add -A -- <feature>/test_cases) expands selective staging from immediate .md artifacts to every non-ignored file, recursively. For example, an untracked test_cases/debug.json or editor backup will now be staged and automatically committed by publish_artifacts. This contradicts the existing selective-publication contract, which skills/test-plan-publish/SKILL.md still describes as test_cases/.md with internal working files excluded. Supporting deleted Markdown cases does not require publishing unrelated files.

Suggested fix: Restrict addition, modification, and deletion staging to the previously supported immediate test_cases/*.md files, including tracked Markdown files that no longer exist (e.g. a <tc_rel>/*.md pathspec with git add -A). Add a regression test asserting that a non-Markdown working file remains unstaged while a deleted test case is staged.

Also from the review (same change):

Replacing the test_cases/*.md selection with directory-wide git add -A also stages non-Markdown files and nested directories. An unignored local credential file, kubeconfig, or private execution output under test_cases/ is now automatically committed by publish_artifacts and pushed by the calling skills; previously these files were excluded.

Keep:

  • nested feature dirs (basename, repo-relative path, absolute path inside the repo)
  • deleted tracked TC-*.md files still staged
  • $feature_dir passed from the three skills

Do not stage non-Markdown files or files in nested subdirectories under test_cases/. Add a test that a deleted Markdown TC is staged and that e.g. test_cases/debug.json and test_cases/draft/secret.env stay unstaged.

Leave the PR description as a direct bug fix with no issue. Do not edit AGENTS.md or CONTRIBUTING.md.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Finished Fix · ✅ Success · Started 3:43 PM UTC · Completed 3:47 PM UTC

Commit: cfd8ab5 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.38

Stage only top-level test_cases/*.md (plus tracked deleted ones) instead of
the whole directory so non-Markdown and nested files are never published.
Keeps staged_files semantics; adds regression test.

Addresses review feedback on PR #114.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

🔧 Fix agent — iteration 1 (human-triggered)

Restricted test_cases staging to direct-child *.md (plus tracked deleted *.md), restored staged_files semantics, added a regression test. Full test suite passes. ruff/flake8/pre-commit could not be run in the sandbox: the tools are not installed and the pre-commit hook download failed on a TLS certificate error. Lines are under 120 chars. No merge conflict. Project CI was not inspected in detail.

Fixed (3):

  1. test_cases staging expands to every non-ignored file (api-contract) (scripts/repo.py) [f_4614d2cf38ac608a, fixed]: Staging is back to direct-child test_cases/*.md files only. Tracked *.md files deleted from the working tree are also staged as deletions. Added a regression test that a deleted TC is staged while test_cases/debug.json and test_cases/draft/secret.env stay unstaged.
  2. Directory-wide git add -A could stage credentials under test_cases/ (secret-exposure) (scripts/repo.py) [f_0b8ec16f0e3a6707, fixed]: Removed the directory-wide git add -A. Only direct-child *.md files, plus tracked deleted *.md files, are staged. Non-Markdown files and nested directories are never staged. The new regression test covers debug.json, draft/secret.env and draft/notes.md.
  3. staged_files meaning changed for test_cases/ (backward-incompatible) (scripts/repo.py) [f_6513203990c15f81, fixed]: staged_files no longer comes from git diff --cached. It again lists the test_cases/*.md files that were git added, as before, plus any deleted tracked TC. JSON keys and shape are unchanged.

Tests: passed

Conflict update: skipped; strategy none; forge MERGEABLE; target main

Decision points
  • How to keep the old staged_files semantics while staging deletions (alternatives: git add -A with a :(glob) pathspec and git diff --cached for the list, Enumerate existing *.md files plus git ls-files --deleted direct children, and git add each; rationale: Explicit enumeration keeps the old listing (every added .md) and avoids pathspec glob/magic pitfalls.)

PR metadata: body updated

Finding threads:

  • f_4614d2cf38ac608a (fixed): replied and resolved — thread
  • f_0b8ec16f0e3a6707 (fixed): replied and resolved — thread
  • f_6513203990c15f81 (fixed): replied and resolved — thread

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push

Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:50 PM UTC · Completed 3:57 PM UTC

Commit: 6a9dd02 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.35

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change modifying protected script and skill paths with accompanying unit tests, low recent churn, and no security or CI workflow changes.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] scripts/repo.py — This PR modifies protected governance/infrastructure paths: scripts/repo.py, skills/test-plan-case-implement/SKILL.md, skills/test-plan-publish/SKILL.md, skills/test-plan-resolve-feedback/SKILL.md. The PR has no linked issue ("Related Issue: None"), so there is no recorded authorization for changing these files. Human approval is always required for protected-path changes.
    Remediation: Link or open an issue that authorizes the change, or have a maintainer explicitly approve it.

Low

  • [missing-authorization] scripts/repo.py — Non-trivial change opened without a linked tracking issue, so there are no acceptance criteria to check the scope against.

Earlier findings

  • scripts/repo.py:253, api-contract — resolved. Staging now adds individual direct-child test_cases/*.md files and tracked deletions instead of the whole directory (scripts/repo.py:246-268), with a regression test in tests/unit/test_repo_stage.py.
  • scripts/repo.py:253, secret-exposure — resolved. Non-Markdown and nested files under test_cases/ are no longer staged (scripts/repo.py:246-268); the new test asserts debug.json, draft/secret.env and draft/notes.md stay unstaged.
  • scripts/repo.py:241, backward-incompatible — resolved. Against the base branch, stage_artifacts already staged only direct-child *.md files and listed all of them in staged_files. The only addition is staging deletions of tracked *.md files.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:38 AM UTC · Completed 10:48 AM UTC

Commit: 64ddb87 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.07

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change modifying protected script and skill paths with accompanying unit tests, low recent churn, and no security or CI workflow changes.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] scripts/repo.py — The PR modifies protected governance/infrastructure paths (scripts/repo.py, skills/test-plan-case-implement/SKILL.md, skills/test-plan-publish/SKILL.md, skills/test-plan-resolve-feedback/SKILL.md) and has no linked issue ("Related Issue: None"), so the description does not justify touching these files. Human approval is always required for protected-path changes.
    Remediation: Link a tracking issue (or explain in the PR description why these files must change) and obtain human approval.

Low

  • [injection-vuln] scripts/repo.py:265 — Paths in tc_files are passed to git add -A -- <rel> as pathspecs, not literal paths, so Git expands wildcards. A tracked direct-child file whose name is literally *.md (or contains [...]) passes the prefix/extension/direct-child checks and then expands recursively, which can stage untracked nested files (e.g. test_cases/draft/notes.md) that this change intends to exclude; publish-artifacts would then commit them. Reproduced locally with git: git add -A -- f/test_cases/*.md staged f/test_cases/draft/secret.md. Requires a pathological tracked filename, so low severity under the local single-user threat model.
    Remediation: Use git --literal-pathspecs (or :(literal)) for the git add and git ls-files calls in stage_artifacts, and add a regression test with a tracked filename containing *.
  • [missing-authorization] scripts/repo.py — Non-trivial change to artifact staging logic across scripts, skills, and tests has no linked tracking issue to establish authorized scope.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

Comment thread scripts/repo.py
try:
subprocess.run(
["git", "add", rel],
["git", "add", "-A", "--", rel],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

-- stops option parsing, but these arguments are still pathspecs, so a *, ?, or [...] in a feature path segment or a TC filename makes git match sibling paths — and publish_artifacts commits whatever ends up staged. Verified locally: with plans/feat1/ and plans/feat[1]/ both modified, git add -- 'plans/feat[1]/TestPlan.md' stages plans/feat1/TestPlan.md as well; likewise git add -A -- 'plans/feat1/test_cases/TC-1?.md' also stages TC-10.md.

Names created by test-plan-create are snake_case-validated (validate.py feature-name), but publish-artifacts accepts a user-supplied or PR-authored path and never re-checks it, so the allowlist holds only by convention. The same applies to the ls-files lookup below.

Cheap fix: run these calls with GIT_LITERAL_PATHSPECS=1 (or :(literal) prefixes) for both adds and the ls-files path, and add a regression that creates a [-named sibling and asserts the index holds only the intended path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed — -- doesn't make these literal. I'll run the git add / ls-files calls with GIT_LITERAL_PATHSPECS=1 and add a regression with a [-named sibling so only the intended path is in the index.

feature_name=$(basename "$feature_dir")
repo_root=$(git -C "$feature_dir" rev-parse --show-toplevel)
if ! publish_result=$(cd "$(cd -P "${CLAUDE_SKILL_DIR}/../.." && pwd -P)" && uv run python scripts/repo.py publish-artifacts "$repo_root" "$feature_name" "test-plan(<source_key>): <short summary of changes> (PR #<PR_NUMBER>)"); then
if ! publish_result=$(cd "$(cd -P "${CLAUDE_SKILL_DIR}/../.." && pwd -P)" && uv run python scripts/repo.py publish-artifacts "$repo_root" "$feature_dir" "test-plan(<source_key>): <short summary of changes> (PR #<PR_NUMBER>)"); then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

§0.5 discovers the plan with find . — relative to the agent's cwd, not $repo_path. For an existing clone the checkout runs in a subshell, so cwd is unchanged and discovery can search the wrong repo entirely. And when cwd is a subdirectory of the repo, find . yields ./feat, which _feature_dir_and_rel re-bases under repo_root → <repo>/feat instead of <repo>/plans/feat: it fails, or commits a different feature. basename at least produced a repo-relative name; $feature_dir makes the result depend on an uncontrolled cwd. Discover from the located checkout (find "$repo_path" -name TestPlan.md) and keep feature_dir absolute from there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. $feature_dir only helps if discovery is already rooted at the checkout. I'll switch this to find "$repo_path" -name TestPlan.md and keep feature_dir absolute from there, same in the other skills this PR changed.

Comment thread scripts/repo.py Outdated
for md_file in tc_dir.glob("*.md"):
rel = f"{feature_name}/test_cases/{md_file.name}"
tc_files.extend(f"{tc_rel}/{md.name}" for md in sorted(tc_dir.glob("*.md")) if md.is_file())
deleted = subprocess.run(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Discovery runs after the required/optional files are already staged, and check=True is not wrapped in a try, so if git ls-files fails the index is left modified and the caller gets a traceback instead of the documented {"status": "failed", "error": ...} JSON — which the skills then pipe through jq -r '.committed'. Move discovery above the first git add and return the standard JSON error. While there, read the -z output as bytes and decode with surrogateescape, since -z emits raw path bytes rather than text.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. Ill move the ls-files lookup above the first git add, return the usual {"status": "failed", "error": ...} JSON on failure, and decode the -z output as bytes with surrogateescape.

@Benkapner

Copy link
Copy Markdown
Member Author

/fs-fix Fix only Federico's three inline comments. Do not add a tracking issue. Do not address protected-path.

  1. Pathspecs: -- stops option parsing, but arguments are still pathspecs, so *, ?, or [...] in a feature path segment or TC filename makes git match sibling paths — and publish_artifacts commits whatever ends up staged. Verified locally: with plans/feat1/ and plans/feat[1]/ both modified, git add -- 'plans/feat[1]/TestPlan.md' stages plans/feat1/TestPlan.md as well; likewise git add -A -- 'plans/feat1/test_cases/TC-1?.md' also stages TC-10.md. Names created by test-plan-create are snake_case-validated, but publish-artifacts accepts a user-supplied or PR-authored path and never re-checks it. Cheap fix: run these calls with GIT_LITERAL_PATHSPECS=1 (or :(literal) prefixes) for both adds and the ls-files path, and add a regression that creates a [-named sibling and asserts the index holds only the intended path.

  2. Skill discovery: §0.5 discovers the plan with find . — relative to the agent's cwd, not $repo_path. For an existing clone the checkout runs in a subshell, so cwd is unchanged and discovery can search the wrong repo entirely. And when cwd is a subdirectory of the repo, find . yields ./feat, which _feature_dir_and_rel re-bases under repo_root → <repo>/feat instead of <repo>/plans/feat: it fails, or commits a different feature. basename at least produced a repo-relative name; $feature_dir makes the result depend on an uncontrolled cwd. Discover from the located checkout (find "$repo_path" -name TestPlan.md) and keep feature_dir absolute from there. Apply the same pattern in every skill this PR changed that still uses find . for the feature dir.

  3. Error handling: Discovery runs after the required/optional files are already staged, and check=True is not wrapped in a try, so if git ls-files fails the index is left modified and the caller gets a traceback instead of the documented {"status": "failed", "error": ...} JSON — which the skills then pipe through jq -r '.committed'. Move discovery above the first git add and return the standard JSON error. While there, read the -z output as bytes and decode with surrogateescape, since -z emits raw path bytes rather than text.

Do not widen staging back to the whole test_cases directory. Keep direct-child *.md plus tracked deleted *.md only.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Finished Fix · ✅ Success · Started 1:06 PM UTC · Completed 1:10 PM UTC

Commit: 64ddb87 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.19

…s (PR #114)

- Run git add/ls-files with GIT_LITERAL_PATHSPECS so wildcard names match only themselves
- Discover test case paths before staging, return JSON error on ls-files failure, decode -z output as bytes with surrogateescape
- Discover TestPlan.md from the located checkout in test-plan-resolve-feedback

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

🔧 Fix agent — iteration 2 (human-triggered)

Addressed Federico's three comments (literal pathspecs, discovery from the located checkout, discovery-before-staging with JSON error handling) as instructed; protected-path finding and tracking issue left alone per instruction. All 1620 tests pass; ruff/flake8/pre-commit could not run in the sandbox (tools missing / network blocked).

Fixed (3):

  1. Pathspecs: git add/ls-files treat paths as wildcard pathspecs (scripts/repo.py) [f_4b0a5a266e183178, fixed]: All git add and git ls-files calls in stage_artifacts now run with GIT_LITERAL_PATHSPECS=1 (and the required/optional adds use --). Added regressions for a feat[1] sibling dir and a tracked TC-1?.md name.
  2. Skill discovery: find . depends on the agent's cwd (skills/test-plan-resolve-feedback/SKILL.md): §0.5 now searches find "$repo_path" from the located checkout and keeps feature_dir absolute. It was the only changed skill still using find . (publish and case-implement use locate-feature-dir / absolute paths).
  3. Error handling: discovery after staging, unwrapped check=True, text-mode -z output (scripts/repo.py): Test case discovery now runs before the first git add, git ls-files failure returns {"error": ...} JSON with the index untouched, and -z output is read as bytes and decoded with surrogateescape. Staging remains direct-child *.md plus tracked deleted *.md. Added a regression test.

Tests: passed

Finding threads:

  • f_4b0a5a266e183178 (fixed): replied and resolved — thread

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push

Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:14 PM UTC · Completed 1:21 PM UTC

Commit: 9c8aa4f · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.24

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change modifying protected script and skill paths with accompanying unit tests, low recent churn, and no security or CI workflow changes.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] scripts/repo.py — This PR modifies protected governance/infrastructure paths (scripts/repo.py, skills/test-plan-case-implement/SKILL.md, skills/test-plan-publish/SKILL.md, skills/test-plan-resolve-feedback/SKILL.md) and has no linked issue ("Related Issue: None"), so it lacks justification for modifying these files. Human approval is required for protected-path changes.
    Remediation: Link a tracking issue that authorizes the change, or obtain explicit maintainer approval for these protected files.

Low

  • [missing-authorization] scripts/repo.py — Non-trivial change to artifact staging in scripts/repo.py, three skill definitions, and tests has no linked tracking issue; the PR body says "Related issue: None — opened directly as a bug fix."
    Remediation: Create and link a tracking issue defining the bug and acceptance criteria, or confirm maintainer authorization for direct PR bug fixes.

Earlier findings

  • scripts/repo.py:265, injection-vuln — resolved: git commands now run with GIT_LITERAL_PATHSPECS=1 and a -- separator for feature-derived, required/optional, and test-case paths.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

@Benkapner
Benkapner requested a review from fege December 2, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants