Skip to content

Feature/bug sweep#124

Merged
rafmevis merged 9 commits intomainfrom
feature/bug-sweep
Mar 5, 2026
Merged

Feature/bug sweep#124
rafmevis merged 9 commits intomainfrom
feature/bug-sweep

Conversation

@rafmevis
Copy link
Collaborator

@rafmevis rafmevis commented Mar 5, 2026

Summary by cubic

Strengthens theme editing and DPP with stable materials, adaptive fonts, sharper images, and safe external links. Adds storage‑domain config and URL remapping across apps, revalidates DPP passports on publish via UPID/barcode tags, and introduces a delete‑safe catalog fan‑out that auto‑republishes affected products.

  • New Features

    • Materials editor: normalized input (.7 → 0.7), stable totals with two‑decimal rounding, and uninterrupted editing while focused.
    • Typography: weight options adapt per family (Google/custom, incl. variable); invalid weights auto‑correct; preview uses a canonical Google Fonts URL; newly uploaded custom fonts auto‑select.
    • DPP UI: manufacturer links and testing institute websites show when present; sharper images and improved CTA button styling.
    • Social: YouTube link added to theme config, editor, demo data, and DPP footer.
    • Storage: support NEXT_PUBLIC_STORAGE_URL/SUPABASE_STORAGE_URL, Next.js image allowlist for the storage domain (admin/app), public URL remapping in Supabase utils and jobs (incl. QR export), and legacy/storage path extraction in the DPP API.
    • DPP cache: revalidate passport pages on variant/product publish using new dpp‑passport/dpp‑barcode tags.
    • Catalog fan‑out: enqueue a ~45s delayed Trigger.dev job on manufacturer/material/certification/operator edits; captures affected published product IDs before FK updates and deduplicates by content hash.
  • Bug Fixes

    • Prevent percentage drift and >100% errors using integer hundredths in validation.
    • Correct bulk selection payload key from includeIds to ids.
    • Keep the selected item visible when opening font lists and generic selects; focus search on material chooser.
    • Resolve snapshot product images to valid public URLs and remap public storage URLs to the configured storage domain.
    • Prefetch notifications in the theme editor to reduce refresh flicker.

Written for commit 1ce0cc3. Summary will update on new commits.

@supabase
Copy link

supabase bot commented Mar 5, 2026

Updates to Preview Branch (feature/bug-sweep) ↗︎

Deployments Status Updated
Database Thu, 05 Mar 2026 21:39:52 UTC
Services Thu, 05 Mar 2026 21:39:52 UTC
APIs Thu, 05 Mar 2026 21:39:52 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Thu, 05 Mar 2026 21:39:58 UTC
Migrations Thu, 05 Mar 2026 21:40:01 UTC
Seeding Thu, 05 Mar 2026 21:40:02 UTC
Edge Functions Thu, 05 Mar 2026 21:40:04 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

8 issues found across 27 files

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/app/src/hooks/use-variant-form.ts">

<violation number="1" location="apps/app/src/hooks/use-variant-form.ts:280">
P2: Rounding before the negative check means small negative percentages (e.g., -0.004) become 0 and bypass validation. Validate the raw percentage value before rounding so any negative input is rejected.</violation>
</file>

<file name="packages/dpp-components/src/lib/google-fonts.ts">

<violation number="1" location="packages/dpp-components/src/lib/google-fonts.ts:104">
P2: The variable-font weight filter can return an empty list, producing malformed `:wght@` URLs.</violation>
</file>

<file name="apps/app/src/components/select/font-select.tsx">

<violation number="1" location="apps/app/src/components/select/font-select.tsx:134">
P2: The pending auto-select flag is not cleared when no new custom font is added, which can cause unexpected future auto-selection on later `customFonts` updates.</violation>
</file>

<file name="packages/dpp-components/src/components/layout/product-image.tsx">

<violation number="1" location="packages/dpp-components/src/components/layout/product-image.tsx:24">
P2: Using `width={0}` and `height={0}` on `next/image` removes meaningful intrinsic sizing and can cause layout shift now that the fixed aspect-ratio wrapper was removed.</violation>
</file>

