PlotDirector/Docs/Deployment/AutomaticDevelopment.md

73 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Automatic PlotDirector Development deployment
Owner policy, 2 December 2026: application, SQL-only, combined schema/data and
corrective Development releases are automatically authorised. Production deployment
is not authorised by this policy. Feature acceptance remains the feature worker’s
responsibility.
## Worker operation
Commit tested source, then use the existing `deployment-request` command for
`application-development` and poll `deployment-result`. Use one unique key per
intent. The controller rechecks the current task, dependencies, assignment, claim,
full commit and root-owned Development-only policy at every admission.
New SQL uses the next free numbered filename under `PlotLine/Sql`. Applied scripts
are immutable; procedure/function revisions are new forward migrations. The installed
planner preserves the complete ledger, appends new scripts in order, and refuses
number collisions. Data-only migrations are supported transactionally. Qualification
and live postconditions plus the measured resulting schema detect structural errors.
Use task-specific smoke/persistence checks for functional correctness; no routine
full application regression is imposed by the deployment adapter.
Pending SQL is tested on a disposable restored copy. Its temporary login has rights
only in that copy and never receives the live migrator credentials. The independent
installed DatabaseWorker executes SQL under that identity. A fixed maintenance broker
backs up/restores/drops generated copies; it never executes release SQL as administrator.
Recovery backups are retained. Application-only changes skip all this SQL work.
The existing deployment lock, SQL application lock, verified backup, migration history,
transaction per script, fixed target, immutable signed package, service stop, health
and full binary/source identity checks remain. Successful activation refreshes the
root-controlled baseline. Root/code/service/secret permissions are not delegated
to workers. Production tooling, configuration, signatures and approval policy are
unchanged.
## Diagnostics and correction
`failed_safe` identifies a known failure before live activation. Results include
phase, actionable build diagnostics or SQL code/script/batch/line, applied counts,
current deployed commit and migration history. Fix and submit another key in the
same execution. Durable linked attempt records preserve every failed attempt and
block replay after an uncertain/crashed attempt. Worker-written mailbox results are
never authoritative.
`recovery_required` means the external effect is uncertain or live activation failed.
Do not replay it. Inspect the original protected receipt and actual state. Partial
migration failure may have committed earlier scripts; keep the service stopped and
recover or make an explicitly reconciled forward correction. Never restart an old
application against an incompatible schema. Read-only installed helper `--status`
reports actual binary, service, database schema/history and last successful marker.
The controller returns those facts without granting worker sudo or credentials.
## Infrastructure maintenance
Drain the controller, let current executions finish, then stop it. Preserve branches,
working changes, receipts and request stores. Review exact source/diff, run focused
contained tests, and data-copy a protected snapshot with hashes. Build only the
reviewed independent DatabaseWorker through `atlas-worker-exec tooling-build` with
locked dependencies. Snapshot the existing installed files before replacing them.
Never run a repository installer with administrative authority. Install only reviewed
code and independently built tooling; no change to sudo rules is needed. The
unprivileged adapter needs `development_plan.py`; the existing Development helper
needs `development_qualification.py`, `development_plan.py` and the reviewed worker.
The Production installation is deliberately untouched. Initial provisioning also installs
the qualification modules and takes a reviewed `--legacy-source-index` JSON file
with the pinned historical source commit and excluded SQL file hashes. This index
is root-controlled baseline data; routine releases never require a new index or
operator action.
Commission using real Development activations: application-only, SQL-only, combined,
successive correction and controlled copy/build failure. Check receipts and actual
identity/history, then restore the controller and normal queue polling.