Skip to content

feat(companies): a company look with revisions, and patchy look, look publish and look restore - #577

Merged
allisonmahmood merged 15 commits into
mainfrom
look/565-look-revisions
Oct 7, 2026
Merged

allisonmahmood merged 15 commits into
mainfrom
look/565-look-revisions

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

A company has nowhere to keep its look: no revisions, no way for an admin to publish or roll one back, and nothing a member's agent can read. This is ticket 2 of the company-look stack (#547).

How

  • One checks module, @patchy/core/look. checkLook(files) returns one line per failure: the 15 tokens each declared once, colours opaque #RRGGBB, no !important, everything but @font-face inside @layer look, 4.5:1 for every text colour on bg and on surface and for accent-fg on accent, no @import and only data: URLs (the logo may use #fragment links), and the look.bytes and look.brief.bytes caps from the limits registry. The CLI runs it before sending; the instance runs it again. The four prototype looks, with the contrast fixes and the two status tokens added, are its fixtures under packages/core/fixtures/looks/.
  • Companies owns the revisions. Migration 10 adds look_revisions (company, number, author, note, the three files inline) and a nullable companies.current_look_revision, with a composite foreign key so the pointer can only name the same company's revision. Publish locks the company row and takes the next number. Restore moves the pointer and copies nothing. No look is the starting state.
  • A look API group. GET /api/look for any active member; POST /api/look/publish and /api/look/restore for admins. A member gets 403 admin_required with the active admins. Publish and restore are business events (look.published, look.restored), reported after commit.
  • The CLI. patchy look (history, and the files' contents under --json), patchy look publish <dir> --note "…" and patchy look restore <n|none>, with exit codes and --json per ADR-0004. The failure document now carries admins.
  • Docs. docs/API.md, ADR-0004, the CLI README, docs/limits.md, the Companies glossary (Look, Look revision), docs/product.md, the context map and the operations event list.

Seams for the next tickets. #566 (preview) imports checkLook and LOOK_TOKENS from @patchy/core/look. #567 (generation) reads Looks.Looks → read(companyId).current, which carries the revision number, author, note and files.

Closes #565

Built by Claude Opus 5.5 in Claude Code, running in T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area size:xl Over 1,000 changed lines; review in multiple passes labels Oct 7, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round 1 (stack orchestration for #547): one Claude Opus 5.5 reviewer and three GPT-6.1 Sol reviewers (server, publish checks, YAGNI + CLI contract), each read-only against bd11cde, plus the orchestrator's own read.

Agreed sound: revision numbering under the company row lock (FOR NO KEY UPDATE), the composite foreign key so the pointer only names a same-company revision, company scoping on every read and write, the server-side admin gate naming active admins, restore none, commit-before-analytics, migration 0010, the CLI's exit codes and --json shapes, rendered docs/API.md, and the tests (the six-way concurrent publish really guards the lock). All four fixtures' contrast pairs were recomputed independently and pass.

Sent to the builder, all in the checks module and fixtures:

  • Tokens counted anywhere: require the fifteen declarations in an unconditional :root inside @layer look; refuse @property --look-*.
  • Self-containment misses image-set("https://…") strings and escaped identifiers (u\72l(…), --\6c ook-fg): collect string image sources; refuse backslash escapes in identifiers.
  • False refusals of @layer look; and a leading @charset.
  • Restore numbers above int4 and NUL bytes in files surface as server defects instead of refusals.
  • The Duolingo and Patchy fixtures keep shadows, transforms and uppercase on plain elements, which the companies: a company look, so new patches look like their company by default #547 verdict forbids; the Patchy fixture becomes the default look in feat(sdk): new patch repos start in their company's look #567.
  • Logo: refuse <script>, <foreignObject> and on* attributes.
  • README.md and CONTEXT-MAP.md summaries of core omit the look checks.

Judged not worth a check (the look's author is an admin of the company whose patches it reaches, so the checks catch mistakes, not attacks on one's own company): logo <style> cascade effects, and malformed SVG that parse5 recovers.

Posted by Claude Fable 5.1 (orchestrator) in Claude Code, running in T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round 2: a GPT-6.1 Sol verifier re-probed the fix commits in css-tree and Chromium. Every round-1 refusal probe now refuses; honest CSS (a leading @charset, the @layer look; statement, embedded and local() fonts, nesting, comments, @media and @supports rules) passes; the warnings field matches the --json contract. Three small items came back and are resolved at 04a396b: every @property is refused (an escaped prelude could re-register a token), Linear's plain button hover is colour-only, and the exact :root rule is kept on purpose (the message says where tokens go; judging which selector lists are "global" would bring back the effective-token reasoning the rule removed).

Verdict from the orchestrator: ready to merge after #576.

Posted by Claude Fable 5.1 (orchestrator) in Claude Code, running in T3 Code.

allisonmahmood and others added 15 commits October 7, 2026 16:40
One pure module, @patchy/core/look, that the CLI and the instance both run:
the 15 tokens declared once each as opaque #RRGGBB, no !important, everything
inside @layer look, WCAG contrast for text on both grounds and accent-fg on
accent, data: URLs only, and the two size caps from the limits registry.
The four prototype looks, contrast-fixed, are its fixtures.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A company owns numbered look revisions, each with its author, time, note and
three files, and a nullable pointer to the current one. GET /api/look is for
any active member; POST /api/look/publish and /api/look/restore are admin-only
and refuse members with the active admins' names. Publishing reruns the core
look checks and serializes per company; restore moves the pointer only. Both
report business events after commit.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
patchy look prints the company's current revision and history, with the
files' contents under --json. look publish checks a look folder with the core
look checks before sending it; look restore takes a revision number or none.
A member's refusal relays the admins to ask in the failure document.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…d commits

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Duolingo's lip, press and uppercase labels and Patchy's hover shadow and press
move from plain elements into LOOK.md recipes; element styles keep to colours,
fonts, borders, radius and spacing, as the verdict on #547 asks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A token counts only in a :root rule directly inside @layer look, and
@Property may not register one. Escaped names, string addresses in
image-set() and src(), NUL characters, and a logo with script, handlers or
foreignObject are refused. A leading @charset and the @layer look; statement
are accepted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…n_unavailable

Looks.Revision and Current become plain interfaces; nothing decodes them.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s colour only

Refusing every @Property closes an escaped prelude registering a token; a look
never needs one. The Linear fixture's plain button hover drops its brightness
filter for a colour mix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the look/565-look-revisions branch from 04a396b to bdbe5c2 Compare October 7, 2026 14:40
@allisonmahmood
allisonmahmood merged commit 8c20cae into main Oct 7, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the look/565-look-revisions branch October 7, 2026 14:50
allisonmahmood added a commit that referenced this pull request Oct 7, 2026
Release 8 of What's new, written for the deploy of the company look
stack (#547, first build). It covers everything merged after release 7's
`through`.

- **New: Your tools can look like your company** — #577, #579
- **New: Preview a look before you publish it** — #578
- **New: Setting up Patchy sets up your look** — #598 (the rebased
replacement for #582)
- **Improved: Patches hear when the look changes** — #581
- **Improved: Static pages can use embedded fonts** — #576
- Behind the scenes: the personal style file retires (#598)

Written by Claude Fable 5.1 in Claude Code, running in T3 Code.

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:server Touches the server area size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(companies): a company look with revisions, and patchy look, look publish and look restore

1 participant