Skip to content

feat(acceptance): accept benign repo-hygiene passengers instead of refusing the folder#242

Merged
sunib merged 2 commits into
mainfrom
feat/accept-benign-passenger-files
Jul 15, 2026
Merged

feat(acceptance): accept benign repo-hygiene passengers instead of refusing the folder#242
sunib merged 2 commits into
mainfrom
feat/accept-benign-passenger-files

Conversation

@sunib

@sunib sunib commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

A GitTarget subtree is operator-exclusive: any non-YAML file that isn't an operator artifact (README.md/.sops.yaml) or a build directive is refused as foreign, stalling the whole folder (GitPathAccepted=False). For the reverser's core case — adopting an existing repo, which has no .gittargetignore — a stray LICENSE, a .gitkeep, or a non-README .md refuses everything on first scan. As raised: "it's unwise to not accept a folder because of a few markdowns or .gitignore/.gitkeep files."

Change

A new RoleBenignPassenger + isBenignPassenger — a closed hygiene set accepted by default:

  • *.md / *.markdown
  • LICENSE / LICENCE / COPYING / NOTICE (+ .txt variants)
  • .gitignore / .gitattributes / .gitkeep / .keep

Matched after the .gittargetignore filter, so a benign passenger is user-suppressible and never muddies the operator-artifact role (role 3 stays "operator-authored, un-suppressible"). Wired through the one shared ClassifyEntry, so the folder scan and the live-writer worktree scan agree.

Still refused (ratchet preserved): loose application data (notes.txt, values.json, deploy.sh), symlinks, submodules, foreign YAML. The set holds only files no future "own the subtree" behaviour (wrap-to-ConfigMap, faithful sweep) would ever want to claim.

Design

Reverses the original minimal-set stance (D-foreign-3) for the adoption case, recorded as D-foreign-7 and role 3b in gitpath-foreign-content-stringency.md. Bootstrap .gittargetignore and the support-boundary README updated to match.

Evidence

Regenerated corpus baseline (support-today.md) shows exactly which real fixtures moved:

  • 1-desired-state/repo-per-environment: the three gitops-* env folders flip refused → accepted (each was blocked only by a .gitignore).
  • 6-hostile/mixed-and-hostile: the .gitkeep no longer counts as non-KRM, while deployment.json correctly stays foreign.

Validation

  • task fmt / task vet clean
  • task lint — doccheck OK, golangci-lint 0 issues
  • task test — all unit + writer-integration tests pass; coverage 76.3% → 76.4% (baseline bumped)
  • task test-e2e — 56 passed, 0 failed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Common repository-hygiene files, including Markdown documentation, licenses, and Git metadata files, are now accepted automatically within GitTarget content.
    • Other unmanaged files remain rejected unless explicitly excluded through the root .gittargetignore.
  • Documentation

    • Updated support guidance and path-handling specifications to explain the new acceptance rules and recommended ignore patterns.
  • Bug Fixes

    • GitTarget candidates containing accepted hygiene files, such as .gitignore, are no longer incorrectly refused.

…fusing the folder

A GitTarget subtree is operator-exclusive: any non-YAML file that is not an
operator artifact (README.md/.sops.yaml) or a build directive was refused as
foreign, stalling the whole folder. For the reverser's core case — adopting an
existing repo, which has no .gittargetignore — a stray LICENSE, .gitkeep, or
non-README markdown refused everything on first scan.

