Skip to content

Count changed files (not total wiki files) in push-wiki-memory limit enforcement - #36818

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-push-wiki-memory-count
Jun 4, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/fix-push-wiki-memory-count

Conversation

Copilot AI commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

push-wiki-memory enforced MAX_FILE_COUNT using total scanned files in the wiki artifact, which incorrectly failed large wikis even when a run changed only a small subset. This updates enforcement to use actual git working-tree changes produced by the run.

  • Behavior change

    • Removes pre-copy limit enforcement based on filesToCopy.length.
    • Enforces MAX_FILE_COUNT after copy using changed-file count from git status --porcelain.
  • Failure semantics

    • Updates the limit error to explicitly describe changed files in the working directory, aligning the guardrail with real mutation scope.
  • Regression guard

    • Adds source-level assertions in push_repo_memory.test.cjs to ensure:
      • changed-file-based enforcement remains present.
      • pre-copy total-file limit enforcement does not return.
const status = execGitSync(["status", "--porcelain"]);
const changedEntries = status
  .split("\n")
  .map(line => line.trim())
  .filter(Boolean);
const changedFileCount = changedEntries.length;

if (changedFileCount > maxFileCount) {
  core.setFailed(`Too many changed files in working directory (${changedFileCount} > ${maxFileCount})`);
  return;
}

Copilot AI changed the title Fix push wiki memory file limit to count changed files Count changed files (not total wiki files) in push-wiki-memory limit enforcement Jun 4, 2026
Copilot AI requested a review from pelikhan June 4, 2026 04:17
@pelikhan
pelikhan marked this pull request as ready for review June 4, 2026 04:20
Copilot AI review requested due to automatic review settings June 4, 2026 04:20
@pelikhan
pelikhan merged commit 7099374 into main Jun 4, 2026
4 of 7 checks passed
@pelikhan
pelikhan deleted the copilot/fix-push-wiki-memory-count branch June 4, 2026 04:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates push_repo_memory’s MAX_FILE_COUNT enforcement to reflect the number of actual working-tree changes produced by the run (via git status --porcelain), instead of the total number of files scanned from the artifact (which could incorrectly fail large wiki artifacts even when only a small subset changes).

Changes:

  • Removes pre-copy MAX_FILE_COUNT enforcement based on filesToCopy.length.
  • Adds post-copy enforcement based on changed-file count derived from git status --porcelain.
  • Adds a regression-style source assertion test to ensure changed-file enforcement remains and the old pre-copy check does not return.
Show a summary per file
File Description
actions/setup/js/push_repo_memory.cjs Moves file-count enforcement to post-copy and bases it on git working-tree changes.
actions/setup/js/push_repo_memory.test.cjs Adds a source-level regression assertion for changed-file-based enforcement.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

let hasChanges = false;
let changedFileCount = 0;
try {
const status = execGitSync(["status", "--porcelain"]);
const scriptContent = nodeFs.readFileSync(scriptPath, "utf8");

expect(scriptContent).toContain("changedFileCount");
expect(scriptContent).toContain('execGitSync(["status", "--porcelain"])');
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.

3 participants