Skip to content

Return the assigned group id from bootstrap - #1243

Merged
elemdos merged 1 commit into
mainfrom
fix/return-bootstrap-group-id
Sep 20, 2026
Merged

elemdos merged 1 commit into
mainfrom
fix/return-bootstrap-group-id

Conversation

@elemdos

@elemdos elemdos commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bootstrap resolves a site's group by id → by name → create. But the store can regenerate a provided id, so the id the caller sent isn't necessarily the id that gets stored. Clients that mirror server.yaml therefore drift from the database — the reported symptom was server.yaml saying architecture1 while the database held a generated id.

Return the authoritative group_id in the bootstrap response, in both branches (with and without an import), so a client can reconcile instead of guess.

Verification

Built locally (go build) and drove it with PRIMO_BINARY from the companion CLI change against a scratch workspace:

before: server.yaml id=architecture1        DB id=<generated>
after:  server.yaml id=hjjkzxsz0n66csy      site.yaml group=hjjkzxsz0n66csy      DB id=hjjkzxsz0n66csy

All three now agree, where before the files kept the requested id and the database had a different one.

Companion

primocms/primo-cli#32 consumes this field and writes the id back into server.yaml / site.yaml (and leaves name references alone). Older CLI versions ignore the new field.

Notes

  • Additive response change only; no existing field is altered.
  • ensureBootstrapGroup still tries to honor a provided id first — this just makes the actual result knowable when the store overrides it.

Summary by CodeRabbit

  • New Features
    • Bootstrap success responses now include the resolved site group identifier for both ZIP imports and standard setup flows.

Bootstrap resolves a group (looking up by id, then by name, then creating one), but a store may regenerate the id it considers invalid — so the id the caller sent is not necessarily what was stored. Return the authoritative `group_id` in the response so a client can reconcile its files with the database instead of guessing.

The CLI (primocms/primo-cli#32) writes it back to server.yaml and site.yaml.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 56696dc9-b90f-4495-bf91-64ac7ae72551

📥 Commits

Reviewing files that changed from the base of the PR and between 6e72090 and fa81927.

📒 Files selected for processing (1)
  • internal/bootstrap.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Bootstrap success responses now include the resolved site group ID for both ZIP-import and no-ZIP paths.

Changes

Bootstrap response

Layer / File(s) Summary
Add group ID to bootstrap responses
internal/bootstrap.go
The ZIP-import and no-ZIP success responses now include group_id.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Feature

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: returning the assigned group ID in the bootstrap response.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@elemdos
elemdos merged commit d59ff62 into main Sep 20, 2026
7 checks passed
@elemdos
elemdos deleted the fix/return-bootstrap-group-id branch September 20, 2026 21:09
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