Skip to content

feat(patchy): retire, delete, restore, rollback and describe; the description sync and the change reminder #253

Closed

Description

@allisonmahmood

Part of #247. Implements spec §6 (the description sync, describe, file mode, the primitive-change reminder) and §8 (the lifecycle verbs); decisions The patch lifecycle, Admin authority (the ownership refusal as the agent reads it) and Patch metadata.

What to build

  • The reminder: at refresh, dev start and publish, for every table or store whose executed definition (columns, indexes, shared) differs from patchy/_generated/manifest.json while its description is byte-identical, print "Table orders changed since its last generation; check that its description still holds: '…'". Notice only; the command proceeds; under --json it is a warnings entry; patchy-loop mentions it.
  • Verbs: patchy retire [<file>] [--patch <id>] [--force], patchy delete … [--yes] [--force] (interactive confirmation unless --yes; non-interactive without it is local exit 1), patchy restore … [--force] (refused with patch_deleted past purgeAt), patchy rollback <n> … (live only), patchy describe "<text>" | <file> "<text>" | --clear, patchy publish … [--force] for an unshare with dependants, each with the share/delete target rules, --json and the ladder: has_dependants and sources_off print the list and end with "Ask the person you are working for before forcing."; wrong_state, not_owner (naming the owner, never suggesting a new patch), patch_retired, patch_deleted (with the reclaim date) are rejected with their fields in the failure document. A file-cache entry is forgotten only after a successful delete.
  • The description in patchy.json: { instance, patch?, description, descriptionSyncedAt? }; init --purpose writes description (refusing an over-long purpose with the count and the bound; interactive re-prompt); a repo without one is invalid_manifest at publish. The manifest carries it; publish records the returned descriptionUpdatedAt as descriptionSyncedAt. Pull-down at refresh, dev start and publish: when the cloud's descriptionUpdatedAt is later than descriptionSyncedAt, write the cloud text into patchy.json, print "The description was changed in the portal to '…'; check it" quoting the replaced local text when it differed, record the stamp, and (for publish) send the pulled text. describe in a repo updates the cloud and rewrites patchy.json in one run. File mode: publish <file> --description "…"; the flag in repo mode is a local refusal pointing at patchy.json.
  • Publish's new refusals as the agent reads them: not_owner, patch_retired and patch_deleted are definitive (the attempt is cleared), keep the id in patchy.json, and say restore it or ask an admin; only the 404 of a reclaimed patch still says to remove patch from patchy.json.

Admitted at merge

The owner's whole lifecycle from the CLI; a retired or deleted address still answers 404 until ticket 11. Admin acts wait for the portal.

Done when

  • Each verb's text and --json document is tested with the refusals above; describe rewrites patchy.json; the pull-down notice fires on refresh after a cloud edit and not after a local one; --force and --yes behave; the reminder fires only when the definition changed and the text did not, in all three commands; init refuses a 501-code-point purpose; the packed e2e retires (refused, then forced), restores, rolls back to 1 and describes, then sees the pull-down on refresh.

Surfaces

The CLI (packages/patchy/README.md, ADR-0004's command table, definitive refusals and patchy.json fields, the global skill for retire/delete/restore/rollback/describe and the description, skills-lock.json, patchy-loop for the sync notice, the starter AGENTS.md saying which file holds which text), docs/product.md § Building a patch and § Describing a patch from decided to built, the Publishing glossary (Description sync).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions