Skip to content

Stop primo add from duplicating the Default group - #49

Merged
elemdos merged 2 commits into
masterfrom
fix/duplicate-site-groups
Sep 30, 2026
Merged

elemdos merged 2 commits into
masterfrom
fix/duplicate-site-groups

Conversation

@elemdos

@elemdos elemdos commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Round-3 release testing reproduced #17 from round 1: server.yaml ends up with the same "Default" group twice (same id, index 0 and 1).

Cause

After the first import, server.yaml holds the server's id for Default instead of the default slug. A hand-authored site.yaml with group: default made primo add append { id: default, name: Default }, and the group writeback then rewrote that entry to the server's id, producing two identical entries. primo dev also printed a rewrite notice on every start.

Fix

  • primo add reuses an existing group named Default and points the site at its id.
  • write_server_config keeps one entry per group id and re-indexes, so workspaces that already have the duplicate heal the next time the file is written.

Tests

  • Reproduced with init → new → dev → hand-authored site with group: default → add → dev. Before: two entries. After: one, with both sites on the same group id.
  • New write_server_config dedupe test. 94 tests: 93 pass, and the one skip needs a real binary.

🤖 Generated with Claude Code

After the first import server.yaml holds the server's id for Default, but a
hand-authored site.yaml still saying group: default made add append a second
Default entry, which was then rewritten to the same id: two identical groups,
and a rewrite notice on every dev start. Point the site at the existing
Default group instead, and drop repeated group ids whenever server.yaml is
written so existing workspaces heal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 61628f2e-a0cc-407d-8f32-7d33c2c89c6b

📥 Commits

Reviewing files that changed from the base of the PR and between b6d4f1f and fccb6b9.

📒 Files selected for processing (4)
  • src/commands/add.ts
  • src/commands/new.ts
  • src/utils/server-config.ts
  • tests/group-writeback.test.mjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A round-3 agent opened a site's preview URL, got the CMS, and couldn't tell
it needed a preview build first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elemdos
elemdos merged commit da1f494 into master Sep 30, 2026
2 checks passed
@elemdos elemdos mentioned this pull request Sep 30, 2026
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.

1 participant