schema: brand, features and onboarding schemas (@coa/schema, plan Task 3) #7
Labels
No labels
agent-blocked
agent-working
bug
deferred
enhancement
model-haiku
model-opus
model-sonnet
needs-info
needs-triage
no-triage
priority
product-decision
ready-for-agent
ready-for-human
ready-for-session
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Reference
Matou/coa#7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan
docs/superpowers/plans/2026-08-27-coa-phase-0-1.mdTask 3 — follow its steps and code verbatim; the Interfaces block is the contract.Deliverable
New workspace package
packages/schema(@coa/schema) withsrc/brand.ts,src/features.ts,src/onboarding.ts,src/index.tsand the three Vitest files underpackages/schema/test/.Interfaces produced
BrandSchema/Brand,SLUG_RE,HEX_REFeaturesSchema/Features,TOGGLEABLE_FEATURES = ['chat','projects','proposals','notices','events']OnboardingSchema/Onboarding,ApprovalSchema/Approval,APPROVAL_MODES = ['open','admin','endorsements','endorsements+session']Acceptance
pnpm --filter @coa/schema testpasses andpnpm --filter @coa/schema typecheckis clean.^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])?$; colour regex^#[0-9a-fA-F]{6}$.identityis forcedtrueandidentity: falseis rejected; unknown feature keys are rejected (.strict()).endorsements/endorsements+sessionrequirerequired1–20; info pages capped at 3.pnpm -r typecheck && pnpm -r testexit 0 at the workspace root;pnpm-lock.yamlupdated in the same commit.depends_on
— (first code ticket)
out_of_scope
backend / ClientConfig / submission schemas (next ticket); any server or site code.
Ruled by agent under ADR 0174 — veto anytime.
Ruling:
enhancement+ready-for-agent(wasneeds-triage).packages//server//site//tools//e2e/in the tree yet (#7 is the first code ticket); no matching.out-of-scope/rejection. Redundancy and prior-rejection checks both clear.ready-for-agentnow cannot let a worker start out of order.Why a two-way door. The outcome is a label, reverted by a later label change, and every acceptance criterion is provable by the plan's own tests (
pnpm -r typecheck && pnpm -r test). It touches no credential, emails no community contact, dispatches no build or release, provisions no shared-infra tenant, writes no realcommunities/data, widens no security posture, and changes no form contract the spec does not already state — none of this repo's one-way doors.Ruled by agent under the two-way-door doctrine — veto anytime.
Decision needed. Two acceptance clauses conflict. The pinned slug regex
^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])?$accepts a 1-character slug ("a"→ matches, because the middle group is optional) and rejects 2-character slugs. But the plan's pinnedbrand.test.tsasserts"a"is rejected. So "regex is exactly X" and "the plan's test files pass" cannot both hold with the verbatim.regex(SLUG_RE)alone.Ruling. Keep
SLUG_REexactly the pinned literal (so neighbours importing it get the pinned pattern and the "regex is exactly X" clause holds), and add a.min(2)length guard on theslugfield so the single-character case is rejected. Result: all 22 pinned tests pass,SLUG_REis byte-for-byte the pinned regex, and behaviour matches the spec's stated "2–40 chars" (plan §Global Constraints line 16).Why two-way. It is a validation rule, reverted by a later commit, and proven by
pnpm --filter @coa/schema test(22/22 green). It touches no credential bytes, sends no email, dispatches no build/release, provisions no shared-infra tenant, writes nocommunities/data, widens no security posture, and does not change the form's contract beyond what the spec already states (2–40 chars). None of ADR 0002's one-way doors.Proof.
pnpm -r typecheck && pnpm -r testexit 0;packages/schema/test/brand.test.tscovers"a"(rejected via min-length) and the 41-char case (rejected via regex).close-report for #7 — status
success✅ close-report gates passed — every claim verified against the PR head; PR #20 (#20) is green and was merged (agent-after-green); the issue closed via
closes #7.envelope