Add a closed benign-passenger set accepted by default (isBenignPassenger,
RoleBenignPassenger): *.md/*.markdown, LICENSE/LICENCE/COPYING/NOTICE, and
.gitignore/.gitattributes/.gitkeep/.keep. Matched after the .gittargetignore
filter so it stays user-suppressible and never muddies the operator-artifact
role. Loose application data (notes.txt, values.json, deploy.sh), symlinks, and
submodules stay refused — the acceptance ratchet holds because the set holds
only files no future "own the subtree" behaviour would ever claim.

Reverses the original minimal-set decision for the adoption case; recorded as
D-foreign-7 in the stringency spec (role 3b). Regenerated corpus baseline shows
repo-per-environment's three env folders flip refused→accepted (each blocked
only by a .gitignore) and mixed-and-hostile's .gitkeep no longer counts, while
deployment.json correctly stays foreign.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@sunib, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0732fbdf-88c6-40e7-ae95-dadbf483b2fb

📥 Commits

Reviewing files that changed from the base of the PR and between b6ddf8e and 5c7dbaf.

📒 Files selected for processing (2)
  • internal/git/gittargetignore_writer_test.go
  • internal/manifestanalyzer/gittargetignore_test.go
📝 Walkthrough

Walkthrough

Adds a closed benign-passenger role for inert repository-hygiene files, preserves .gittargetignore suppression, integrates the role into scanning and writes, and updates tests, documentation, fixtures, and the coverage baseline.

Changes

Benign passenger content

Layer / File(s) Summary
Benign passenger policy and templates
docs/spec/gitpath-foreign-content-stringency.md, docs/design/support-boundary/README.md, internal/git/bootstrapped-repo-template/.gittargetignore
Documents the accepted hygiene-file set, classification precedence, foreign-content boundary, and revised ignore examples.
Classification and analyzer behavior
internal/manifestanalyzer/gittargetignore.go, internal/manifestanalyzer/analyzer.go, internal/manifestanalyzer/scan_repo.go, internal/manifestanalyzer/gittargetignore_test.go
Adds RoleBenignPassenger, bounded filename and Markdown matching, analyzer handling, updated count comments, and coverage for acceptance, suppression, and refusal.
Write-path integration and expected outputs
internal/git/plan_flush.go, internal/git/gittargetignore_writer_test.go, test/fixtures/gitops-layouts/support-today.md, .coverage-baseline
Allows benign passengers during worktree scanning and pending writes, validates successful commits, and updates generated support results and coverage baseline.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Worktree as scanWorktreeSubtree
  participant Classifier as ClassifyEntry
  participant Analyzer as collectFiles
  participant Writer as commitPendingWrites
  Worktree->>Classifier: classify repository entry
  Classifier->>Analyzer: return RoleBenignPassenger
  Analyzer->>Worktree: record entry as NonYAML
  Worktree->>Writer: provide accepted worktree
  Writer->>Writer: commit pending write
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed, but it does not follow the required template and omits the Type of Change, Checklist, Related Issues, Screenshots, and Additional Notes sections. Add the missing template sections, especially Type of Change, Testing, Checklist, Related Issues, Screenshots, and Additional Notes, or mark non-applicable items N/A.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: allowing benign repo-hygiene files instead of refusing the whole GitTarget folder.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/accept-benign-passenger-files

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

❤️ Share

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/manifestanalyzer/gittargetignore_test.go`:
- Around line 88-92: Extend the expected values in the non-YAML inventory
assertion loop of the relevant test to include COPYING, docs/guide.markdown, and
.gitattributes, while preserving the existing entries and containsString
validation.
- Around line 63-96: Rename the affected tests to clearly identify the component
and scenario: internal/manifestanalyzer/gittargetignore_test.go:63-96 to
TestCollectFiles_BenignPassengerAcceptedByDefault, 98-114 to
TestCollectFiles_BenignPassengerStillUserSuppressible, and 116-136 to
TestIsBenignPassenger_AcceptedAndRefused; rename
internal/git/gittargetignore_writer_test.go:92-111 to
TestCommitPendingWrites_BenignPassengerAllowsWrite.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7565cbcd-d673-4713-8b09-80bfae9dba61

📥 Commits

Reviewing files that changed from the base of the PR and between 3b937f9 and b6ddf8e.

📒 Files selected for processing (11)
  • .coverage-baseline
  • docs/design/support-boundary/README.md
  • docs/spec/gitpath-foreign-content-stringency.md
  • internal/git/bootstrapped-repo-template/.gittargetignore
  • internal/git/gittargetignore_writer_test.go
  • internal/git/plan_flush.go
  • internal/manifestanalyzer/analyzer.go
  • internal/manifestanalyzer/gittargetignore.go
  • internal/manifestanalyzer/gittargetignore_test.go
  • internal/manifestanalyzer/scan_repo.go
  • test/fixtures/gitops-layouts/support-today.md

Comment thread internal/manifestanalyzer/gittargetignore_test.go Outdated
Comment thread internal/manifestanalyzer/gittargetignore_test.go Outdated
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sunib
sunib merged commit 49327fd into main Jul 15, 2026
17 of 18 checks passed
@sunib
sunib deleted the feat/accept-benign-passenger-files branch July 15, 2026 19:01
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.

1 participant