Align repo-memory max-patch-size pre-check with push diff semantics - #48106
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
max-patch-size pre-check with push diff semantics
There was a problem hiding this comment.
Pull request overview
Aligns repo-memory pre-checks with per-push diff semantics.
Changes:
- Extracts shared staged-additions sizing.
- Replaces total-folder enforcement with staged-diff validation.
- Adds regression coverage and release-workflow guidance.
Show a summary per file
| File | Description |
|---|---|
safe_outputs_handlers.test.cjs |
Tests diff-based validation. |
safe_outputs_handlers.cjs |
Validates staged additions. |
repo_memory_patch_size.cjs |
Adds shared sizing helper. |
push_repo_memory.cjs |
Uses shared helper. |
SKILL.md |
Adds release workflow reference. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/js/repo_memory_patch_size.cjs:27
- The default diff suppresses binary contents as
Binary files ... differ, so this helper reports zero additions for binary files. Since repo-memory allows all extensions by default, multiple binary files can now bypass the patch limit (while remaining under the per-file/count limits). Force a textual diff, and add a binary regression case, so binary additions contribute to the gate.
const patchContent = execGitSyncFn(["diff", "--cached"], { stdio: "pipe", cwd });
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Medium
| function getAddedPatchSizeBytesFromDiff(patchContent) { | ||
| return patchContent | ||
| .split("\n") | ||
| .filter(line => line.startsWith("+") && !line.startsWith("+++")) | ||
| .reduce((sum, line) => sum + Buffer.byteLength(line + "\n", "utf8"), 0); | ||
| } |
|
✅ Test Quality Sentinel completed test quality analysis. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
@copilot please run the Unresolved review feedback:
Failed checks:
|
…d repo_memory_patch_size.cjs to SAFE_OUTPUTS_FILES - Replace filter-based +++ exclusion with a state-machine that tracks whether parsing is inside a hunk. File headers (+++ before the first @@ of each file) are correctly ignored; content lines that begin with ++ (appearing as +++ inside a hunk) are now correctly counted. - Add repo_memory_patch_size.cjs to SAFE_OUTPUTS_FILES in setup.sh so the transitive-dependency test passes (safe_outputs_handlers.cjs requires it at runtime). Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed both issues in the latest commit: Review comment (hunk-state tracking): Replaced the CI failure (shard 4/4): Added |
|
@copilot please run the Unresolved review feedback:
Failed checks:
|
Both issues were already addressed in commit
The referenced failed runs (30186794434, 30186875359) predate that commit. The latest CJS run on the fix commit (30190167597) shows |
🤖 PR Triage — §30192186368
Why: Fixes repo-memory pre-check enforcing total folder size instead of diff (patch) size — causing incremental memory updates to fail once memory accumulates. Copilot check passing. Regression tests updated. Next: Full CI confirmation, then fast-track merge.
|
|
🎉 This pull request is included in a new release. Release: |
repo-memorydocumentsmax-patch-sizeas a per-push diff limit, but MCP pre-check logic enforced it as total folder size. This caused small incremental updates to fail once memory accumulated.Use diff-based patch sizing in both enforcement points
actions/setup/js/repo_memory_patch_size.cjs.push_repo_memory.cjsnow calls the shared helper instead of duplicating diff parsing.Fix MCP pre-check behavior
safe_outputs_handlers.cjsnow computes staged additions size fromgit diff --cachedin the memory repo and compares that againstmax_patch_size * 1.2(same effective limit model as push gate).max-patch-size.Regression coverage for the documented contract
safe_outputs_handlers.test.cjsto validate: