Skip to content

chore(patches): remove the operator's routes, the admin scope and pins #136

Closed

Description

@allisonmahmood

Parent

Auth: Clerk, companies and machine tokens on tier 0, spec §4.

What to build

The prefactor: the operator's routes, the admin scope and pins leave before the schema is rewritten, so the data ticket after this one moves tables and nothing else. After this PR the API is mint, me, upload and delete; a bearer token has no scopes to check and no route acts on another bearer's token; nothing on the instance can be pinned.

Do

  • Remove from the wire and the server: GET /api/patches/:patchId (the moderated read), GET /api/principals/:principalId/patches, POST /api/patches/:patchId/disable, POST .../pin, POST .../unpin; the schemas ModeratedPatch, PatchView, PrincipalPatches, Pinned, DisableRequest; hasScope and every scope check (upload and delete become owner-only by the token's principal, as they are for a non-admin today); the scope-shaped Forbidden refusal text. POST /api/tokens and POST /api/tokens/:apiTokenId/revoke go in the same PR, with CreateTokenRequest, CreatedToken and RevokedToken: their only guard was the admin scope, and a revoke-by-id route with no guard would let any bearer revoke any token between this PR and the next. Nothing calls them but the patchy-mint-token skill, which is deleted here with its line in docs/SKILL_DISTRIBUTION.md. The self-service mint and /api/me stay until the data ticket.
  • Remove pins whole: Patches.setPinned, findForModeration, listByPrincipal, disable, the ModerationOptions; the pinned_at column and its partial index from the patches baseline (edit the baseline in place: nothing is deployed, and pnpm dev reset is the documented answer to a ledger that changed shape); the pin term in the not-expired predicate and in the sweep.
  • patch.disabled leaves the analytics events; patch.deleted loses its admin property.
  • Re-render docs/API.md; the CLI README and the patchy skill lose nothing here (neither documents these routes), but check.
  • Glossary: Pinned patch and Moderation leave packages/patches/CONTEXT.md; Retire and Delete lose their "reached by moderation" and "or operator" clauses; the intro's route list shrinks. docs/product.md § The operator gains the one line from The operator is Patchy, not a token: its surfaces are a separate login and separate dashboards, never a company in the product and never in the patchy CLI. packages/companies/CONTEXT.md's Operator entry gets the same line.
  • Tests: delete the moderation and pin suites; keep the sweep's suite green without the pin case.

Surfaces

The wire contract; vocabulary and product shape; migrations (the baseline edit is not a new record, so the three migrator call sites are untouched); reverse states (pin and unpin leave together).

Done when

  • pnpm test, pnpm typecheck, pnpm lint and the packed e2e pass.
  • docs/API.md lists four routes and no Admin scope sentence anywhere.
  • grep -r pinned_at and grep -r hasScope find nothing outside git history.
  • The glossary and product edits above are in the same PR.

Decisions implemented

The operator is Patchy, not a token; spec §4.

Blocked by

None (can start immediately).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:docsarea:serverready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions