Skip to content

feat(reconcile): add a Preference kind#1762

Open
rohilsurana wants to merge 4 commits into
feat/reconcile-roles-permissionsfrom
feat/reconcile-preference-kind
Open

feat(reconcile): add a Preference kind#1762
rohilsurana wants to merge 4 commits into
feat/reconcile-roles-permissionsfrom
feat/reconcile-preference-kind

Conversation

@rohilsurana

Copy link
Copy Markdown
Member

Stacked on #1737; will rebase onto main once #1731 and #1737 squash-merge.

What

A Preference kind for frontier reconcile and frontier export, for platform settings
like disable_orgs_on_create and the invite mail template.

kind: Preference
spec:
  - name: disable_orgs_on_create
    value: "true"

How it behaves (per the RFC's rules)

  • Missing entry resets to default (rule 4, the settings option). The file is the full
    desired state. A preference you list is set to your value; a preference you leave out is
    written back to its trait default. This is the first kind to use reset-to-default.
  • No delete flag (rule 5). There is no delete RPC, and setting a preference back to
    its default is what removal means here.
  • Export (rule 9). Export writes only the preferences whose value differs from the
    default, sorted by name, so reconciling an export plans no changes.

Values are strings end to end, so a yes/no setting compares as "true" or "false".
Unknown names and duplicate names fail the plan. A stored value whose trait no longer
exists is left alone — the file cannot name it, so nothing manages it.

API use

  • ListPreferences (AdminService) reads the stored platform preferences.
  • DescribePreferences (FrontierService) gives the valid platform traits and their
    defaults — both the source of defaults and the set of valid names.
  • CreatePreferences (AdminService) upserts a value; a reset writes the default back.

Values are read from the DB on every call, so a write reaches all pods. There is a
standing TODO in core/preference/service.go to cache platform preferences; if that lands
as a boot-lifetime map, pods would serve stale values after a write. It needs a TTL or
read-through. Flagging it here so the cache is not added without that.

Tests

  • Diff: set, reset, converged, a value equal to the default is a no-op, sets before
    resets, unknown trait, duplicate name, empty name, and a stored value whose trait is
    gone.
  • Reconciler with a fake API: apply a set and a reset, dry run, unknown trait fails before
    applying, export returns only overrides and round-trips, and an all-default export is
    empty.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Jul 16, 2026 8:30am

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c34fd99a-8813-4902-b90d-98e7c8cc0393

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@coveralls

coveralls commented Jul 15, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29475048848

Coverage increased (+0.1%) to 45.593%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 18 uncovered changes across 2 files (108 of 126 lines covered, 85.71%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
internal/reconcile/preference_reconciler.go 78 61 78.21%
cmd/reconcile.go 6 5 83.33%
Total (3 files) 126 108 85.71%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
cmd/reconcile.go 1 43.37%

Coverage Stats

Coverage Status
Relevant Lines: 38311
Covered Lines: 17467
Line Coverage: 45.59%
Coverage Strength: 13.07 hits per line

💛 - Coveralls

@rohilsurana rohilsurana marked this pull request as ready for review July 16, 2026 07:50
@rohilsurana rohilsurana force-pushed the feat/reconcile-roles-permissions branch from 71e95c2 to a226f47 Compare July 16, 2026 08:28
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.

2 participants