Repository navigation
fix(companies): a person without a name is named by their email - #687
Merged
Merged
Conversation
Owner
Author
|
Review by GPT 6.1 Sol (xhigh, read-only, against
|
Clerk's name claim is null for email-only accounts, and company creation, invitation acceptance and the per-request claim refresh stored it as a blank users.name, so every surface that names a person showed nothing. Users.displayName is the one rule: a name blank after trim() is stored as the lowercased email's local part, or the whole email when that part is empty. The shared user insert and refreshClaims (before its change check) apply it, Join's suggested company name uses it, and migration 15 backfills existing blank names with the same rule. Closes #583 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Postgres's \s depends on the locale and misses whitespace JavaScript's trim() strips, such as U+FEFF, so a deactivated user with such a name would have kept it blank. The migration now spells out trim()'s whitespace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
force-pushed
the
fix/583-blank-user-name
branch
from
October 15, 2026 19:26
e403b04 to
cbe128c
Compare
allisonmahmood
added a commit
that referenced
this pull request
Oct 15, 2026
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
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clerk's name claim is null for email-only accounts. Company creation, invitation acceptance and the per-request claim refresh stored that as a blank
users.name, so every surface that names a person showed nothing:patchy lookprintedOnly an admin changes it: .,whoamiprintedUser: (email), the app header read· Acme Co, and Join suggested's company.The fix
One rule,
Users.displayName({ name, email }): a name blank aftertrim()is stored as the lowercased email's local part (up to the last@), or the whole email when that part is empty. A non-blank name is stored exactly as given.Companies; the rule applies there.Users.refreshClaimsapplies it before its change check, so a nameless person's repeat requests (any whitespace, any email case) write nothing and wake no directory subscriptions. A real name later replaces the fallback, clearing it brings the fallback back, and an email change while nameless moves it.<local part>'s company.0015_user_name_never_blankrewrites existing blank names for active and deactivated users with the same rule in SQL. Its notion of blank istrim()'s whitespace, spelled out, since Postgres's\svaries with the locale and misses some of it (U+FEFF, for one). The directory trigger records each rename as usual.No read-time fallbacks, no constraint, no change to claim decoding or any wire shape.
Migration id: this takes 15. #587 is adding a Companies migration at the same time; whichever lands second renumbers (the record's test fails on a duplicate or skipped id).
Rolling deploy: an old host can re-blank a name during the rollout; it heals on that person's next browser request (checked by hand below).
Tested by hand
In
pnpm dev up team:[email protected]as an admin from/company(303). The address signed in through/dev/sign-in, saw Acme Co · admin on/joinand joined (303 to/company).patchy lookprintedOnly an admin changes it: Ada Park, nova.quinn.pnpm dev shot [email protected] /company: the header readsnova.quinn · Acme Co, and the user list showsnova.quinn(You),[email protected], Admin.''in the database, as an old host would: the next/companyrequest restorednova.quinnand advanced the directory revision 5 → 6, and a repeat request left it at 6.Tests: creation and acceptance with empty and whitespace-only names (separately), the rule's empty-local-part fallback, the
refreshClaimssequence with an update audit, the migration on a pre-15 database (including a name of only non-ASCII whitespace, which fails against a\sclause), and Join's suggestion from aname: nullsession.Surfaces
packages/companies/src/migrations.ts, composed byapps/server/src/migrations.tsas before.patchy-memberssaysnameis never blank.Closes #583
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.