fix(engine): include uncommitted working-tree changes in base-ref change detection#409
Conversation
…nge detection getFilesChangedSinceRef only ran 'git diff base...HEAD', which sees committed changes exclusively. Since a base ref is detected in any normal repo, review-context and check --base silently omitted the staged, unstaged, and untracked files actually under review during a dev session. The function now unions three concurrent git queries: - git diff base...HEAD (committed branch changes) - staged + unstaged edits to tracked files (getChangedFiles) - untracked non-ignored files (git ls-files --others --exclude-standard) Bad-ref/non-repo behavior is unchanged (returns []); --staged is untouched. Docs updated in en/nb/pt-br, including the previously missing 'Changed files detection' section on the pt-br check page. Fixes #403 Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR expands uncommitted working-tree change detection in archgate by broadening ChangesChanged Files Detection Fix
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Deploying archgate-cli with
|
| Latest commit: |
45113da
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c14ad44e.archgate-cli.pages.dev |
| Branch Preview URL: | https://fix-review-context-uncommitt.archgate-cli.pages.dev |
Code Coverage
Full HTML report available in workflow artifacts. Per-directory breakdown
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 @.claude/agent-memory/archgate-developer/MEMORY.md:
- Line 63: Reword the incident-specific sentence about pt-br check.mdx to a
general illustrative pattern: replace "pt-br `check.mdx` was missing the entire
'Changed files detection' section" with a neutral example such as "e.g., a
'Changed files detection' section might exist in English but be entirely absent
from pt-br" so the MEMORY.md line about locale drift reads as a recurring risk
rather than a past-event; update the sentence in the
.claude/agent-memory/archgate-developer/MEMORY.md entry referencing `check.mdx`,
`docs/src/content/docs/nb/<path>`, and `docs/src/content/docs/pt-br/<path>`
accordingly.
In `@docs/src/content/docs/nb/reference/cli/check.mdx`:
- Around line 106-107: Replace the abbreviated Norwegian phrase "+ arbeidstre"
with the full, consistent term "+ arbeidstre-endringer" in the table rows that
currently read "` .archgate/config.json` `baseBranch` | `git diff
<resolved-ref>...HEAD` + arbeidstre" and "Git-autodeteksjon | `git diff
<detected-ref>...HEAD` + arbeidstre" so all rows match the full wording used in
the sibling row ("+ arbeidstre-endringer").
In `@docs/src/content/docs/pt-br/reference/cli/check.mdx`:
- Around line 98-110: Normalize the Portuguese in this section by replacing the
older compound forms with current-form compounds: change occurrences of
"auto-detecta" and "auto-detecção" to "autodetecta" and "autodetecção"
respectively, and expand the abbreviation "ref" to the full word "referência"
where it appears in the prose; ensure these replacements are applied to the
paragraph describing how archgate check resolves the base branch and the
bullet/priority table so wording remains consistent (e.g., update "git diff
<ref>...HEAD" text descriptions to use "referência" in the human-readable
sentences).
In `@docs/src/content/docs/pt-br/reference/rule-api.mdx`:
- Line 96: Update the Portuguese phrasing in the sentence that begins "Arquivos
que foram modificados de acordo com o git..." by replacing "de acordo com o git"
with "conforme o Git" and "auto-preenchido" with "autopreenchido" (and ensure
"Git" is capitalized), keeping the rest of the sentence unchanged to preserve
the technical meaning.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: eafb1dcb-44a1-47d6-ab5b-8138b50c51c8
📒 Files selected for processing (17)
.claude/agent-memory/archgate-developer/MEMORY.mddocs/public/llms-full.txtdocs/src/content/docs/concepts/rules.mdxdocs/src/content/docs/guides/writing-rules.mdxdocs/src/content/docs/nb/concepts/rules.mdxdocs/src/content/docs/nb/guides/writing-rules.mdxdocs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/nb/reference/rule-api.mdxdocs/src/content/docs/pt-br/concepts/rules.mdxdocs/src/content/docs/pt-br/guides/writing-rules.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/rule-api.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/rule-api.mdxsrc/engine/git-files.tstests/engine/git-files.test.tstests/integration/review-context.test.ts
- nb check.mdx: use 'arbeidstre-endringer' consistently in all priority table rows - pt-br check.mdx: current-form compounds (autodetecta, autodetecao) and 'referencia' instead of 'ref' in prose - pt-br rule-api.mdx: tighten phrasing (conforme o Git, autopreenchido, ex.:, Fica vazio) - agent memory: reword locale-section-parity note as a general pattern instead of an incident report Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@docs/src/content/docs/pt-br/reference/cli/check.mdx`:
- Around line 106-107: Replace the abbreviated phrase "+ árvore de trabalho"
with the full, consistent Portuguese wording "+ alterações da árvore de
trabalho" in the priority table rows containing `.archgate/config.json
baseBranch` and `Autodetecção do git` so all rows match the wording used in the
row with `baseRef` (`+ alterações da árvore de trabalho`) and align with the
Norwegian-version fix.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 55e2fcc1-b873-4535-bd02-7cd99d389dc1
📒 Files selected for processing (4)
.claude/agent-memory/archgate-developer/MEMORY.mddocs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/rule-api.mdx
Apply the same consistency fix to the pt-br and English tables that the previous commit applied to the Norwegian one: rows 3-4 now spell out 'alteracoes da arvore de trabalho' / 'working-tree changes' instead of the abbreviated form. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
# archgate ## [0.45.3](v0.45.2...v0.45.3) (2026-06-11) ### Bug Fixes * **engine:** include uncommitted working-tree changes in base-ref change detection ([#409](#409)) ([ee0b1c1](ee0b1c1)), closes [#403](#403) --- This PR was generated with [simple-release](https://github.com/TrigenSoftware/simple-release). <details> <summary>📄 Cheatsheet</summary> <br> You can configure the bot's behavior through a pull request comment using the `!simple-release/set-options` command. ### Command Format ````md !simple-release/set-options ```json { "bump": {}, "publish": {} } ``` ```` ### Useful Parameters #### Bump | Parameter | Type | Description | |-----------|------|-------------| | `version` | `string` | Force set specific version | | `as` | `'major' \| 'minor' \| 'patch' \| 'prerelease'` | Release type | | `prerelease` | `string` | Pre-release identifier (e.g., "alpha", "beta") | | `firstRelease` | `boolean` | Whether this is the first release | | `skip` | `boolean` | Skip version bump | | `byProject` | `Record<string, object>` | Per-project bump options for monorepos | #### Publish | Parameter | Type | Description | |-----------|------|-------------| | `skip` | `boolean` | Skip publishing | | `access` | `'public' \| 'restricted'` | Package access level | | `tag` | `string` | Tag for npm publication | ### Usage Examples #### Force specific version ````md !simple-release/set-options ```json { "bump": { "version": "2.0.0" } } ``` ```` #### Force major bump ````md !simple-release/set-options ```json { "bump": { "as": "major" } } ``` ```` #### Create alpha pre-release ````md !simple-release/set-options ```json { "bump": { "prerelease": "alpha" } } ``` ```` #### Publish with specific access and tag ````md !simple-release/set-options ```json { "bump": { "prerelease": "beta" }, "publish": { "access": "public", "tag": "beta" } } ``` ```` ### Access Restrictions The command can only be used by users with permissions: - repository owner - organization member - collaborator ### Notes - The last comment with `!simple-release/set-options` command takes priority - JSON must be valid, otherwise the command will be ignored - Parameters apply only to the current release execution - The command can be updated by editing the comment or adding a new one </details> <!-- Please do not edit this comment. simple-release-pull-request: true simple-release-branch-from: release simple-release-branch-to: main --> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Summary
Fixes #403 —
archgate review-context(andarchgate check --baseviactx.changedFiles) silently omitted uncommitted work whenever a base ref was detected, which is almost always. During a typical AI-agent dev session (files written via editor tools, nothing committed), the reviewer validated the wrong file set.Changes
src/engine/git-files.ts—getFilesChangedSinceRefnow unions three concurrent git queries:git diff base...HEAD(committed branch changes)getChangedFiles)git ls-files --others --exclude-standard)Bad-ref / non-repo behavior is unchanged (returns
[]);--stagedis untouched.Tests — 3 unit regression tests (uncommitted tracked edits, staged-only, untracked + gitignore exclusion) and 1 integration test reproducing the issue's agent-session scenario.
Docs (en/nb/pt-br) — updated
check.mdx,rule-api.mdx,concepts/rules.mdx,guides/writing-rules.mdxto describe the new semantics. The pt-br check page was missing the entire "Changed files detection" section — added it.Dogfooding note
The GEN-002
i18n-translation-driftrule flagged the missing pt-br doc updates only after this fix was applied — previously it couldn't see uncommitted edits at all.Validation
bun run validatefully green (1266 tests, 39/39 ADR rules, knip, build check)review-contextwent fromallChangedFiles: []to listing all uncommitted edits in this very sessionSummary by CodeRabbit
New Features
Documentation
--staged/--base <ref>behavior.Tests