Skip to content

feat(core): add .nx/polygraph to gitignore in migration and caia#34659

Merged
MaxKless merged 2 commits intomasterfrom
polygrpah-gitignore-caia
Mar 2, 2026
Merged

feat(core): add .nx/polygraph to gitignore in migration and caia#34659
MaxKless merged 2 commits intomasterfrom
polygrpah-gitignore-caia

Conversation

@MaxKless
Copy link
Copy Markdown
Collaborator

@MaxKless MaxKless commented Mar 2, 2026

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #


Note

Low Risk
Low risk: additive changes that only update .gitignore using an ignore-pattern check to avoid duplicates or already-covered entries; no runtime behavior beyond file generation/migrations.

Overview
Ensures .nx/polygraph is automatically ignored by Git.

Adds a 22-7-0-add-polygraph-to-git-ignore migration (registered in migrations.json) that appends .nx/polygraph to an existing .gitignore, while skipping Lerna-only workspaces (with lerna.json but no nx.json).

Updates the setup-ai-agents generator to also add .nx/polygraph to the target directory’s .gitignore, and introduces a shared addEntryToGitIgnore helper that avoids adding the entry when it’s already present or covered by broader ignore rules; tests were added for both the migration and generator behavior.

Written by Cursor Bugbot for commit de6f232. This will update automatically on new commits. Configure here.

@MaxKless MaxKless requested a review from a team as a code owner March 2, 2026 09:47
@MaxKless MaxKless requested a review from AgentEnder March 2, 2026 09:47
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 2, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit de6f232
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69a58be0f0ac34000862385f
😎 Deploy Preview https://deploy-preview-34659--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 2, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit de6f232
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69a58be0bc2b700008c1ec72
😎 Deploy Preview https://deploy-preview-34659--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Mar 2, 2026

View your CI Pipeline Execution ↗ for commit de6f232

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 57m 44s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 26s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 7s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-02 14:10:49 UTC

ig.add(gitignore);
if (!ig.ignores(entry)) {
const updatedLines = gitignore.length ? [gitignore, entry] : [entry];
tree.write(gitignorePath, updatedLines.join('\n'));
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.

Missing trailing newline in the generated .gitignore file. The current code uses join('\n') which places newlines between elements but not at the end. This removes any trailing newline that existed in the original file, violating POSIX text file standards and potentially causing git to show "no newline at end of file" warnings.

Impact: Changes file format unexpectedly, may cause git warnings.

Fix:

tree.write(gitignorePath, updatedLines.join('\n') + '\n');

This ensures the file always ends with a newline, which is the standard for text files.

Suggested change
tree.write(gitignorePath, updatedLines.join('\n'));
tree.write(gitignorePath, updatedLines.join('\n') + '\n');

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

This comment came from an experimental review—please leave feedback if it was helpful/unhelpful. Learn more about experimental comments here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Free Tier Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

ig.add(gitignore);
if (!ig.ignores(entry)) {
const updatedLines = gitignore.length ? [gitignore, entry] : [entry];
tree.write(gitignorePath, updatedLines.join('\n'));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Written gitignore file lacks trailing newline

Low Severity

addEntryToGitIgnore writes the updated .gitignore without a trailing newline. When the existing content ends with \n (standard for text files), [gitignore, entry].join('\n') produces a double blank line before the entry and no final newline. The migration path has no Prettier pass to fix this, so git will warn about \ No newline at end of file for every user who runs this migration.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

These changes fix the test failure by updating the expected output message. The new migration 22-7-0-add-polygraph-to-git-ignore legitimately modifies .gitignore in fresh workspaces, causing lerna repair to output "Successfully repaired your configuration" instead of "No changes were necessary". This test now correctly expects the new behavior introduced by the PR's migration.

Warning

We could not verify this fix.

diff --git a/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts b/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts
index bdddb8842a..d02d5642d6 100644
--- a/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts
+++ b/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts
@@ -45,7 +45,7 @@ describe('Lerna Smoke Tests', () => {
         .replace(/Ran .* from .*\n  .*\n\n/g, '') // end of individual migration run
         .replace(/No changes were made\n\n/g, ''); // no changes during individual migration run
       expect(result).toContain(
-        'Lerna   No changes were necessary. This workspace is up to date!'
+        'Lerna   Successfully repaired your configuration. This workspace is up to date!'
       );
     }, 1000000);
   });

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally ovtL-CV8q

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

@MaxKless MaxKless merged commit aa4f47e into master Mar 2, 2026
25 of 26 checks passed
@MaxKless MaxKless deleted the polygrpah-gitignore-caia branch March 2, 2026 15:15
FrozenPandaz pushed a commit that referenced this pull request Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 8, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants