Repository navigation
fix(settings): keep the server Supabase client out of Roles & access, so the web build passes - #1796
Merged
Merged
Conversation
… so the web build passes Settings › Roles & access (ansvisor#1780) imports lib/chat/access.ts, which reads plan-facts.ts, which imported planFromOrgRow from plan-guard.ts, and plan-guard.ts imports the server's Supabase client (next/headers). The production build fails on that since ansvisor#1780 met ansvisor#1776 on main. The row-to-plan reads move to plan-row.ts, with no database client; plan-guard re-exports them. A test walks every 'use client' file's imports and fails if one reaches lib/supabase/server.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 of 6 tasks
gkhngyk
approved these changes
Oct 29, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Moving the row-to-plan reads into plan-row.ts, with no database client, keeps the server Supabase client out of the client bundle that Settings › Roles & access pulls in through lib/chat/access.ts → plan-facts.ts; plan-guard.ts re-exports them, so server callers are unchanged. The new plan-row.test.ts walks the imports from every client file and fails on a path to lib/supabase/server.ts. On today's main (Wix, #1751 and the fan-out PRs included) web typecheck is clean and the guards and Chat tests pass.
8 tasks done
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
main's web build has failed since #1780 (e2587ed, 17:05 UTC), so no web change merged since then can deploy. CI on main shows
web — format, lint & typecheckfailing at Next.js production build:Why
roles-access-section.tsx, a client component, feat(settings): show Roles & access, your own access and your plan #1780) importslib/chat/access.ts.access.tsimportsplanGateLockfromplan-facts.ts(feat(chat): decide each tool call by plan, role, policy and mode #1776).plan-facts.tsimportedplanFromOrgRowfromlib/guards/plan-guard.ts.plan-guard.tsimports the server Supabase client.Each PR built on its own, and the chain only formed once both were on main.
Fix
lib/guards/plan-row.ts:ORG_PLAN_COLUMNS,planFromOrgRowandusagePlanFromOrgRowmove here, with no database client and nothing else changed.plan-guard.ts: re-exports them, so every server caller (and every test that mocksplan-guard) is unchanged.plan-facts.ts: imports fromplan-row.plan-row.test.ts: walks the imports of every'use client'file (stopping at'use server'modules, skipping type-only imports) and fails if one reacheslib/supabase/server.ts. With the old import it lists exactly this chain.Related issue
Fixes main's build, broken by #1780 meeting #1776.
Type of change
fix— Bug fixHow to test
cd web && yarn build. It passes; on main it fails with the error above.yarn vitest run src/lib/guards src/lib/chat.Checklist
src/lib/guards,src/lib/chat,prompt.test.ts,chat-access: 18 files, 347 tests)Local build and typecheck: running; CI on this PR runs the same production build.
🤖 Generated with Claude Code