Skip to content

Prepare Switchboard for public beta - #4

Merged
LaneBucher merged 5 commits into
mainfrom
fix/public
Aug 2, 2026
Merged

Prepare Switchboard for public beta#4
LaneBucher merged 5 commits into
mainfrom
fix/public

Conversation

@LaneBucher

@LaneBucher LaneBucher commented Aug 2, 2026

Copy link
Copy Markdown
Member

Hardens Switchboard for public use with secure dependency updates, reliable authentication and form behavior, a responsive admin UI, and expanded release verification.

Summary by CodeRabbit

  • New Features
    • Added a refreshed admin navigation layout with clearer links and a form-based logout experience.
    • Improved logout handling to fully clear sessions and return users to the login page.
    • Forms now preserve entered non-password values and checkbox selections after submission errors.
    • Added Prisma configuration support for schema, migrations, environment variables, and seeding.
  • Documentation
    • Updated installation and release guidance for beta version 0.6.0-beta.2, including testing and credential recommendations.
  • Chores
    • Excluded generated Playwright data and output files from version control.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 33 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c2aa801d-4074-4d65-b1ef-4c4010f987d1

📥 Commits

Reviewing files that changed from the base of the PR and between 9c01e46 and 29cbb19.

⛔ Files ignored due to path filters (2)
  • examples/basic-next-prisma/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • CONTRIBUTING.md
  • README.md
  • examples/basic-next-prisma/package.json
  • examples/basic-next-prisma/src/app/admin/layout.tsx
  • examples/basic-next-prisma/src/app/admin/logout/route.ts
  • examples/basic-next-prisma/src/components/form/SmartForm.tsx
  • examples/basic-next-prisma/src/middleware.ts
  • package.json
  • packages/cli/README.md
  • packages/cli/package.json
  • packages/cli/src/cli.js
  • packages/cli/templates/adminLayout.js
  • packages/cli/templates/authFiles.js
  • packages/cli/templates/supportFiles.js
  • packages/cli/test/auth.test.js
  • packages/cli/test/init.test.js
  • packages/cli/test/package-boundaries.test.js
  • src/app/admin/layout.tsx
  • src/app/admin/logout/route.ts
  • src/components/form/SmartForm.tsx
  • src/middleware.ts
📝 Walkthrough

Walkthrough

The PR prepares the beta release, updates Prisma configuration, changes admin logout to a server action, restores form values after errors, updates generated CLI templates, and adds related tests and documentation.

Changes

Beta release and admin workflow

