docs(36): capture phase context
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
# Phase 36: Granular MCP OAuth & API token scope picker - Context
|
||||
|
||||
**Gathered:** 2026-11-24
|
||||
**Status:** Ready for planning
|
||||
|
||||
<domain>
|
||||
## Phase Boundary
|
||||
|
||||
Scale the administrator MCP OAuth consent screen (`admin/src/views/ConnectView.vue`) and personal API token creation dialog (`admin/src/components/account/ApiTokenCreateDialog.vue`) to dozens of plugins and hundreds of granular feature-level scopes, fix the `admin:read` visibility footgun, expose additive plugin/group metadata on `cabana.AdminAPITokenScope`, and emit a boot-time structured warning in `pier` when any plugin registers backend write MCP tools uncovered by a non-`*` `TokenScope`.
|
||||
|
||||
In addition to `summercms.go` (Go packages `pact`, `cabana`, `pier`, OpenAPI schema, admin SPA + rebuilt `modules/boardwalk/dist`, en/pl phrasebook copy, Go unit tests, Vitest coverage), this phase ships `pact.HasTokenScopes` in `sm-seo-plugin`, `sm-sitemap-plugin`, and any other core plugin discovered to have uncovered backend write MCP tools. Delivery ends at patch release tags across `summercms.go` and the updated core plugins plus a local pointer bump and verification in `sm-grzybyfunkcjonalne-app` (proving the consent screen with Journal, SEO, and Sitemap scopes locally). Production deploy of `grzybyfunkcjonalne.pl` stays separate.
|
||||
|
||||
</domain>
|
||||
|
||||
<decisions>
|
||||
## Implementation Decisions
|
||||
|
||||
### Carried Forward from Explore Note (`.planning/notes/2026-11-24-mcp-consent-granular-scope-picker.md`) & Phase 32.2
|
||||
- **D-01:** **Full feature-level granularity is first-class.** Never assume a single Read/Write pair per plugin; a plugin may declare arbitrary feature-level scopes (e.g. `shop_sales:read` + `shop_orders` without `shop_customers:read`). `pact.ValidTokenScopeName` regex (`^[a-z][a-z0-9_-]*(:[a-z][a-z0-9_-]*)?$`) stays unchanged.
|
||||
- **D-02:** **Option D layout (summary card + dedicated picker).** `ConnectView.vue` keeps its calm `480px` standalone card matching `LoginView.vue` with a 3-way **Access level** selector (**Full `*`** | **Read-only `admin:read`** | **Custom**), a compact summary box showing effective access, and a **Customize scopes…** button that opens a dedicated picker modal (search across plugin/group/label/code/description, `All | Selected | Read-only` filter pills, collapsible plugin/group accordions with count badges and per-group `Read` / `All` / `Clear` actions). `ApiTokenCreateDialog.vue` reuses the exact same `ScopePicker` component via an in-dialog view swap (`← Back` / `Apply scopes`, never a nested modal overlay).
|
||||
- **D-03:** **Initial tier on `/connect`:** Default to **`Read-only (admin:read)`** when `admin:read` is requested and grantable. If the client requested only a narrow subset without `admin:read` or `*` (e.g. `journal:read`), open in `Custom` with the requested grantable scopes selected. If `*` is the only grantable scope, start on `Full (*)`. If no plugin scopes beyond `*` and `admin:read` are grantable, hide the `Custom` tier. Consent screen continues to hide ungrantable scopes, keep `offline_access` ticked by default, and never auto-focus Allow/Deny (Phase 32.2).
|
||||
- **D-04:** **Combinable `admin:read` toggle inside Custom (fixes the PII footgun).** Inside Custom, provide an explicit opt-in toggle (unchecked by default): **"Also allow reading all other plugins (`admin:read`)"**. When enabled, every `read_only` scope row is visibly locked-checked with a `via admin:read` badge (cannot be unticked independently), and `admin:read` appears as an explicit chip on the summary card. When disabled (default in Custom), `admin:read` is omitted from the submitted scopes so unticking a sensitive `:read` scope genuinely blocks read access.
|
||||
- **D-05:** **`pact.HasTokenScopes` stays explicit.** Never auto-generate `<plugin>` scopes at boot (which would undermine least-privilege granular splits).
|
||||
|
||||
### Picker UX & Summary Card
|
||||
- **D-06:** **Capped chip list + `+N more` in the Custom summary box.** Display `admin:read` (when enabled) and write scopes first, capped at ~6 chips, followed by a `+N more` chip that opens the ScopePicker, accompanied by a summary subtitle (`"X scopes across Y plugins"`).
|
||||
- **D-07:** **Smart accordion expand/collapse default.** When opening the ScopePicker:
|
||||
- Small catalog (`≤ 3` groups or `≤ 12` scopes): expand all groups automatically.
|
||||
- Larger catalog: expand only groups that have active selections (all collapsed if none are selected).
|
||||
- While searching: always auto-expand matching groups.
|
||||
- **D-08:** **`ApiTokenCreateDialog.vue` initializes on `Read-only (admin:read)`.** Matches `ConnectView.vue`'s safe 1-click default (elevating to `Full (*)` or narrowing in `Custom` is an intentional click; falls back to `Full (*)` if `admin:read` is unavailable to the admin).
|
||||
- **D-09:** **Custom tier switching behavior.** Clicking **Custom** when no custom scopes are selected yet automatically opens the ScopePicker (saving an extra click). Switching away to **Read-only** or **Full** and back to **Custom** restores the previously chosen custom selection in memory.
|
||||
|
||||
### Customize Modal & Mobile Styling
|
||||
- **D-10:** **Responsive modal presentation on `ConnectView.vue`.** Below `640px` (mobile), render the Customize scopes modal as a `100dvh` full-screen sheet with sticky search/filter header and sticky footer; on desktop (`≥ 640px`), render a centered modal (`max-w-[640px] max-h-[85dvh]`) with sticky header and footer.
|
||||
- **D-11:** **Draft until Apply semantics.** Edits inside the ScopePicker are staged as a draft until **Apply scopes** is clicked. Clicking **Cancel** / **X** / **Escape** (in `ConnectView`) or **← Back** (in `ApiTokenCreateDialog`) discards unsaved picker edits and restores the previous selection. If Custom was auto-opened empty from another tier (D-09) and the user cancels without applying, revert to the previous tier.
|
||||
- **D-12:** **Surface-matched theming on shared `ScopePicker`.** `ScopePicker` uses semantic admin CSS tokens so `ApiTokenCreateDialog.vue` inherits light/dark mode automatically; `ConnectView.vue` pins light-literal tokens on its Customize modal so it remains visually seamless with the white consent card regardless of dark mode.
|
||||
- **D-13:** **In-dialog swap behavior in `ApiTokenCreateDialog.vue`.** Pressing **Escape** while in the swapped ScopePicker view acts like **← Back** (discards picker draft and returns to the token form without closing the dialog or losing token name/expiry). Keep the dialog frame at a fixed `max-w-[560px]` width across both views to avoid a resize jump.
|
||||
|
||||
### Backend Group Metadata & Picker Grouping
|
||||
- **D-14:** **Optional `Group string` on `pact.TokenScope`.** Accepts a phrasebook key (containing `::`, validated by `validateTokenScopeMessageKeys` at boot) or literal text, mirroring `pact.Permission.Tab`. — **Reversibility:** costly — exported `pact` struct field that external plugins will populate.
|
||||
- **D-15:** **`AdminAPITokenScope` additive JSON fields.** Add `PluginID string` (`json:"plugin_id"`) and `Group string` (`json:"group"`) as always-present strings (no `omitempty`, matching existing `AdminAPITokenScope` fields so OpenAPI/TS types remain plain `string`). Framework scopes (`*`, `admin:read`) and unknown stored scopes emit `plugin_id: ""` and `group: ""`. — **Reversibility:** costly — public admin OpenAPI contract shared by `/account/tokens/scopes`, `/account/tokens`, and `/mcp/consent/{request}`.
|
||||
- **D-16:** **Fallback resolution order for `AdminAPITokenScope.group`.** When `TokenScope.Group` is empty, resolve in order:
|
||||
1. `<pluginID>::lang.plugin.name` (if present and translated in phrasebook)
|
||||
2. Matched `reg.permissions` `Tab` (if the scope's matched permissions resolve to a unanimous non-empty `Tab`, translated when containing `::`)
|
||||
3. Raw `PluginID`
|
||||
- **D-17:** **Flat accordions keyed by `(plugin_id, group)`, ordered alphabetically by resolved `group` label.** Each distinct `(plugin_id, group)` pair is one collapsible accordion (no 2-level nesting, and two different plugins never collide even if they use the same label). Sort groups alphabetically (locale-aware, tie-breaking on `plugin_id`) while preserving the plugin's declared scope order within each group. When the `admin:read` toggle is ON, disable the per-group **Read** quick action and have **Clear** untick only unlocked (non-`read_only`) scopes.
|
||||
|
||||
### Core Plugin Rollout & Boot Warning
|
||||
- **D-18:** **Boot-time uncovered backend write MCP tool warning in `pier.Mount`.** Check every compiled backend non-read-only `MCPTool` (`guardName == "backend"`, `method` not `GET`/`HEAD`) against all registered non-`*` `TokenScope`s by both HTTP method and permission coverage (`cabana` helper called from `pier`, which already imports `cabana` — no circular dependency). Group uncovered tools by `plugin_id` and emit **one structured `Warn` log per plugin** naming `plugin`, `tools`, and guidance to implement `pact.HasTokenScopes`. Never break boot.
|
||||
- **D-19:** **Core plugin `HasTokenScopes` rollout included in Phase 36.** Implement `pact.HasTokenScopes` in `sm-seo-plugin`, `sm-sitemap-plugin`, and any other core plugin found to expose uncovered backend write MCP tools. Use a clean `<name>:read` + `<name>` pair by default (e.g. `sitemap:read` + `sitemap`), splitting a plugin into granular feature-level scopes only where its existing permissions already separate distinct risk tiers (for example in `sm-seo-plugin` if rules/meta vs. crawls/settings have separate permissions). — **Reversibility:** costly — scope names become part of published OAuth `scopes_supported` and stored token grants.
|
||||
- **D-20:** **Release & local proof boundary.** Cut patch release tags in dependency order (`summercms.go` first, then updated core plugins), and bump pointers in `sm-grzybyfunkcjonalne-app` to prove the end-to-end consent flow locally with Journal, SEO, and Sitemap scopes and zero boot warnings. Production deployment of `grzybyfunkcjonalne.pl` stays outside this phase.
|
||||
|
||||
### Claude's Discretion
|
||||
- Exact component file decomposition under `admin/src/components/` (e.g. `ScopePicker.vue`, `ScopeAccessControl.vue` / `ScopeSummary.vue`, composable for tier/draft state) and whether to use Reka UI `Collapsible` / `Accordion` or semantic `<button aria-expanded>` primitives.
|
||||
- Exact `cabana` helper signature exported for `pier` to check `(method, permissions)` coverage against non-`*` `TokenScope`s.
|
||||
- Exact chip cap threshold (~6 chips) and search input debounce/matching details.
|
||||
- Exact en/pl phrasebook key names under `backend::lang.api_tokens.*` and `backend::lang.mcp_connect.*` (following existing naming conventions).
|
||||
- Lean plan split (present plan count before writing PLAN.md files, with unit tests / Vitest + dist/OpenAPI checks as the final plan per project rules).
|
||||
|
||||
</decisions>
|
||||
|
||||
<canonical_refs>
|
||||
## Canonical References
|
||||
|
||||
**Downstream agents MUST read these before planning or implementing.**
|
||||
|
||||
### Decision & Roadmap Specs
|
||||
- `.planning/notes/2026-11-24-mcp-consent-granular-scope-picker.md` — Origin explore note: grzyby root cause, `admin:read` PII footgun, Option D UI layout, `pact.TokenScope.Group`, boot warning design.
|
||||
- `.planning/ROADMAP.md` § "Phase 36: Granular MCP OAuth & API token scope picker" — Phase goal and 5 success criteria.
|
||||
- `.planning/phases/32.2-mcp-oauth-with-administrator-subjects/32.2-CONTEXT.md` — Prior administrator MCP OAuth consent decisions (`ConnectView.vue` standalone card, light-literal styling, hidden ungrantable scopes, `offline_access` default, no auto-focus on Allow/Deny).
|
||||
- `.planning/phases/32.1-mcp-oauth-for-plugin-apps-declared-scopes-mcp-subject-on-con/32.1-CONTEXT.md` — Prior MCP OAuth scope advertising and consent semantics.
|
||||
- `.planning/notes/2026-10-07-embedded-admin-release-gate.md` — Required OpenAPI (`scripts/check-admin-openapi.sh`) and embedded `modules/boardwalk/dist` (`scripts/check-admin-dist.sh`) rebuild gates for `admin/` changes.
|
||||
|
||||
### Framework Go Source (Backend Metadata & Boot Warning)
|
||||
- `modules/pact/capabilities.go` (lines 850–915) — `Permission`, `TokenScope`, `HasTokenScopes`, `ValidTokenScopeName`.
|
||||
- `modules/cabana/token_scopes.go` — `compileTokenScopes`, `validatePluginTokenScope`, `validateTokenScopeMessageKeys`, `scopeMatch`, `scopeCoversAll`, `scopeOverlaps`, `methodFilterScopes`.
|
||||
- `modules/cabana/account_tokens.go` — `AdminAPITokenScope`, `mapCompiledScope`, `mapStoredScope`, `accountTokenScopes`.
|
||||
- `modules/cabana/token_scopes_export.go` — `TokenScopeNames`, `TokenScopeLabels`.
|
||||
- `modules/cabana/mcp_consent.go` — `grantableConsentScopes`, `mcpConsentShow`, `mcpConsentDecide`.
|
||||
- `modules/cabana/registry.go` — `reg.permissions` (`map[string]pact.Permission`), plugin compilation.
|
||||
- `modules/pier/pier.go`, `modules/pier/catalog.go`, `modules/pier/backend_guard.go` — `pier.Mount`, `compileCatalog`, `tool` struct, existing `cabana` import.
|
||||
|
||||
### Admin SPA Source & Tests
|
||||
- `admin/src/views/ConnectView.vue` — Current standalone MCP consent card (light-literal tokens, Reka-free form, `initialTicks`, `decide`).
|
||||
- `admin/src/components/account/ApiTokenCreateDialog.vue` — Current 2-step Reka `Dialog` create flow (semantic theme tokens, `RadioGroupRoot`, Escape/close handling).
|
||||
- `admin/src/components/account/ApiTokensPanel.vue` — Token list consumer of `AdminAPITokenScope`.
|
||||
- `admin/src/api/types.ts` — Generated OpenAPI schema aliases (`AdminAPITokenScope`, `MCPConsent`).
|
||||
- `admin/tests/views/ConnectView.test.ts`, `admin/tests/views/AccountView.test.ts` — Existing Vitest suites to extend.
|
||||
|
||||
### Core Plugins & Local Proof Target
|
||||
- `../sm-seo-plugin/` — Audit backend MCP tools and permissions; add `pact.HasTokenScopes`.
|
||||
- `../sm-sitemap-plugin/` — Audit backend MCP tools and permissions; add `pact.HasTokenScopes`.
|
||||
- `../sm-journal-plugin/` — Reference `pact.HasTokenScopes` + backend MCP tools implementation.
|
||||
- `../sm-faq-plugin/`, `../sm-menu-plugin/`, and sibling `../sm-*-plugin/` repos — Audit for any other uncovered backend write MCP tools.
|
||||
- `../sm-grzybyfunkcjonalne-app/` — Local pointer bump and consent-screen proof (Journal + SEO + Sitemap).
|
||||
|
||||
</canonical_refs>
|
||||
|
||||
<code_context>
|
||||
## Existing Code Insights
|
||||
|
||||
### Reusable Assets
|
||||
- `reka-ui` (`2.9.10`) in `admin/package.json` — Already powers `Dialog*` and `RadioGroup*` in `ApiTokenCreateDialog.vue`; provides `Dialog*` for `ConnectView.vue`'s Customize modal and `Collapsible*` / `Accordion*` if desired, with zero new npm dependencies.
|
||||
- `cabana.AdminAPITokenScope` (`modules/cabana/account_tokens.go`) — Single response type shared by `GET /account/tokens/scopes`, `GET /account/tokens`, and `GET /mcp/consent/{request}`. Extending it once updates both surfaces and OpenAPI generation together.
|
||||
- `cabana.scopeMatch` / `cabana.scopeCoversAll` (`modules/cabana/token_scopes.go`) — Existing permission-pattern matching logic reusable for both `group` permission-`Tab` fallback and the `pier` boot-time coverage check.
|
||||
- `modules/pier/backend_guard.go` — `pier` already imports `cabana`, so `pier.Mount` can invoke a new `cabana` coverage helper directly without architectural refactoring or new `pact` indirection.
|
||||
- `@lucide/vue` (`1.17.0`) — Icons for search, chevrons, lock (`via admin:read`), badges, and `← Back`.
|
||||
|
||||
### Established Patterns
|
||||
- `ConnectView.vue` intentionally uses light-literal palette (`bg-white`, `#141b2d`, `#566175`, `#e6e9ef`, `#f3f5f8`, `#22304d`) to match `LoginView.vue` in both light and dark modes, while authenticated admin dialogs (`ApiTokenCreateDialog.vue`) use semantic Tailwind/CSS theme tokens (`bg-surface`, `text-text`, `text-muted`, `border-border`, `bg-subtle`, `accent-primary`).
|
||||
- Phrasebook keys containing `::` are validated at boot by `validateTokenScopeMessageKeys`; `TokenScope.Group` follows the same rule when non-empty and containing `::`.
|
||||
- Admin OpenAPI conformance is pinned in `modules/cabana/openapi_conformance_test.go`, and `admin/` changes require `scripts/check-admin-openapi.sh` and `scripts/check-admin-dist.sh`.
|
||||
- Multi-repo phases release `summercms.go` first, then core plugin patch tags, then consumer app pointer bumps (`Phase 32.1`, `Phase 32.2`, `Phase 34`).
|
||||
|
||||
### Integration Points
|
||||
- `modules/pact/capabilities.go` (`TokenScope`) → `modules/cabana/token_scopes.go` (`compiledTokenScope`, `compileTokenScopes`, `validateTokenScopeMessageKeys`) → `modules/cabana/account_tokens.go` (`AdminAPITokenScope`, `mapCompiledScope`).
|
||||
- `modules/pier/pier.go` (`Mount`, right after `compileCatalog`) → calls new `cabana` coverage helper over compiled backend non-read-only tools and logs one `Warn` per plugin with uncovered tools.
|
||||
- `admin/src/views/ConnectView.vue` + `admin/src/components/account/ApiTokenCreateDialog.vue` → share the new `ScopePicker` + 3-tier access/summary components.
|
||||
- `modules/cabana/lang/` (or backend phrasebook YAML files) → new en/pl copy for tiers, summary counts, `admin:read` toggle, `via admin:read` lock badge, filters, quick actions, and modal controls.
|
||||
|
||||
</code_context>
|
||||
|
||||
<specifics>
|
||||
## Specific Ideas
|
||||
|
||||
- **Safety-first defaults on both screens:** Both `ConnectView.vue` and `ApiTokenCreateDialog.vue` default to `Read-only (admin:read)` when grantable, so 1-click approval is read-only and write/full access is always an intentional elevation.
|
||||
- **No silent `admin:read` leak in Custom:** Unticking a sensitive `:read` scope (such as customer PII) must genuinely block read access unless the admin explicitly opts into **"Also allow reading all other plugins (`admin:read`)"**, in which case every `:read` row visibly locks with a `via admin:read` badge.
|
||||
- **Elevated scopes surfaced first in summary chips:** When capping the summary chip list at ~6 chips, show `admin:read` (if enabled) and write scopes before read-only scopes so the admin always sees the highest-privilege grants at a glance.
|
||||
- **Zero modal stacking:** `ApiTokenCreateDialog` swaps its body in place (`max-w-[560px]` fixed width, Escape = `← Back`), never opening a modal on top of a modal.
|
||||
|
||||
</specifics>
|
||||
|
||||
<deferred>
|
||||
## Deferred Ideas
|
||||
|
||||
- **Production deployment of `sm-grzybyfunkcjonalne-app`** with the new scope picker and SEO/Sitemap scopes — happens separately after Phase 36 on the user's go-ahead.
|
||||
- **Strict-boot mode (failing boot instead of warning)** for uncovered backend write MCP tools — not needed now; structured boot warning is sufficient.
|
||||
- **Frontend member token (`usr_` / `vue-oauth-layer`) scope picker scaling** — out of scope for Phase 36, which targets administrator backend scopes in `ConnectView.vue` and `ApiTokenCreateDialog.vue`.
|
||||
|
||||
</deferred>
|
||||
|
||||
---
|
||||
|
||||
*Phase: 36-granular-mcp-oauth-api-token-scope-picker*
|
||||
*Context gathered: 2026-11-24*
|
||||
@@ -0,0 +1,230 @@
|
||||
# Phase 36: Granular MCP OAuth & API token scope picker - Discussion Log
|
||||
|
||||
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
|
||||
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
|
||||
|
||||
**Date:** 2026-11-24
|
||||
**Phase:** 36-granular-mcp-oauth-api-token-scope-picker
|
||||
**Areas discussed:** Picker UX & summary card, Customize modal & mobile styling, Backend group fallback & multi-group plugins, Core plugin rollout & boot warning
|
||||
|
||||
---
|
||||
|
||||
## Picker UX & summary card
|
||||
|
||||
### Question 1: How should the Custom summary box display many selected scopes?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Capped chip list + "+N more" | Show `admin:read` (if enabled) and write scopes first up to ~6 chips, then a `+N more` chip that opens the picker, with a `"X scopes across Y plugins"` subtitle | ✓ |
|
||||
| Per-plugin summary chips | Collapse into one chip per group (e.g. `"Shop · 3"`, `"Journal · write"`) and only list individual scopes inside the picker | |
|
||||
| All chips in a capped scroll box | Render every selected scope chip inside a ~120px scrollable area on the card | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Capped chip list + "+N more"
|
||||
**Notes:** Prioritizing `admin:read` and write scopes surfaces elevated permissions immediately without overflowing the `480px` consent card.
|
||||
|
||||
### Question 2: What should the default expand/collapse state of plugin accordions be when opening the scope picker?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Smart expand | Expand all when small (`≤ 3` groups or `≤ 12` scopes); on larger catalogs expand only groups with active selections (collapsed if none), and auto-expand matches while searching | ✓ |
|
||||
| Always collapsed | Start every group collapsed with its count badge (e.g. `"2/6"`), expanding only on click or while searching | |
|
||||
| Always expand selected only | Even on small catalogs, open only groups that already have at least one checked scope | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Smart expand
|
||||
**Notes:** Keeps small apps (like `grzyby`) immediately readable while preventing giant scroll lists on 20–40 plugin installs.
|
||||
|
||||
### Question 3: How should ApiTokenCreateDialog initialize the 3-tier access selector?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Default to Read-only (`admin:read`) | Matches `ConnectView`'s safe 1-click default; elevating to Full or narrowing in Custom is an explicit click (falls back to Full if `admin:read` is unavailable) | ✓ |
|
||||
| No tier pre-selected | Keep today's behavior where Create stays disabled until the admin explicitly picks Full, Read-only, or Custom scopes | |
|
||||
| Start on Custom (empty) | Shows the empty Custom summary box so the admin either clicks "Customize scopes…" or switches to Read-only / Full | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Default to Read-only (`admin:read`)
|
||||
**Notes:** Consistent safe-by-default mental model across both `ConnectView` and `ApiTokenCreateDialog`.
|
||||
|
||||
### Question 4: What should happen when switching to the Custom tier?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Auto-open picker if Custom is empty + remember picks | First click on Custom opens the ScopePicker immediately (saving a click); switching to Full/Read-only and back to Custom restores your previous custom selection | ✓ |
|
||||
| Stay on summary card + remember picks | Clicking Custom shows an empty state with a "Customize scopes…" button (never opens the picker automatically); still preserves picks when switching tiers | |
|
||||
| Auto-open every time Custom is clicked | Clicking the Custom tier always opens the picker directly to edit scopes | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Auto-open picker if Custom is empty + remember picks
|
||||
**Notes:** Removes friction on first entry into Custom without getting in the way once custom scopes are picked.
|
||||
|
||||
---
|
||||
|
||||
## Customize modal & mobile styling
|
||||
|
||||
### Question 1: How should ConnectView's "Customize scopes" modal present on mobile viewports?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Full-screen sheet on mobile, centered modal on desktop | `100dvh` full-bleed sheet below `640px` for maximum list room with sticky search header & footer, and centered `max-w-[640px] max-h-[85dvh]` modal on desktop | ✓ |
|
||||
| Centered modal everywhere | `max-h-[90dvh] w-[calc(100%-32px)] max-w-[640px]` with sticky header and footer (matches `ApiTokenCreateDialog`'s Reka Dialog chrome) | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Full-screen sheet on mobile, centered modal on desktop
|
||||
**Notes:** Maximizes vertical scrolling space for large scope catalogs on phones.
|
||||
|
||||
### Question 2: Should picker edits be a draft until "Apply scopes" is clicked, or live-applied?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Draft until Apply | Cancel / `← Back` / Escape discards unsaved picker edits; if Custom was auto-opened empty from Read-only, cancelling reverts to the previous tier | ✓ |
|
||||
| Live-applied | Every checkbox toggle immediately updates the selection; "Done" / `← Back` / Escape all keep your ticks (no Cancel button) | |
|
||||
| Draft until Apply, stay on Custom | Cancel / `← Back` discards unsaved picker edits, but leaves you on the Custom tier even if empty | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Draft until Apply
|
||||
**Notes:** Prevents accidental partial edits and cleanly reverts when backing out of an auto-opened empty Custom picker.
|
||||
|
||||
### Question 3: How should the shared ScopePicker be themed across ConnectView and ApiTokenCreateDialog?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Match each host surface | `ScopePicker` uses semantic tokens (dark-mode-aware in `ApiTokenCreateDialog`), while `ConnectView` pins light-literal tokens on its Customize modal so it stays visually seamless with the white consent card | ✓ |
|
||||
| Theme-aware modal everywhere | Keep `ConnectView`'s summary card light-literal, but let the Customize modal follow the browser/admin theme on both screens | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Match each host surface
|
||||
**Notes:** Preserves `ConnectView`'s Direction C v2 light-literal appearance while keeping dark mode intact inside My account.
|
||||
|
||||
### Question 4: How should Escape and dialog width behave during the in-dialog picker view in ApiTokenCreateDialog?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Escape returns to token form + keep fixed 560px width | Pressing Escape acts like `← Back` (discards picker draft without losing token name/expiry) and avoids a jarring dialog resize jump | ✓ |
|
||||
| Escape returns to token form + widen to 640px | Pressing Escape backs out to the token form, and the dialog expands to `640px` while picking scopes for extra breathing room | |
|
||||
| Escape closes the whole dialog | Keep standard Reka Dialog Escape dismissal on all views | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Escape returns to token form + keep fixed 560px width
|
||||
**Notes:** Protects unsaved token name/expiry inputs and keeps the modal geometry calm.
|
||||
|
||||
---
|
||||
|
||||
## Backend group fallback & multi-group plugins
|
||||
|
||||
### Question 1: When TokenScope.Group is omitted, what fallback order should resolve AdminAPITokenScope.group?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Plugin name first → permission Tab → `plugin_id` | Try `<pluginID>::lang.plugin.name` first (clean, predictable plugin grouping), fall back to the matched permission's `Tab` if missing, then `PluginID` | ✓ |
|
||||
| Permission Tab first → plugin name → `plugin_id` | Inspect `reg.permissions` matched by the scope (when unanimous) before `<pluginID>::lang.plugin.name`, so plugins with custom permission Tabs automatically reuse them | |
|
||||
| Plugin name → `plugin_id` only | Skip inspecting `reg.permissions`; plugins that want custom group labels set `TokenScope.Group` explicitly | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Plugin name first → permission Tab → `plugin_id`
|
||||
**Notes:** Ensures predictable plugin-level grouping unless a plugin explicitly opts into custom `TokenScope.Group` labels.
|
||||
|
||||
### Question 2: How should the picker group scopes into accordions when a plugin declares multiple Groups (or two plugins share a Group label)?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Flat accordions keyed by `(plugin_id, group)` | Each distinct `(plugin_id, group)` pair is one collapsible accordion in catalog order: large plugins can split into separate sections, two unrelated plugins never collide, and there's no nested 2-level accordion clutter | ✓ |
|
||||
| Flat accordions merged by group label | Scopes with the same resolved group label combine into one accordion even across different plugins (e.g. companion plugins sharing `Group: "SEO"`) | |
|
||||
| Two-level hierarchy | Outer accordion per plugin, with sub-group headings inside whenever that plugin declares multiple `Group` values | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Flat accordions keyed by `(plugin_id, group)`
|
||||
**Notes:** Simple flat UI with clean plugin isolation.
|
||||
|
||||
### Question 3: How should plugin_id and group serialize for framework (`*`, `admin:read`) and unknown scopes?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Always-present strings, empty `""` for framework/unknown | Matches existing `AdminAPITokenScope` JSON style (no `omitempty`, clean non-optional `string` in TS); `*` and `admin:read` leave `plugin_id` and `group` empty since they live in the tier selector and `admin:read` toggle | ✓ |
|
||||
| Use `omitempty` for `plugin_id` and `group` | Omit both fields from JSON when empty (framework/unknown scopes), making them optional in OpenAPI/TS | |
|
||||
| Populate `group` ("System") on framework scopes | Keep `plugin_id` empty on `*` and `admin:read`, but set `group` to a translated "System" label | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Always-present strings, empty `""` for framework/unknown
|
||||
**Notes:** Consistent with existing `AdminAPITokenScope` struct serialization.
|
||||
|
||||
### Question 4: How should plugin/group accordions be ordered in the ScopePicker?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Alphabetical by group label (locale-aware) | Easier to scan at 20–40 plugins while keeping declared scope order inside each group; when `admin:read` is ON, disable per-group "Read" and have "Clear" untick only unlocked (write) scopes | ✓ |
|
||||
| Backend catalog (activation) order | Keep the exact API order for both groups and scopes; when `admin:read` is ON, disable "Read" and have "Clear" untick only unlocked scopes | |
|
||||
| Selected groups first, then alphabetical | Pin groups with active selections to the top on open, then sort the rest alphabetically (keeping order stable while clicking checkboxes) | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Alphabetical by group label (locale-aware)
|
||||
**Notes:** Scannable at scale while preserving plugin author intent for scope order inside each group.
|
||||
|
||||
---
|
||||
|
||||
## Core plugin rollout & boot warning
|
||||
|
||||
### Question 1: Should adding `pact.HasTokenScopes` to `sm-seo-plugin`, `sm-sitemap-plugin`, and other core plugins happen inside Phase 36?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Ship framework + core plugin `HasTokenScopes` together in Phase 36 | Implement `summercms.go` changes plus `HasTokenScopes` in `sm-seo-plugin`, `sm-sitemap-plugin`, and any other core plugin with uncovered backend write MCP tools so everything ships warning-free end to end | ✓ |
|
||||
| Framework (`summercms.go`) only in Phase 36 | Keep Phase 36 focused on `summercms.go`; add `HasTokenScopes` to `sm-seo-plugin`, `sm-sitemap-plugin`, and other core plugins in separate quick tasks / follow-up phase | |
|
||||
| Framework + SEO & Sitemap only | Ship `summercms.go` plus `sm-seo-plugin` and `sm-sitemap-plugin` (closing the grzyby gap), defer auditing other core plugins (`faq`, `menu`, etc.) to later | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Ship framework + core plugin `HasTokenScopes` together in Phase 36
|
||||
**Notes:** Closes the full gap end-to-end with zero boot warnings across core plugins.
|
||||
|
||||
### Question 2: How should the boot-time warning for uncovered backend write MCP tools be logged?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| One structured warning per plugin | Group uncovered backend write tools by plugin and log one `Warn` per plugin (with `plugin_id`, uncovered tool names, and hint to implement `pact.HasTokenScopes`), checking against all non-`*` `TokenScope`s by method + permissions | ✓ |
|
||||
| One structured warning per uncovered tool | Log a separate `Warn` line for each individual tool (`plugin_id`, `tool`, `method`, `permissions`) | |
|
||||
| Per-plugin warning + optional strict-boot config | Same per-plugin warning by default, plus an `mcp.*` config flag to turn uncovered tools into a fatal boot error | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** One structured warning per plugin
|
||||
**Notes:** Clean, concise boot diagnostics without spamming logs on plugins with 10+ write tools.
|
||||
|
||||
### Question 3: What scope granularity should `sm-seo-plugin`, `sm-sitemap-plugin`, and audited core plugins declare?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Standard `<name>:read` + `<name>` pair, split only where existing permissions warrant it | e.g. `sitemap:read` + `sitemap`, and for `sm-seo-plugin` split into granular scopes only if its existing permissions already separate distinct risk tiers (like rules/meta vs. crawls/settings) | ✓ |
|
||||
| Strictly `<name>:read` + `<name>` pair across core plugins | Keep SEO, Sitemap, and other core plugins simple with read + write; reserve multi-scope splits for larger domain plugins | |
|
||||
| Split `sm-seo-plugin` into granular feature scopes now | Break `sm-seo-plugin` into separate feature scopes (e.g. meta/rules vs. site audit/crawls vs. settings) right away as a live showcase of the granular picker | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Standard `<name>:read` + `<name>` pair, split only where existing permissions warrant it
|
||||
**Notes:** Pragmatic granularity anchored to each plugin's existing permission structure.
|
||||
|
||||
### Question 4: Where should Phase 36's rollout boundary stop?
|
||||
|
||||
| Option | Description | Selected |
|
||||
|--------|-------------|----------|
|
||||
| Patch tags + local grzyby pointer bump (no prod deploy) | Mirrors Phase 32.2: tag `summercms.go` and updated core plugins, bump `sm-grzybyfunkcjonalne-app` to prove the consent screen with Journal + SEO + Sitemap scopes locally, keep production deploy separate | ✓ |
|
||||
| Patch tags only | Commit, test, and tag `summercms.go` and updated core plugins; bump consuming apps later | |
|
||||
| Code & tests only (no tags yet) | Finish implementation and automated checks across `summercms.go` and core plugins; handle tagging and app bumps separately | |
|
||||
| You decide | Claude discretion | |
|
||||
|
||||
**User's choice:** Patch tags + local grzyby pointer bump (no prod deploy)
|
||||
**Notes:** Matches the proven Phase 32.2 release & verification pattern.
|
||||
|
||||
---
|
||||
|
||||
## Claude's Discretion
|
||||
|
||||
- Component decomposition under `admin/src/components/` and Reka UI vs semantic button primitives for accordions.
|
||||
- Exact `cabana` helper signature invoked by `pier.Mount` for uncovered backend write MCP tool checks.
|
||||
- Exact chip cap threshold (~6 chips) and search matching details.
|
||||
- Exact en/pl phrasebook key names under `backend::lang.api_tokens.*` and `backend::lang.mcp_connect.*`.
|
||||
- Plan breakdown (following lean planning + unit tests last).
|
||||
|
||||
## Deferred Ideas
|
||||
|
||||
- Production deployment of `sm-grzybyfunkcjonalne-app` with the new scope picker and SEO/Sitemap scopes (separate go-ahead after Phase 36).
|
||||
- Strict-boot mode turning uncovered backend write MCP tools into a fatal boot error.
|
||||
- Scaling the frontend member token (`usr_` / `vue-oauth-layer`) consent picker.
|
||||
Reference in New Issue
Block a user