Skip to content

feat(companies): a look restore says who restored it and why - #688

Merged
allisonmahmood merged 1 commit into
mainfrom
feat/587-look-restore-record
Oct 15, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
feat/587-look-restore-record

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Restoring a look moved the company's pointer but recorded nobody. A repo at revision 8 that refreshed after Ada restored 7 heard "rev 8 → 7 by Sam: first green", crediting Sam with Ada's decision, and patchy look showed nothing about the restore.

What changed

A company now keeps one record of its latest look restore: who moved the pointer, when, and an optional note. It is a single record, not a history. A later restore replaces it and a publish clears it.

  • Record. Three nullable columns on companies, added by migration 0016_look_restore. Looks.restore sets them in the same transaction that moves the pointer. Restoring the revision that is already current changes nothing, the record included. Looks.publish clears them. Looks.read returns the record from the same statement as the revisions.
  • Wire. LookRestoreRequest.note is optional and validated as a LookNote. CompanyLook.restored and LookRestored.restored are { by: { id, name }, at, note } | null. The decoders also accept the key being absent, so a new CLI still works against an older server.
  • Generation. index.json gets lookRestore beside look, from the same read. The patchy-look skill's state line names the restorer. Notices still compare looks by revision and creation time, so a restore that leaves a repo on the revision it already has stays silent.
  • CLI. The notice names the restorer when a restore brought the look in: Acme's look changed, rev 8 → 7, restored by Ada: rev 8 failed dark mode. Without a note it reads …, restored by Ada. For none, the notice names the restorer, then says the Patchy look stands in. patchy look restore takes --note. patchy look and look restore print Restored by Ada on 2026-10-07: … under the byline, and --json carries restored. Notices for publishes are unchanged.

Migration id: 0016. #583's fix (#687) also adds a Companies migration and took 0015, so this one was renumbered when the two were merged together.

Surfaces

  • Wire contract: packages/api schemas and endpoint descriptions, the look handler, look / look restore and their --json shapes, and docs/API.md (regenerated).
  • CLI: packages/patchy/README.md, ADR-0004, the global patchy skill (--note) with its skills-lock.json hash, and the patchy-loop project skill's notice example. The patchy-look state line comes from generation.
  • Vocabulary and product: the Companies glossary (the "Look revision" entry, plus a new Look restore term) and docs/product.md.
  • Migrations: 0016_look_restore in packages/companies/src/migrations.ts.
  • Reverse states: a publish clears the record and a later restore replaces it.
  • Not touched: the dev loop, company resources, served pages and the repo layout. look.restored analytics are unchanged.

Tested by hand

pnpm dev up team (Acme Co). Ada (admin) published two revisions with the environment's CLI and created a patch repo at revision 2. Ada promoted Cleo to admin on /company. Cleo's and Ben's own CLIs then logged in through the device flow, each approved with that person's own cookie jar.

$ patchy look restore 1 --note "rev 2 failed dark mode"        # Cleo
Revision 1 is the company's look again.
By Ada Park on 2026-10-14: first green
Restored by Cleo Shah on 2026-10-14: rev 2 failed dark mode.

$ patchy look                                                    # Ada
Revision 1 is the company's look.
By Ada Park on 2026-10-14: first green
Restored by Cleo Shah on 2026-10-14: rev 2 failed dark mode.
…
History:
  2  2026-10-14  Ada Park  darker green
  1  2026-10-14  Ada Park  first green  (current)

$ curl -H "Authorization: Bearer <ben>" $URL/api/look | jq '{current: .current.revision, restored}'   # Ben, a member
HTTP/1.1 200 OK  ·  cache-control: private, no-store
{ "current": 1, "restored": { "by": { "id": "usr_env_acme_cleo", "name": "Cleo Shah" }, "at": "2026-10-14T18:42:20.159Z", "note": "rev 2 failed dark mode" } }

