Skip to content

Make repo-memory max-patch-size pre-check measure the push diff, not the whole folder #47591

Description

@nestele

Summary

repo-memory's max-patch-size is documented as a per-push diff limit, but the MCP pre-check measures the whole memory folder instead. This blocks pushes even when the actual change is tiny. #42773 was closed by #43301, which only reworded the error message — the behavior is unchanged.

Current behavior

Two checks share the same max-patch-size:

  • actions/setup/js/push_repo_memory.cjs — measures the git diff. ✅ matches docs.
  • actions/setup/js/safe_outputs_handlers.cjs — sums the byte size of every file in the folder. ❌ undocumented, contradicts docs.

The docs only define per-file (max-file-size), file-count (max-file-count), and per-push diff (max-patch-size). No total-folder limit exists anywhere in the docs.

Impact

Once accumulated files exceed the limit, every push is rejected — even a one-line change — with no way to satisfy it.

Fix

Make the pre-check use the same diff-based logic as the push gate. Do not add a total-folder limit.

Implementation plan

  1. In safe_outputs_handlers.cjs, replace the total-file-size sum with the staged git diff size (same calculation as push_repo_memory.cjs).
  2. Extract that diff-size calculation into one shared helper so both checks call the same function.
  3. Add tests: a tiny diff on a large folder passes; an oversized diff fails.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions