improvement(tables): show the lock chip only when a table is actually locked - #5967
Conversation
… locked - The header chip rendered whenever an admin had the flag on, so an unlocked table permanently carried a "Lock settings" entry. Header space is for state: the chip now appears only once something is locked and names the mode. The admin route to the panel on an unlocked table is the breadcrumb dropdown, which already had it - Keep the Append-only name when the schema is locked too. Append-only describes the row semantics and a schema lock doesn't change them; the detail line calls out the locked columns instead
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The PATCH route applies the same scoped flag check when enabling a lock (workspace org lookup only on that path). Lock updates now write richer audit entries (per-kind locked/unlocked text, before/after metadata, optional request for IP/UA). Append-only labeling no longer requires schema to be unlocked; schema lock is mentioned in the detail line when present. Reviewed by Cursor Bugbot for commit 0b72227. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR limits the table-header lock chip to locked tables and aligns lock configuration, feature gating, labeling, and auditing across the UI and API.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/table/[tableId]/route.ts | Aligns the PATCH feature gate with the page’s user and workspace-host context before enabling locks. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/page.tsx | Resolves the table-lock rollout server-side and supplies it to the client table component. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx | Shows the header lock chip only for active locks while retaining the gated breadcrumb settings entry. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/lock-copy.ts | Preserves the append-only label when schema locking is additionally enabled and clarifies the detail text. |
| apps/sim/lib/table/service.ts | Captures serialized before/after lock state and emits more descriptive audit metadata with request context. |
| apps/sim/lib/core/config/env.ts | Removes the obsolete public environment mirror now that feature-flag resolution occurs server-side. |
Reviews (2): Last reviewed commit: "fix(tables): resolve the lock flag with ..." | Re-trigger Greptile
…k changes fully - Drop NEXT_PUBLIC_TABLE_LOCKS. A feature flag's gating lives in AppConfig, which has no client counterpart, so mirroring it into a public env var meant AppConfig couldn't control the UI at all and org/user clauses could never reach the client — only global on/off. The page now resolves the flag with session context and passes it down, per the add-feature-flag skill. Embedded renders default to false, failing closed; enforcement of stored locks is unaffected either way - Record the previous locks alongside the new ones and name the transitions in the audit description, so the log answers who locked what without expanding metadata. Forward the request for IP / user-agent capture
The page passed userId/orgId while the PATCH gate resolved the flag with no context, so an org- or user-targeted rollout would show the settings panel and then 403 on save — the rollout path the previous commit exists to enable. Both now key on the workspace's host organization rather than the viewer's active one, matching the convention getWorkspaceHostContextForViewer documents: active-org describes the account, not the workspace host. The route's lookup runs only when a lock is actually being turned on.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0b72227. Configure here.
Summary
Follow-up to #5960.
Type of Change
Testing
Tested manually. Lint, boundary validation, and the full audit suite pass; 513 table tests pass.
Checklist