Skip to content

fix(config): migrate legacy distribution key on write-back (BEX-327) - #31

Merged
piyushsarin-sib merged 2 commits into
enable-public-appfrom
BEX-255_change
Jul 23, 2026
Merged

fix(config): migrate legacy distribution key on write-back (BEX-327)#31
piyushsarin-sib merged 2 commits into
enable-public-appfrom
BEX-255_change

Conversation

@piyushsarin-sib

@piyushsarin-sib piyushsarin-sib commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #30 — two fixes on top of that branch's work:

  1. Migrate legacy config on write-back. readProjectConfig() backfilled auth.type from the legacy top-level distribution key 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 in readProjectConfig().
  2. Move distribution_type to a top-level field. 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: 'private' | 'public' as a top-level field — matching the real brevo app upload payload shape — instead of the nested auth.type from feat: enable public app distribution in brevo app create #30. auth is back to just { scopes, redirectUrls }.

readProjectConfig() now backfills distribution_type from whichever shape is on disk, in precedence order: top-level distribution_type (new) → interim auth.type (never actually released) → oldest legacy top-level distribution (every currently-published scaffold) → defaults to 'private' if none are present. All legacy shapes are dropped on the next write-back — no changes needed in update.ts or start.ts themselves, since both just forward whatever readProjectConfig() returns.

Test Plan

  • New config tests 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 to distribution_type only.
  • Updated update.test.ts fixtures to the new top-level distribution_type shape.
  • Manually verified end-to-end against all three shapes (oldest legacy distribution, interim auth.type, new distribution_type) — each correctly resolves and migrates on write.
  • Full suite: 40 suites, 634 tests passing. yarn lint and yarn build clean.

🤖 Generated with Claude Code

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>

@Tribhuvan14 Tribhuvan14 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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>
@sonarqubecloud

Copy link
Copy Markdown

@piyushsarin-sib
piyushsarin-sib merged commit ca48d26 into enable-public-app Jul 23, 2026
2 checks passed
@piyushsarin-sib
piyushsarin-sib deleted the BEX-255_change branch July 23, 2026 09:23
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>
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