fix(config): migrate legacy distribution key on write-back (BEX-327) - #31
Merged
Conversation
readProjectConfig() backfilled auth.type from the legacy top-level distribution key on read, but never stopped forwarding that legacy key into the object callers eventually write back to disk, so it round-tripped forever instead of converging old projects to the new shape. Now dropped centrally in readProjectConfig(), so every write-back path (update.ts, start.ts) migrates automatically. Also narrows auth.type from string to 'private' | 'public'. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Per the resolved discussion on the Product solutioning doc ("distribution_type
would be moved out and reflect auth as well"), ProjectConfig now carries
distribution_type as a top-level field matching the real brevo app upload
payload shape, instead of the nested auth.type introduced earlier today.
auth is back to just { scopes, redirectUrls }.
readProjectConfig() backfills distribution_type from whichever shape is on
disk, in precedence order: top-level distribution_type -> interim auth.type
(never released) -> oldest legacy top-level distribution (every
currently-published scaffold) -> defaults to 'private'. All legacy shapes
are dropped on the next write-back.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
piyushsarin-sib
added a commit
that referenced
this pull request
Jul 23, 2026
* feat: enable public app distribution in brevo app create Accept --distribution public (remove the coming-soon rejection) and enable the Public option in the interactive prompt. Scaffolded app-config.json now writes the actual distribution type into auth.type and drops the redundant top-level distribution key; legacy configs are read transparently by backfilling auth.type from the old key. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: add changeset for public app distribution Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: add testing checklist and work tracker for public app distribution Add TESTING.md as a running checklist of verification criteria (seeded with the enable-public-app changes) and TODO.md as a work tracker. First tracked task: migrate old users' app-config.json distribution type into auth.type on `brevo app update`, dropping the legacy top-level `distribution` key so existing projects converge to the new format. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(app-create): clarify OAuth callback URL hint as local test-server Reword APP_CREATE_REDIRECT_HINT so the localhost default is explicitly labeled a local test-server callback URL (used by `brevo app start oauth`), with a reminder to add a production callback URL before going live. - Update create.test.ts assertions to match the new wording - Append the hint change to the existing changeset (minor bump unchanged) - Add a TESTING.md verification entry, per the new working-docs convention documented in CLAUDE.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(config): migrate legacy distribution key on write-back (BEX-327) (#31) * fix(config): migrate legacy distribution key on write-back (BEX-327) readProjectConfig() backfilled auth.type from the legacy top-level distribution key on read, but never stopped forwarding that legacy key into the object callers eventually write back to disk, so it round-tripped forever instead of converging old projects to the new shape. Now dropped centrally in readProjectConfig(), so every write-back path (update.ts, start.ts) migrates automatically. Also narrows auth.type from string to 'private' | 'public'. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix(config): move distribution_type to a top-level field (BEX-327) Per the resolved discussion on the Product solutioning doc ("distribution_type would be moved out and reflect auth as well"), ProjectConfig now carries distribution_type as a top-level field matching the real brevo app upload payload shape, instead of the nested auth.type introduced earlier today. auth is back to just { scopes, redirectUrls }. readProjectConfig() backfills distribution_type from whichever shape is on disk, in precedence order: top-level distribution_type -> interim auth.type (never released) -> oldest legacy top-level distribution (every currently-published scaffold) -> defaults to 'private'. All legacy shapes are dropped on the next write-back. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Piyush Sarin <piyush.sarin@brevo.com> Co-authored-by: Piyush Sarin <84779634+piyushsarin-sib@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Follow-up to #30 — two fixes on top of that branch's work:
readProjectConfig()backfilledauth.typefrom the legacy top-leveldistributionkey on read, but kept forwarding that legacy key into the object callers eventually write back to disk — so it round-tripped forever instead of converging old projects to the new shape. Fixed centrally inreadProjectConfig().distribution_typeto a top-level field. Per the resolved discussion on the Product solutioning doc ("distribution_type would be moved out and reflect auth as well"),ProjectConfignow carriesdistribution_type: 'private' | 'public'as a top-level field — matching the realbrevo app uploadpayload shape — instead of the nestedauth.typefrom feat: enable public app distribution in brevo app create #30.authis back to just{ scopes, redirectUrls }.readProjectConfig()now backfillsdistribution_typefrom whichever shape is on disk, in precedence order: top-leveldistribution_type(new) → interimauth.type(never actually released) → oldest legacy top-leveldistribution(every currently-published scaffold) → defaults to'private'if none are present. All legacy shapes are dropped on the next write-back — no changes needed inupdate.tsorstart.tsthemselves, since both just forward whateverreadProjectConfig()returns.Test Plan
configtests covering all three read-precedence paths, the strip-on-return behavior for both legacy shapes, and full read → write round-trips proving the on-disk file converges todistribution_typeonly.update.test.tsfixtures to the new top-leveldistribution_typeshape.distribution, interimauth.type, newdistribution_type) — each correctly resolves and migrates on write.yarn lintandyarn buildclean.🤖 Generated with Claude Code