feat(cli): add export command to generate desired-state YAML from current state#1731
feat(cli): add export command to generate desired-state YAML from current state#1731rohilsurana wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughAdds an export capability to the reconcile framework: an ChangesReconcile Export Feature
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 75607dba-a629-489d-b90a-5de555cb5f68
📒 Files selected for processing (5)
cmd/reconcile.gointernal/reconcile/platformuser_reconciler.gointernal/reconcile/platformuser_reconciler_test.gointernal/reconcile/reconcile.gointernal/reconcile/reconcile_test.go
Coverage Report for CI Build 28654562809Coverage increased (+0.1%) to 44.962%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
2ca9edd to
d553b7f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 025c0faa-f5bc-4b12-bf33-7bcc3ee2fbaa
📒 Files selected for processing (7)
cmd/apply.gocmd/get.gocmd/root.gointernal/reconcile/platformuser_reconciler.gointernal/reconcile/platformuser_reconciler_test.gointernal/reconcile/reconcile.gointernal/reconcile/reconcile_test.go
✅ Files skipped from review due to trivial changes (1)
- internal/reconcile/reconcile.go
🚧 Files skipped from review as they are similar to previous changes (3)
- internal/reconcile/platformuser_reconciler.go
- internal/reconcile/platformuser_reconciler_test.go
- internal/reconcile/reconcile_test.go
d553b7f to
987ae62
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
cmd/export.go (1)
51-56: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick winNarrow output file permissions for exported PII.
The exported document contains per-principal emails; writing with
0o644leaves it world-readable. Matches an already-flagged concern on a prior commit of this file.🔒 Proposed fix
- return os.WriteFile(output, out, 0o644) + return os.WriteFile(output, out, 0o600)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4ef1ccea-dab3-45ac-8fb9-8f03784960e8
📒 Files selected for processing (7)
cmd/export.gocmd/reconcile.gocmd/root.gointernal/reconcile/platformuser_reconciler.gointernal/reconcile/platformuser_reconciler_test.gointernal/reconcile/reconcile.gointernal/reconcile/reconcile_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
- internal/reconcile/reconcile_test.go
- internal/reconcile/reconcile.go
- internal/reconcile/platformuser_reconciler.go
- internal/reconcile/platformuser_reconciler_test.go
987ae62 to
12fc9a5
Compare
…xport in CLI reference
What
Adds
frontier export <kind>, a top-level sibling offrontier reconcile. It reads the current state of one kind from the server through the admin API and prints it as a desired-state YAML document, the same formatreconcilereads. Output goes to stdout only — redirect it to save a file. YAML is the only format.The
reconcilecommand is unchanged. The kind argument is case-insensitive and accepts a plural, soplatformusersfindsPlatformUser. An unknown kind lists the available ones.Both
reconcileandexportare now documented in the CLI reference (reconcilewas missing from it).Why
When an environment adopts the reconcile flow, its first desired-state file must match what already exists on the server. If it does not, the first apply makes unwanted changes. Writing that file by hand from list APIs is slow and easy to get wrong.
How
Exporterinterface next toReconcilerininternal/reconcile. A kind that implements it can be exported. Kinds that do not implement it return a clear error.PlatformUserimplements it: one entry per principal and relation — a user or service user holding both admin and member exports as two entries. Users are referenced by email when they have one, service users by id. The bootstrap service account is skipped, the same as in reconcile.spec: [], which reconcile accepts as an intentional empty list.reconcileandexport.Guarantees covered by tests
reconcile --dry-runreports no changes, including principals that hold both relations.