docs: lock down permission string format (<id>:<action>)#19
Conversation
CLAUDE.md never declared the permission string format explicitly — only
examples — and the `$schema` referenced in module.json is not published,
so editors and LLMs get no formal hint. The shell parses with
`indexOf(":")`, which silently accepts malformed inputs like
`my-module:conta:read` (action becomes "conta:read") and yields a dead
permission no RBAC role can ever grant.
- CLAUDE.md: new "Permission strings — exactly two segments" section
near the nav docs, with the rule, the why (silent failure), and four
worked examples (correct + three wrong patterns).
- check-module skill: new check 2.6 "Formato das permissoes" validates
declared `permissions[]` and `requiredPermission` in nav/perspectives
against `<id>:<action>`. Subsequent sections renumbered.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@copilot review |
Revisão das mudançasAs alterações são exclusivamente em arquivos Markdown (documentação e skill) e estão bem estruturadas. Seguem os pontos relevantes:
|
Summary
my-module:conta:readtrap)./check-modulevalidation 2.6 — Formato das permissoes that catches malformed strings inpermissions[]andrequiredPermission(extra colons, resource ≠ module id, empty segments, non-kebab actions). Subsequent sections renumbered.Why
A developer wrote
my-module:conta:readinpermissions[]and Claude Code didn't push back. Investigating, the project never documents the format explicitly — only shows 2-segment examples — and the$schemaURL referenced inmodule.jsondoesn't actually exist incorabank/platform-backoffice-shell, so editors and LLMs get no formal hint. The shell parses withindexOf(":")(split on the first colon), somy-module:conta:readsilently parses toaction="conta:read"— a dead permission no RBAC role can ever grant. The module registers fine, the sidebar renders, and users get permanent permission-denied with nothing in logs.This PR closes two gaps:
/check-moduleflags violations locally before they ship.A follow-up worth doing in another repo: publish
module.schema.jsonin@platform/shell-contractwithpattern: ^[a-z][a-z0-9-]*:[a-z][a-z0-9_-]*$so editors enforce the format at edit time too.Test plan
/check-moduleon a module with"permissions": ["my-module:conta:read"]and confirm it reports a format error.requiredPermissioninsidenavigation[]/perspectives[]..claude/skills/check-module/SKILL.md(2.6 → 2.12) renders cleanly.🤖 Generated with Claude Code