Skip to content

Dev — W09 (Feb 26 – Mar 5)

D1 Config Store — Migrated client configuration from KV to a proper D1 relational database. Added schema, data access layer, KV-to-D1 migration script, in-memory cache with 60s TTL, and switched all worker read/write paths. The CLIENTS KV namespace was fully removed — D1 is now the sole config store.

Monorepo Cleanup — Renamed all packages to the @lk/* scope. Extracted shared CF API helpers, consolidated crypto primitives into @lk/theme-utils, and DRY’d seed/hydrate/deploy scripts. Deleted the unused @lk/ts-utils package. Pared the justfile from 28 to 3 recipes.

CLI Infrastructure — Built a createScript factory using citty + pino, then migrated all 16 root scripts to use it. Provides consistent argument parsing, structured logging, and error handling across every CLI command.

Typed KV Accessors — Added a typed accessor layer to @lk/client-config for reading/writing KV keys with proper TypeScript types. Adopted across all workers and the renderer.

Declarative Fetch Manifest — Product metafield fetching is now driven by a manifest ({"products":{"metafields":[...]}}) instead of hardcoded field lists. Namespace/key pairs are declared once and used by both seed:kv and hydrate:kv.


Thu Feb 27 — Container Build Pipeline & Package Consolidation

Section titled “Thu Feb 27 — Container Build Pipeline & Package Consolidation”

Container Build Pipeline — Added a queue-triggered deploy pipeline using Cloudflare Containers. Theme builds now run in an isolated container with a real Dockerfile, triggered via queue message or HTTP. Includes NDJSON streaming for build progress.

R2 Component Cache — Transpiled components are now cached in R2 as single-archive snapshots (2 round-trips instead of hundreds). Deploy-time cache hits skip re-transpilation entirely, cutting build times significantly.

R2 Snapshots — Added S3-compatible R2 API helpers, snapshot/restore functions, and r2:snapshot CLI. Integrated into deploy for archiving theme state before each release.

Package Consolidation — Major rename and merge pass:

  • trk-workercf-trk
  • dashboardcf-app
  • renderercf-client-site
  • liquid-transpilertranspiler
  • edge-worker + dispatch-workercf-client-dispatch
  • client-config + theme-schema + theme-utilsconfig
  • Removed the storefront package entirely

Client Slug Rename — Standardized client slugs (bb→brbb, frdf→fmdf, oscr→osco) and deleted the unused fd client. Hardened deploy scripts with consolidated D1 IDs and positional args.

Biome Linting — Unified Biome config across all packages for consistent formatting and lint rules.


Fri Feb 28 — Service Worker & Transpiler Fixes

Section titled “Fri Feb 28 — Service Worker & Transpiler Fixes”

Prefetch Mesh Service Worker — Added a service worker that intercepts navigation requests and prefetches linked pages for near-instant transitions. Cache is versioned per deploy so stale content is automatically evicted on release.

Client Assets on R2 — Migrated client static assets (CSS overrides, fonts) from Cloudflare Static Assets to R2 for more control over cache headers and versioning.

Transpiler Fixes — Parser error recovery now auto-heals unclosed HTML elements (e.g., <button> not closed before </form>), mimicking HTML5 parser behavior. Metafield direct output ({{ metafields.ns.key }}) now auto-resolves .value to prevent [object Object] rendering. Fixed image width/height on media objects, protocol-relative img_url, and media alt text fallback.

Autonomous Container Pipeline — The container build pipeline now handles its own CF API deploys end-to-end — no external orchestrator needed.


Sat Mar 1 — Currency Detection, Dashboard MVP & Build Observability

Section titled “Sat Mar 1 — Currency Detection, Dashboard MVP & Build Observability”

Geolocated Currency Detection — Prices now resolve per-market using Shopify’s Admin API contextual pricing at build time. Each market’s currency/locale is baked into the deploy, so edge rendering serves localized prices without runtime API calls.

Starlight Docs Site — Launched packages/cf-docs — an Astro Starlight documentation site with architecture, operations, guides, and implementation docs. Supports worktree port offsets.

Cache Observability — Added x-lk-cache response headers showing cache status per layer (CDN, section, KV). Cookie-gated debug mode (lk-debug=1) exposes detailed timing. Modularized worker.ts into 8 focused modules with tests.

Build Pipeline — Observability — Integrated Axiom for build pipeline telemetry. Build events stream to a durable log sink with a CLI viewer (pnpm build:logs). Fixed stuck build cron, container sizing, and added --skip-* flags for partial deploys.

Dashboard — Build History — Added a Builds tab with WebSocket-streamed live logs, build status timeline, and duration tracking. Reads from D1 + Axiom.

Dashboard — Pages Tab — New URL browser with collapsible template sections, filter bar with URL-synced state, and search. Replaced the old Templates tab.

Local Dev Sync — Replaced pull-kv with a proper preview layer (pull:prod / pull:preview). Dev startup now seeds both renderer KV and dashboard D1/KV automatically. Added --reset and --clean flags to pnpm dev.

Webhook Observability — Added structured Axiom wide events for webhook processing. Webhook handler labels now show invalidation instead of ignored.

Transpiler — Collection Support — App-owned metafield islands are now detected via manifest and emitted as empty containers. Fixed variant.options flat array, depth-aware island stripping, paginate tag transpilation, D1 schema compatibility, and section cache scoping by URL path + page param.

D1 Cache Purge — Added TTL-based D1 cache with a /api/cache/purge endpoint for targeted eviction. Deploy pipeline now sets CACHE_PURGE_TOKEN automatically.


Sun Mar 2 — Auth, Debug Toolbar & Template Routing

Section titled “Sun Mar 2 — Auth, Debug Toolbar & Template Routing”

WorkOS Authentication — Integrated WorkOS AuthKit for dashboard authentication with SSO support. Added DEV_BYPASS_AUTH for local development. Sign-out button and branded landing page.

Dashboard — Activity Feed — New Activity tab showing Axiom event feed with day grouping. Webhook events are enriched with resource metadata (product title, collection handle) and affected URLs. Attribution webhooks (orders/checkouts) are filtered out.

Debug Toolbar — Added a visual debug bar injected into rendered pages (cookie-gated). Shows per-section cache status (HIT/MISS/DYNAMIC), CDN cache status, cache keys, and a purge button. Purge requests flow through dispatch to theme worker for both section cache and CDN eviction.

Template Routing — Implemented 1:1 suffix-aware template gating. The worker reads each resource’s template_suffix from KV and checks the full name (e.g., product.ge-optimized-color) against the templates_json whitelist. New architecture doc added.

Dashboard — Color Mode — Added light/dark mode toggle with system preference detection. Data-driven status pill shows client lifecycle stage (onboarding → ab_test → active → inactive).

Sentry — cf-app & cf-client-deploy — Integrated Sentry error tracking in the dashboard and deploy pipeline workers. Added secrets/deploy env file reference to CLAUDE.md.

Targeted KV Seeding — Added --only filter to both seed:kv and hydrate:kv for seeding specific content types (pages, products, collections, etc). Full production seed in ~2s instead of minutes.

Content-Fingerprinted Section Cache — Replaced URL-based section cache keys with content-fingerprinted keys derived from closest data, preventing stale cache hits when the same URL serves different content.


Mon Mar 3 — Performance Audit System & 404 Handling

Section titled “Mon Mar 3 — Performance Audit System & 404 Handling”

Performance Audit System — Built a per-template Lighthouse audit pipeline with app attribution. Runs via Cloudflare Workflows against Browserless, comparing LayerKick vs Shopify performance side-by-side. Includes parity checking, screenshot capture, template detail views with performance wins, and audit history with cleanup.

Dashboard — Pages Stats — Added template stats with a two-pane layout on the Pages tab. LayerKick vs Shopify stats row shows template coverage and URL counts per template type.

Template Manifest — Added --only=manifest to hydrate:kv for production template manifest seeding. Includes .liquid templates so Replo/WSG-built pages get entries.

404 Handling — Unknown routes and missing resources now proxy to Shopify for proper 404 page rendering instead of returning a generic error.

Sentry — Remaining Workers — Integrated Sentry error tracking in cf-client-dispatch and cf-client-site.

Transpiler — PDP Fixes — Fixed image dimension handling to respect explicit nil width/height (matching Shopify behavior), hide recommendations placeholder when SSR products are present, and bypass PLATFORM_PATTERNS for scripts inside shopify-app-block containers.


Tue Mar 4 — Blue-Green Deploys, Themes Tab & Failover

Section titled “Tue Mar 4 — Blue-Green Deploys, Themes Tab & Failover”

Blue-Green KV Versioning — Theme config keys (settings_data, templates/*, etc.) are now versioned with a blue/green slot in KV. Deploys write to the inactive slot, then the promote step atomically flips the pointer. Rollback is instant — just flip the slot back.

Multi-Theme Support — D1 schema now supports multiple themes per client with an experiments table for A/B testing. Added pull-theme with --theme-id flag for pulling alternate themes.

Dashboard — Themes Tab — Promoted Themes to its own top-level dashboard tab with a split layout: active theme preview on the left, grouped theme list on the right. Restructured dashboard under /admin/* with path-based tabs and status-driven visibility.

Shopify Failover — Both dispatch and site workers now gracefully fail over to Shopify on unrecoverable errors. If the renderer crashes, the request proxies transparently to Shopify so end users never see an error page.

Selective Webhook Re-fetchcf-trk webhooks now selectively re-fetch only the affected resource from Shopify (product, collection, page, article) instead of re-syncing everything. Storefront token resolution and variant inventory now pull from Admin API.

Dashboard — Activity Table — Upgraded Activity tab to TanStack Table with server-side pagination, column filtering, and search.

Sentry — cf-audit & cf-trk — Completed Sentry rollout across all remaining workers.

Shared Shopify API — Consolidated Shopify API helpers, transforms, and KV key builders into @lk/config for cross-package reuse.


Wed Mar 5 — Page Dependencies, Dashboard States & Webhook Tracing

Section titled “Wed Mar 5 — Page Dependencies, Dashboard States & Webhook Tracing”

Render-Time Page Dependencies — Built a dependency tracking system that records which Shopify resources (products, collections, pages) each URL uses at render time. Dependencies are stored as JSONB in a new D1 page_deps table using multi-row INSERT with correct D1 param limits. When a webhook fires for a resource update, the system now resolves exactly which pages to purge — surgical CDN invalidation instead of blanket purges. Collection-nested product IDs are included in settings deps so product changes propagate to collection pages.

Status-Driven Dashboard — Restructured the client dashboard with status-driven views. Each client lifecycle stage (onboarding, ab_test, active, inactive) gets a tailored dashboard with relevant tabs and content. Admin users see a “View as” dropdown to preview different client states. Routes restructured under /admin/* with path-based tabs.

Webhook Activity Trail — Webhook processing now records step-by-step tracing in D1 with a step_tracker utility. Affected URLs are stored in webhook events and surfaced in the dashboard activity feed. Events are grouped by correlation ID so multi-step webhook flows (receive → refetch → purge) display as a single grouped entry.

Resilient Purge Pipeline — Fixed purge 500 errors with resilient batching. Batch purge requests now respect Cloudflare’s 100-path limit. Added Sentry to the purge failure path in cf-trk for better error visibility.

Token-Based Debug Toolbar — Debug toolbar activation switched from cookie-based to URL token, making it easier to share debug links without requiring cookie setup.

Dashboard Auth Fix — Fixed a redirect loop in the WorkOS auth callback on Cloudflare Workers SSR caused by incorrect redirect URL construction.