Repository navigation
feat(auth): add login API endpoint for user authentication - #13
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThe pull request adds production-readiness changes across runtime security, PostgreSQL connectivity, rate limiting, CLI builds, deployment, authentication templates, landing-page presentation, CI, and project documentation. ChangesRuntime hardening
Build and deployment flow
Authentication templates
Landing page presentation
Project operations and documentation
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant LoginPage
participant LoginAPI
participant AuthSession
Client->>LoginPage: submit credentials
LoginPage->>LoginAPI: POST credentials
LoginAPI->>AuthSession: validate credentials and create session
AuthSession-->>LoginAPI: session cookie
LoginAPI-->>LoginPage: JSON success or error
LoginPage-->>Client: redirect or display error
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 13
🧹 Nitpick comments (2)
CONTRIBUTING.md (1)
8-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a language tag to the project-layout fence.
The fenced block at Line 8 has no language tag. Add
textso Markdown linting passes consistently.Proposed fix
-``` +```text🤖 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 `@CONTRIBUTING.md` around lines 8 - 15, Add the text language tag to the fenced project-layout block in CONTRIBUTING.md, changing its opening fence to ```text while leaving the listed contents and closing fence unchanged.Source: Linters/SAST tools
.github/dependabot.yml (1)
5-10: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winAdd Dependabot coverage for GitHub Actions.
The repository uses
actions/checkout@v4andoven-sh/setup-bun@v2, but this configuration monitors only package dependencies. Add a weeklygithub-actionsentry so action security updates receive pull requests. GitHub listsgithub-actionsas a supported ecosystem. (docs.github.com)Proposed fix
updates: - package-ecosystem: "npm" directory: "/" schedule: interval: "weekly" open-pull-requests-limit: 10 versioning-strategy: increase + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly"🤖 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 @.github/dependabot.yml around lines 5 - 10, Add a separate weekly Dependabot configuration entry with package-ecosystem set to github-actions and directory set to the repository root, preserving the existing npm configuration and pull-request limit behavior.
🤖 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 @.github/dependabot.yml:
- Around line 5-10: Update the Dependabot configuration entry to use the native
"bun" package ecosystem instead of "npm", and remove the unsupported
versioning-strategy setting while preserving the directory, schedule, and
pull-request limit.
In @.github/workflows/ci.yml:
- Around line 49-60: Add a separate dependency-audit step near the existing
“Audit dependencies” step that runs an unignored `bun audit --prod`, while
preserving the current ignored full `bun audit` for development dependencies.
Use a distinct step name that clearly identifies the production audit.
- Line 17: Update both actions/checkout@v4 steps in the workflow to set
persist-credentials to false, including the checkout steps near the first and
second checkout locations. Leave all other checkout configuration unchanged.
In `@DEPLOY.md`:
- Around line 14-21: Use a consistent dist output directory throughout the
deployment instructions: update the start command to include --outDir dist, and
ensure the VPS deployment build also uses --outDir dist before copying files
from dist. Keep all build, start, and copy steps aligned to the same directory.
In `@Dockerfile`:
- Around line 30-34: Update Dockerfile lines 30-34 to make the production image
include a self-contained server bundle or copy the runtime dependency
installation and required application modules alongside dist, ensuring
dist/server/index.ts can resolve `@thexjs/core` and route configuration. Update
DEPLOY.md lines 3-4 to require these runtime files for direct and VPS
deployments if the production build remains non-self-contained; otherwise state
that the self-contained build removes that requirement.
- Line 27: Update Dockerfile lines 27-27 so the CLI build output is written to
the directory copied by the production stage, preferably by changing the output
path to ../../dist; update DEPLOY.md lines 128-129 to document the selected
artifact location consistently.
In `@packages/core/src/build.ts`:
- Around line 415-433: Update shutdown in packages/core/src/build.ts so it
awaits server.stop() to drain active requests, then schedules the three-second
fallback to call server.stop(true) followed by process.exit(0); do not
force-stop before the drain or exit immediately. Update AGENTS.md lines 69-70 to
describe the generated behavior as a three-second graceful drain followed by
forced shutdown.
In `@packages/core/src/data/postgres.ts`:
- Around line 90-101: Fix the priming race in the run function by always
awaiting the shared promise returned by prime before executing work, rather than
conditionally awaiting only when primed is unset. Preserve prime’s ??= behavior
so concurrent callers share the same probeWithRetry operation and all queries
wait for its retry/backoff completion.
- Around line 63-78: Update the connection setup around the computed sslMode and
Bun.SQL constructor to apply the TLS policy through the resolved URL’s sslmode
query parameter, rather than passing an unsupported sslMode option. Append
sslmode only when sslMode is not "disable", while preserving the existing URL,
TLS CA, and other connection options.
In `@packages/core/src/security/rate-limit.ts`:
- Around line 150-159: Update getClient to clear connecting when connect()
rejects, while preserving the existing client assignment on successful
connection. Ensure the rejected promise does not remain cached, allowing
subsequent calls to initiate a fresh connection attempt.
In `@packages/create-thexjs-app/templates/saas/src/api/auth/login.ts`:
- Around line 1-29: Add a matching “DEMO ONLY” warning comment immediately above
the hardcoded credential comparison in POST, clearly indicating that the
admin/admin plaintext check is for demonstration purposes and must not be used
in production.
- Around line 1-29: The authentication flow is duplicated across the API route
and page loader; centralize credential validation, session creation, and cookie
issuance in an authenticate(email, password) helper in
packages/create-thexjs-app/templates/saas/src/lib/auth.ts. Update
packages/create-thexjs-app/templates/saas/src/api/auth/login.ts lines 1-29 to
call authenticate, and update
packages/create-thexjs-app/templates/saas/src/pages/login.tsx lines 9-24 to use
the same helper instead of its local admin check, preserving each caller’s
existing response behavior.
In `@README.md`:
- Around line 276-281: Update the “Links” section in README.md to convert the
SECURITY.md and CONTRIBUTING.md code spans into clickable Markdown links,
preserving their existing labels and document targets.
---
Nitpick comments:
In @.github/dependabot.yml:
- Around line 5-10: Add a separate weekly Dependabot configuration entry with
package-ecosystem set to github-actions and directory set to the repository
root, preserving the existing npm configuration and pull-request limit behavior.
In `@CONTRIBUTING.md`:
- Around line 8-15: Add the text language tag to the fenced project-layout block
in CONTRIBUTING.md, changing its opening fence to ```text while leaving the
listed contents and closing fence unchanged.
🪄 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: 5ef3ca6b-ca9c-414c-88bc-9880ec893474
📒 Files selected for processing (30)
.env.example.github/dependabot.yml.github/workflows/ci.ymlAGENTS.mdCHANGELOG.mdCODE_OF_CONDUCT.mdCONTRIBUTING.mdDEPLOY.mdDockerfileREADME.mdSECURITY.mdexamples/basic/src/lib/auth.tsexamples/landing/src/pages/index.tsxexamples/saas/src/lib/auth.tspackage.jsonpackages/cli/src/index.tspackages/core/src/build.tspackages/core/src/createApp.tspackages/core/src/data/postgres.tspackages/core/src/index.tspackages/core/src/security/csrf.tspackages/core/src/security/env-isolation.tspackages/core/src/security/headers.tspackages/core/src/security/rate-limit.tspackages/core/src/security/security.test.tspackages/create-thexjs-app/templates/basic/src/lib/auth.tspackages/create-thexjs-app/templates/basic/src/pages/login.tsxpackages/create-thexjs-app/templates/saas/src/api/auth/login.tspackages/create-thexjs-app/templates/saas/src/lib/auth.tspackages/create-thexjs-app/templates/saas/src/pages/login.tsx
💤 Files with no reviewable changes (1)
- packages/core/src/security/headers.ts
…eployment instructions for Vercel
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
examples/landing/src/styles/globals.css (1)
371-402: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueRemove unused crop mark selectors.
.crop-marks .crop-tland.crop-marks .crop-brare declared here, but the landing example only usescrop-marksand hides its pseudo-elements via inline styles. Remove these dead selector rows unless a component later adds child.crop-tl/.crop-brelements.🤖 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 `@examples/landing/src/styles/globals.css` around lines 371 - 402, Remove the unused `.crop-marks .crop-tl` and `.crop-marks .crop-br` selectors from the crop-marks rule, leaving the `.crop-marks` pseudo-element selectors and their existing styling unchanged.
🤖 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 `@examples/landing/src/components/boarding-pass.tsx`:
- Around line 48-63: Update deriveTicket to generate a unique stable id
alongside each bar width, then return both values in the bars data. In the
boarding-pass JSX map, replace the index-based key with each bar’s generated id;
do not use width alone, since repeated widths must still produce distinct keys.
- Around line 42-44: Run Biome formatting on the code containing the boarding
time expression in the boarding pass component, and retain explicit parentheses
around the modulo result before multiplication to document the intended operator
grouping.
In `@examples/landing/src/components/route-trail.tsx`:
- Around line 27-75: Update the effect’s onMove handler to guard ref.current
locally and use that guarded element for getBoundingClientRect and appendChild,
removing both el! assertions. In the cleanup callback, replace
live.current.forEach with a for...of loop that removes each pin, preserving the
existing cleanup behavior.
In `@examples/landing/src/styles/globals.css`:
- Around line 598-601: Update the header comment near the “Boarding Pass” styles
so the final comment line includes a space before the closing */ delimiter,
satisfying the comment-whitespace-inside Stylelint rule.
- Around line 78-81: Update the --font-mono declaration in the `@theme` inline
block by changing the SFMono-Regular font keyword to lowercase, preserving the
existing fallback order and other font declarations.
- Around line 172-176: Update the em and i style rule to remove the conflicting
not-italic utility from its `@apply` directive, while preserving font-display,
italic, and text-primary.
In `@packages/create-thexjs-app/templates/saas/src/lib/auth.ts`:
- Around line 47-55: Update authenticate to prevent the universal admin/admin
credential from granting sessions: use user lookup with password-hash
verification, or gate demo authentication behind an explicit non-production
mode. Ensure both existing callers retain the Session/null contract, and add
coverage confirming the demo credential is rejected in production mode.
---
Nitpick comments:
In `@examples/landing/src/styles/globals.css`:
- Around line 371-402: Remove the unused `.crop-marks .crop-tl` and `.crop-marks
.crop-br` selectors from the crop-marks rule, leaving the `.crop-marks`
pseudo-element selectors and their existing styling unchanged.
🪄 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: 29e68430-8027-4139-a629-51ba76094b96
⛔ Files ignored due to path filters (7)
bun.lockis excluded by!**/*.lockexamples/landing/public/files/inter-latin-ext-wght-normal.woff2is excluded by!**/*.woff2examples/landing/public/files/inter-latin-wght-normal.woff2is excluded by!**/*.woff2examples/landing/public/files/jetbrains-mono-latin-ext-wght-normal.woff2is excluded by!**/*.woff2examples/landing/public/files/jetbrains-mono-latin-wght-normal.woff2is excluded by!**/*.woff2examples/landing/public/files/space-grotesk-latin-ext-wght-normal.woff2is excluded by!**/*.woff2examples/landing/public/files/space-grotesk-latin-wght-normal.woff2is excluded by!**/*.woff2
📒 Files selected for processing (21)
.github/dependabot.yml.github/workflows/ci.ymlDEPLOY.mdDockerfileLICENSEREADME.mdexamples/basic/package.jsonexamples/landing/package.jsonexamples/landing/src/components/boarding-pass.tsxexamples/landing/src/components/route-trail.tsxexamples/landing/src/pages/index.tsxexamples/landing/src/pages/play.tsxexamples/landing/src/styles/globals.cssexamples/landing/x.config.tspackage.jsonpackages/core/src/data/postgres.tspackages/core/src/data/sqlite.tspackages/core/src/security/rate-limit.tspackages/create-thexjs-app/templates/saas/src/api/auth/login.tspackages/create-thexjs-app/templates/saas/src/lib/auth.tspackages/create-thexjs-app/templates/saas/src/pages/login.tsx
🚧 Files skipped from review as they are similar to previous changes (9)
- Dockerfile
- package.json
- .github/workflows/ci.yml
- README.md
- packages/create-thexjs-app/templates/saas/src/pages/login.tsx
- packages/create-thexjs-app/templates/saas/src/api/auth/login.ts
- examples/landing/src/pages/index.tsx
- packages/core/src/data/postgres.ts
- DEPLOY.md
| useEffect(() => { | ||
| const el = ref.current; | ||
| if (!el) return; | ||
| if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; | ||
| if (window.matchMedia("(pointer: coarse)").matches) return; // skip on touch | ||
|
|
||
| function onMove(e: PointerEvent) { | ||
| const rect = el!.getBoundingClientRect(); | ||
| const x = e.clientX - rect.left; | ||
| const y = e.clientY - rect.top; | ||
| if (x < 0 || y < 0 || x > rect.width || y > rect.height) return; | ||
|
|
||
| const prev = last.current; | ||
| if (prev) { | ||
| const dx = x - prev.x; | ||
| const dy = y - prev.y; | ||
| if (Math.hypot(dx, dy) < MIN_DISTANCE) return; | ||
| } | ||
| last.current = { x, y }; | ||
|
|
||
| const pin = document.createElement("span"); | ||
| pin.className = "route-pin-drop"; | ||
| pin.style.left = `${x}px`; | ||
| pin.style.top = `${y}px`; | ||
| pin.style.transform = "translate(-50%, -50%)"; | ||
| el!.appendChild(pin); | ||
| live.current.push(pin); | ||
|
|
||
| if (live.current.length > MAX_LIVE_PINS) { | ||
| const stale = live.current.shift(); | ||
| stale?.remove(); | ||
| } | ||
|
|
||
| window.setTimeout(() => { | ||
| pin.remove(); | ||
| live.current = live.current.filter((p) => p !== pin); | ||
| }, PIN_LIFETIME_MS); | ||
| } | ||
|
|
||
| // Listen on window rather than the (pointer-events-none) overlay itself — | ||
| // the overlay must stay click-through so it never eats clicks on the | ||
| // hero's real buttons/inputs, so we hit-test against its rect instead. | ||
| window.addEventListener("pointermove", onMove); | ||
| return () => { | ||
| window.removeEventListener("pointermove", onMove); | ||
| live.current.forEach((p) => p.remove()); | ||
| live.current = []; | ||
| }; | ||
| }, []); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
Does TypeScript narrow a const variable captured by a nested function declaration after an early-return null check on the outer variable?
💡 Result:
Whether TypeScript preserves the narrowed type of a const variable inside a nested function declaration depends on the type of function used (declaration vs. expression) and current TypeScript limitations. In general, TypeScript does not maintain type refinements for variables captured within nested function declarations (the function name() {} syntax) [1][2]. This is primarily because function declarations are hoisted to the top of the enclosing scope, meaning the function could theoretically be called before the code that performs the narrowing has executed [1]. Because of this hoisting, the compiler cannot safely assume the variable has been narrowed when the function is eventually invoked [1]. Key distinctions and behaviors include: 1. Function Declarations vs. Expressions: If you define the nested function as a function expression (e.g., const inner = () => { ... } or const inner = function() { ... }), TypeScript is often able to preserve the narrowed type because it can verify the closure is created after the narrowing has occurred [1][3]. 2. Limitations with Hoisting: Even for const variables, which cannot be reassigned, the compiler does not currently distinguish between them and other variables regarding this hoisting-related limitation [1]. There is an active, long-standing request to improve this, but it remains a known constraint [1][4]. 3. Workarounds: - Use function expressions instead of function declarations when the function must capture a narrowed variable [1]. - Alias the narrowed value to a new constant inside the narrowed scope (e.g., const narrowedAlias = variable;) [4][5]. Since this new constant is block-scoped and defined only after the narrowing, capturing this alias in a nested function will typically preserve the expected type [4][5]. In summary, while it may seem logical for TypeScript to preserve narrowing for a const variable in a hoisted function declaration, it currently does not [1]. Using function expressions or local aliasing are the recommended patterns to achieve the desired type-safety [1][4].
Citations:
- 1: https://stackoverflow.com/questions/79577968/why-does-a-closure-un-narrow-a-narrowed-const-type-in-typescript
- 2: Narrowed variable types become widened in functions defined after narrowing microsoft/TypeScript#50580
- 3: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html
- 4: Narrowed
constvariables are widened in block-scoped closures microsoft/TypeScript#61158 - 5: https://stackoverflow.com/questions/73052676/type-narrowed-let-variable-reverts-to-its-original-type-when-passed-to-a-closu
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
fd -a 'route-trail\.tsx|tsconfig.*' . || true
echo "== route-trail.tsx outline =="
ast-grep outline examples/landing/src/components/route-trail.tsx || true
echo "== route-trail.tsx relevant lines =="
cat -n examples/landing/src/components/route-trail.tsx | sed -n '1,110p'Repository: abdelkabirouadoukou/x
Length of output: 4702
Avoid el! and forEach in this effect.
el! at Lines 34 and 52 triggers Biome noNonNullAssertion; add a local guard at the start of onMove instead of assuming the outer null check persists there. Replace live.current.forEach((p) => p.remove()) at Line 72 with a for...of loop to satisfy noForEach.
🧰 Tools
🪛 GitHub Actions: CI / 0_Test (ubuntu-latest).txt
[error] 34-34: Biome lint/style/noNonNullAssertion: Forbidden non-null assertion on 'el!'.
[error] 52-52: Biome lint/style/noNonNullAssertion: Forbidden non-null assertion on 'el!'.
[error] 72-72: Biome lint/complexity/noForEach: Prefer a for...of loop instead of forEach.
🪛 GitHub Actions: CI / 2_Test (macos-latest).txt
[error] 34-34: Biome lint/style/noNonNullAssertion: Forbidden non-null assertion on 'el!'.
[error] 52-52: Biome lint/style/noNonNullAssertion: Forbidden non-null assertion on 'el!'.
[error] 72-72: Biome lint/complexity/noForEach: Prefer a for...of loop instead of forEach.
🪛 GitHub Actions: CI / Test (macos-latest)
[error] 34-34: Biome lint error (lint/style/noNonNullAssertion): Forbidden non-null assertion on 'el!'.
[error] 52-52: Biome lint error (lint/style/noNonNullAssertion): Forbidden non-null assertion on 'el!'.
[error] 72-72: Biome lint error (lint/complexity/noForEach): Prefer a for...of loop instead of forEach.
🪛 GitHub Actions: CI / Test (ubuntu-latest)
[error] 34-34: Biome lint error (lint/style/noNonNullAssertion): Forbidden non-null assertion on el!. Replace it with safer null-aware logic. Command: bun run lint.
[error] 52-52: Biome lint error (lint/style/noNonNullAssertion): Forbidden non-null assertion on el!. Replace it with safer null-aware logic. Command: bun run lint.
[error] 72-72: Biome lint error (lint/complexity/noForEach): Prefer a for...of loop instead of forEach. Command: bun run lint.
🤖 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 `@examples/landing/src/components/route-trail.tsx` around lines 27 - 75, Update
the effect’s onMove handler to guard ref.current locally and use that guarded
element for getBoundingClientRect and appendChild, removing both el! assertions.
In the cleanup callback, replace live.current.forEach with a for...of loop that
removes each pin, preserving the existing cleanup behavior.
Source: Pipeline failures
| @theme inline { | ||
| --font-display: "Oswald", ui-sans-serif, system-ui, sans-serif; | ||
| --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif; | ||
| --font-mono: "IBM Plex Mono", ui-monospace, monospace; | ||
| --font-display: "Space Grotesk Variable", ui-sans-serif, system-ui, sans-serif; | ||
| --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif; | ||
| --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, monospace; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the Stylelint keyword-case failure.
CI reports value-keyword-case at Line 81 for SFMono-Regular. Lowercase the keyword to match the project's Stylelint configuration.
🎨 Proposed fix
- --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, monospace;
+ --font-mono: "JetBrains Mono Variable", ui-monospace, sfmono-regular, monospace;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @theme inline { | |
| --font-display: "Oswald", ui-sans-serif, system-ui, sans-serif; | |
| --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif; | |
| --font-mono: "IBM Plex Mono", ui-monospace, monospace; | |
| --font-display: "Space Grotesk Variable", ui-sans-serif, system-ui, sans-serif; | |
| --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif; | |
| --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, monospace; | |
| `@theme` inline { | |
| --font-display: "Space Grotesk Variable", ui-sans-serif, system-ui, sans-serif; | |
| --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif; | |
| --font-mono: "JetBrains Mono Variable", ui-monospace, sfmono-regular, monospace; |
🧰 Tools
🪛 Stylelint (17.14.1)
[error] 81-81: Expected "SFMono-Regular" to be "sfmono-regular" (value-keyword-case)
(value-keyword-case)
[error] 78-78: Unexpected unknown at-rule "@theme" (scss/at-rule-no-unknown)
(scss/at-rule-no-unknown)
🤖 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 `@examples/landing/src/styles/globals.css` around lines 78 - 81, Update the
--font-mono declaration in the `@theme` inline block by changing the
SFMono-Regular font keyword to lowercase, preserving the existing fallback order
and other font declarations.
Source: Linters/SAST tools
| /* accent the display font's red kicker runs in italics when present */ | ||
| em, | ||
| i { | ||
| @apply font-display not-italic italic text-primary; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove the conflicting not-italic utility.
@apply font-display not-italic italic text-primary; applies both not-italic and italic to font-style. Since italic is listed after not-italic, it wins in the cascade, so not-italic has no effect. The surrounding comment states the intent is italics, so drop the dead not-italic class.
🎨 Proposed fix
em,
i {
- `@apply` font-display not-italic italic text-primary;
+ `@apply` font-display italic text-primary;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* accent the display font's red kicker runs in italics when present */ | |
| em, | |
| i { | |
| @apply font-display not-italic italic text-primary; | |
| } | |
| /* accent the display font's red kicker runs in italics when present */ | |
| em, | |
| i { | |
| `@apply` font-display italic text-primary; | |
| } |
🤖 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 `@examples/landing/src/styles/globals.css` around lines 172 - 176, Update the
em and i style rule to remove the conflicting not-italic utility from its `@apply`
directive, while preserving font-display, italic, and text-primary.
| /* ---------------------------------------------------------------------- */ | ||
| /* Boarding Pass — personalized ticket generator (new feature, see */ | ||
| /* boarding-pass.tsx). Perforated stub layout + a barcode made of CSS bars.*/ | ||
| /* ---------------------------------------------------------------------- */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the Stylelint comment-whitespace failure.
CI reports comment-whitespace-inside at Line 600. Add a space before the closing */.
🎨 Proposed fix
-/* boarding-pass.tsx). Perforated stub layout + a barcode made of CSS bars.*/
+/* boarding-pass.tsx). Perforated stub layout + a barcode made of CSS bars. */📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* ---------------------------------------------------------------------- */ | |
| /* Boarding Pass — personalized ticket generator (new feature, see */ | |
| /* boarding-pass.tsx). Perforated stub layout + a barcode made of CSS bars.*/ | |
| /* ---------------------------------------------------------------------- */ | |
| /* ---------------------------------------------------------------------- */ | |
| /* Boarding Pass — personalized ticket generator (new feature, see */ | |
| /* boarding-pass.tsx). Perforated stub layout + a barcode made of CSS bars. */ | |
| /* ---------------------------------------------------------------------- */ |
🧰 Tools
🪛 Stylelint (17.14.1)
[error] 600-600: Expected whitespace before "*/" (comment-whitespace-inside)
(comment-whitespace-inside)
🤖 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 `@examples/landing/src/styles/globals.css` around lines 598 - 601, Update the
header comment near the “Boarding Pass” styles so the final comment line
includes a space before the closing */ delimiter, satisfying the
comment-whitespace-inside Stylelint rule.
Source: Linters/SAST tools
| // DEMO ONLY: the single source of truth for the credential check, shared by | ||
| // the login API route and the login page's server fallback. Replace this with | ||
| // real (hashed) password verification before shipping. | ||
| export function authenticate(email: string, password: string): Session | null { | ||
| if (email === "admin" && password === "admin") { | ||
| return createSession(email); | ||
| } | ||
| return null; | ||
| } |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
Do not ship a universal admin / admin credential.
Line 51 grants a session to any caller who knows the template defaults. Both the login API and the page loader use authenticate, so this credential enables access through both flows.
The DEMO ONLY comment does not enforce safe deployment. Replace this with user lookup and password-hash verification, or disable demo authentication unless an explicit non-production mode is enabled. Add a test that rejects the demo credential in production mode.
🤖 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/create-thexjs-app/templates/saas/src/lib/auth.ts` around lines 47 -
55, Update authenticate to prevent the universal admin/admin credential from
granting sessions: use user lookup with password-hash verification, or gate demo
authentication behind an explicit non-production mode. Ensure both existing
callers retain the Session/null contract, and add coverage confirming the demo
credential is rejected in production mode.
- Updated package.json in examples/basic to re-add "shadcn" dependency. - Refactored boarding-pass.tsx to use bitwise right shift operator for seat calculations and improved barcode rendering logic. - Enhanced route-trail.tsx by changing function declaration to arrow function and improved cleanup logic. - Cleaned up index.tsx and play.tsx for better readability by adjusting JSX formatting. - Added overrides for specific packages in the root package.json. - Enhanced adapter-vercel to include stylesheetHref in the generated entry and manifest. - Updated core build and app creation logic to handle stylesheetHref more effectively. - Simplified Postgres client type definitions and connection logic for better readability.
- 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)
… (#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)
* 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).
Summary by CodeRabbit
New Features
Bug Fixes
Documentation