Repository navigation
Closed
Labels
ready-for-agentFully specified, ready for an AFK agent
Description
Part of #247. Implements spec §7's patch routes, §13's read query and §14's read rows (the connections group is ticket 4's); decisions Discovery for agents and the prototype (a company-readable inventory, reads, purgeAt, --state at the patch level, token-only).
What to build
- One read query in
packages/patches, shared later by the portal: the company's patches joined with their owners (name, deactivated), the current version's number and publish time, the live dependant edges, each patch's declared shared-table reads across its retained versions (alias, source patch id and name, table, source state), and, when the company database exists, the cumulative inventory per patch. It takes the credential's openability predicate (every company patch today) and a state filter. - A company-readable inventory read in
Patches, openability-gated, that does not take the owner-only write predicate; the owner'sGET /api/patches/:patchId/inventorykeeps its route. - Routes in the
patchesgroup:GET /api/patches?mine&state→{ patches: [PatchSummary] }(no connections; the CLI merges them);GET /api/patches/:patchRef?stateandGET /api/patches/:patchRef/primitives/:name?statewith one resolution rule: a name resolves among non-deleted patches, an id among all; a resolved patch whose state lies outside the requestedstateiswrong_state409 naming its actual state (retired name under live, deleted id withoutall, live name under retired); unopenable, unknown, foreign, gone and deleted-by-name are one 404.PatchDetailcarriestitle,inventory: { tables, stores } | null(null when the company database is unavailable;declarable, thereasoncode andhintper spec §7) andreads(withgoneas a state andnameomitted when the source is gone);PrimitiveDetailper spec §7 (an absentdefaultis no default; explicitnullis present). An overlong:patchRefis 414 through the guard's table. Machine tokens only. - Hints and reasons: shared table
patchy add shared-table <patchId>/<table>; unsharednot_sharedwith the owner's name in the hint; storenot_shareable; a source that is offsource_off; connected connectionpatchy add postgres/<handle>; disconnectednot_connectedpointing at/company/connections.
Admitted at merge
The read routes for any machine token. The catalog route is ticket 4's to remove; nothing here breaks patchy catalog.
Done when
- A patch the credential cannot open (test with an alternate openability layer) is absent from the list and 404 by name; a name resolves only to non-deleted patches; reads listed from an older retained version that the current version dropped; the inventory shown to a non-owner includes a table omitted since; an unavailable company database answers
inventory: null, never empty arrays; a retired name understate=live, a deleted id withoutstate=alland a live name understate=retiredare each 409 naming the state;purgeAtequalsdeletedAtplus 30 days; the guard's 414 covers:patchRef.
Surfaces
The wire (docs/API.md), the API guard's 414 table, the Patches glossary (Dependant, the openable gate), docs/product.md § Sharing and finding (agents discover) from decided toward built.
Metadata
Metadata
Assignees
Labels
ready-for-agentFully specified, ready for an AFK agent
Activity
feat(patches): add company-readable patch discovery
feat(patches): add company-readable patch discovery