# Plugin Registry Persistence Plan **Goal:** Add database-backed governance for trusted Feature Plugin releases and persist the complete resolved plugin plan with every generation run. ## Task 1: Publication Schema - [x] Add `factory_plugin` definitions with a current published version pointer. - [x] Add immutable `factory_plugin_version` rows with canonical manifest JSON and SHA-256. - [x] Add a repeatable migration and synchronize full workbench/database scripts. - [x] Add `plugin_plan_json` to generation runs while preserving historical nullable rows during upgrade. ## Task 2: Publication Service - [x] Add plugin definition list/detail/create/update operations. - [x] Create monotonic immutable draft versions only from installed trusted implementations. - [x] Publish drafts by retiring the previous release and atomically moving the current pointer. - [x] Roll back only to retired releases. - [x] Verify stored row identity, canonical hash, provider, schema, version, and installed implementation before publication. ## Task 3: Runtime Catalog - [x] Add a database-backed primary release catalog with a disabled-by-default configuration switch. - [x] Preserve the installed Spring registry as the compatibility fallback. - [x] Resolve only published or retired database versions backed by an identical installed manifest. - [x] Reject tampered manifests and published releases whose implementation is absent. ## Task 4: Audit And API - [x] Persist canonical `PluginExecutionPlan` JSON with the existing plugin fingerprint. - [x] Return the plan snapshot from generation run list/detail responses. - [x] Add secured management APIs for definitions, versions, publish, and rollback. - [x] Keep arbitrary plugin upload and execution outside this phase. ## Task 5: Verification - [x] Add catalog, publication service, immutable Mapper, schema, plan persistence, and controller contract tests. - [x] Run focused tests, the complete Generator baseline, Admin tests, formatting checks, and frontend health check. - [x] Record deployment order and the remaining first built-in plugin migration.