Repository navigation
docs(domain): reconcile the map after auth - #160
Conversation
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. The changes reconcile the existing documentation and skill surfaces rather than introduce another implementation path. The API deletion description is corrected at its source and in the generated reference. Removing the obsolete route-specific assertions retains general guard coverage. Future product decisions are distinguished from shipped capabilities; no future-facing runtime machinery is added. SpecNo merge-blocking intent findings. The map, vocabulary, product, ADRs, development recipes, CLI guidance and publishing/onboarding skills are aligned with the shipped auth model. The PR includes the requested surface audit. The retired-concept search found no surviving retired auth concepts; remaining lexical matches refer to dependency/origin pinning, sharing/primitive scopes and Effect's I checked the documented instance/credential precedence, login completion and replacement behavior, logout, and deletion/retention timing against their implementations. No missing, incorrect or extra requirement in this diff warrants blocking the merge. Verification
Summary: Standards: 0 blockers, worst issue: none. Spec: 0 blockers, worst issue: none. |
allisonmahmood
left a comment
There was a problem hiding this comment.
Two-axis review of PR 160 against issue 145 (docs(domain): the map after auth), plus the implementation method and a YAGNI pass. Several reviewers read the same three-dot diff independently (2602396...c17c10d).
Standards
(a) Documented-standard breaches
CONTEXT-MAP.md Relationships — docs/agents/domain.md / domain-modeling: the map names who depends on whom, not wiring. This hunk is a handler walk: session helpers, Content, “login middleware … two patch routes”, patch_versions/machine_tokens, “same transaction”, “without importing Auth”, ExpirySweep. Hosting → runtime packages is the same (mounts, guard, forks). Drop service/table/middleware names; keep the arrows.
examples/plan.html access table — docs/agents/domain.md (use the glossary; don’t drift). Adjacent rows were updated while Viewer moved to Auth. Serving Page _Avoid_s both viewer and wrapper. The leftover row still uses both for the sandboxed frame (examples/plan.html ~676–678).
docs/SKILL_DISTRIBUTION.md — writing-for-agents / skill-design: one home per fact. A wiring doc restates login, sharing, logout, and how to read company patches, plus “keep aligned with CLI README and ADR-0004” (already Hit every surface). Leave the wiring; delete the recipe.
skills/patchy/SKILL.md vs references/onboarding.md — SKILL.md says onboarding owns user-facing copy, then restates create-or-join, Not you? Sign out, Deny, --json on next, and whoami vs PATCHY_API_TOKEN. Keep procedure pointers; keep the spoken words in onboarding only.
No Effect service findings (api.ts is OpenAPI prose; ApiGuard.test.ts drops /api/tokens/self-service).
(b) Baseline smells (judgement)
- Duplicated Code — login/credential chain, 90/30 expiry, 60s public cache restated in SKILL, onboarding, CLI README, DEVELOPMENT,
patchy-dev-loop. Hit every surface requires those files; it does not require copying Clerkapp_…/clerk env pullfromdocs/DEVELOPMENT.mdinto.agents/skills/patchy-dev-loop/SKILL.md. - Mysterious Name — new delete copy in
packages/api/src/api.ts,docs/API.md, CLI README, SKILL.md: “the origin stops serving it”. Not a glossary term (instance/ page). - Shotgun Surgery — 35 files. Suppressed: Hit every surface requires the walk.
Spec
Quoted against issue 145 and spec §12/§13.
(a) Missing or partial
“leaves no sentence describing public hosting, minting, the bootstrap token, the operator's token or the pre-auth door” and “the docs say what the code now does, everywhere at once.”
examples/plan.html now says login-then-upload; packages/serving/src/render.ts still teaches PATCHY_SETUP_TOKEN and patchy auth set, calling it a “Patchy Cloud API token.” render.test.ts locks that copy in. Opening the printed API URL contradicts README/DEVELOPMENT First publish is login, then upload. The PR’s served-pages audit (“corrected the example… no product UI”) is the miss.
“A fresh agent following
README.md,docs/DEVELOPMENT.mdand thepatchyskill canpnpm dev, sign in,patchy login, publish and open the page without reading an issue.”
README/DEVELOPMENT’s first-publish-as-yourself is /join → Sign in → pnpm patchy login with PATCHY_API_TOKEN unset. The skill says: with a working key already configured, skip login. After pnpm dev, status reports hasToken: true from the seed. Following the skill publishes as Dev Machine; without PATCHY_DEV_CLERK_USER_ID the browser user is in another company and the page is a 404.
“The five glossaries read as one vocabulary”
Companies Operator is Patchy; Publishing Driver avoids operator. ADR-0004 still says exit 3 is “retry later, or tell the operator”; skills/patchy/SKILL.md repeats it.
“ADRs: 0002 to 0006 and the two new ones still true”; spec §12: “Deletes nothing: ADR-0002, 0003, 0005 and 0006 stand as written.”
0004 and 0006 were the named amends. ADR-0002 Decision 4 was rewritten into “the wire uses the domain’s vocabulary” (not a decision). ADR-0003 still narrates rewritten pre-deployment history. They were not deleted, but they no longer stand as written.
every “not yet in code” / “once login lands” clause resolved
Live patch still says “neither deleted nor disabled” (packages/patches/CONTEXT.md). Retire _Avoid_s “disable”. Product says operator take-down is a SQL statement by hand. Pick one: define the stamp, or stop saying “disabled.”
Otherwise the Do list holds: CONTEXT-MAP arrows and ADR-0007/0008 are present; glossary headings are unique; mint-era terms are gone; product.md CI sentence is future tense; skill lock hash matches SKILL.md (32890d63…fac525); retired-term grep is empty outside origin/dependency pinning, sharing/cookie/primitive scopes, and Command.unlisted.
(b) Scope creep
.agents/skills/effect-service-conventions/SKILL.md (add companies; drop “Effect is not yet imported”) is not in the 145 Do list. Small and true; still extra.
In spec, not extra: examples/plan.html (unlisted), ApiGuard.test.ts (self-service), packages/api/src/api.ts (API.md delete prose). CLI README PATCHY_SETUP_TOKEN under auth set is the packed-e2e fixture for an existing machine token.
(c) Looks implemented, but wrong
Same / vs example split: a fresh agent who opens the instance root does not get the shipped login path.
Implementation method
Mostly sound. This was a real end-to-end reconciliation, not a mechanical rename. Distinctive edits required reading the code: DELETE waits for the retention clock because listExpired is expires_at < now, not deleted_at; PATCHY_DEV_CLERK_USER_ID is seed-only; re-login sends previousMachineTokenId only for source === "login"; seed copy matches DEV_SEED; login --json matches Login.ts. Wire copy was edited in api.ts and regenerated. Viewer now lives only in Auth. One commit and 35 files is the right grain for “everywhere at once.”
The miss is a rewrite habit on ADR history and glossary internals, plus skipping the live home page while updating the example. The surface audit in the PR body matches hunks, then under-claims served pages.
YAGNI
The ticket asked every surface to tell the truth. Breadth is required. The result is honest about now vs later, then copies the same walkthrough into four homes.
Hard: four first-publish recipes (README Try it, DEVELOPMENT steps 1–4, patchy-dev-loop §2, product.md “First publish is login, then upload”). product.md is not a CLI contract — --json on next, seed fallback, and courtesy-revocation warnings belong in ADR-0004 / CLI README. CONTEXT-MAP Relationships over-explain internals. DEVELOPMENT.md’s CLERK_JWT_KEY as “RSA-2048 PEM … exponent 65537” is not load-bearing for pnpm dev.
Beautiful: glossaries now point future Group/SSO/Connect door at product.md instead of restating. Serving dropped its duplicate Viewer. CLI CONTEXT defers the exit-code ladder to ADR-0004. product.md’s Built today banner and Admins will see everything make the in-and-out split unsurprising. ADR-0002 deleting the Fastify adapter paragraph is the right kind of cut.
Summary: Standards — 4 hard + 3 judgement; worst is CONTEXT-MAP.md Relationships as a wiring spec. Spec — 5 missing/wrong + 1 mild creep; worst is the served / still teaching PATCHY_SETUP_TOKEN / auth set while the rest of the map says login-then-upload.
|
Addressed both the Astra issue comment and the two-axis PR review in c4f6b0b. Astra had no additional blockers; the concrete findings in the two-axis review warranted the fixes below. Fixed
Kept, with reasons
Verification
No remaining blocker. The PR remains based on |
2602396 to
7c075c1
Compare
Reconcile the completed auth build across the context map, glossaries, product, ADRs, development and publishing guides, and bundled skills. Surface audit for #145: - Wire: correct deletion cleanup timing and regenerate the API reference. - CLI: align login handoff, identity, sharing and skill/hash instructions. - Dev loop: reconcile keys, seed, state isolation and both live test tiers. - Vocabulary: distinguish shipped auth from future product decisions. - Migrations: verify three baselines at server, dev and Vitest composition. - Served pages: correct example publishing/access copy; policy unchanged. - Reverse states: document denial, logout, revoke, reactivation and sharing. - Layout: refresh package responsibilities and skill distribution paths. Remove obsolete route assertions; retain general API guard coverage. Retired-concept search retains only legitimate dependency/origin pinning, sharing/cookie scopes and Effect's Command.unlisted API. Verified lint, typecheck, 322 offline tests, packed CLI e2e, local publishing, and live Clerk's two Backend API and two Playwright tests. Standards review: two vocabulary findings fixed. Spec review: state-directory default clarified. No open review findings. Refs #145
c4f6b0b to
624ee31
Compare
`look publish` read `logo.svg` with parse5's HTML parser, which recovers from mistakes. Every place a logo appears loads it as an image, and browsers parse images as strict, namespace-aware XML. So an inline `<svg>` copied from a company's site during onboarding (no `xmlns`, ` `, an undeclared `xlink:` prefix) passed every check, then showed as a broken image in the specimen and in every patch. ## Fix `checkLogo` in `@patchy/core/look` now parses the logo with [`saxes`](https://github.com/lddubeau/saxes), with namespaces on, and walks that parse. saxes is about 8 KB, ISC and pure JS, so the module stays browser-safe. parse5 stays in core for the HTML policy. - A logo that isn't well-formed or namespace-valid is refused with one line: the position, saxes' problem, and the general fix. The general fix is always included because saxes sometimes names the wrong thing (a bare `&` in `<title>` reports `unclosed tag: title`). It also tells the agent to run an inline `<svg>` through `new XMLSerializer().serializeToString(svg)`: `logo.svg:1:56 is not well-formed XML (undefined entity); a logo is XML, not HTML, so quote every attribute, close every tag, declare prefixes such as xmlns:xlink, and write & as & and as  . For an inline <svg> copied from a page, serialize it with new XMLSerializer().serializeToString(svg) in a browser.` - A `<!DOCTYPE>` is refused. The root must be `svg` in the `http://www.w3.org/2000/svg` namespace, as resolved from the declarations. That covers a missing or wrong `xmlns`, and only `xmlns:svg` on an unprefixed root. - A namespace declaration with spaces around its value is refused. saxes trims declarations, but browsers compare them exactly: a padded root `xmlns`, or a padded reserved `xmlns:xml`, is a broken image in Chromium and Firefox. - An XML declaration other than `version="1.0"` is refused: Firefox shows any XML 1.1 logo as a broken image. - Every existing logo check keeps its message. Attribute names still match case-insensitively, as parse5's did. `xlink:href` counts as a reference, `xmlns:*` declarations don't, and `<style>` text, including CDATA, goes to the CSS reference check. ### With #678's bounds #678 bounded the logo's parse5 parse (512 deep, 256 attributes, a repair budget) so that no upload could stall the server. The XML parse replaces that for the logo. saxes has no error repair and no recursion, but it has three costs of its own that I measured: - It finds each element's namespace by searching every open element, which is quadratic in depth. A 20,000-deep logo took 2.4 s, and 220,000 deep took over 300 s. - It pairs each namespace with every prefixed attribute's name: a 16 KB namespace across 20k attributes took 0.9 s. - It builds an `Error` with a stack trace for every problem: about 0.5 s for 175k undefined entities in 512 KiB. So a logo nests at most **64** elements deep, and a namespace is at most **256** characters. Real logos nest a few elements deep, Chromium and Firefox render well past 5,000, and real namespaces are short URIs, so both are purely cost bounds. Problems are recorded without building an `Error`, and a logo past the look's 512 KiB limit is refused for its size without being parsed. Measured warm against `main`'s bounded parse5 on the same inputs: | Input | This branch | `main` | | --- | --- | --- | | 500 KiB of `<rect/>` siblings | 28 ms | 24 ms | | 500 KiB of `<g/>` siblings at depth 63 (the worst case left) | 99 ms | 30 ms | | 500 KiB nested or left unclosed | 1 ms, refused | 1 ms, refused | | 500 KiB of undefined entities | 14 ms | 30 ms | | 500 KiB of prefixed attributes under a 250-character namespace | 57 ms | not measured | | any shape at 1.5 MiB (the request cap) | 1–2 ms, refused for size | 64–93 ms | #678's logo-bounds test is replaced by the 64/65 depth threshold. All of its inputs are malformed XML now. ## Surfaces - **Wire contract:** the publish endpoint's description lists the logo rule, including both bounds, and `docs/API.md` is re-rendered. No request or response shape changed. - **CLI:** the `patchy` README's look section describes the rule. There is no new command, flag or exit code, so ADR-0004 is unchanged. The global skill gains one sentence in `look-capture.md`'s `logo.svg` section. `SKILL.md` is unchanged, so `skills-lock.json` is untouched. - Not applicable: dev loop, vocabulary and product shape, migrations, company resources, served pages (the HTML policy is untouched), reverse states and repo layout. ## Tried by hand In Chromium (Playwright), I took two inline logos as a browser reads them back through the DOM: GitHub's header mark from github.com, and the brief's typical site logo after parsing it as HTML. Each went into a look folder next to a fixture `look.css` and `LOOK.md`. Both read-backs render as broken images, and `main`'s checks accept both. Against this branch's dev environment (`pnpm dev up`, team scenario), using the environment's packed CLI as Ada: - `patchy look preview` on GitHub's mark printed `look publish would refuse this look: - logo.svg's <svg> is not in the SVG namespace; set xmlns="http://www.w3.org/2000/svg" on it.` `--json` carried the same line in `failures`, where it used to report none. - `patchy look publish` refused both read-backs with exit 1 and `invalid_look`. The brief's logo gave the `logo.svg:1:56 … undefined entity …` line above. - I also POSTed both read-backs straight to `/api/look/publish` with curl, skipping the CLI's own check. The instance answered `422 invalid_look` with the same lines. - I ran `new XMLSerializer().serializeToString(svg)` on both logos in Chromium. Preview then reported no failures, and publish stored them as revisions 1 and 2. - Opened in Chromium, the specimen for the read-back showed a broken-image icon followed by the alt text `Linear's look`, which reads like a wordmark (`naturalWidth` 0). The specimen for the serialized logo rendered it (`naturalWidth` 300). That run was on the commit before the rebase onto #678. On the rebased commit, `pnpm patchy look preview` from source gives the same four results. I checked every refusal or acceptance added after review as an image in both Chromium and Firefox: padded `xmlns` and `xmlns:xml`, XML 1.1, namespace declarations, uppercase attributes, depth, and the brief's must-pass logos, including Patchy's own. WebKit couldn't launch on this machine. ## Review GPT 6.1 Sol reviewed at xhigh over three rounds. - **Round 1** found six issues and I fixed five: a padded `xmlns`, XML 1.1 (widened after Firefox showed any 1.1 logo broken), namespace declarations read as `href`/`on*`, attribute-name case, and README wording. The sixth is dismissed in a comment below. - **Round 2**, after the rebase onto #678, found a padded reserved `xmlns:xml` and the long-namespace cost. Both are fixed. - **Round 3** found nothing. ## Left out - Per the brief: the `forceStates` gaps and logo `<style>` cascade rules stay accepted. Stored revisions aren't re-checked, and publish never repairs a logo. - css-tree throws on a non-CSS attribute value containing `url(`, e.g. `data-x="fill:url(#g)"`, which makes `checkLook` throw instead of refusing. This predates this PR on `main` and needs its own fix. Closes #597 Made by Claude Opus 5.5 in Claude Code, running in T3 Code.
What changed
The auth build is complete, but its docs still mix the old publishing model, shipped auth behavior and future plans. This pass reconciles the map, glossaries, product, ADRs and setup recipes so a fresh agent can sign in, log in the CLI, publish and open a page without reading an issue.
Rebased onto
mainafter the auth stack merged. This PR contains the final documentation pass over PRs #147–#159, preserving the newer invitation-expiry and current-public-version rules throughout the docs and skills.Closes #145.
Surface audit
docs/API.md; wire shapes unchanged.Removed obsolete route assertions while retaining general API-guard coverage. The retired-concept sweep leaves only legitimate lexical matches: dependency/origin pinning, sharing/cookie scopes and Effect's
Command.unlisted.How it was verified
pnpm lint,pnpm typecheck,pnpm test— 322 tests across 38 files.pnpm test:packed-cli-e2e— complete packed CLI real-server contract.pnpm test:clerk— two Backend-API tests and two Playwright workflows; cleanup confirmed zero test users remain.Release impact
Model: OpenAI GPT-6 Astra. Harness: Oh My Pi.
Integration verification: local formatting, lint, typecheck and all 322 offline tests pass. Reconciled both rounds of rebase conflicts, refreshed the public skill hash, corrected ADR-0007’s stale no-expiry claim, and documented the invitation-expiry migration. Final-head CI, including live Clerk/browser and packed CLI checks, is the merge gate.
Integration: GPT-6 in the Codex harness.