Layer / File(s) Summary
Beta release and project configuration
package.json, prisma.config.ts, examples/basic-next-prisma/..., CONTRIBUTING.md, README.md, packages/cli/package.json, packages/cli/README.md, .gitignore
Package metadata, Prisma configuration, release instructions, installation guidance, and ignored output paths now target the beta release.
Admin logout flow
src/switchboard/auth-actions.ts, src/app/admin/layout.tsx, src/app/admin/logout/route.ts, examples/basic-next-prisma/src/switchboard/auth-actions.ts, examples/basic-next-prisma/src/app/admin/...
Admin layouts submit a server logout action. The action expires the session cookie and redirects to /admin/login.
Form error value recovery
src/components/form/SmartForm.tsx, examples/basic-next-prisma/src/components/form/SmartForm.tsx
SmartForm captures submitted values and restores non-password fields after errors. Checkbox state is restored while hidden controls are skipped.
Generated template parity and validation
packages/cli/templates/*, packages/cli/test/*
CLI templates generate the updated logout and form behavior. Tests validate generated files and beta package metadata.
Policy API contract cleanup
src/lib/rbac.ts
Policy.users.canList no longer accepts an unused context argument.

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

Sequence Diagram(s)

sequenceDiagram
  participant AdminLayout
  participant logout
  participant SessionCookie
  participant AdminLogin
  AdminLayout->>logout: submit logout server action
  logout->>SessionCookie: expire session cookie
  logout->>AdminLogin: redirect to /admin/login
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the pull request's primary objective of preparing Switchboard for its public beta release.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c01e461c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/templates/supportFiles.js Outdated
control.value = values[0] ?? "";
}
}
}, [fields, state.error]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore values after every failed submission

When two consecutive saves return the same error string—common for repeated invalid JSON or uniqueness failures—the second state update leaves both dependencies unchanged, so this effect does not run again. React resets uncontrolled fields after the form action resolves, causing the user's non-password values to remain cleared after that second failure; trigger restoration from each submission/state result rather than only changes to state.error.

Useful? React with 👍 / 👎.

Comment thread package.json Outdated
},
"overrides": {
"postcss": "^8.5.18",
"sharp": "^0.35.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the Sharp override compatible with Node 18

The repository still documents Node.js 18 as supported, but this override resolves to Sharp 0.35.3, whose committed lockfile declares node: >=20.9.0. Consequently the documented Node 18 setup selects an unsupported native dependency and installations enforcing engine requirements cannot complete; either retain a Node-18-compatible Sharp release or raise the repository and example minimum Node version consistently.

Useful? React with 👍 / 👎.

@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: 8

🤖 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 `@package.json`:
- Around line 29-31: Enforce the Next.js 15 Node.js minimum by adding
engines.node with ">=18.18.0" to the root package manifest, and update the
Node.js version requirements in CONTRIBUTING.md, README.md, and
packages/cli/README.md from 18 or newer to 18.18.0 or newer.

In `@packages/cli/package.json`:
- Around line 35-37: Update the publishConfig metadata in
packages/cli/package.json to include the beta dist-tag alongside the existing
public access setting, ensuring the 0.6.0-beta.2 package publishes under beta by
default.

In `@packages/cli/src/cli.js`:
- Line 11: Update createCli so the CLI version is sourced from the package
metadata rather than the hardcoded .version("0.6.0-beta.2") value, ensuring
--version stays synchronized with packages/cli/package.json; alternatively, add
coverage that compares --version output with the manifest version.

In `@packages/cli/templates/authFiles.js`:
- Line 297: Remove the generated GET logout route from the auth file generation
logic surrounding the expires configuration, and update the generation tests to
no longer expect or require that route. Preserve the new <form action={logout}>
flow and any remaining logout behavior.

In `@packages/cli/test/package-boundaries.test.js`:
- Around line 52-77: Extend the “package metadata is ready for the public beta”
test with an npm archive-content or packlist assertion that inspects the files
included for publication and verifies they match the allowed packageJson.files
boundaries. Keep the existing metadata assertions unchanged and ensure the check
catches unintended files nested under bin, src, or templates.

In `@src/app/admin/layout.tsx`:
- Around line 22-38: Add a unique aria-label to the top navigation element in
the admin layout, specifically the nav with className "sb-admin-nav", so it is
distinguishable from the sidebar navigation landmark while preserving the
existing links and structure.

In `@src/components/form/SmartForm.tsx`:
- Around line 31-58: Update the restoration useEffect in SmartForm to depend on
the full state object rather than state.error, ensuring it reruns for every
useActionState update even when identical errors recur; keep the existing form
value restoration logic unchanged.

In `@src/switchboard/auth-actions.ts`:
- Around line 47-55: The logout cookie-clearing behavior is inconsistent between
the Server Action and public admin logout routes. Update the cookie options in
src/switchboard/auth-actions.ts:47-55, src/app/admin/logout/route.ts:9-17,
examples/basic-next-prisma/src/switchboard/auth-actions.ts:47-55, and
examples/basic-next-prisma/src/app/admin/logout/route.ts:9-17 so every
SWITCHBOARD_SESSION_COOKIE clear uses sessionCookieOptions() together with an
expired date and zero maxAge, preserving the existing redirect/response
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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f16ed854-8273-49d6-8e4c-a5b7d741b3bb

📥 Commits

Reviewing files that changed from the base of the PR and between 401ed83 and 9c01e46.

⛔ Files ignored due to path filters (2)
  • examples/basic-next-prisma/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (26)
  • .gitignore
  • CONTRIBUTING.md
  • README.md
  • examples/basic-next-prisma/package.json
  • examples/basic-next-prisma/prisma.config.ts
  • examples/basic-next-prisma/src/app/admin/layout.tsx
  • examples/basic-next-prisma/src/app/admin/logout/route.ts
  • examples/basic-next-prisma/src/components/form/SmartForm.tsx
  • examples/basic-next-prisma/src/switchboard/auth-actions.ts
  • package.json
  • packages/cli/README.md
  • packages/cli/package.json
  • packages/cli/src/cli.js
  • packages/cli/templates/adminLayout.js
  • packages/cli/templates/authFiles.js
  • packages/cli/templates/supportFiles.js
  • packages/cli/test/auth.test.js
  • packages/cli/test/init.test.js
  • packages/cli/test/package-boundaries.test.js
  • prisma.config.ts
  • src/app/admin/layout.tsx
  • src/app/admin/logout/route.ts
  • src/components/form/SmartForm.tsx
  • src/lib/prisma.ts
  • src/lib/rbac.ts
  • src/switchboard/auth-actions.ts
💤 Files with no reviewable changes (1)
  • src/lib/prisma.ts

Comment thread package.json
Comment on lines +29 to +31
"@prisma/client": "^6.19.3",
"next": "15.5.22",
"prisma": "^6.19.3",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

jq '.engines // {}' package.json

rg -n -C 2 \
  'Node\.js|node-version|engines|18\.[0-9]+' \
  . --hidden \
  -g 'package.json' \
  -g '*.md' \
  -g '*.yml' \
  -g '*.yaml' \
  -g '.nvmrc' \
  -g '!node_modules/**' || true

Repository: black-candle-technologies/switchboard

Length of output: 971


🌐 Web query:

Next.js 15 requires Node.js 18.18.0 or newer official documentation

💡 Result:

Yes, it is correct that Next.js 15 requires Node.js 18.18.0 or newer. This requirement was officially introduced with the release of Next.js 15 to ensure compatibility with modern framework features and dependencies [1][2]. While some documentation pages may recommend higher versions like Node.js 20.9 for optimal stability or LTS support [3], the hard minimum requirement enforced by the framework is version 18.18.0 [1][4][5]. If you attempt to run a Next.js 15 application with a version of Node.js older than 18.18.0, you will encounter a version mismatch error [2]. To manage this requirement effectively: - Verify your current version by running node -v [2]. - Use a version manager such as nvm or volta to upgrade to a supported version [2]. - Explicitly define the required version in your package.json file to ensure consistency across development and CI/CD environments [2]: { "engines": { "node": ">=18.18.0" } }

Citations:


Enforce the Next.js 15 Node.js floor across the project.

Next.js 15 requires Node.js 18.18.0 or newer, and the root manifest does not set engines.node. Update the remaining Node.js 18 or newer requirements in CONTRIBUTING.md, README.md, and packages/cli/README.md, and add a CI/runtime engine guard such as package.json engines.node: ">=18.18.0".

🤖 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 `@package.json` around lines 29 - 31, Enforce the Next.js 15 Node.js minimum by
adding engines.node with ">=18.18.0" to the root package manifest, and update
the Node.js version requirements in CONTRIBUTING.md, README.md, and
packages/cli/README.md from 18 or newer to 18.18.0 or newer.

Comment thread packages/cli/package.json
Comment thread packages/cli/src/cli.js Outdated
Comment thread packages/cli/templates/authFiles.js Outdated
Comment thread packages/cli/test/package-boundaries.test.js
Comment thread src/app/admin/layout.tsx
Comment thread src/components/form/SmartForm.tsx Outdated
Comment on lines +47 to +55
export async function logout() {
const cookieStore = await cookies();
cookieStore.set(SWITCHBOARD_SESSION_COOKIE, "", {
...sessionCookieOptions(),
expires: new Date(0),
maxAge: 0,
});
redirect("/admin/login");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== relevant files =="
printf '%s\n' $(git ls-files | rg '^src/(switchboard/auth-actions\.ts|switchboard/auth\.ts|app/admin/logout/route\.ts)|examples/basic-next-prisma/src/(switchboard/auth-actions\.ts|app/admin/logout/route\.ts)$' || true)

echo
echo "== logout/action usages =="
rg -n "logout|formAction|type=\"submit\"|submit\\(\"logout\"\\)|/admin/logout|admin/logout|logout\\(\\)" src examples/basic -S || true

echo
echo "== auth-action snippets =="
for f in src/switchboard/auth-actions.ts examples/basic-next-prisma/src/switchboard/auth-actions.ts src/app/admin/logout/route.ts examples/basic-next-prisma/src/app/admin/logout/route.ts; do
  if [ -f "$f" ]; then
    echo "--- $f"
    cat -n "$f" | sed -n '1,120p'
  fi
done

echo
echo "== session cookie options definitions =="
rg -n "function sessionCookieOptions|const sessionCookieOptions|SWITCHBOARD_SESSION_COOKIE|clearSessionCookie" . -S || true

Repository: black-candle-technologies/switchboard

Length of output: 8953


Consolidate logout cookie clearing so admin/logout routes still use the shared cookie settings.

The admin logout Server Action now clears SWITCHBOARD_SESSION_COOKIE with expires: new Date(0) and maxAge: 0, but the /admin/logout GET routes still clear it with sessionCookieOptions() only. If this route exists as a public logout link endpoint, the route must also clear the expired cookie so the action cannot succeed while the route leaves the old session active.

🧰 Tools
🪛 React Doctor (0.9.1)

[error] 47-47: Server action "logout" performs unauthenticated privileged server work (cookies().set()), so anyone can trigger it directly.

Check auth before changing server state or invoking billable services because exported server actions can be called directly by unauthenticated clients.

(server-auth-actions)

📍 Affects 4 files
  • src/switchboard/auth-actions.ts#L47-L55 (this comment)
  • src/app/admin/logout/route.ts#L9-L17
  • examples/basic-next-prisma/src/switchboard/auth-actions.ts#L47-L55
  • examples/basic-next-prisma/src/app/admin/logout/route.ts#L9-L17
🤖 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 `@src/switchboard/auth-actions.ts` around lines 47 - 55, The logout
cookie-clearing behavior is inconsistent between the Server Action and public
admin logout routes. Update the cookie options in
src/switchboard/auth-actions.ts:47-55, src/app/admin/logout/route.ts:9-17,
examples/basic-next-prisma/src/switchboard/auth-actions.ts:47-55, and
examples/basic-next-prisma/src/app/admin/logout/route.ts:9-17 so every
SWITCHBOARD_SESSION_COOKIE clear uses sessionCookieOptions() together with an
expired date and zero maxAge, preserving the existing redirect/response
behavior.

@LaneBucher
LaneBucher merged commit c421847 into main Aug 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant