Skip to content

Promote staging to main#26

Merged
eskobar95 merged 3 commits into
mainfrom
staging
Apr 15, 2026
Merged

Promote staging to main#26
eskobar95 merged 3 commits into
mainfrom
staging

Conversation

@eskobar95
Copy link
Copy Markdown
Owner

@eskobar95 eskobar95 commented Apr 15, 2026

Summary

  • Storefront SEO / sitemap: Canonical site URL now falls back to STOREFRONT_URL and RAILWAY_PUBLIC_DOMAIN when NEXT_PUBLIC_SITE_URL / Vercel env is missing, avoiding localhost in sitemap.xml. Sitemap lists da only via sitemapLocales until /en is ready for indexing.
  • Broader staging delta: Includes prior staged work (SEO, CMS/Payload, PostHog, commerce brand PLP fixes, CI/docs, etc.) — see commits on staging since last promotion.

Test plan

  • Storefront build passes on CI for this PR
  • After deploy: /sitemap.xml uses https://guapo.store (set NEXT_PUBLIC_SITE_URL on the storefront Railway service)
  • Spot-check key routes (home, PDP, PLP) and robots.txt

Deployment / ops

  • Set NEXT_PUBLIC_SITE_URL=https://guapo.store on the storefront Railway service and redeploy so canonical URLs are explicit.

Rollback

  • Revert merge on main or redeploy previous production image if issues arise.

Made with Cursor

Summary by CodeRabbit

  • Improvements

    • Enhanced URL resolution with additional environment variable fallbacks for site configuration.
    • Refined sitemap generation to use a controlled locale allowlist.
  • Documentation

    • Updated environment variable templates and configuration documentation.

- Resolve site URL via STOREFRONT_URL and RAILWAY_PUBLIC_DOMAIN before localhost
- Add sitemapLocales (default da) so /en is omitted until English launches
- Document NEXT_PUBLIC_SITE_URL in env.template; update openmemory sitemap note

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@eskoubar95 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 20 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 45 minutes and 20 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c574d13a-c23e-47ae-9ed4-c848912be2bd

📥 Commits

Reviewing files that changed from the base of the PR and between b0099e2 and fbba778.

📒 Files selected for processing (3)
  • apps/storefront/src/lib/site-url.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • openmemory.md
📝 Walkthrough

Walkthrough

This change introduces a new sitemapLocales constant to restrict sitemap generation to specific locales, enhances server-side URL resolution with additional environment variable fallbacks, and updates related sitemap generation logic to use the new locale configuration.

Changes

Cohort / File(s) Summary
Environment Configuration
apps/storefront/env.template
Updated NEXT_PUBLIC_SITE_URL comment to clarify its purpose for metadata and SEO URLs, and added a commented-out STOREFRONT_URL variable as a server-side fallback reference.
i18n Configuration
apps/storefront/src/i18n/config.ts
Introduced sitemapLocales constant as a readonly Locale[] initialized to ["da"], providing a separate locale allowlist for sitemap generation distinct from the full routing locale list.
URL Resolution Logic
apps/storefront/src/lib/site-url.ts
Enhanced getStorefrontSiteUrl() to strip trailing slashes and support fallback resolution chain: NEXT_PUBLIC_SITE_URLSTOREFRONT_URLVERCEL_URLRAILWAY_PUBLIC_DOMAIN, with http://localhost:3000 as final default.
Sitemap Generation
apps/storefront/src/lib/sitemap-build.ts
Updated to use sitemapLocales instead of locales for iteration, and added filtering logic to skip pages and articles entries whose computed locale is absent from sitemapLocales.
Documentation
openmemory.md
Updated sitemap/canonical conventions to document the new sitemapLocales\-based locale indexing and the enhanced URL fallback chain in getStorefrontSiteUrl().

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A sitemap grows with locale care,
Just Danish URLs in the air,
With fallback chains to find the way,
From RAILWAY to VERCEL's domain to play,
Our fuzzy friend hops proud today! 🌍

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Promote staging to main' accurately describes the main objective of merging the staging branch into main, which aligns with the PR's primary purpose as a release/promotion PR.
Description check ✅ Passed The PR description covers most required sections from the template: Summary (changes and context), Test plan (testing steps), and Deployment/ops notes. However, it is missing Task ID, Acceptance Criteria checklist, and Related issues sections specified in the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch staging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/storefront/src/lib/site-url.ts`:
- Line 8: The inferred host strings returned in this module aren't being
normalized with the existing stripTrailingSlash helper, which allows inputs with
trailing slashes to produce double-slash URLs; update every place that returns
an inferred host (the functions that currently compute/return inferred host
values) to pass the host through stripTrailingSlash before returning or
concatenating, and when concatenating with paths ensure you trim leading slashes
from the path portion so you always join a normalized host from
stripTrailingSlash(...) with a path that does not start with a slash.

In `@apps/storefront/src/lib/sitemap-build.ts`:
- Around line 183-184: The code coerces any non-"en" row.locale into "da" (via
const loc = row.locale === "en" ? "en" : "da"), which can incorrectly map
unknown/malformed locales into Danish URLs; update the logic in sitemap-build
(where loc and sitemapLocaleSet are used) to first validate row.locale against
an explicit allowlist of supported locales (e.g., ["en","da"]) and skip entries
whose locale is not in that allowlist before applying sitemapLocaleSet.has(loc)
or mapping; ensure the same change is applied to the analogous branch around the
second occurrence (the block referenced near where loc is reassigned/used around
line ~205) so only known locales are processed and unknown locales are skipped.

In `@openmemory.md`:
- Line 52: Update the documentation to include the final localhost fallback in
the canonical URL precedence chain by noting that getStorefrontSiteUrl()
(implemented in apps/storefront/src/lib/site-url.ts) will fall back to
"http://localhost:3000" if NEXT_PUBLIC_SITE_URL, STOREFRONT_URL, VERCEL_URL and
RAILWAY_PUBLIC_DOMAIN are all absent; revise the sitemap/canonical description
on line 52 to list that localhost fallback so the runbook/debug behavior matches
the actual implementation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4f5d6e40-3c86-43ee-a5ed-0bf6fb37a4af

📥 Commits

Reviewing files that changed from the base of the PR and between 0c3cf6b and b0099e2.

📒 Files selected for processing (5)
  • apps/storefront/env.template
  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/site-url.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • openmemory.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Typecheck Storefront
🧰 Additional context used
📓 Path-based instructions (8)
apps/storefront/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)

apps/storefront/**/*.{ts,tsx,js,jsx}: Storefront app in apps/storefront should be a Next.js customer UI with i18n routes that composes data from both Medusa and Payload CMS
Customer-facing URLs must follow the Storefront routing pattern with locale prefixes (/da/..., /en/...)

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-structure.mdc)

**/*.{ts,tsx}: Treat files > ~400 lines in one .tsx as tech debt — split before adding features
Use interface for object shapes in TypeScript; keep near usage or in *.types.ts files
Avoid any type in TypeScript; use unknown + narrowing or Zod-inferred types where validated
Prefer as const objects + union type over enums unless enum is required by an external API
Prefer direct imports from the module you need (e.g. @/components/ui/button) to avoid pulling large barrels into client bundles

Define a type for const functions when possible

**/*.{ts,tsx}: Use interfaces for object shapes in TypeScript; write functional components with typed props
Avoid enums; prefer as const objects combined with union types
Do not use any type; use unknown with type narrowing or Zod-inferred types for validated data

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/front-end-cursor-rules.mdc)

**/*.{js,jsx,ts,tsx}: Use early returns whenever possible to make the code more readable
Use descriptive variable and function/const names
Use const instead of function declarations, for example 'const toggle = () =>'
Don't use semicolons

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/nextjs-react-typescript-cursor-rules.mdc)

**/*.{ts,tsx,js,jsx}: Use concise, technical TypeScript; write functional and declarative code; avoid classes
Prefer modularization over duplication; use descriptive names like isLoading, hasError
Use the function keyword for pure functions; write declarative JSX

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/nextjs-react-typescript-cursor-rules.mdc)

**/*.{tsx,ts}: File layout: place exported component first, then subcomponents, helpers, static content, types. Follow code-structure.mdc for file size and splitting decisions
Favor named exports for components
Default to Server Components in Next.js; use 'use client' only for interactivity, browser APIs, or third-party widgets like Stripe; keep client boundaries small
Use next/dynamic for heavy or below-the-fold components
Use nuqs library for managing URL state and search parameters
Do not fetch data on the client when the server can perform the fetch; avoid duplicating fetches in layouts and pages without using React.cache()

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/security.mdc)

Do not log or echo secrets; redact secrets in examples and documentation

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
apps/storefront/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/storefront-next.mdc)

apps/storefront/src/**/*.{ts,tsx}: Talk to Medusa via @medusajs/js-sdk and the shared client in src/lib/medusa.ts (publishable key, NEXT_PUBLIC_MEDUSA_BACKEND_URL)
Custom store endpoints: use medusa.client.fetch or SDK extensions consistently; do not scatter raw fetch URLs without a single base pattern
Payload/content: use existing lib/payload-*.ts helpers; pass locale (da / en) for localized APIs
Parallelize independent loads: start async work then Promise.all to avoid sequential waterfalls
Choose cache explicitly: cache: 'no-store' vs revalidate vs static per data freshness needs
Follow code-structure.mdc for file structure and organization: line budgets, splitting steps/hooks/types, React/TypeScript hygiene

Files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
**/lib/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-structure.mdc)

**/lib/**/*.{ts,tsx}: Pure utilities / mappers (lib/.ts) should be ≤ ~400 lines; split by domain (cart-.ts, checkout-*.ts)
Write pure helpers (formatting, mapping) using function keyword with single responsibility for easy unit testing

Files:

  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
🧠 Learnings (14)
📚 Learning: 2026-04-15T16:59:15.305Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/payload-cms.mdc:0-0
Timestamp: 2026-04-15T16:59:15.305Z
Learning: Applies to apps/cms/**/payload.config.ts : Configure locales `da` (default) and `en` with fallback matching `payload.config.ts`. Localized fields belong in collection/global configs; API consumers use `?locale=` query parameter as documented.

Applied to files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Payload/content: use existing `lib/payload-*.ts` helpers; pass `locale` (`da` / `en`) for localized APIs

Applied to files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/storefront/**/*.{ts,tsx,js,jsx} : Customer-facing URLs must follow the Storefront routing pattern with locale prefixes (`/da/...`, `/en/...`)

Applied to files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
  • openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/storefront/**/*.{ts,tsx,js,jsx} : Storefront app in `apps/storefront` should be a Next.js customer UI with i18n routes that composes data from both Medusa and Payload CMS

Applied to files:

  • apps/storefront/src/i18n/config.ts
  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/env.template
  • openmemory.md
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Talk to Medusa via `medusajs/js-sdk` and the shared client in `src/lib/medusa.ts` (publishable key, `NEXT_PUBLIC_MEDUSA_BACKEND_URL`)

Applied to files:

  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/env.template
  • openmemory.md
📚 Learning: 2026-04-15T16:58:38.430Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/code-structure.mdc:0-0
Timestamp: 2026-04-15T16:58:38.430Z
Learning: Applies to **/(page|layout).{ts,tsx} : Place async loaders in lib/ or getXxxData.ts; keep page.tsx as composition + generateMetadata, not 200 lines of fetch/transform

Applied to files:

  • apps/storefront/src/lib/sitemap-build.ts
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Custom store endpoints: use `medusa.client.fetch` or SDK extensions consistently; do not scatter raw `fetch` URLs without a single base pattern

Applied to files:

  • apps/storefront/src/lib/sitemap-build.ts
  • apps/storefront/src/lib/site-url.ts
📚 Learning: 2026-04-15T16:59:22.553Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2026-04-15T16:59:22.553Z
Learning: Applies to .env* : Keep server-only secrets in server components, route handlers, or server actions — never use `NEXT_PUBLIC_*` prefix unless intentionally public (e.g., publishable key)

Applied to files:

  • apps/storefront/env.template
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Marketing copy, SEO text, layout content, navigation, footer, and homepage sections must be sourced from Payload only; reference Medusa entities by ID/handle where needed and do not duplicate commerce state in CMS

Applied to files:

  • openmemory.md
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Ecommerce UX: align with storefront skill references when building cart, checkout, PLP, PDP

Applied to files:

  • openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/cms/**/*.{ts,tsx,js,jsx} : CMS app in `apps/cms` should implement Payload for managing pages, articles, navigation, homepage, and editorial product copy with live preview to storefront

Applied to files:

  • openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/commerce/**/*.{ts,tsx,js,jsx} : Commerce app in `apps/commerce` should implement Medusa for handling carts, orders, payments, subscriptions, shipping, and product catalog for sale

Applied to files:

  • openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Prices, inventory, cart, checkout, orders, subscriptions, and shipping options must be sourced from Medusa only

Applied to files:

  • openmemory.md
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Follow `code-structure.mdc` for file structure and organization: line budgets, splitting steps/hooks/types, React/TypeScript hygiene

Applied to files:

  • openmemory.md
🔇 Additional comments (3)
apps/storefront/src/i18n/config.ts (1)

11-16: Good separation of routing locales vs sitemap locales.

This keeps runtime locale support intact while safely controlling what gets indexed.

apps/storefront/src/lib/sitemap-build.ts (1)

216-216: Nice change to generate route entries directly from sitemapLocales.

This keeps static/catalog URL generation aligned with indexing policy.

apps/storefront/env.template (1)

4-7: Env guidance update is clear and deployment-friendly.

The comments now make canonical URL precedence explicit and reduce risk of localhost leaking into SEO URLs.

Comment thread apps/storefront/src/lib/site-url.ts Outdated
Comment thread apps/storefront/src/lib/sitemap-build.ts Outdated
Comment thread openmemory.md Outdated
- Normalize inferred origins with stripTrailingSlash (multi-slash trim)
- Skip Payload sitemap rows unless locale passes isValidLocale (da|en)
- Document localhost fallback in openmemory canonical chain

Made-with: Cursor
@railway-app railway-app Bot temporarily deployed to guapo / staging April 15, 2026 22:01 Inactive
@railway-app railway-app Bot temporarily deployed to guapo / staging April 15, 2026 22:08 Inactive
@eskobar95 eskobar95 merged commit db17f69 into main Apr 15, 2026
13 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.

1 participant