$ pnpm patchy refresh                                            # the repo at rev 2
Acme Co's look changed, rev 2 → 1, restored by Cleo Shah: rev 2 failed dark mode. Colours and fonts follow; …
$ pnpm patchy refresh --json | jq .warnings                      # a copy of the repo at rev 2
[ "Acme Co's look changed, rev 2 → 1, restored by Cleo Shah: rev 2 failed dark mode. Colours and fonts follow; …" ]

The repo's patchy-look skill then read: "This is the company's look, revision 1, published by Ada Park: first green. Cleo Shah restored it on 2026-10-14: rev 2 failed dark mode."

The remaining acceptance cases, in the same instance:

  • Ben's look restore none --note mine was refused (Only an admin can change Acme Co's look. Ask Ada Park or Cleo Shah., exit 2), and the record stayed Cleo's.
  • Ada's look restore 1 while 1 was already current left Cleo's record untouched.
  • Cleo's look restore none without a note printed Restored by Cleo Shah on 2026-10-14. The repo's next refresh read rev 1 → none, restored by Cleo Shah. The Patchy look stands in.
  • Ada then published revision 3. patchy look showed no restore line and restored: null. The repo at revision 1 heard rev 1 → 3 by Ada Park: third green. with lookRestore: null.
  • Old CLIs keep working: main's LookRestored and index.json schemas decode bodies carrying restored / lookRestore, and ignore the new keys.

The look, migration and generation suites pass locally. A full pnpm verify is still queued behind the shared machine's lock, so CI is the gate here.

Closes #587

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

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Cross-family review: GPT 6.1 Sol (xhigh, read-only, one pass) reviewed origin/main...1e84653 against the issue's Agent Brief for correctness, every mirrored wire-contract surface, over-engineering and test focus. Result: no findings.

@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:docs Touches the docs area size:l 501-1,000 changed lines labels Oct 15, 2026
A company keeps one record of its latest look restore: who moved the
pointer, when and an optional note. A restore that moves the pointer sets
it, restoring what is already current changes nothing, and a publish
clears it. The look read and restore return it as `restored`, generation
writes it into index.json as `lookRestore`, and the change notice,
`patchy look` and the patchy-look skill name the restorer instead of
crediting the revision's publisher. `patchy look restore` takes --note.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the feat/587-look-restore-record branch from 1e84653 to 4796712 Compare October 15, 2026 19:35
@allisonmahmood
allisonmahmood merged commit 94b36b2 into main Oct 15, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the feat/587-look-restore-record branch October 15, 2026 19:45
allisonmahmood added a commit that referenced this pull request Oct 16, 2026
…u when they fail (#720)

Release 13's What's new entry, written from `c9b8fc4`, ahead of
deploying it. `patchy` and `CURRENT_RELEASE` move to `0.13.0`, so CLIs
and patch repos installed before this deploy are told to upgrade.

| Change | PRs |
| --- | --- |
| New: Home puts the patches you use first | #713, #716, #719 |
| New: Every patch in one list | #715 |
| Improved: Each patch's page leads with Open | #717 |
| New: See when your tools are failing | #718 |
| Fixed: Everyone has a name | #687 |
| Improved: Your company's look is easier to get right | #697, #696,
#703, #688 |
| Improved: Forms follow your look's error states | #691, #692 |
| Improved: Clearer answers when a publish goes wrong | #686, #685, #689
|
| Fixed: Your agent's Patchy commands are steadier | #695, #704, #680,
#681 |
| Behind the scenes: stricter checks on static pages and tools' database
requests; malformed requests are logged | #682, #693, #683 |
| Behind the scenes: usage numbers count every publish, sharing change
and restore | #698, #699, #700, #690 |
| Test and tooling only, no line | #705, #702, #701, #694, #684, #607 |

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

Co-authored-by: Claude Opus 5.5 <[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:docs Touches the docs area area:server Touches the server area size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(companies): a look restore records who restored it and why

1 participant