<file name="apps/app/src/hooks/use-passport-form.ts">

<violation number="1" location="apps/app/src/hooks/use-passport-form.ts:257">
P2: Validate raw percentage bounds before rounding; current check can accept slightly negative or >100 inputs.</violation>
</file>

<file name="packages/dpp-components/src/components/materials/materials-frame.tsx">

<violation number="1" location="packages/dpp-components/src/components/materials/materials-frame.tsx:29">
P2: Scheme detection is case-sensitive, so valid mixed/uppercase `http(s)` URLs are transformed into malformed links.</violation>
</file>

<file name="packages/dpp-components/src/components/product/product-details.tsx">

<violation number="1" location="packages/dpp-components/src/components/product/product-details.tsx:32">
P2: Protocol detection is case-sensitive, which can generate malformed links for valid mixed/upper-case `http(s)` URLs.</violation>
</file>

<file name="apps/app/src/components/theme-editor/panel/views/typography-editor.tsx">

<violation number="1" location="apps/app/src/components/theme-editor/panel/views/typography-editor.tsx:200">
P2: Variable fonts without a `wght` axis incorrectly expose all weight options (100–900), allowing unsupported font weights to be selected.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@greptile-apps
Copy link

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This is a broad feature/bug sweep touching 36 files across the DPP, app, and shared packages. The main themes are: adding YouTube to the social links feature set (type, defaults, demo data, footer, component tree), surfacing manufacturer website and certification URLs as clickable links in the DPP, replacing hardcoded Google Fonts weight lists with font-metadata-aware weight resolution, floating-point-safe percentage arithmetic in the materials block and validation hooks, and a collection of UI polish fixes (image quality, popover sizing, scroll-to-selected, font auto-select after upload).

Key changes:

  • YouTube social link added end-to-end: ThemeConfig type → defaults → demo data → footer render → component tree
  • Manufacturer website and certification testingInstitute.website now flow from the DB queries through buildDppData / InformationFrame into clickable links in ProductDetails and MaterialsFrame
  • Google Fonts URL generation now reads actual font variant metadata (variable axes or static variant list) rather than always requesting weights 300/400/500/700
  • TypographyScaleForm dynamically restricts the weight picker to variants actually available for the selected font, with a useEffect fallback when the current weight is unavailable after a font change
  • Materials block prevents sync overwriting a percentage value while the user is actively typing, using a ref-tracked focused-row guard
  • Percentage validation in both usePassportForm and useVariantForm now uses integer arithmetic (hundredths) to avoid floating-point sum drift
  • table-section.tsx bulk-action payload field renamed from includeIds to ids (bug fix)
  • apps/storage/vercel.json added to proxy and cache storage object URLs via Vercel rewrites
  • seo-geo-audit-march-2026.md is listed as a changed file in the PR diff and simultaneously added to .gitignore; the file is still tracked in git and must be untracked via git rm --cached to actually remove it from the repository

Confidence Score: 3/5

  • Safe to merge with caveats — one potential runtime regression (Geist font removal) and one committed internal document that needs cleanup.
  • The majority of changes are well-structured bug fixes and additive features with no breaking surface. The two issues that lower the score are: (1) removing Geist from LOCAL_FONTS while also removing the hardcoded Geist stylesheet from the DPP layout — if any live theme config stores a Geist font family this will silently break font rendering; and (2) the seo-geo-audit-march-2026.md file appears to have been committed to the repository and merely adding it to .gitignore does not untrack it. The code duplication across hooks and components is a maintainability concern but not a runtime risk.
  • packages/dpp-components/src/lib/google-fonts.ts (Geist removal) and .gitignore / seo-geo-audit-march-2026.md (committed internal document).

Important Files Changed

