Skip to content

refactor(mirrors): drop denormalized ProductMirror.storage_type - #454

Closed
alukach wants to merge 1 commit into
fix/gcs-provider-alignmentfrom
refactor/drop-mirror-storage-type
Closed

refactor(mirrors): drop denormalized ProductMirror.storage_type#454
alukach wants to merge 1 commit into
fix/gcs-provider-alignmentfrom
refactor/drop-mirror-storage-type

Conversation

@alukach

@alukach alukach commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Stacked on #453 (base is fix/gcs-provider-alignment) — review/merge that first; GitHub will retarget this to main once it lands.

Why

Nothing branched on storage_type: the data proxy keys off the connection's details.provider, and the only source.coop consumer was a display label. It was a denormalized copy of the provider, bridged by a cast. This removes the field entirely — dissolving the "two vocabularies" problem rather than just aligning it.

Changes

  • Drop storage_type from ProductMirrorSchema; stop writing it in createProduct / addProductMirror (removes both provider→storage_type casts and the invariant test they needed).
  • Mirror "Type" label now reads the provider from connectionInfo (sourced from the connection's details.provider on the edit page).
  • No migration: ProductMirrorSchema is a plain z.object, so existing records still carrying storage_type parse fine (unknown key stripped).

Verification

tsc clean · jest affected suites 116/116 · lint clean on changed files.

🤖 Generated with Claude Code

Nothing branched on `storage_type`: the data proxy keys off the
connection's `details.provider`, and the only source.coop consumer was a
display label. It was a denormalized copy of the provider, bridged by a
cast. Remove the field and derive the label from the connection instead.

- Drop `storage_type` from ProductMirrorSchema; stop writing it in
  createProduct / addProductMirror (removes both provider→storage_type
  casts and the DataProvider ⊆ storage_type invariant test they needed).
- Mirror "Type" label now reads the provider from connectionInfo (sourced
  from the connection's details.provider on the edit page).
- No migration: ProductMirrorSchema is a plain z.object, so existing
  records that still carry storage_type parse fine (unknown key stripped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
source-cooperative Ready Ready Preview, Comment Jul 22, 2026 5:55pm

Request Review

@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Claude finished @alukach's task in 1m 29s —— View job


Reviewing PR #454

  • Gather context (diff, changed files)
  • Review diff for correctness/security/best-practice issues
  • Post findings

✅ No blocking issues — safe to merge.

  • The storage_type removal is fully self-consistent: every producer (createProduct, addProductMirror) and consumer (ProductMirrorsManager, tests) was updated together, and no other reference to ProductMirror.storage_type remains in src/ (verified via repo-wide grep).
  • Since ProductMirrorSchema is a plain z.object (not .strict()), existing DynamoDB rows that still carry storage_type will continue to parse fine — the unknown key is silently stripped, matching the PR's stated no-migration claim.
  • src/app/(app)/edit/.../data-connections/page.tsx:59 correctly sources provider from the connection's details.provider and threads it through connectionInfo into ProductMirrorsManager.tsx:238.

One minor (non-blocking) behavior note for awareness, not a regression introduced by sloppy code:

  • ProductMirrorsManager.tsx:236-240 — the "Type" field now renders connectionInfo[mirror.connection_id]?.provider, which is undefined (blank) for a mirror whose connection has since been deleted, whereas the old mirror.storage_type would still show the last-known type for such orphaned mirrors. This mirrors the pre-existing behavior of the "Bucket" field (already connection-dependent), so it's consistent with the rest of the component rather than a new gap — flagging only in case a blank "Type" for orphaned mirrors is undesired.

@alukach

alukach commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Re-split into #455 (value alignment) + #456 (storage_type removal, now also owns the map deletion).

@alukach alukach closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant