Repository navigation
feat(serving): require sign-in to open company patches - #153
Conversation
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. Spec[P1] Intent: out-of-range version URLs reveal whether a company patch existspackages/serving/src/Pages.ts:53–58 Issue #140 requires “the 401 shape identical for a missing and a foreign patch” and “A signed-in user of another company and a missing id produce identical 404 bodies and headers.” The metadata lookup can fail before the handler applies admission. Reproduced against the whole server on a real socket, requesting
The 500 also lacks the required Smallest fix: constrain the parsed version to the positive PostgreSQL integer range before calling Verification: six existing focused suites passed (65 tests: Serving pages/rendering, Auth pages/session, whole-server routes, and Content). A separate disposable real-socket reproduction failed the concealment assertion: Summary: Standards: 0 blockers. Spec: 1 blocker; worst: private-patch existence disclosure through version overflow. |
|
Two-axis review of #153 against StandardsNo hard documented-standard violations. Namespace imports, Not violations (checked because they look like they might be):
Baseline smells (judgement calls):
SpecAuthoritative lines are from #140. (a) Missing or partialHandler does not decide the wrong-person states. Spec: “the door is route-scoped middleware … providing the viewer or nothing. The handler that loaded the patch decides:
HEAD is not fixed at the router. Spec: “Fix Nothing else from the Do / Done-when list is absent: two CSPs, cache-by-scope, no (b) Scope creep
Cookie-free deleted-patch packed e2e moving 200/404 → 401 matches “every published patch fetched with no cookies answers 401” and “the 401 shape identical for a missing and a foreign patch.” Not creep. (c) Specified but implemented wrongPublic still authenticates, and a live handshake is discarded. Spec: “A public patch serves exactly as today” and middleware provides “the viewer or nothing.” Door always runs Until sharing lands this is latent: every live patch is company-scoped, so the door’s 401 vs 404 split itself is correct: signed-out missing/foreign → 401 door; signed-in other company / missing → identical 404. Do not treat the packed deleted 401 as a miss. Intent vs #140The product promise of #140 is the door in front of a tier 0 page: paste a company link, one Sign in at Clerk, land back on that URL; a signed-in colleague just gets the page; another company and a missing id are indistinguishable. Public stays today’s anonymous page. The patch never runs script; the host may know who opened a company page. What shipped matches that promise on the response: 401 HTML door with one link and Two intent divergences:
The door is a moment on the way to the patch, not a destination: the patch URL itself is the 401; MethodThe method is sound. It copies the prototype’s shape (two
Splitting HEAD via Extracting The one method bug is the public short-circuit treating handshake as just another admission response. Handshake is completing sign-in, not refusing it. Return 307 + cookies regardless of scope; only skip 401 / 303 / 403 when YAGNIMostly beautiful YAGNI. Credit: Keep (real constraints): HEAD→GET, handshake query strip, referrer overlay so
The second Duplicated join-303: ~15 lines. Live with it or one Auth helper that returns Tests match what #140 asked (memory + socket, two CSPs, cache-by-scope, identical 401, HEAD). Storage-fault and nameless-session are existence/Clerk, not smoke. SurfacesHit-every-surface is mostly done: CONTEXT.md / CONTEXT-MAP / product.md / ADR-0006 / skill + Small leftovers, not #140 blockers:
Summary
Reviewed with Grok 4.6. |
|
Addressed both reviews in 8778407 ( Fixed
Kept, with reasons
Verification
Latest commit Review remediation by GPT-6 Astra in Oh My Pi. |
|
|
@vsrikar08 Following up on your sign-in comment: Allison will walk through the experience personally before deciding on a change. This PR adds the sign-in door for reading company patches. Publishing uses the CLI's saved machine token after login; it should not require signing in for every publish. The comment doesn't yet establish which step is repeating, so this remains an investigation, with no implementation change requested yet. |
|
@vsrikar08 what do you mean it asks for signin patchy cloud is for companies. we don't allow anonymous uploads. once you are signed in once you are fine |
e64e93a to
59dfead
Compare
8778407 to
c1b4933
Compare
Company patches could be read without signing in. They now use the same login door as
/login: active colleagues can open them, and outsiders get the same 404 as a missing patch.Admission happens before content is fetched. Company pages stay private and uncached, with a headless Clerk shell keeping the session fresh; public pages remain anonymously readable and cache for at most a minute on either URL shape. Includes HEAD handling and updated agent guidance.
Stacked on #150 (
auth/146-invite-and-manage-users). This PR targets that branch, notmain.Closes #140.
Verification
pnpm test: 246 passedpnpm typecheckandpnpm lint: passedpnpm test:packed-cli-e2e: passedpublic, max-age=60Production handshake #128 remains deferred as specified. Temporary verification account and helpers were removed; the local instance was stopped.
Implemented with GPT-6 Astra (
openai-codex/gpt-6-astra) in the Oh My Pi harness.