Skip to content

build: Phrase 2 - #1

Merged
abdelkabirouadoukou merged 2 commits into
mainfrom
build-phase-2-and-fix-error-of-phase-1
Jul 26, 2026
Merged

abdelkabirouadoukou merged 2 commits into
mainfrom
build-phase-2-and-fix-error-of-phase-1

Conversation

@abdelkabirouadoukou

@abdelkabirouadoukou abdelkabirouadoukou commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added static page generation and server-route output during builds.
    • Added Markdown content collections with frontmatter-based routing.
    • Added island components with client-side hydration markers and generated scripts.
    • Added layouts, an About page, and a blog example to the basic application.
  • Bug Fixes
    • Improved development routing for content-backed pages.
  • Tests
    • Added coverage for static builds, content parsing, routing, and generated output.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@abdelkabirouadoukou, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 11ee496b-d202-4176-bf31-073d5f18559d

📥 Commits

Reviewing files that changed from the base of the PR and between 9799125 and 8965f57.

📒 Files selected for processing (8)
  • TASKS.md
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
  • packages/core/src/content.ts
  • packages/core/src/createApp.ts
  • packages/core/src/index.ts
  • packages/core/src/island.tsx
  • packages/core/src/render.ts
📝 Walkthrough

Walkthrough

This change adds Markdown content scanning and routing, static route prerendering, build output generation, island registration and stub chunks, development content handlers, and a basic example covering static, dynamic, and content-backed routes.

Changes

Phase 2 rendering pipeline

Layer / File(s) Summary
Content discovery and development serving
packages/core/src/content.ts, packages/core/src/content.test.ts, packages/core/src/createApp.ts, examples/basic/server.ts
Markdown and MDX files are parsed into routed content entries, exposed through contentDir, and served by development handlers.
Page rendering and island registration
packages/core/src/render.ts, packages/core/src/island.tsx, packages/core/src/index.ts
Rendering accepts static output and island injection options, while IslandProvider collects marked island entries with generated identifiers.
Static build and server entry generation
packages/core/src/build.ts, packages/core/src/build.test.ts, TASKS.md, packages/core/src/router.test.ts
build() classifies routes, writes static HTML and content pages, emits island stub files, and generates a server route entry; tests cover the generated outputs.
Basic example routes and content
examples/basic/content/blog/hello.md, examples/basic/src/routes/_layout.tsx, examples/basic/src/routes/about.tsx, examples/basic/src/routes/index.tsx
The example configures content loading, adds a root layout and static About page, and links to static, dynamic, and content routes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Build
  participant Routes
  participant Content
  participant Renderer
  participant Islands
  participant Output
  Build->>Routes: scan route modules and layouts
  Build->>Content: scan contentDir
  Build->>Renderer: render static routes and content pages
  Renderer->>Islands: collect island entries
  Build->>Output: write HTML, server entry, and island chunks
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and typo-prone; it doesn't describe the main build/content/islands changes in this PR. Rename it to a specific summary, e.g. "build: add static rendering, content collections, and island bundling".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch build-phase-2-and-fix-error-of-phase-1

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/src/createApp.ts (1)

145-185: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Dev file watcher never observes contentDir, so content edits don't trigger a rebuild.

watch(options.routesDir, ...) is the only watcher registered; contentHandlers is only refreshed as a side effect of a route-file-triggered buildHandlers() call (line 152). Editing/adding a markdown file under contentDir in dev mode will not be picked up until a route file also changes or the server is restarted, even though options.contentDir is a first-class dev-serving feature.

🔧 Proposed fix: watch contentDir too
     try {
       const watcher = watch(options.routesDir, { recursive: true }, (_eventType, filename) => {
         if (!filename) return;
         const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
         if (name.startsWith(".") || name.startsWith("_")) return;
         if (!/\.(tsx|ts)$/.test(name)) return;
         scheduleRebuild();
       });
     } catch {
       console.warn("[x] file watching not available on this platform");
     }
