Conversation
|
Updates to Preview Branch (feature/dpp-theme-refactor) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
Greptile SummaryThis PR is a significant refactor of the DPP (Digital Product Passport) theme system, consolidating the previous dual-field approach ( Key changes:
Issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Design Editor (Client)
participant SA as saveThemeAction (Server Action)
participant TR as brand.theme.update (tRPC)
participant DB as brand_theme (DB)
participant API as brand.theme.get (tRPC)
Note over Client,DB: Save flow (saveDrafts)
Client->>SA: passport (full public image URLs)
SA->>SA: buildPassportStylesheet(tokens)
SA->>SA: upload stylesheet to dpp-themes bucket
SA->>DB: UPDATE brand_theme SET passport = passport (full URLs stored — NOT normalised)
Note over Client,DB: Save via tRPC update (e.g. admin app)
Client->>TR: passport (may contain full URLs or storage paths)
TR->>TR: normalizePassportImagePathsForStorage(passport)
TR->>DB: UPDATE brand_theme SET passport = normalised passport (storage paths stored)
Note over Client,DB: Read flow
Client->>API: brand.theme.get
API->>DB: SELECT passport, googleFontsUrl, updatedAt
DB-->>API: passport row
API->>API: resolvePassportImageUrls(supabase, passport)
Note right of API: normalizeBucketValue handles both<br/>full URLs and storage paths
API-->>Client: passport (resolved public URLs)
|
There was a problem hiding this comment.
3 issues found across 290 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/api/supabase/migrations/20260308104741_aberrant_ares.sql">
<violation number="1" location="apps/api/supabase/migrations/20260308104741_aberrant_ares.sql:2">
P1: This migration drops `theme_styles` without migrating existing data into `passport`, causing irreversible data loss.</violation>
</file>
<file name="apps/app/src/components/forms/passport/variant-form.tsx">
<violation number="1" location="apps/app/src/components/forms/passport/variant-form.tsx:375">
P2: Publishing failures in edit mode are treated as save failures. If publish throws, the catch block shows "Failed to save variant" even though `submit()` already saved the overrides, which is misleading. Handle publish as best-effort (like create mode) and report a partial failure instead of failing the save.</violation>
</file>
<file name="apps/app/src/actions/design/save-theme-action.ts">
<violation number="1" location="apps/app/src/actions/design/save-theme-action.ts:33">
P2: Guard `passport.tokens` before calling `buildPassportStylesheet` (or validate the passport shape). As written, a null/invalid passport will throw when dereferencing `tokens`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
🚀 Preview Deployment SummaryApp: https://avelero-4ocuip3va-avelero.vercel.app Preview environments will auto-delete when PR closes. |
🚀 Preview Deployment SummaryApp: https://avelero-3ma5dal6w-avelero.vercel.app Preview environments will auto-delete when PR closes. |
🚀 Preview Deployment SummaryApp: https://avelero-czecbr9do-avelero.vercel.app Preview environments will auto-delete when PR closes. |
🚀 Preview Deployment SummaryApp: https://avelero-a7voq0zxx-avelero.vercel.app Preview environments will auto-delete when PR closes. |
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/dpp-components/src/components/modals/impact-modal.tsx">
<violation number="1" location="packages/dpp-components/src/components/modals/impact-modal.tsx:352">
P1: Synchronize `activeTab` with `metrics` updates; otherwise the modal can show no comparisons after async metric changes (e.g., water-only data loaded after initial render).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| } | ||
| } | ||
|
|
||
| const [activeTab, setActiveTab] = useState<MetricCategory>( |
There was a problem hiding this comment.
P1: Synchronize activeTab with metrics updates; otherwise the modal can show no comparisons after async metric changes (e.g., water-only data loaded after initial render).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/dpp-components/src/components/modals/impact-modal.tsx, line 352:
<comment>Synchronize `activeTab` with `metrics` updates; otherwise the modal can show no comparisons after async metric changes (e.g., water-only data loaded after initial render).</comment>
<file context>
@@ -1,65 +1,376 @@
+ }
+ }
+
+ const [activeTab, setActiveTab] = useState<MetricCategory>(
+ availableCategories[0]?.category ?? "carbon",
+ );
</file context>
🚀 Preview Deployment SummaryApp: https://avelero-e6bp74euj-avelero.vercel.app Preview environments will auto-delete when PR closes. |
Summary by cubic
Refactored DPP theming into a single Passport JSON per brand and wired it through the DB, TRPC, and the editor. Added a server-side Google Maps Static API proxy, moved the app shell to system fonts, and shipped small UX improvements.
Refactors
passportJSON across DB,brand.theme.get/update, and the editor; save action now builds a Passport stylesheet and normalizes image paths before upload.Passporttypes andbuildPassportStylesheetfrom@v1/dpp-components; kept Google Fonts URL generation.resolvePassportImageUrlsand addednormalizePassportImagePathsForStorage./api/google-maps/staticproxy and moved the app shell to a system font stack (removedgeist).Migration
20260308104741_aberrant_ares(addsbrand_theme.passport, dropstheme_stylesandtheme_config).brand_theme.passportfor existing brands before enabling the new editor.dpp-assetsanddpp-themesexist and that normalized image URLs resolve.Written for commit 02bad8d. Summary will update on new commits.