Skip to content

feat(ui): rail every sidebar · hide unavailable paid features · Read-by-default - #10

Merged
PMQ9 merged 2 commits into
wiki-v2from
feat/ui-consistency-audit
Sep 3, 2026
Merged

PMQ9 merged 2 commits into
wiki-v2from
feat/ui-consistency-audit

Conversation

@PMQ9

@PMQ9 PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown

TL;DR

The wiki half of the UI-consistency pass (tracked in cccvu/wiki-v2 issue 149; paired with the super-repo PR that bumps this submodule). Three root-cause fixes to the fork client: rail every sidebar (none slide/vanish), hide unavailable paid features (don't advertise them), and Read-by-default page open mode.

What this does

  • Rail every sidebar (feat(public): anonymous front page + discovery endpoint (wiki-v2 #26) #1/chore(wiki-v2): promote #57 platform-admin entry seam onto the durable branch #2). getSidebarCollapseState now rails ALL navbar sidebars on collapse (home/settings/space/AI) to the 52px icon rail — none use Mantine's hide, which slid the navbar off-screen. New space + AI-chat rails (collapsed prop → data-collapsed + railHidden CSS, mirroring the global/settings rails); the space resize handle hides while railed. Dimensions come from a new CCC-owned features/layout/layout-tokens.ts (shared with the console via a drift test in the super-repo).
  • Hide, don't advertise (fix(authz): harden PLATFORM_AUTHZ_TIMEOUT_MS parse (empty/typo → deny-all self-DoS) #4). New CCC-owned features/feature-availability/ gate (FeatureGate/useFeatureAvailable). The settings-nav show-check folds in feature-availability (hiding a nav item also makes its EE page unreachable). Every remaining paid leaf is hidden instead of disabled: Templates (both sidebars), editor Bases/Kanban, DOCX/PDF/Confluence import, DOCX export, comment Resolve, page-verification badge+menu, MFA row, space-security toggles, workspace toggles. Drops the useUpgradeLabel affordances.
  • Read-by-default + workspace-admin gating (CCC header lockup + sidebar icon rail (incl. settings rail) #5/test(client): #46 regression + complete passwordless migration (#52) #6). Pure resolvePageEditMode(userPref, workspaceDefault) helper — precedence explicit user pref > workspace default > Read — plus a Read-default atom/preference, so pages open read-only. The wiki Workspace General page gates its editable admin controls on the Docmost manage-settings ability (role: "admin" on the nav item), so non-privileged platform admins no longer see 403-throwing controls (they manage workspace settings in the console — super-repo side); its default-edit-mode control warns before Edit.

Why

Merge b3e64af (fork PR 5 + super PR 124) added the icon-rail pattern to only some surfaces and left paid-feature UI greyed. See cccvu/wiki-v2 issue 149 for the full context, rationale, and the rejected alternatives (notably: NOT elevating the shadow user's Docmost role — the platform, not Docmost roles, is the auth authority).

How it works

All genuinely-new logic lives in boundary-excluded CCC dirs (features/layout/, features/feature-availability/) or pure helpers (sidebar-collapse.ts, resolve-page-edit-mode.ts); the upstream edits are minimal per-surface hasFeature && … / return null guards + rail plumbing. Every intentional upstream edit is documented in UPSTREAM_MODIFICATIONS.md (#64–#82 new, #34/#36/#38/#40/#41/#51 refreshed) — the boundary check is green.

Testing

  • pnpm --filter client test — 151 pass (new: sidebar-collapse truth-table extended, resolve-page-edit-mode, feature-gate behavior).
  • pnpm --filter client tsc --noEmit — 0 errors (after building @docmost/editor-ext).
  • scripts/check-upstream-boundary.sh (super-repo) — green.
  • Live QA (dev server on the running backend): home + space sidebars rail to icons on collapse (no slide); settings nav shows no greyed paid items; Templates gone from the home rail; a page opens in Read; dark mode + narrow/mobile overlay render correctly.

Risk & rollback

Presentation + client-gating only — no server/authz change on the fork side (server re-enforces every permission; the feature-hiding is advisory UI). Rollback = revert the merge. The rail behavior is guarded by sidebar-collapse.test.ts; the boundary check guards the seam set.

🤖 Generated with Claude Code

…-default

UI-consistency pass (wiki-v2 UI audit). Three root-cause fixes to upstream seams:

- Rail-every-sidebar (#1/#2): getSidebarCollapseState now rails ALL navbar
  sidebars on collapse (home/settings/space/AI) so none slide off-screen. New
  space + AI-chat rails (collapsed prop + railHidden CSS); dimensions come from a
  new CCC-owned features/layout token module (shared with the console).
- Hide-don't-advertise (#4): a new CCC-owned features/feature-availability gate;
  fold feature-availability into the settings-nav show check and hide every
  paid/EE control that was rendered disabled with an "Available with a paid
  license" tooltip (Templates, Bases/Kanban, DOCX/PDF/Confluence import, DOCX
  export, comment Resolve, page verification, MFA, space security, workspace
  toggles). Drops the useUpgradeLabel affordances on those surfaces.
- Read-by-default (#5/#6): pure resolvePageEditMode helper (user pref > workspace
  default > Read) + Read-default atom/preference; the workspace General page is
  gated on the Docmost manage-settings ability (platform admins manage workspace
  settings in the console) and the default-edit-mode control warns before Edit.

New/changed upstream seams documented in UPSTREAM_MODIFICATIONS.md (#64–#82,
plus refreshed #34/#36/#38/#40/#41/#51). New pure helpers carry regression tests.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

Performance Review

Reviewer: Performance Reviewer (Claude Opus 4.8)
Scope: fork cccvu/docmost#10 @ 5b8d8e8d (reviewed as one unit with super cccvu/wiki-v2#151 @ daf006a)
Lens: runtime performance of the code as written

Summary

No Performance findings on this side at HEAD 5b8d8e8d. This is a presentational change (sidebar rails, hide-vs-disable feature gates, Read-by-default edit mode) with no render-path regression. Several changes are net-positive for perf.

What I checked (render paths, atoms, memoization)

  • command-list.tsx — the new visibleItems useMemo is keyed correctly ([items, hasBases]) and flatItems derives from it; filtering gated slash items out before render means fewer nodes, not more. Small improvement, not a regression.
  • mfa-settings.tsx / page-verification-modal.tsx — the status/verification queries are now gated on availability (enabled: canUseMfa, hasVerificationFeature ? pageId : undefined) and the component returns null when unentitled. That's fetch-avoidance — a win.
  • full-editor.tsx — the added useAtom(workspaceAtom) subscription only re-renders on workspace-settings writes (effectively never during editing); resolvePageEditMode is a cheap pure call. Not a hot-path concern.
  • space-sidebar.tsx — the inline railTip helper and the 4 always-mounted disabled-when-expanded Tooltips are negligible and mirror the established global-sidebar rail pattern; the tips are produced during render, not passed as props to memoized children.
  • global-sidebar.tsx — mainNavItems was already built inline each render (4 items); switching Templates to a conditional spread doesn't change that. Trivial.
  • feature-gate.tsx / settings-modal.tsx / space-security-settings.tsx — useFeatureAvailable is a thin wrapper over the existing entitlement read; a handful of subscriptions in cold (modal/settings) paths.

Nothing here plausibly costs real time, memory, or render churn at realistic sizes.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🏛️ Architecture Review

Reviewer: Architecture Reviewer
Model: Claude Opus 4.8
PR / Diff: #10 (HEAD 5b8d8e8d) — reviewed together with the coupled super PR cccvu/wiki-v2#151 (daf006a)
Verdict: Merge OK, minor notes — no Critical/Major architecture findings on the fork side.

Summary: The fork side is a large, disciplined "hide-don't-advertise + rail-every-sidebar + Read-by-default" pass. Layering is clean (pure, unit-tested resolvePageEditMode/sidebar-collapse helpers; presentation-only seams; no wrong-way deps), the new fork-owned dirs are correctly boundary-excluded and every upstream edit is enumerated in UPSTREAM_MODIFICATIONS.md. Two non-blocking notes: the new feature-availability module is described as the central predicate but most hide call-sites bypass it, and the space-security availability rule is duplicated across two components.


Findings

[Minor] — Abstraction boundaries — apps/client/src/features/feature-availability/feature-gate.tsx:19 — Priority Level 3 — optional

What: The new module's docstring declares useFeatureAvailable "the single predicate (a thin, intention-revealing wrapper over the upstream entitlement check)" and "The central predicate is the CCC-owned features/feature-availability/ gate ... Prefer these over hand-rolling disabled={!hasFeature}" (also asserted in UPSTREAM_MODIFICATIONS.md). But useFeatureAvailable is a verbatim re-export — return useHasFeature(feature) — and ~10 of the hide call-sites in this very PR bypass it and call useHasFeature directly (global-sidebar.tsx, settings-sidebar.tsx, mfa-settings.tsx, export-modal.tsx, page-import-modal.tsx, comment-menu.tsx, more-inserts-group.tsx, command-list.tsx, page-verification-modal.tsx). Only settings-modal.tsx, space-security-settings.tsx (hook) and workspace-settings.tsx (<FeatureGate>) actually go through the module.

Why it costs: The "single predicate / single seam" benefit — one place to later change what "available" means (e.g. if availability becomes more than raw entitlement) — is not realized, because the majority of gates read useHasFeature straight. And the next contributor is left guessing which of the two identical-behavior paths to use for a new gate, since the doctrine and the code disagree. An abstraction that claims centrality but is bypassed is worse than none: it invites divergence.

Fix: Pick one. Either (a) route all the hide call-sites through useFeatureAvailable so the single-seam claim holds, or (b) if raw useHasFeature is fine, drop the passthrough hook and keep only <FeatureGate> (the declarative subtree wrapper genuinely earns its keep and is not redundant), and soften the "single/central predicate" language. This can also be a small follow-up rather than blocking — but the docstring should not over-promise what the code doesn't do.


[Minor] — Coupling / duplicated rule — apps/client/src/features/space/components/settings-modal.tsx:34-41 + space-security-settings.tsx:20-25 — Priority Level 2 — optional

What: The "which paid controls make the Security section non-empty" rule now lives in two places. The parent (settings-modal.tsx) computes hasSpaceSecurity = useFeatureAvailable(SHARING_CONTROLS) || useFeatureAvailable(VIEWER_COMMENTS) to decide whether to render the tab + panel; the child (space-security-settings.tsx) independently re-checks the same two features and return null if neither.

Why it costs: Adding or removing a paid space control means editing the predicate in both components in lockstep; miss one and you get either an empty Security tab or a hidden-but-present panel. It's defensible as defense-in-depth (the child self-guards so it's safe to render anywhere), but the rule has two homes.

Fix: Export the composite predicate (e.g. useSpaceSecurityAvailable()) from one place and consume it in both, so the feature list has a single home. Low priority.


Checklist coverage

  • Separation of concerns: ✅ — pure helpers (resolvePageEditMode, sidebar-collapse) kept framework-free and unit-tested; seams are presentation-only.
  • Layering: ✅ — no wrong-way deps; full-editor reads workspaceAtom and defers precedence to the pure resolver; no upstream logic in fork-owned dirs.
  • Responsibilities: ⚠️ — space-security availability rule duplicated across parent/child (Level 2).
  • Coupling: ✅ — rail decision centralized in sidebar-collapse.ts; collapsed prop threaded cleanly to each sidebar.
  • Abstraction boundaries: ⚠️ — useFeatureAvailable is a verbatim passthrough that's inconsistently adopted vs its "central predicate" claim (Level 3).
  • API / contract design: ✅ — resolvePageEditMode(string|null|undefined, …) is a defensive, well-typed contract; collapsed?: boolean props default safely.
  • Code organization: ✅ — new CCC dirs (features/layout/, features/feature-availability/) correctly boundary-excluded in check-upstream-boundary.sh; every upstream edit enumerated in UPSTREAM_MODIFICATIONS.md (test(collab): complete nanoid mock in #344 gateway spec (fix CI) #34–fix(content-parse,collab): converter small-write priority and full event-loop yields (wiki-v2 issue 731) #82).
  • Maintainability & change cost: ✅ — "On upstream bump" notes per seam; drift guard for tokens; regression truth-tables for the rail + edit-mode helpers.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

DevOps / Operations / Reliability Reviewer (Claude Opus 4.8) — reviewed jointly with super PR cccvu/wiki-v2#151.

No DevOps/Reliability findings on this side at HEAD 5b8d8e8d. This PR is client-only UI (rail sidebars, editor UX, feature-gate) — no Dockerfile/CI/infra/secrets/migration surface, and the Docmost image builds unchanged. The operational surface of this coupled change — the submodule pin (5b8d8e8d is currently on feat/ui-consistency-audit, not yet on wiki-v2), the merge-order / repoint gate, the scripts/check-upstream-boundary.sh exclude additions, and the CI-inert layout-sync.test.ts drift guard — is all on the super PR, where I posted the full review (1 merge-sequencing gate + 2 optional). Cross-ref: cccvu/wiki-v2#151.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🔒 Security Review — fork side (coupled with super cccvu/wiki-v2#151)

Security Reviewer: Security Reviewer — Claude (independent Security lens)
Model: Claude Opus 4.8
PR: #10 — feat(ui): rail every sidebar · hide unavailable paid features · Read-by-default
Commit: 5b8d8e8d (base wiki-v2) · reviewed together with super #151 @ daf006a
Date: 2026-09-03

Verdict

✅ No Security findings on this side at HEAD 5b8d8e8d.

This PR is entirely apps/client/** — presentation + client-side gating only. It introduces no new server or authorization behavior, so it cannot open a server-side hole. The security-relevant question for a "hide paid/admin features" change is "is the client hide being treated as the control?" — and it is not:

  • No server/authz surface touched. The diff has no apps/server/**, no authz/, no .zed schema, and no guard/permission files. No new fetch/axios/process.env/eval/dangerouslySetInnerHTML/innerHTML sinks.
  • Feature-hiding is advisory, server still enforces. The new CCC FeatureGate/useFeatureAvailable (features/feature-availability/feature-gate.tsx) is a thin wrapper over upstream's existing useHasFeature entitlement check — it swaps disabled-with-upgrade-tooltip for not-rendered. The underlying Docmost EE licensing/entitlement enforcement is unchanged; hiding a leaf does not remove the server check that already refused it.
  • Admin-control gating is defense-in-depth, not the gate. workspace-settings.tsx hides editable controls behind isAdmin (useUserRole), and the space Security tab passes SpaceSecuritySettings readOnly={!canManageSettings} from the Docmost CASL ability. The real mutations still go through Docmost's CASL-gated POST /workspace/update etc. server-side (the code comment itself calls this "defense-in-depth for a direct URL"). Platform admins manage workspace settings through the platform's guard-enforced /admin/workspace/settings seam on the super-repo side — reviewed there.
  • Read-by-default is a UX safety default, not an authz control. resolvePageEditMode(userPref, workspaceDefault) (precedence user > workspace > Read) only decides which mode the editor opens in. Actual edit permission is still enforced server-side by the seam-1 (PagePermissionRepo/SpaceMemberRepo) PDP-backed rebind regardless of open mode — opening a page in Edit without permission is still blocked on write.

The genuinely-new logic lives in boundary-excluded CCC dirs / pure helpers with unit tests (sidebar-collapse.ts, resolve-page-edit-mode.ts, feature-gate.tsx); upstream edits are minimal per-surface hasFeature && … / return null guards. No secrets, no injection sinks, no crypto, no dependency additions.

Checklist coverage

  • ✅ Authorization — client gating only; server re-enforces (advisory, correctly not relied on as the control)
  • ✅ XSS — no dangerouslySetInnerHTML/innerHTML; React auto-escaping
  • ✅ Secrets / Dependencies — none added
  • ➖ Injection / SSRF / File upload / Deserialization / Path traversal / Crypto — not applicable (client presentation)

Cross-reference

The security-critical half of this coupled change (the platform WorkspaceAdminService that writes Docmost's workspaces table under @WorkspaceAdmin) is on the super PR — full trace and verdict posted at cccvu/wiki-v2#151.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🧪 Test Review — QA Engineer's Eye

Reviewer role: Test Reviewer
Model: Claude Opus 4.8
PR / change: #10 — rail every sidebar, hide unavailable paid features, Read-by-default (fork HEAD 5b8d8e8d)
Date: 2026-09-03

Coupled review: this is the fork half of a two-PR unit with cccvu/wiki-v2#151. The drift-test contract that spans both repos and the WorkspaceAdminService spec are reviewed on docmost#151.

Verdict

💬 Comment

Adequately tested to merge. The three new fork tests (sidebar-collapse, resolve-page-edit-mode, feature-gate) each map to their production behavior and would catch the headline regressions (a sidebar hiding on collapse, pages defaulting to Edit, a gated control rendering). No merge-blocking gap. The findings below are all optional hardening: a couple of unpinned branches and one genuinely untested logic change (slash-menu keyboard-nav index).

Summary

The change (a) reduces getSidebarCollapseState so every navbar route rails on collapse instead of hiding, (b) adds resolvePageEditMode(userPref, workspaceDefault) with precedence explicit user > workspace default > Read, defaulting pages to Read, and (c) adds a FeatureGate / useFeatureAvailable primitive so unavailable paid features are hidden rather than rendered disabled — then applies that doctrine across ~12 components. The new unit tests cover the three pure/primitive seams well. A regression of the core behaviors would be caught. Gaps are on secondary branches (showGlobalSidebar for space/AI, invalid-pref fallthrough) and on the one component with real logic that got no test — the slash-menu index filter.

Findings

🟡 Minor — showGlobalSidebar is unasserted for the space & AI routes

  • Category: Weak/vacuous assertion (missing assertion on a reachable path)
  • Location: apps/client/src/components/layouts/global/sidebar-collapse.ts:31 (showGlobalSidebar = !isSpaceRoute && !isSettingsRoute && !isAiRoute) / apps/client/src/components/layouts/global/sidebar-collapse.test.ts:38,48 (SPACE / AI cases)
  • Gap: The SPACE and AI tests assert only railsWhenCollapsed and isRail; they never assert showGlobalSidebar === false. Only HOME (true) and SETTINGS (false) pin that flag.
  • Why it slips through: Drop !isSpaceRoute from showGlobalSidebar and every test still passes — HOME stays true, SETTINGS stays false, and SPACE's showGlobalSidebar (now wrongly true) is unchecked. In global-app-shell.tsx that flag gates {showGlobalSidebar && <GlobalSidebar collapsed={isRail} />}, so the bug renders both the SpaceSidebar and the GlobalSidebar on a /s/ route.
  • Regression risk: A refactor of the showGlobalSidebar expression double-renders a sidebar on space/AI routes with a green suite.
  • Suggested test: Add to the SPACE and AI cases: expect(collapsed.showGlobalSidebar).toBe(false); (or use the full-object toEqual form the HOME case already uses).

🟡 Minor — precedence: an invalid user pref + a valid workspace default is untested

  • Category: Missing edge case
  • Location: apps/client/src/features/editor/resolve-page-edit-mode.ts:15-22 / apps/client/src/features/editor/resolve-page-edit-mode.test.ts:31-35
  • Gap: The "falls to workspace default" case only uses undefined/null for the user pref. The "ignores unrecognized values" case makes both user and workspace invalid → Read. Nothing pins malformed user pref → fall through to a valid workspace default.
  • Why it slips through: Change the first guard to if (userPref != null) return userPref (a plausible "trust whatever's stored" refactor) — every existing case still passes except it's caught only because case 5 uses garbage for both args. But a subtler mutation — "only fall to workspace when userPref == null" (not merely invalid) — survives all five cases, yet makes ("garbage", Edit) return Read instead of the admin's Edit default.
  • Regression risk: A stale/legacy stored pageEditMode string silently suppresses the workspace default (minor UX, not safety) with a green suite.
  • Suggested test: expect(resolvePageEditMode("garbage", PageEditMode.Edit)).toBe(PageEditMode.Edit);

🟡 Minor — slash-menu visibleItems filter (the one real-logic change) has no test

  • Category: Untested behavior / regression risk
  • Location: apps/client/src/features/editor/components/slash-menu/command-list.tsx:44-60 (new visibleItems memo feeding both flatItems and the render loop) / no test
  • Gap: This seam (feat(authz): step-up freshness for remote-mode admin-tier routes (wiki-v2 issue 713) #71) is the only converted call-site with actual logic: it filters bases-gated commands out of the grouped items so the keyboard-nav flat index and the rendered options stay aligned. The PR comment itself names the invariant ("keeps the flat index / keyboard-nav consistent with what's actually rendered"), yet nothing exercises it.
  • Why it slips through: If a future edit re-points the render loop at items while flatItems stays on visibleItems (exactly the drift this refactor removes), arrow-key selection and the highlighted option desync — and no test goes red. The isItemDisabled predicate, the "drop empty categories" branch (if (kept.length > 0)), and the flat-index math are all unguarded.
  • Regression risk: Keyboard navigation selects the wrong slash command after a bases-gated item is hidden.
  • Suggested test: A small @testing-library/react render with useHasFeature mocked false: assert a requiresBases item is not in the DOM, that an empty category disappears, and that data-item-index values are contiguous over what renders.

🔵 Question / 🟡 Minor — the "hide, don't advertise" doctrine is verified only at the primitive, not the ~9 hand-rolled call-sites

  • Category: Test design / behavior coverage
  • Location: feature-gate.test.tsx covers FeatureGate/useFeatureAvailable; but mfa-settings.tsx, page-verification-modal.tsx, comment-menu.tsx, page-import-modal.tsx, export-modal.tsx, more-inserts-group.tsx, global-sidebar.tsx, settings-sidebar.tsx, space-sidebar.tsx hand-roll hasFeature && <…> / if (!x) return null rather than using the gate.
  • Gap: Only two components (workspace-settings, space-security-settings/settings-modal) actually route through the tested primitive; the rest re-implement the hide inline, untested.
  • Why it slips through: Reasonable for declarative render guards (low logic, high churn), so I'm not calling it a blocker — but the suite does not prove any specific paid affordance is hidden; it proves the abstract gate works. page-verification and mfa also changed data-fetching (enabled: canUseMfa, usePageVerificationInfoQuery(undefined)) with no test.
  • Suggested test: Optional — one render test per high-value surface (MFA row absent when MFA unavailable; verification badge/menu-item null), or migrate the hand-rolled sites onto FeatureGate so the primitive's test does more work.

🔵 Question — FeatureGate doesn't assert the fallback is absent when available

  • Category: Missing edge case (symmetry)
  • Location: feature-gate.test.tsx:24-34 (available → children) — no fallback passed in that case.
  • Gap: The available ? children : fallback render is only checked as children-shown (no fallback in scope) and fallback-shown (unavailable). "Available ⇒ fallback NOT rendered" is unpinned.
  • Why it slips through: A mutation available ? <>{children}{fallback}</> : fallback passes every current case. Trivial impact.
  • Suggested test: In the "renders children when available" case, pass fallback={<div>Fallback</div>} and assert screen.queryByText("Fallback") is null.

Coverage map — behaviors vs. tests

Behavior / branch Covered? Test that guards it
Home/global rails on collapse (showGlobalSidebar:true, isRail per toggle) ✅ sidebar-collapse.test.ts HOME (full toEqual)
Settings rails, never hides (showGlobalSidebar:false) ✅ SETTINGS case
Space page-tree rails, never hides ⚠️ partial SPACE case — showGlobalSidebar unasserted (Minor)
AI chat rails, never hides ⚠️ partial AI case — showGlobalSidebar unasserted (Minor)
isRail true only when desktop toggle off ✅ "isRail is true only when…" loop over all 4 routes
Every navbar sidebar rails ✅ "every navbar sidebar rails" loop
edit-mode: explicit user Edit/Read wins ✅ resolve-page-edit-mode.test.ts cases 1–2
edit-mode: null/undefined user → workspace default ✅ case 3
edit-mode: neither set → Read fallback ✅ case 4
edit-mode: both invalid → Read ✅ case 5
edit-mode: invalid user + valid workspace → workspace ❌ none — see Minor
FeatureGate: available → children ✅ feature-gate case 3
FeatureGate: unavailable → hidden ✅ case 4
FeatureGate: unavailable → fallback ✅ case 5
FeatureGate: available ⇒ fallback absent ❌ none — Question (trivial)
slash-menu gated-item filter / flat-index alignment ❌ none — see Minor
~9 hand-rolled hasFeature && … hides (mfa/verify/comment/import/export/…) ❌ none — Question

What I checked

  • Behavior coverage — each new pure/primitive branch has a test that would fail if it regressed (two secondary branches don't; noted)
  • Edge cases and boundaries — null/undefined/garbage/empty covered for edit-mode; invalid-user+valid-ws missing
  • Failure modes — n/a for these pure functions/render guards
  • Assertions are meaningful — verified the sidebar/edit-mode assertions go red under plausible mutations; showGlobalSidebar for space/AI does not
  • Tests aren't brittle — no time/order/network/float coupling; feature-gate mocks useHasFeature and cleans up per-test (good)
  • Regression resistance — the core "no sidebar hides" and "Read-by-default" invariants are pinned; slash-menu index is not
  • Test design / maintainability — clean; truth-table + precedence tables read well

Priority mapping (for the review loop)

All findings are optional (none merge-blocking — the current code is correct; these are regression-resistance / edge gaps). Priority Level 1–5, 5 highest:

  • L3 — slash-menu visibleItems filter / flat-index alignment untested (new logic, keyboard-nav desync class)
  • L2 — showGlobalSidebar unasserted for space/AI cases (double-render regression survives)
  • L2 — invalid user pref + valid workspace default fallthrough untested
  • L2 — hide-doctrine verified only at the FeatureGate primitive, not the ~9 hand-rolled call-sites (+ untested data-fetch gating in mfa/verification)
  • L1 — FeatureGate doesn't assert fallback-absent when available

Open questions for the author

  • railsWhenCollapsed is now a tautology ((!s&&!set&&!ai) || set || s || ai ≡ true for all inputs), so the collapsed.desktop = railsWhenCollapsed ? false : !desktopOpened "hide" branch in global-app-shell.tsx is dead. Intentional? If a route ever should hide again, the current tests would not distinguish it — worth a one-line comment so the next editor knows the table has no "hide" row by design.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🐛 Correctness Review — Bug Hunter

Reviewer role: Correctness Reviewer
Model: Claude Opus 4.8
PR / change: #10 — "rail every sidebar · hide unavailable paid features · Read-by-default" (HEAD 5b8d8e8d), reviewed together with super PR cccvu/wiki-v2#151
Date: 2026-09-03

Verdict

🔴 Request changes (one Major, reachable rendering bug on the space route; two optional/latent items)

The three pure helpers (resolvePageEditMode, getSidebarCollapseState, FeatureGate) are correct and well-tested, and the feature-hide guards are polarity-correct with no "hidden nav ⇒ page unreachable that shouldn't be" traps. But the space-route navbar width regresses the mobile overlay, and one hook is called conditionally.

Summary

I traced the edit-mode precedence, the rail-vs-hide truth table, every feature-gate leaf, and the slash-menu index math. resolvePageEditMode (explicit user > workspace default > Read) and its garbage/null/empty fall-throughs are exactly right; enum casing ("read"/"edit") matches the server's stored lowercase. The importers/exporters keep Markdown/HTML/Notion always available, and the {...props} render-prop wiring survives. One Major bug: on space routes the navbar width is a non-responsive number, so a user who collapsed the desktop sidebar sees a 52px mobile overlay. Plus a latent Rules-of-Hooks violation and a benign slash-menu %0.

Findings

🟠 Major — Space-route navbar width collapses the mobile overlay to the 52px rail

  • Category: Logic error / edge case (responsive breakpoint)
  • Location: apps/client/src/components/layouts/global/global-app-shell.tsx:117-121
  • Problem: The space branch of the navbar width is a plain number, applied at every breakpoint:
    width: isSpaceRoute
      ? (isRail ? RAIL_WIDTH : sidebarWidth)          // number → all breakpoints
      : { base: SIDEBAR_WIDTH, sm: isRail ? RAIL_WIDTH : SIDEBAR_WIDTH }, // responsive
    The non-space branch (and the console shell in super PR Home button missing on mobile layout  docmost/docmost#151, via railed = collapsed && isDesktop) deliberately keep the mobile (base) width at full and only rail at sm+. The space branch does not. isRail = railsWhenCollapsed && !desktopOpened is not media-gated, and desktopSidebarAtom is atomWithWebStorage("showSidebar", true) — persisted.
  • Trigger: A user collapses the desktop sidebar (persists showSidebar=false), then views a space route (/s/...) below the sm breakpoint (narrow desktop window, tablet portrait, or responsive mode) and opens the mobile burger. isRail is true, so the overlay navbar width = RAIL_WIDTH (52px). Meanwhile the space rail CSS is gated to @media (min-width: $mantine-breakpoint-sm) (space-sidebar.module.css), so at mobile the sidebar still renders its full tree + switcher markup.
  • Consequence: The mobile space-sidebar overlay is a 52px-wide strip trying to hold the full page tree — content clipped/overflowing and effectively unusable. This is exactly the "narrow/mobile overlay renders correctly" case the PR claims to have fixed, and the in-code comment at line 115 ("Mobile always uses the full overlay") is contradicted by this branch.
  • Suggested fix: Mirror the sibling branch / the console's isDesktop gating:
    width: isSpaceRoute
      ? { base: sidebarWidth, sm: isRail ? RAIL_WIDTH : sidebarWidth }
      : { base: SIDEBAR_WIDTH, sm: isRail ? RAIL_WIDTH : SIDEBAR_WIDTH },
  • Note on severity: the trigger needs the persisted desktop-collapse on the same browser plus a sub-sm viewport; a pure phone (toggle is visibleFrom="sm") never sets it and is unaffected. If the team judges that path too narrow, downgrade to must-fix-soon — but the fix is one line and the correct pattern already exists twice in this same change.

🟡 Minor (latent) — Conditional hook call via || short-circuit in SpaceSettingsModal

  • Category: State management (Rules of Hooks)
  • Location: apps/client/src/features/space/components/settings-modal.tsx:36-38
  • Problem: const hasSpaceSecurity = useFeatureAvailable(SHARING_CONTROLS) || useFeatureAvailable(VIEWER_COMMENTS); — JS || short-circuits, so the second useFeatureAvailable hook is skipped whenever the first returns true. That violates the Rules of Hooks (hook count must be render-stable). Notably, the sibling file space-security-settings.tsx:1871-1872 does the identical feature pair the correct way (two separate const assignments), so this is an inconsistency, not intent.
  • Trigger: Not reachable in this deployment: with no paid entitlements, SHARING_CONTROLS is always absent → the first operand is always false → the second hook is always called → hook count is stable. It bites only if SHARING_CONTROLS ever becomes entitled and that value flips across renders (e.g. async entitlement hydration): the render where it turns true calls one fewer hook → React throws "Rendered fewer hooks than expected" and the modal crashes. (ESLint react-hooks/rules-of-hooks does not catch the || form, so CI won't flag it.)
  • Consequence: Latent crash of the space settings modal under a future entitlement change; correctness/maintainability defect now.
  • Suggested fix: Assign each to its own const first, exactly like space-security-settings.tsx:
    const hasSharing = useFeatureAvailable(Feature.SHARING_CONTROLS);
    const hasViewerComments = useFeatureAvailable(Feature.VIEWER_COMMENTS);
    const hasSpaceSecurity = hasSharing || hasViewerComments;

🟡 Minor — Slash-menu arrow keys produce NaN index when the visible list is empty

  • Category: Edge case/boundary
  • Location: apps/client/src/features/editor/components/slash-menu/command-list.tsx:79,85
  • Problem: (selectedIndex + flatItems.length - 1) % flatItems.length and (selectedIndex + 1) % flatItems.length divide by flatItems.length, which is 0 when the filtered list is empty → setSelectedIndex(NaN). The keydown listener stays attached even though the component renders null for an empty list. This was already reachable via a no-match query, but the new hide-gating makes it newly reachable when a query matches only unavailable Bases commands (now filtered out, leaving zero).
  • Trigger: Type a slash query that resolves to only bases-gated items (no entitlement) — e.g. the Bases/Kanban commands — so visibleItems is empty, then press ArrowUp/ArrowDown.
  • Consequence: Benign and self-healing: flatItems[NaN] is undefined → selectItem no-ops, scrollIntoView finds nothing, and the useEffect([flatItems]) resets selectedIndex to 0 as soon as items are non-empty again. No crash, no wrong command. Worth a cheap guard.
  • Suggested fix: Guard the modulo: if (!flatItems.length) return; at the top of the Arrow branches, or flatItems.length ? (…​) % flatItems.length : 0.

What I checked and considered fine

  • resolvePageEditMode precedence (user Edit/Read > workspace Edit/Read > Read); "", "garbage", null, undefined all fall through to Read. Enum values "read"/"edit" match the server's .toLowerCase()-stored setting and workspace.util.ts normalization.
  • getSidebarCollapseState truth table: railsWhenCollapsed is now true for home/settings/space/AI (a tautology given showGlobalSidebar is the negation of the three route flags); isRail = rails && !desktopOpened; desktop:true toggle → isRail:false. Matches the extended test.
  • currentPageEditModeAtom default flipped to Read; the module-level defaultEditModeApplied one-shot seed is unchanged in mechanism (fail-safe toward Read if workspace loads late).
  • DefaultPageEditModeControl confirm-before-Edit: controlled SegmentedControl, no optimistic flip before confirm, applyChange reverts to prevValue on error, effect re-syncs to workspace value. No stuck state.
  • Feature-gate leaves — export (default format Markdown, docx unselectable when unentitled), import (Markdown/HTML/Notion always present; {...props} preserved on all 7 FileButtons), comment Resolve, MFA, page-verification, more-inserts Bases/Kanban, space-security toggles, settings-sidebar nav (role:"admin" incl. owner via useUserRole) — all polarity-correct; hiding a nav item doesn't strip a route a member still needs.
  • Slash-menu flat-index consistency: flatItems and the render both derive from visibleItems, so keyboard nav and rendered rows stay in the same index space.

Open questions for the author

  • On the Major finding: is the "desktop-collapsed then sub-sm" path in scope for your mobile QA, or was QA done with the default showSidebar=true? The fix is trivial and matches your own sibling/console pattern, so I'd take it before merge.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🎨 Frontend / UI / UX Review

Reviewer: Frontend / UI / UX Reviewer
Model: Claude Opus 4.8
PR / Diff: #10 @ 5b8d8e8d (reviewed together with the super PR cccvu/wiki-v2#151 @ daf006a)
Visual check: performed — wiki client via the live Vite HMR dev server (localhost:5173), desktop 1440px. Rendered the collapsed space page-tree rail (light + dark), ran a real keyboard Tab-walk through it, verified the hidden tree/switcher are display:none + untabbable, and confirmed the Read-by-default edit-mode path. Admin-console side is static-only (see docmost#151 — its running build predates this PR).
Design system: Mantine v7 + light-dark() CSS-var tokens; the fork's rail CSS idiom (.navbar[data-collapsed] @ min-width: sm, sr-only labels + hover Tooltip) and the new CCC features/layout/layout-tokens.ts.
Verdict: Merge OK, minor notes — no Critical/Major findings; a couple of L2/L1 polish items.

Summary: This is a clean, well-executed UI-consistency pass. The "rail every sidebar" change renders correctly (icons centered, no clipping, good light/dark contrast), the hidden tree/switcher are correctly removed from the tab order in rail mode, keyboard focus is visible on every rail (I verified this live — see note under Q4, it disproved my one candidate a11y finding), and Read-by-default genuinely gates the editor (editor.setEditable(editable && mode===Edit), atom defaults to Read = fail-safe) with a discoverable header toggle. The "hide, don't advertise" conversions are consistent and don't leave orphaned dividers/empty categories/empty tabs. Nothing here blocks merge.


Findings

4. Will it work for everyone, on any device?

[Minor] — Design-system adherence / focus consistency — apps/client/src/features/space/components/sidebar/space-sidebar.module.css (and ee/ai-chat/styles/chat-sidebar.module.css)

What: The global and settings rails give their .link an explicit brand focus ring — &:focus-visible { outline: 2px solid var(--mantine-primary-color-filled); outline-offset: 2px; } (global-sidebar.module.css:34, settings.module.css:35). The new space rail .menu and the AI-chat rail have no such rule, so they fall back to the app-wide focus outline. Focus is NOT missing — I keyboard-walked the collapsed space rail live and every action (Overview/Search/Space settings/New page) reports :focus-visible true with a 2px solid rgb(24,24,27) outline — so this is not an a11y failure, only a visual inconsistency: for a PR whose stated goal is rail parity, the focus indicator is a different color/offset on two of the four rails.
Who it hurts: keyboard users get an inconsistent focus affordance across otherwise-identical rails; minor.
Fix: add the same &:focus-visible block to .menu in space-sidebar.module.css (and, if you want full parity, to the AI-chat New-chat control) so all four rails share the brand ring.
Evidence: keyboard Tab-walk at 1440px, collapsed /s/ rail — each .menu button focusVisible:true, outlineColor rgb(24,24,27), outline-offset 0 vs the sibling rails' --mantine-primary-color-filled @ offset 2px. Optional, Priority 2.

2. Is it consistent with the rest of the app?

[Nit] — Dead CSS — apps/client/src/features/editor/components/slash-menu/slash-menu.module.css:29

What: command-list.tsx no longer renders gated (disabled) slash items — the classes.gatedItem reference is gone — but .gatedItem remains in the module CSS.
Who it hurts: the next dev (a stale style with no consumer).
Fix: delete the now-unused .gatedItem rule. Optional, Priority 1.


Notes (not defects)

  • Read-by-default first-render flash (Priority 1, note only): currentPageEditModeAtom now defaults to Read and the resolved mode is applied in a post-mount useEffect (full-editor.tsx), so the first page a session opens briefly paints Read (no toolbar, non-editable) before flipping to Edit for an Edit-preferring user. This is fail-safe (it never briefly shows an editable surface that should be read-only — the reverse of the old Edit-default) and is a one-time-per-session frame, so it's an improvement, not a bug. Flagging only so it's a conscious choice.
  • Verified no leakage/empty-state regressions from the "hide" conversions: the AI rail hides .title/.searchInput/.chatList (sentinel + loader live inside .chatList, so nothing leaks); more-inserts-group keeps a valid divider between the always-present "Advanced" items and "Diagrams" (no orphan); command-list drops empty categories (kept.length>0); the space Security tab is hidden when neither paid control is available (no empty tab). All good.
  • Import removals are clean — space-security-settings.tsx genuinely no longer references Text/React (automatic JSX runtime), export-modal still imports Text via its multi-line import.

Checklist coverage

  • State & data correctness: ✅ (Read-mode gates setEditable; hide-conversions don't strand state)
  • State coverage (loading / empty / error / disabled / focus): ✅ (no new async surfaces; empty-tab/empty-category cases handled)
  • Design-system adherence (tokens, variants, no one-offs): ⚠️ (focus-ring parity nit; new layout-tokens.ts is the right move)
  • Shared-primitive blast radius (callers checked): ✅ (collapsed prop additive & defaulted; sidebar-collapse truth-table updated + tested)
  • Bundle & load cost: ✅ (removes useUpgradeLabel/Badge/Tooltip call-sites; no new deps)
  • Runtime & rendering cost (CLS, thrash, waterfalls): ✅ (rail is CSS-only; mfa query now gated on entitlement)
  • Accessibility (semantics, keyboard, focus, contrast, ARIA): ✅ verified live — rail focus visible, labels sr-only (accessible name kept), hidden sections untabbable; ⚠️ minor focus-ring-color parity only
  • Responsive & interaction UX (320→1440px, touch, error copy): ✅ (rail gated to sm+; mobile keeps full overlay)

Visual evidence

  • space-rail-light.png — collapsed /s/ rail, 52px, 4 action icons centered, no clipping; header lockup near-black.
  • space-rail-dark.png — same in dark mode; rail bg rgb(18,18,20), icons legible, lockup near-white. (Screenshots local to the reviewer; not inlined.)

Deferred to other reviewers

  • Whether role:"admin" on Settings→General and the feature:Feature.AI gate match the server's authz — pr-security / pr-correctness.
  • Slash-menu flatIndex/selectedIndex math after filtering visibleItems — pr-correctness (looked coherent: both render and flatItems derive from visibleItems).

…ks-safe gate, tested slash filter

PR #10 review fixes (coupled with wiki-v2 PR docmost#151):

- BLOCKER (Correctness): the space-route navbar width was a plain number applied at
  every breakpoint, so a below-`sm` viewer who had collapsed the desktop sidebar got a
  clipped 52px mobile overlay with the full tree still rendered. Make `base` responsive
  on every route (full-width overlay below sm; rail/resizable only at sm+), mirroring
  the non-space branch and the console's isDesktop-gated rail.

- L3 (Correctness): settings-modal computed space-security availability as
  `useFeatureAvailable(A) || useFeatureAvailable(B)`, which short-circuits the second
  hook (Rules-of-Hooks violation if entitlements change between renders). Add a
  `useSpaceSecurityAvailable()` composite in the feature-availability module that calls
  both hooks unconditionally; the parent tab-gate now uses it. This also gives the
  module a real multi-entitlement predicate (Architecture: the passthrough now
  centralizes a genuine rule) and the doc no longer over-claims a "single seam".

- L3 (Testing): extract the slash-menu visibility filter into a pure, unit-tested
  `getVisibleSlashItems` helper and delegate command-list.tsx to it — covers the
  flat-index-matches-render invariant (the one real logic change in the slash menu).

Seams #83/#84 documented in wiki-v2 UPSTREAM_MODIFICATIONS.md; boundary check green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

Review round 1 — addressed (fork PR 10 @ 7dc7a5f6; coupled super PR 151 @ 63b41c6)

Thanks all. Round-justifying findings fixed in-PR; Level-≤2 polish tracked in cccvu/wiki-v2 issue 153. New HEAD, so a re-review follows.

Fixed on this (fork) side:

  • [MERGE-BLOCKING — Correctness] global-app-shell.tsx unresponsive space-navbar width. The space route used a plain number width at every breakpoint, so a below-sm viewer who had collapsed the desktop sidebar (state persists in localStorage) got a clipped 52px overlay with the full tree still rendered. width is now responsive on every route — full-width overlay (base: SIDEBAR_WIDTH) below the breakpoint, rail/resizable only at sm+ — mirroring the non-space branch and the console's isDesktop-gated rail.
  • [L3 — Correctness] Rules-of-Hooks violation in settings-modal.tsx. useFeatureAvailable(A) || useFeatureAvailable(B) short-circuited the second hook. Added useSpaceSecurityAvailable() to the feature-availability module — it calls both entitlement hooks unconditionally — and the tab-gate now uses it.
  • [L3 — Architecture] useFeatureAvailable was a bare passthrough. The composite above gives the module a real multi-entitlement predicate defined once (parent tab-gate + child panel agree), and the doc no longer over-claims a "single seam" — an inline hasFeature at a one-off leaf is explicitly fine.
  • [L3 — Testing] slash-menu visibility filter had no test. Extracted the filter to a pure, unit-tested getVisibleSlashItems helper (seam fix(service-bridge): per-principal rate buckets with a global backstop (wiki-v2 issue 780) #83/fix(authz): refuse malformed collab updates before they apply; same rules over HTTP (wiki-v2 #781) #84) and delegated command-list.tsx to it; the tests pin the flat-order-matches-render invariant that keeps keyboard nav honest.

Deferred (non-blocking, Level ≤2) → issue 153: rail :focus-visible parity, dead .gatedItem CSS, the slash-menu % 0 empty-list guard, and the 375px console eyeball.

Verification at HEAD: fork client tsc (0 errors) + vitest (20 pass across the affected + new suites); upstream-boundary check green.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

Performance Re-review (round 1 fixes)

Reviewer: Performance Reviewer (Claude Opus 4.8)
Scope: fork cccvu/docmost#10 @ 7dc7a5f6 (reviewed as one unit with super cccvu/wiki-v2#151 @ 63b41c6)
Lens: runtime performance of the code as written

Verdict: Approve — no Performance findings at HEAD 7dc7a5f6.

Slash-menu refactor confirmed clean (and improved). command-list.tsx now derives both visibleItems and flatItems from a single useMemo over the pure getVisibleSlashItems(items, hasBases) (keyed [items, hasBases]), replacing round 1's two chained memos. The helper is a single O(n) pass — one .filter per category plus one Object.values().flat() over a few-dozen-item list — so there's no per-keystroke or per-open churn, and selectItem's dep array correctly shrank to [command, flatItems] now that gating is baked into the memoized list. Net: fewer rendered nodes and one fewer memo than before. No regression introduced.

Nothing else in my lane changed materially (the full-editor workspaceAtom subscription and the other hide-vs-disable gates were already clean at round 1). Clean side.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🔒 Security Re-review (round 1) — ✅ No new Security findings on the fork side at HEAD 7dc7a5f6

Security Reviewer: Security Reviewer — Claude · Model: Claude Opus 4.8 · Date: 2026-09-03
Coupled with super cccvu/wiki-v2#151 @ 63b41c6 (its submodule bump now points at this fork HEAD).

Re-fetched and re-checked the fork diff at 7dc7a5f6. It remains client-only — no apps/server, no authz/, no .zed schema, no guard/permission files, and zero dangerouslySetInnerHTML/innerHTML/eval/new-fetch/axios-mutation sinks. No new server or authorization behavior. Feature-hiding and admin-control gating stay advisory (server still enforces via Docmost CASL + the seam-1 PDP-backed repos); Read-by-default remains a UX default, not an authz control.

The security-critical half of this coupled change (the platform WorkspaceAdminService — round-1 refactor to a single dynamic, parameterized UPDATE … RETURNING + a requireDocmost() 503) was re-verified and approved on the super PR: still guard-enforced (@WorkspaceAdmin → PDP workspace#administer before the body), fully parameterized, workspace-scoped (where id = $N and deleted_at is null), and never touches users.role. Full trace at cccvu/wiki-v2#151.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🎨 Frontend / UI / UX Re-review (round 1 fixes)

Reviewer: Frontend / UI / UX Reviewer · Model: Claude Opus 4.8
PR / Diff: #10 @ 7dc7a5f6 (coupled with cccvu/wiki-v2#151 @ 63b41c6)
Visual check: static re-verify (the round-1 live desktop rail pass at 375/1440 light+dark still stands; the change since is a standard Mantine responsive-width object, verified by reading).
Verdict: No new Frontend/UX findings — the one in-lane change is correct and a net improvement. Approve.

What moved in my lane — dispositions

✅ RESOLVED (net improvement) — mobile-overlay width, global-app-shell.tsx. The navbar width is now a responsive object on every route:

width: { base: SIDEBAR_WIDTH, sm: isRail ? RAIL_WIDTH : isSpaceRoute ? sidebarWidth : SIDEBAR_WIDTH }

Below sm the navbar is a full 300px overlay for all routes (home/settings/space/AI), so the rail styles (gated to sm+) never render the full tree into a clipped 52px overlay. Correct. It's also better than upstream on the space route: base is now a fixed 300 regardless of a persisted desktop drag, so a viewer who dragged the tree to 600px on desktop no longer gets a 600px overlay wider than a 375/320px phone. collapsed.desktop and the !isRail resize-handle gate are unchanged and still correct.

✅ RESOLVED — slash-menu keyboard-nav (was deferred to Correctness). The visibility filter is extracted to a pure, unit-tested slash-menu-visibility.ts (getVisibleSlashItems); command-list.tsx now derives {visibleItems, flatItems} from one call and drops the redundant isItemDisabled re-check in selectItem. flatItems is flattened in the same category order the render walks, so the flat index / aria-activedescendant can never point at a hidden row. Empty categories are dropped (no stray headers). No empty-menu risk in practice (only Bases/Kanban are gated; non-bases commands always remain). Clean.

Prior optional items (deferred to docmost#153) — unchanged, still Level ≤2

No new frontend/UX findings introduced by the fixes on this PR.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🏛️ Architecture Re-review (round 1 fixes)

Reviewer: Architecture Reviewer
Model: Claude Opus 4.8
PR / Diff: #10 @ 7dc7a5f6 (coupled with cccvu/wiki-v2#151 @ 63b41c6)
Verdict: Approve — both prior fork-side findings resolved; no regressions in the Architecture lane.

Summary: The round-1 fixes land cleanly. The feature-availability module now earns its keep and the docstring is honest about when to use it; the space-security availability rule has a single home. No new structural issues.


Prior findings — status

✅ RESOLVED — L3 — feature-gate.tsx over-claimed centrality + inconsistent adoption.
The docstring no longer promises a "single seam." It now states plainly that "a single inline hasFeature/useHasFeature check at a leaf is equivalent and fine; reach for these when the intent is 'HIDE unavailable functionality' … and ALWAYS for a multi-entitlement rule." That matches the actual call-site mix and removes the contradiction. Critically, the module now has a real reason to exist beyond a passthrough: useSpaceSecurityAvailable() is a genuine composite (SHARING_CONTROLS || VIEWER_COMMENTS) with both hooks called unconditionally (Rules-of-Hooks-safe), so a rule spanning several entitlements is defined once.

✅ RESOLVED — L2 — space-security availability rule duplicated across parent/child.
settings-modal.tsx now gates the tab via useSpaceSecurityAvailable() — the "is the Security section non-empty" rule lives in exactly one named place. The child space-security-settings.tsx keeps the two individual flags (it needs per-toggle granularity to render each toggle + the divider), and its if (!hasPublicSharing && !hasViewerComments) return null is now local defense-in-depth derived from flags it must hold anyway — not a second copy of the composite rule. Good separation.


Regression hunt (Architecture lane) — clean

No merge-blocking or Level-3+ Architecture findings remain on the fork side.

SHA: fork=7dc7a5f6,super=63b41c6 | LENS: Architecture

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🐛 Correctness Re-review (round 1) — Bug Hunter

Reviewer role: Correctness Reviewer
Model: Claude Opus 4.8
PR / change: #10 @ HEAD 7dc7a5f6 (re-review of round-1 fixes; coupled with super cccvu/wiki-v2#151 @ 63b41c6)
Date: 2026-09-03

Verdict

✅ Approve (Correctness lane) — my one merge-blocking finding and my L3 latent finding are both fixed; the extraction is behavior-preserving; no new correctness issue introduced.

Re-check of prior findings

✅ FIXED — 🟠 Major: space-route mobile overlay collapsed to 52px

global-app-shell.tsx:121-124 — the navbar width is now a single responsive object on every route:

width: {
  base: SIDEBAR_WIDTH,
  sm: isRail ? RAIL_WIDTH : isSpaceRoute ? sidebarWidth : SIDEBAR_WIDTH,
}

Traced all four cases:

  • Mobile (base) = SIDEBAR_WIDTH (300) on every route, incl. space → the below-sm overlay is full-width, never the 52px rail. The exact bug is gone.
  • Desktop rail (isRail) = RAIL_WIDTH (52) → rail preserved.
  • Desktop space expanded (!isRail && isSpaceRoute) = sidebarWidth → the resizable width is preserved (the ternary is right-associative: isRail ? 52 : (isSpaceRoute ? sidebarWidth : 300)).
  • Desktop home/settings/AI expanded = SIDEBAR_WIDTH (300) → unchanged.

No regression to the desktop rail or the drag-to-resize: startResizing handle is still isSpaceRoute && !isRail. The only behavioral delta is that the mobile space overlay is now a fixed 300 rather than tracking a resized desktop width — which is correct (a 600px-resized desktop shouldn't drive the phone overlay). Fix verified.

✅ FIXED — 🟡 (L3 latent) Rules-of-Hooks via || short-circuit

settings-modal.tsx:37 now calls const hasSpaceSecurity = useSpaceSecurityAvailable();, and the new feature-gate.tsx:34-38 helper calls both entitlement hooks unconditionally as separate consts and returns hasSharingControls || hasViewerComments — the || is now on plain booleans, not hook call sites. Hook count is render-stable regardless of entitlement flips. Violation resolved, and the rule is now defined once for both the tab-gate and the child panel.

➖ Deferred (acknowledged) — 🟡 slash-menu % flatItems.length NaN

Still present at command-list.tsx:69,75; tracked as issue docmost#153 (Level ≤2). The logic was extracted to the pure, unit-tested getVisibleSlashItems(items, hasBases) (slash-menu-visibility.ts) and command-list.tsx delegates via useMemo(..., [items, hasBases]). I diffed the extraction against the old inline logic: identical filter (requiresBases === true && !hasBases), identical drop-empty-category, identical category-order flatten — so visibleItems/flatItems stay in the same index space and selection can't point at a hidden row. Behavior-preserving; the NaN guard remains a benign, self-healing Level-2 follow-up.

New-issue sweep (fixes only)

  • Width ternary associativity, resize-handle gate, isRail derivation — all correct (above).
  • useSpaceSecurityAvailable — both hooks unconditional; correct.
  • getVisibleSlashItems — pure, deps [items, hasBases] complete; selectItem reads flatItems[index] from the same memoized source. No stale-index or new off-by-one.

No merge-blocking Correctness findings remain on the fork side at 7dc7a5f6.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

🧪 Test Re-review (round 1 fixes) — QA Engineer's Eye

Reviewer role: Test Reviewer · Model: Claude Opus 4.8
PR: #10 @ HEAD 7dc7a5f6 (coupled with cccvu/wiki-v2#151 @ 63b41c6; the docmost#151 submodule bump points here)
Date: 2026-09-03

Verdict

✅ Approve (Testing lens) — my one fork L3 is resolved; no regressions in the new/changed tests; remaining items are all non-blocking Level ≤2 polish.

Prior findings — status

✅ RESOLVED — slash-menu filter untested (was L3)

The gated-item filter is extracted to a pure getVisibleSlashItems(items, hasBases) (slash-menu-visibility.ts) and command-list.tsx now consumes a single { visibleItems, flatItems } from it — render iterates visibleItems, keyboard nav iterates flatItems, both from one source, so the flat index can no longer point at a hidden row by construction. The new slash-menu-visibility.test.ts covers the behaviors that mattered:

  • hide bases-requiring items when unentitled, partial-category survival ("advanced" keeps Table, drops Board), and drop-now-empty category ("bases" gone);
  • flatItems === Object.values(visibleItems).flat() and flatItems.every(requiresBases !== true) — pins the flat-order-matches-render invariant;
  • the all-filtered-out empty case.
    I mentally broke it (keep a gated item / don't drop the empty category / mis-order the flatten) and each mutation reddens a test. Good extraction — the untested surface is now trivial glue.
  • Residual (not blocking, ≤L2): the command-list.tsx render loop itself (flatIndex increment / aria-selected / selectItem bounds) still has no component test, so a future edit re-pointing the render at raw items wouldn't be caught by a unit test. Much smaller risk now; fine as follow-up.

Still open (non-blocking Level ≤2 — correctly deferred; not re-raising to block)

  • L2 sidebar-collapse.test.ts — SPACE/AI cases still don't assert showGlobalSidebar === false; the !isSpaceRoute-dropped double-render mutation still survives. One-line add.
  • L2 resolve-page-edit-mode.test.ts — still no invalid user pref + valid workspace default case (("garbage", Edit) → Edit); the "only fall to workspace when userPref is null" mutation still survives.
  • L2 hide-doctrine verified only at the FeatureGate primitive, not the ~9 hand-rolled hasFeature && … call-sites (mfa/verification data-fetch gating included).
  • L1 feature-gate.test.tsx — "renders children when available" still passes no fallback, so "available ⇒ fallback absent" is unpinned.

Regression hunt

No new fork test regressed; the slash-menu change is net-negative risk. No new untested logic introduced on the fork side this round.

Re-review conclusion: all round-justifying (L3+) Testing findings on the fork side are resolved. The four items above are Level ≤2 polish for the follow-up issue.

@PMQ9

PMQ9 commented Sep 3, 2026

Copy link
Copy Markdown
Author

DevOps / Reliability Reviewer (Claude Opus 4.8) — re-review at HEAD 7dc7a5f6.

Still no DevOps/Reliability findings on this side. The round-1 fork delta (5b8d8e8d..7dc7a5f6) is client-only (global-app-shell.tsx, slash-menu command-list.tsx + new slash-menu-visibility.ts/.test.ts, feature-gate.tsx, settings-modal.tsx) — no CI/Docker/env/package.json/lockfile changes, so it stays operationally inert on its own, and the Docmost image builds unchanged. I ran the super-repo check-upstream-boundary.sh against this exact fork HEAD and it passes (all new files are documented seams). All operational surface — the submodule pin (now = this HEAD, still on feat/ui-consistency-audit, not yet wiki-v2), the merge-order/repoint gate, and the now-CI-active layout-sync.test.ts drift guard — is on the super PR, where I posted the full re-review. Cross-ref: cccvu/wiki-v2#151.

@PMQ9
PMQ9 merged commit 430fdae into wiki-v2 Sep 3, 2026
@PMQ9
PMQ9 deleted the feat/ui-consistency-audit branch September 3, 2026 05:48
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