+
+    if (options.contentDir) {
+      try {
+        watch(options.contentDir, { recursive: true }, (_eventType, filename) => {
+          if (!filename) return;
+          const name = typeof filename === "string" ? filename : (filename as Buffer).toString();
+          if (name.startsWith(".")) return;
+          if (!/\.(md|mdx)$/.test(name)) return;
+          scheduleRebuild();
+        });
+      } catch {
+        console.warn("[x] content file watching not available on this platform");
+      }
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/createApp.ts` around lines 145 - 185, Extend the
development watcher setup around scheduleRebuild and the existing
watch(options.routesDir, ...) call to also watch options.contentDir. Reuse the
same filename filtering and rebuild scheduling for content changes, while
preserving route-change detection and logging behavior.
🧹 Nitpick comments (3)
packages/core/src/createApp.ts (1)

41-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shared layout-wrapping logic duplicated across createApp.ts and build.ts. Both implement an identical (Component, params, layoutModules) => ReactNode helper that walks the layout chain and wraps the page component.

  • packages/core/src/createApp.ts#L41-L56: replace wrapWithLayouts with an import from a shared module.
  • packages/core/src/build.ts#L132-L142: replace renderPageWithLayout with the same shared import.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/createApp.ts` around lines 41 - 56, Extract the duplicated
layout-wrapping helper into a shared module, then replace wrapWithLayouts in
packages/core/src/createApp.ts (lines 41-56) and renderPageWithLayout in
packages/core/src/build.ts (lines 132-142) with imports of that shared helper.
Preserve the existing component, params, layoutModules signature and wrapping
order at both call sites.
packages/core/src/render.ts (1)

10-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

renderPage and renderStaticPage are near-duplicates.

Both build an identical HTML shell, differing only in renderToString vs renderToStaticMarkup. Consider extracting the shared template-building logic into a helper parameterized by the render function.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/render.ts` around lines 10 - 58, Extract the duplicated
HTML shell construction from renderPage and renderStaticPage into a shared
helper parameterized by the rendering function. Keep each public function
responsible for selecting renderToString or renderToStaticMarkup, while
preserving the existing title, island scripts, island props, and output
formatting behavior.
packages/core/src/build.ts (1)

169-181: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Generated server entry hardcodes absolute filesystem paths.

import Page${i} from "${p.entry.filePath}"; embeds the build machine's absolute path. This only works if bun build runs immediately afterward on the same filesystem (per TASKS.md's stated workflow); it isn't portable if the generated server/index.ts is bundled or inspected elsewhere. Consider computing paths relative to serverEntryPath's directory via node:path's relative().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/build.ts` around lines 169 - 181, The buildServerEntry
function currently emits absolute page entry paths in generated imports; compute
each import path relative to the generated server entry directory using
node:path relative(), then normalize it as a module specifier with the required
leading ./ when needed. Pass or derive serverEntryPath’s directory in the build
flow, while preserving the existing route generation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/build.ts`:
- Around line 144-156: Convert markdown to sanitized HTML before injecting
content.body through dangerouslySetInnerHTML: update StaticContentPage in
packages/core/src/build.ts (lines 144-156) and renderContentPage in
packages/core/src/createApp.ts (lines 58-75) to use the same markdown-rendering
and sanitization approach, preserving the existing title rendering and page
structure.
- Around line 79-118: Track route paths written by the static-page loop and the
content-entry loop, and detect duplicates before writing output files. Update
the build flow around the loops over staticPages and contentEntries to warn or
fail on collisions, including the existing "/" to "/index.html" case, instead of
allowing the later write to silently overwrite the earlier page.
- Around line 91-99: Update the island chunk naming in the registry.entries loop
to stop using island.id directly. Generate a deterministic, filesystem-safe
filename identifier from page.entry.filePath or routePath, island.name, and a
per-page counter or stable hash, then use it in writeFileSync while preserving
the existing island directory and bundle-generation behavior.

In `@packages/core/src/render.ts`:
- Around line 10-33: Update renderPage and renderStaticPage to HTML-escape the
title before interpolating it into the title element, and safely serialize
islandProps for embedding in the application/json script so sequences such as
</script> cannot terminate the element. Reuse a shared escaping/serialization
helper if appropriate, while preserving the existing output and island data
behavior.

---

Outside diff comments:
In `@packages/core/src/createApp.ts`:
- Around line 145-185: Extend the development watcher setup around
scheduleRebuild and the existing watch(options.routesDir, ...) call to also
watch options.contentDir. Reuse the same filename filtering and rebuild
scheduling for content changes, while preserving route-change detection and
logging behavior.

---

Nitpick comments:
In `@packages/core/src/build.ts`:
- Around line 169-181: The buildServerEntry function currently emits absolute
page entry paths in generated imports; compute each import path relative to the
generated server entry directory using node:path relative(), then normalize it
as a module specifier with the required leading ./ when needed. Pass or derive
serverEntryPath’s directory in the build flow, while preserving the existing
route generation.

In `@packages/core/src/createApp.ts`:
- Around line 41-56: Extract the duplicated layout-wrapping helper into a shared
module, then replace wrapWithLayouts in packages/core/src/createApp.ts (lines
41-56) and renderPageWithLayout in packages/core/src/build.ts (lines 132-142)
with imports of that shared helper. Preserve the existing component, params,
layoutModules signature and wrapping order at both call sites.

In `@packages/core/src/render.ts`:
- Around line 10-58: Extract the duplicated HTML shell construction from
renderPage and renderStaticPage into a shared helper parameterized by the
rendering function. Keep each public function responsible for selecting
renderToString or renderToStaticMarkup, while preserving the existing title,
island scripts, island props, and output formatting behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 652ad708-1310-406d-8189-eb53cba29225

📥 Commits

Reviewing files that changed from the base of the PR and between 5d34657 and 9799125.

📒 Files selected for processing (15)
  • TASKS.md
  • examples/basic/content/blog/hello.md
  • examples/basic/server.ts
  • examples/basic/src/routes/_layout.tsx
  • examples/basic/src/routes/about.tsx
  • examples/basic/src/routes/index.tsx
  • packages/core/src/build.test.ts
  • packages/core/src/build.ts
  • packages/core/src/content.test.ts
  • packages/core/src/content.ts
  • packages/core/src/createApp.ts
  • packages/core/src/index.ts
  • packages/core/src/island.tsx
  • packages/core/src/render.ts
  • packages/core/src/router.test.ts

Comment thread packages/core/src/build.ts Resolved
Comment thread packages/core/src/build.ts Resolved
Comment thread packages/core/src/build.ts Resolved
Comment thread packages/core/src/render.ts Resolved
@abdelkabirouadoukou
abdelkabirouadoukou merged commit 72e271f into main Jul 26, 2026
2 checks passed
@abdelkabirouadoukou
abdelkabirouadoukou deleted the build-phase-2-and-fix-error-of-phase-1 branch August 1, 2026 04:37
abdelkabirouadoukou added a commit that referenced this pull request Aug 20, 2026
- changeset: scope the 'no embedded literals' claim to masked quoted
  strings; note the template-tag path binds values out-of-band (#1)
- cli: serialize Tailwind recompiles so saves coalesce into one follow-up
  run after the active compile exits, instead of stacking overlapping
  processors writing the same output (#8); unit test proves no two
  compiles overlap, verified to fail against the old concurrent spawn
- redact: capture the authorization/auth keyword group so it survives the
  $1 replacement instead of emitting a literal '$1 [REDACTED]' (#9);
  exact-output regression test verified against the old non-capturing regex
- tracing: stop double-recording a throwing handler error on the x.http
  root span (the wrapper's fail() plus runWithRequestSpan's catch) (#11);
  mask quoted SQL string literals to '?' in db.statement (#13) — both
  verified failing against the previous behavior
- redis rate-limit test: FakeRedis PTTL now validates its key argument
  instead of silently modeling a malformed call as a missing key (#15)
- auth: empty-identifier regression test now provably fails against the
  old shared `login:` account key (auth.ts skip logic and brute-force
  namespacing both reverted to confirm); IP-bucket test rewritten so the
  attacker's own successful login must NOT reset the spray counter
  (verified it fails when the success path clears the IP bucket)
abdelkabirouadoukou added a commit that referenced this pull request Aug 20, 2026
… (#141)

* feat(core): request-scoped OpenTelemetry tracing correlation (#79)

@thexjs/core never initializes OpenTelemetry itself — apps opt in by calling setTracer() (or getTracer()) with any tracer whose startSpan(name, { attributes }) matches the OTel surface. Without a configured tracer the layer degrades to synchronous no-ops.

Every request opens an x.http root span carrying the x.requestId attribute plus route/method/status; with no inbound x-request-id, one is minted and shared via traceRequestId() so the log line, the response header and the trace span all agree. Request-scoped phase spans cover the whole pipeline, all correlated by x.requestId: x.api (API routes), x.loader (page loaders + SSR/SSG), x.action (server functions), x.middleware (composed onion + handler), x.ssr, and x.db (both connectSQLite and connectPostgres, wrapping query/run/execute/template-tag calls with db.system, db.operation and a redacted + truncated db.statement). Errors inside any span set ERROR and record an exception.

runWithRequestSpan, tracePhase, tracePhaseSync, dbTraceAttributes, TraceSpan and TracerLike are exported. Mock-tracer tests cover a failing DB call carrying the request id, phase spans, error status propagation and the full createApp request lifecycle.

* fix(core): reject hydration beacons from prefix-matching or opaque origins (#138)

The hydration-mismatch beacon used a prefix match on the canonical origin, so Origin: https://localhost.evil.com passed (not just https://localhost). Exact-match now: the header is parsed via originFromHeader and compared as a full origin string, and a present-but-unparseable header (Origin: null from a sandboxed/opaque origin) is treated as cross-site rather than absent. Regression tests cover the evil-prefix origin and Origin: null.

* fix(core): deterministic routing when dynamic routes tie (#140)

Same-category route ties (e.g. /bar/[b] vs /[a]/foo both matching /bar/foo) were left to the OS's directory-scan order, so a build could serve different pages on different platforms. Ties are now broken segment-by-segment by positional specificity (literal 0 > param 1 > catch-all 2), falling back to a lexical routePath sort — deterministic everywhere and documented in the core README. Regression test with both fixture routes active.

* fix(core): serialize concurrent Postgres migrations with an advisory lock (#131)

runPostgresMigrations now runs inside one client.begin() transaction holding SELECT pg_advisory_xact_lock(MIGRATION_LOCK_KEY), so a second process racing the same migration set can't double-apply or interleave DDL. The applied-tracking read happens under the lock, migrations use savepoints, and a failure rolls back only its own migration while prior successes keep their commit. Concurrency regression test added.

* fix(core): pin image-proxy fetch to the verified public IP to close the DNS-rebinding TOCTOU (#132)

The allow-listed hostname was resolved once for validation but the actual fetch re-resolved it, so the DNS answer for the fetch could differ (a second lookup rebinding to a private address). The target is now resolved a single time: private/reserved literals are rejected, every DNS answer must be public, and the first public IP is pinned into the fetch via the Host header + tls.serverName with redirect: manual. Each redirect hop re-resolves and re-pins before connecting. Tests cover pinning on first fetch and on every hop.

* fix(auth): rate-guess spraying across IPs with separate account and IP buckets (#133)

Brute-force was keyed by (IP, identifier), so rotating source IPs reset the throttle. createBruteForceGuard now maintains two independent buckets — an account bucket (identifier alone) stopping guessing one account from many IPs, and an IP bucket (client IP) stopping one IP spraying many accounts — checked together, failed/reset together, with Retry-After reflecting the longer window. Tests updated and extended for the two-bucket behavior.

* fix(core): generated href() now fills catch-all params instead of dropping them (#134)

A catch-all like /docs/* compiles to a * token with no :slug to substitute, so href('/docs/*', { slug }) only stripped the * and returned '/docs/'. The generated href() now substitutes * segments in param order with the value (segments encoded individually so multi-segment values keep their slashes). New runtime test imports the generated manifest and asserts catch-all, param and static href calls.

* fix(core): Redis rate-limiter reports the real window reset, not a sliding one (#135)

The Redis store returned resetAt = Date.now() + windowMs on every call, so Retry-After kept sliding forward instead of converging on the TTL the EXPIRE enforces. incr() now reads PTTL right after INCR (clamped to >= 0) and derives resetAt from the key's actual remaining life. FakeRedis models PTTL and a regression test verifies a mid-window key reports ~remaining, not the full window; verified it fails against the old implementation.

* fix(core): mask connection-string passwords in log redaction (#136)

redactString already masked bearer/basic credentials and inline Authorization values but not URI userinfo, so postgres://deploy:supersecret@db:5432/app printed the password. Redaction now masks the userinfo password for any scheme (http, postgres, mysql, redis, ...) via a scheme://user:pass@ shape regex, leaving password-less URLs untouched. Regression tests added for the common drivers.

* fix(cli): keep dev server responsive during Tailwind recompiles and exit promptly on SIGTERM (#137, #139)

Dev-mode Tailwind recompilation used an async spawn but awaited it synchronously, stalling request handling until the (potentially multi-second) recompile finished; the watcher path now uses a true async compile so the server stays responsive mid-build. shutdown() awaited server.stop(true) inside the 3s window, so a SIGTERM that arrived with nothing left to drain still waited the full grace period — it now stops immediately and the timer is a hard-cap fallback (unref'd). E2E tests cover both: a fake-slow bunx keeping the dev server under 1s, and prompt SIGTERM exit.

* fix(core): lock bookkeeping-table creation in Postgres migrations (#131)

The _x_migrations table was created via CREATE TABLE IF NOT EXISTS before the advisory lock, so two booting replicas raced that DDL and hit Postgres's simultaneous-create catalog race (pg_type_typname_nsp_index) before serialization kicked in. Moving the table creation inside the locked transaction means the loser instead finds the table the winner committed and proceeds to skip — the advisory lock now guards the entire run.

* fix: finish CodeRabbit review on tracing PR (#141, #79, #131-#140)

- changeset: scope the 'no embedded literals' claim to masked quoted
  strings; note the template-tag path binds values out-of-band (#1)
- cli: serialize Tailwind recompiles so saves coalesce into one follow-up
  run after the active compile exits, instead of stacking overlapping
  processors writing the same output (#8); unit test proves no two
  compiles overlap, verified to fail against the old concurrent spawn
- redact: capture the authorization/auth keyword group so it survives the
  $1 replacement instead of emitting a literal '$1 [REDACTED]' (#9);
  exact-output regression test verified against the old non-capturing regex
- tracing: stop double-recording a throwing handler error on the x.http
  root span (the wrapper's fail() plus runWithRequestSpan's catch) (#11);
  mask quoted SQL string literals to '?' in db.statement (#13) — both
  verified failing against the previous behavior
- redis rate-limit test: FakeRedis PTTL now validates its key argument
  instead of silently modeling a malformed call as a missing key (#15)
- auth: empty-identifier regression test now provably fails against the
  old shared `login:` account key (auth.ts skip logic and brute-force
  namespacing both reverted to confirm); IP-bucket test rewritten so the
  attacker's own successful login must NOT reset the spray counter
  (verified it fails when the success path clears the IP bucket)
abdelkabirouadoukou added a commit that referenced this pull request Aug 20, 2026
* feat(core): request-scoped OpenTelemetry tracing correlation (#79)

@thexjs/core never initializes OpenTelemetry itself — apps opt in by calling setTracer() (or getTracer()) with any tracer whose startSpan(name, { attributes }) matches the OTel surface. Without a configured tracer the layer degrades to synchronous no-ops.

Every request opens an x.http root span carrying the x.requestId attribute plus route/method/status; with no inbound x-request-id, one is minted and shared via traceRequestId() so the log line, the response header and the trace span all agree. Request-scoped phase spans cover the whole pipeline, all correlated by x.requestId: x.api (API routes), x.loader (page loaders + SSR/SSG), x.action (server functions), x.middleware (composed onion + handler), x.ssr, and x.db (both connectSQLite and connectPostgres, wrapping query/run/execute/template-tag calls with db.system, db.operation and a redacted + truncated db.statement). Errors inside any span set ERROR and record an exception.

runWithRequestSpan, tracePhase, tracePhaseSync, dbTraceAttributes, TraceSpan and TracerLike are exported. Mock-tracer tests cover a failing DB call carrying the request id, phase spans, error status propagation and the full createApp request lifecycle.

* fix(core): reject hydration beacons from prefix-matching or opaque origins (#138)

The hydration-mismatch beacon used a prefix match on the canonical origin, so Origin: https://localhost.evil.com passed (not just https://localhost). Exact-match now: the header is parsed via originFromHeader and compared as a full origin string, and a present-but-unparseable header (Origin: null from a sandboxed/opaque origin) is treated as cross-site rather than absent. Regression tests cover the evil-prefix origin and Origin: null.

* fix(core): deterministic routing when dynamic routes tie (#140)

Same-category route ties (e.g. /bar/[b] vs /[a]/foo both matching /bar/foo) were left to the OS's directory-scan order, so a build could serve different pages on different platforms. Ties are now broken segment-by-segment by positional specificity (literal 0 > param 1 > catch-all 2), falling back to a lexical routePath sort — deterministic everywhere and documented in the core README. Regression test with both fixture routes active.

* fix(core): serialize concurrent Postgres migrations with an advisory lock (#131)

runPostgresMigrations now runs inside one client.begin() transaction holding SELECT pg_advisory_xact_lock(MIGRATION_LOCK_KEY), so a second process racing the same migration set can't double-apply or interleave DDL. The applied-tracking read happens under the lock, migrations use savepoints, and a failure rolls back only its own migration while prior successes keep their commit. Concurrency regression test added.

* fix(core): pin image-proxy fetch to the verified public IP to close the DNS-rebinding TOCTOU (#132)

The allow-listed hostname was resolved once for validation but the actual fetch re-resolved it, so the DNS answer for the fetch could differ (a second lookup rebinding to a private address). The target is now resolved a single time: private/reserved literals are rejected, every DNS answer must be public, and the first public IP is pinned into the fetch via the Host header + tls.serverName with redirect: manual. Each redirect hop re-resolves and re-pins before connecting. Tests cover pinning on first fetch and on every hop.

* fix(auth): rate-guess spraying across IPs with separate account and IP buckets (#133)

Brute-force was keyed by (IP, identifier), so rotating source IPs reset the throttle. createBruteForceGuard now maintains two independent buckets — an account bucket (identifier alone) stopping guessing one account from many IPs, and an IP bucket (client IP) stopping one IP spraying many accounts — checked together, failed/reset together, with Retry-After reflecting the longer window. Tests updated and extended for the two-bucket behavior.

* fix(core): generated href() now fills catch-all params instead of dropping them (#134)

A catch-all like /docs/* compiles to a * token with no :slug to substitute, so href('/docs/*', { slug }) only stripped the * and returned '/docs/'. The generated href() now substitutes * segments in param order with the value (segments encoded individually so multi-segment values keep their slashes). New runtime test imports the generated manifest and asserts catch-all, param and static href calls.

* fix(core): Redis rate-limiter reports the real window reset, not a sliding one (#135)

The Redis store returned resetAt = Date.now() + windowMs on every call, so Retry-After kept sliding forward instead of converging on the TTL the EXPIRE enforces. incr() now reads PTTL right after INCR (clamped to >= 0) and derives resetAt from the key's actual remaining life. FakeRedis models PTTL and a regression test verifies a mid-window key reports ~remaining, not the full window; verified it fails against the old implementation.

* fix(core): mask connection-string passwords in log redaction (#136)

redactString already masked bearer/basic credentials and inline Authorization values but not URI userinfo, so postgres://deploy:supersecret@db:5432/app printed the password. Redaction now masks the userinfo password for any scheme (http, postgres, mysql, redis, ...) via a scheme://user:pass@ shape regex, leaving password-less URLs untouched. Regression tests added for the common drivers.

* fix(cli): keep dev server responsive during Tailwind recompiles and exit promptly on SIGTERM (#137, #139)

Dev-mode Tailwind recompilation used an async spawn but awaited it synchronously, stalling request handling until the (potentially multi-second) recompile finished; the watcher path now uses a true async compile so the server stays responsive mid-build. shutdown() awaited server.stop(true) inside the 3s window, so a SIGTERM that arrived with nothing left to drain still waited the full grace period — it now stops immediately and the timer is a hard-cap fallback (unref'd). E2E tests cover both: a fake-slow bunx keeping the dev server under 1s, and prompt SIGTERM exit.

* fix(core): lock bookkeeping-table creation in Postgres migrations (#131)

The _x_migrations table was created via CREATE TABLE IF NOT EXISTS before the advisory lock, so two booting replicas raced that DDL and hit Postgres's simultaneous-create catalog race (pg_type_typname_nsp_index) before serialization kicked in. Moving the table creation inside the locked transaction means the loser instead finds the table the winner committed and proceeds to skip — the advisory lock now guards the entire run.

* fix: finish CodeRabbit review on tracing PR (#141, #79, #131-#140)

- changeset: scope the 'no embedded literals' claim to masked quoted
  strings; note the template-tag path binds values out-of-band (#1)
- cli: serialize Tailwind recompiles so saves coalesce into one follow-up
  run after the active compile exits, instead of stacking overlapping
  processors writing the same output (#8); unit test proves no two
  compiles overlap, verified to fail against the old concurrent spawn
- redact: capture the authorization/auth keyword group so it survives the
  $1 replacement instead of emitting a literal '$1 [REDACTED]' (#9);
  exact-output regression test verified against the old non-capturing regex
- tracing: stop double-recording a throwing handler error on the x.http
  root span (the wrapper's fail() plus runWithRequestSpan's catch) (#11);
  mask quoted SQL string literals to '?' in db.statement (#13) — both
  verified failing against the previous behavior
- redis rate-limit test: FakeRedis PTTL now validates its key argument
  instead of silently modeling a malformed call as a missing key (#15)
- auth: empty-identifier regression test now provably fails against the
  old shared `login:` account key (auth.ts skip logic and brute-force
  namespacing both reverted to confirm); IP-bucket test rewritten so the
  attacker's own successful login must NOT reset the spray counter
  (verified it fails when the success path clears the IP bucket)

* fix(release): bump changesets/action to v2 for changesets CLI v3

changesets/action@v1 detects published packages by parsing the publish
command's stdout for 'New tag:' lines, which @changesets/cli v3 no longer
prints. Since the CLI was bumped to v3.0.0 (#55), npm publishes succeeded
but the action never pushed git tags or created GitHub releases.

v2 reads the CHANGESETS_OUTPUT event file the CLI writes instead and
fails loudly if that output is missing. Rename the custom-script inputs
to their v2 names (version-script, publish-script, pr-title,
commit-message).
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