prometeu-studio/docs/packer/pull-requests/PR-22-delete-asset-action-confirmation-and-fs-first-manifest-removal.md
2026-03-24 13:42:46 +00:00

78 lines
3.4 KiB
Markdown

# PR-22 Delete Asset Action Confirmation and Fs-First Manifest Removal
Domain Owner: `docs/packer`
Cross-Domain Impact: `docs/studio`
## Briefing
The action capability contract introduced in `PR-20` needs its next real delivery beyond `REGISTER`.
`DELETE` must remove the asset from packer control without deleting the asset directory or its remaining files. The operation is filesystem-first: delete `asset.json`, update `index.json` when needed, and then apply a point snapshot update in memory.
Studio must require explicit confirmation before calling this write path.
## Objective
Deliver `AssetAction.DELETE` end to end with packer-owned capability resolution, Studio confirmation modal, filesystem-first manifest removal, and point runtime snapshot update.
## Dependencies
- [`./PR-20-asset-action-capabilities-and-register-first-delivery.md`](./PR-20-asset-action-capabilities-and-register-first-delivery.md)
- [`./PR-21-point-in-memory-snapshot-updates-after-write-commit.md`](./PR-21-point-in-memory-snapshot-updates-after-write-commit.md)
## Scope
- extend the public action contract with `DELETE`
- expose `DELETE` capability from the packer for assets that currently own `asset.json`
- add a packer write path that deletes only `asset.json`
- remove any registered entry from `index.json`
- keep the asset directory and its non-manifest files on disk
- patch the loaded runtime snapshot in memory after successful delete
- add a Studio modal that requires typing the asset name before confirming deletion
## Non-Goals
- no recursive directory deletion
- no deletion of companion files or arbitrary asset contents
- no frontend-local action capability rules
- no bulk delete
## Execution Method
1. Extend the action enum and packer API with `DELETE` and its write message/response.
2. Add packer capability resolution for `DELETE` based on `asset.json` presence, independent from declaration validity.
3. Implement `deleteAsset` in the packer write lane.
4. Make the write path:
- resolve the asset
- delete `asset.json`
- remove the registry entry when the asset is registered
- keep the asset directory and any remaining files untouched
- patch the in-memory snapshot by removing the asset from runtime view
5. Add a Studio confirmation modal that requires the user to type the asset name exactly.
6. On success, let Studio refresh and clear the current selection.
## Acceptance Criteria
- `DELETE` is exposed through the packer action capability contract
- Studio renders `DELETE` only from packer-provided capabilities
- Studio requires asset-name confirmation before executing `DELETE`
- `DELETE` removes only `asset.json`
- registered assets are also removed from `index.json`
- the asset directory and remaining files stay on disk
- the runtime snapshot is updated in memory without whole-project reload in the normal path
## Validation
- packer tests for `DELETE` capability visibility
- packer tests for deleting registered and unregistered assets
- packer tests proving directory contents remain on disk after delete
- Studio compile/test validation for the confirmation modal and action wiring
## Affected Artifacts
- `prometeu-packer/prometeu-packer-api/src/main/java/p/packer/**`
- `prometeu-packer/prometeu-packer-v1/src/main/java/p/packer/**`
- `prometeu-packer/prometeu-packer-v1/src/test/java/p/packer/**`
- `prometeu-studio/src/main/java/p/studio/**`
- `prometeu-studio/src/main/resources/**`