Filename Overview
packages/dpp-components/src/lib/google-fonts.ts Improves font URL generation to use font metadata (variants/axes) for accurate weight selection, but removes Geist from LOCAL_FONTS which could cause broken Google Fonts requests for any theme still using Geist.
apps/app/src/hooks/use-passport-form.ts Adds floating-point-safe percentage validation using integer arithmetic (hundredths); logic is duplicated verbatim in use-variant-form.ts.
apps/app/src/hooks/use-variant-form.ts Same floating-point-safe percentage validation as use-passport-form.ts; four utility constants/functions are duplicated between the two files.
packages/dpp-components/src/components/product/product-details.tsx Adds manufacturer website link and capitalizes labels; defines toExternalHref helper that is also defined identically in materials-frame.tsx.
packages/dpp-components/src/components/materials/materials-frame.tsx Adds clickable certification URL links with proper rel/target, using toExternalHref helper that is also duplicated in product-details.tsx.
apps/app/src/components/theme-editor/panel/views/typography-editor.tsx Adds per-font weight options based on Google Font metadata and custom font declarations; useEffect to auto-correct invalid weights depends on the entire value object rather than only fontFamily, causing unnecessary runs on every typography field change.
apps/app/src/components/forms/passport/blocks/materials-block.tsx Significant improvement: adds stable percentage rounding helpers, focus tracking to avoid clobbering live user input during parent sync, and search auto-focus on popover open.
.gitignore Adds seo-geo-audit-march-2026.md to .gitignore, but the file itself appears as a changed file in this PR, indicating it was committed before being ignored — it needs to be untracked with git rm --cached.

Sequence Diagram

sequenceDiagram
    participant User
    participant TypographyEditor
    participant FontSelect
    participant GoogleFontsLib
    participant GoogleFonts

    User->>FontSelect: Selects font family
    FontSelect->>GoogleFontsLib: generateGoogleFontsUrlForFont(family)
    GoogleFontsLib->>GoogleFontsLib: isGoogleFont(family)
    alt Google Font
        GoogleFontsLib->>GoogleFontsLib: getFontWeights(family)<br/>(reads font metadata/axes)
        GoogleFontsLib-->>FontSelect: Fonts CSS URL with exact weights
        FontSelect->>GoogleFonts: Load stylesheet link
    else Local/Custom Font
        GoogleFontsLib-->>FontSelect: "" (skip)
    end

    FontSelect-->>TypographyEditor: onValueChange(fontFamily)
    TypographyEditor->>TypographyEditor: getAvailableWeightOptions(fontFamily, customFonts)
    TypographyEditor->>TypographyEditor: useEffect: validate current fontWeight<br/>vs available options
    alt Weight not available
        TypographyEditor->>TypographyEditor: onChange(fallbackWeight)
    end

    User->>TypographyEditor: Saves theme
    TypographyEditor->>GoogleFontsLib: generateGoogleFontsUrlFromTypography(typography)
    GoogleFontsLib-->>TypographyEditor: Combined URL for all scale fonts
    TypographyEditor->>GoogleFonts: Inject preconnect + stylesheet links
Loading

Comments Outside Diff (3)

  1. General comment

    useEffect depends on the entire value object instead of just fontFamily

    The effect's purpose is to reset the font weight when the selected font family changes its available variants. However, because value (the full TypographyScale object) is in the dependency array, the effect also fires whenever fontSize, lineHeight, letterSpacing, or any other field changes — even though none of those affect weightOptions. Each unnecessary run calls hasCurrentWeight, iterates weightOptions, and does a redundant string-to-number parse.

    A more targeted dependency would be value.fontFamily (or just value.fontWeight):

    // deps that actually matter for this check
    }, [weightOptions, value.fontFamily, value.fontWeight, onChange]);

    This avoids re-running the weight validation on every keystroke in other typography fields.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/app/src/components/theme-editor/panel/views/typography-editor.tsx
    Line: 920-934
    
    Comment:
    **`useEffect` depends on the entire `value` object instead of just `fontFamily`**
    
    The effect's purpose is to reset the font weight when the selected font family changes its available variants. However, because `value` (the full `TypographyScale` object) is in the dependency array, the effect also fires whenever `fontSize`, `lineHeight`, `letterSpacing`, or any other field changes — even though none of those affect `weightOptions`. Each unnecessary run calls `hasCurrentWeight`, iterates `weightOptions`, and does a redundant string-to-number parse.
    
    A more targeted dependency would be `value.fontFamily` (or just `value.fontWeight`):
    
    ```typescript
    // deps that actually matter for this check
    }, [weightOptions, value.fontFamily, value.fontWeight, onChange]);
    ```
    
    This avoids re-running the weight validation on every keystroke in other typography fields.
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. General comment

    seo-geo-audit-march-2026.md is committed but adding it to .gitignore does not untrack it

    seo-geo-audit-march-2026.md appears as a changed file in this PR's diff, which means it was committed to the repository. Adding a file to .gitignore only prevents future untracked files from being staged — it does not remove a file that is already tracked by git.

    The file is still fully visible in the repository history to anyone with read access. To actually untrack it, run:

    git rm --cached seo-geo-audit-march-2026.md

    If this is a sensitive internal document, consider whether it needs to be scrubbed from git history as well.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: .gitignore
    Line: 141-142
    
    Comment:
    **`seo-geo-audit-march-2026.md` is committed but adding it to `.gitignore` does not untrack it**
    
    `seo-geo-audit-march-2026.md` appears as a changed file in this PR's diff, which means it was committed to the repository. Adding a file to `.gitignore` only prevents *future* untracked files from being staged — it does not remove a file that is already tracked by git.
    
    The file is still fully visible in the repository history to anyone with read access. To actually untrack it, run:
    
    ```bash
    git rm --cached seo-geo-audit-march-2026.md
    ```
    
    If this is a sensitive internal document, consider whether it needs to be scrubbed from git history as well.
    
    How can I resolve this? If you propose a fix, please make it concise.
  3. General comment

    Geist removed from LOCAL_FONTS may break existing themes

    "geist", "geist sans", and "geist mono" were removed from the LOCAL_FONTS list. After this change, isGoogleFont("Geist") returns true, so generateGoogleFontsUrl(["Geist"]) will construct a Google Fonts stylesheet URL for Geist. Geist is a Vercel font — it is not hosted on Google Fonts — so that request will fail with a 404 and the font will silently fall back to the browser default.

    The hardcoded <link> for Geist is also removed from apps/dpp/src/app/layout.tsx in this same PR, closing the last loading path. If any brand has Geist, Geist Sans, or Geist Mono stored in their theme config in the database, those DPP pages will lose their font rendering after this deploy.

    Consider either keeping the three Geist entries in LOCAL_FONTS until confirmed no live themes use them, or running a data migration to replace Geist selections before removing the entries.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/dpp-components/src/lib/google-fonts.ts
    Line: 13-17
    
    Comment:
    **Geist removed from `LOCAL_FONTS` may break existing themes**
    
    `"geist"`, `"geist sans"`, and `"geist mono"` were removed from the `LOCAL_FONTS` list. After this change, `isGoogleFont("Geist")` returns `true`, so `generateGoogleFontsUrl(["Geist"])` will construct a Google Fonts stylesheet URL for `Geist`. Geist is a Vercel font — it is not hosted on Google Fonts — so that request will fail with a 404 and the font will silently fall back to the browser default.
    
    The hardcoded `<link>` for Geist is also removed from `apps/dpp/src/app/layout.tsx` in this same PR, closing the last loading path. If any brand has `Geist`, `Geist Sans`, or `Geist Mono` stored in their theme config in the database, those DPP pages will lose their font rendering after this deploy.
    
    Consider either keeping the three Geist entries in `LOCAL_FONTS` until confirmed no live themes use them, or running a data migration to replace Geist selections before removing the entries.
    
    How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: d8aa30a

tr4m0ryp
tr4m0ryp previously approved these changes Mar 5, 2026
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Preview Deployment Summary

App: https://avelero-9zxwovq6p-avelero.vercel.app
API: https://pr-124-avelero-api.fly.dev
Web: https://avelero-website-qxgdh1gi6-avelero.vercel.app
Admin: https://avelero-admin-g6x2zhluj-avelero.vercel.app
DPP: https://avelero-passport-5czc8gh7s-avelero.vercel.app
Jobs: Deployed to Trigger.dev

Preview environments will auto-delete when PR closes.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 14 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/jobs/src/trigger/bulk/export-qr-codes.ts">

<violation number="1" location="packages/jobs/src/trigger/bulk/export-qr-codes.ts:97">
P2: This adds a duplicate implementation of storage public URL remapping that already exists in packages/supabase/src/utils/storage.ts. Reuse the shared utility to avoid divergence and reduce maintenance overhead.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Preview Deployment Summary

App: https://avelero-ivubmq137-avelero.vercel.app
API: https://pr-124-avelero-api.fly.dev
Web: https://avelero-website-qqrfs64lt-avelero.vercel.app
Admin: https://avelero-admin-49x1f79bq-avelero.vercel.app
DPP: https://avelero-passport-kh3914h80-avelero.vercel.app
Jobs: Deployed to Trigger.dev

Preview environments will auto-delete when PR closes.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Preview Deployment Summary

App: ❌ Failed
API: ❌ Failed
Web: ❌ Failed
Admin: https://avelero-admin-djmrs7y78-avelero.vercel.app
DPP: https://avelero-passport-8f9u5xi70-avelero.vercel.app
Jobs: Deployed to Trigger.dev

Preview environments will auto-delete when PR closes.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Preview Deployment Summary

App: https://avelero-bdq7k6ir3-avelero.vercel.app
API: https://pr-124-avelero-api.fly.dev
Web: https://avelero-website-1pb8bajiu-avelero.vercel.app
Admin: https://avelero-admin-5035vp22y-avelero.vercel.app
DPP: https://avelero-passport-arwfurywe-avelero.vercel.app
Jobs: Deployed to Trigger.dev

Preview environments will auto-delete when PR closes.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 13 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/jobs/src/trigger/catalog/fan-out.ts">

<violation number="1" location="packages/jobs/src/trigger/catalog/fan-out.ts:59">
P2: The queue config doesn’t enforce the “1 per brand” behavior described in the comment. Without a `concurrencyKey`, `concurrencyLimit: 5` applies to the whole queue and allows concurrent runs for the same brand, which can still step on each other’s snapshot writes. Consider using a per-brand `concurrencyKey` at trigger time (or align the comment/config).</violation>
</file>

<file name="apps/api/src/trpc/routers/catalog/index.ts">

<violation number="1" location="apps/api/src/trpc/routers/catalog/index.ts:371">
P2: New fan-out branch duplicates core CRUD logic instead of reusing shared helpers, increasing maintenance drift risk.</violation>

<violation number="2" location="apps/api/src/trpc/routers/catalog/index.ts:445">
P1: Delete fan-out is triggered after FK nullification, which can miss affected published products for manufacturer/certification deletions.</violation>
</file>

<file name="packages/db/src/queries/products/catalog-fan-out.ts">

<violation number="1" location="packages/db/src/queries/products/catalog-fan-out.ts:108">
P2: Certification fan-out duplicates material fan-out query logic instead of sharing one implementation, creating a high risk of future logic drift.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Preview Deployment Summary

App: https://avelero-9no6is4m6-avelero.vercel.app
API: https://pr-124-avelero-api.fly.dev
Web: https://avelero-website-l4frxsdk9-avelero.vercel.app
Admin: https://avelero-admin-jtynm7o8s-avelero.vercel.app
DPP: https://avelero-passport-a7tqkf6d0-avelero.vercel.app
Jobs: Deployed to Trigger.dev

Preview environments will auto-delete when PR closes.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🚀 Preview Deployment Summary

App: https://avelero-mgf1ztw69-avelero.vercel.app
API: https://pr-124-avelero-api.fly.dev
Web: https://avelero-website-f7lgphezf-avelero.vercel.app
Admin: https://avelero-admin-joa0je8nk-avelero.vercel.app
DPP: https://avelero-passport-jh5k2j69t-avelero.vercel.app
Jobs: Deployed to Trigger.dev

Preview environments will auto-delete when PR closes.

@rafmevis rafmevis merged commit 5eb17fb into main Mar 5, 2026
21 checks passed
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