Deploy preview API
How to use it from the Studio: Review what a deploy changes.
GET /api/dev/projects/{id}/deploy-preview
Section titled “GET /api/dev/projects/{id}/deploy-preview”What an explicit Deploy of project {id} would change now, compared with the deploy operators run (the stored manifest). Read-only: the bundle is built without being stored. Lead_Engineer or Administrator. Cache-Control: no-store.
| HTTP | When |
|---|---|
200 |
The preview (below). |
401 |
No session. |
403 |
The user may not deploy (operators and supervisors). |
404 |
No such project. |
405 |
A method other than GET. |
500 |
The preview could not be computed. |
{ "project_id": "default", "preview_hash": "3f1c...e9", "base": "a07b...41", "base_deployed_at": 1793900624000, "base_deployed_by": "admin", "next": "f325...6c", "screens": [{"id": "qa_pump_station", "kind": "screen", "name": "QA Pump station", "change": "changed"}], "command_targets": { "added": [{"tag": "Plant/P101/StopCmd", "where": "QA Pump station (qa_pump_station) > btn_stop", "screen_id": "qa_pump_station", "after": "action set_0; ..."}], "removed": [], "changed": [{"tag": "Plant/P102/StartCmd", "where": "...", "before_tag": "Plant/P101/StartCmd", "after_tag": "Plant/P102/StartCmd", "before": "...", "after": "..."}] }, "scripts_added": [{"screen_id": "qa_pump_station", "screen_name": "QA Pump station", "kind": "run_command", "where": "...", "excerpt": "system.tag.write('Plant/P101/Reset', 1)"}], "scripts_removed": [], "write_policy_changes": [{"target": "Plant/P101/SpeedSP", "kind": "limits", "before": "min 0 max 100 (spMin/spMax)", "after": "min 0 max 120 (spMin/spMax)"}], "ack_required": true, "counts": {"screens": 1, "command_targets_added": 2, "command_targets_removed": 0, "command_targets_changed": 2, "scripts_added": 1, "scripts_removed": 0, "write_policy_changes": 2}, "lint": {"ready": true, "blocking": false, "errors": 0, "warnings": 4, "items": [...]}}| Field | Meaning |
|---|---|
preview_hash |
SHA-256 of the preview’s content with the hash of the stored manifest and of the manifest the deploy would publish. A deploy acknowledges this value. |
base |
Hash of the stored (deployed) manifest; "none" before the first deploy, when everything is “added”. base_deployed_at (Unix ms) and base_deployed_by when there is one. |
next |
Hash of the manifest the deploy would publish. |
screens |
Documents added, removed or changed. kind: screen, popup, report, 3d, iso, dashboard, project (pages and navigation). change: added, removed, changed. |
command_targets |
Writes added, removed and changed. tag is (any tag) for a write that cannot be derived (a run_command script, a display startup script) and (code that can write) for code that can reach a write. A changed row whose object now writes another tag has before_tag and after_tag (tag is the new one). before / after describe the write: action, values written, confirmation, interlocks, limits, screen level. |
scripts_added, scripts_removed |
Screen scripts added or removed. |
write_policy_changes |
kind: signature, confirmation, limits, interlock (per tag; a pattern tag ends with (pattern)), screen_access (per screen). before is empty for a new fact, after for one that is gone. |
ack_required |
true when there is any command target, script or write-policy change: an explicit deploy then needs ack. |
counts |
The number of each change. |
lint |
The Problems panel’s summary: ready (false while the checks are not ready), blocking (the project blocks deploys on errors), errors, warnings, and up to 200 items (errors and warnings). |
Arrays are empty, never absent, when nothing changed.
POST /api/dev/projects/{id}/deploy: the acknowledgement
Section titled “POST /api/dev/projects/{id}/deploy: the acknowledgement”When the preview has ack_required, the deploy body must carry the acknowledgement:
{"ack": {"preview_hash": "3f1c...e9", "reason": "Pump P-102 start moved to the new starter"}, "signature_ticket": "..."}| Member | Rule |
|---|---|
ack.preview_hash |
Exactly the preview_hash the server computes at the deploy. |
ack.reason |
Not empty or blank; at most 1000 characters. Recorded in the DEPLOY record. |
signature_ticket |
Unchanged: when the project requires an e-signature. See Require an e-signature to deploy. |
An ack sent for a preview without changes to acknowledge is ignored. The lint_override_reason query parameter is unchanged.
The server computes the preview again at the deploy and checks the acknowledgement right after the review gate and before the e-signature, so a refused acknowledgement never uses a signature ticket. A deploy that passes is bound to the manifest the preview compared (next): a change saved before the deploy is made refuses it.
Refusals
Section titled “Refusals”Nothing is deployed and nothing changes. Each refusal answers the preview the server computed now:
{"status": "deploy_preview_stale", "code": "deploy_preview_stale", "error": "not deployed: the project changed after the preview was shown (...)", "preview": { ... }}| HTTP | status / code |
When |
|---|---|---|
409 |
deploy_preview_ack_required |
The preview has changes to acknowledge and the body has no ack, no preview_hash, an empty or blank reason, or a reason over 1000 characters. |
409 |
deploy_preview_stale |
preview_hash is not the preview computed now (something was saved after it was read); or the project changed during the deploy’s checks or while it was deployed. Read the preview again. |
403 |
deploy_preview_ack_refused |
The deploy comes from the AI co-pilot’s account, which may not acknowledge: a person deploys it. |
500 |
The preview could not be computed: not deployed. |
The other deploy refusals keep their codes. The checks run in this order: the review gate, this acknowledgement (an explicit deploy only), the deploy signature (deploy_signature_required / deploy_signature_refused), the plant e-stop, the screen errors (lint_errors); then 503 AUDIT_NOT_WRITTEN when the deploy’s audit record cannot be written.
- Product
- Service or process
- Data store
- Person or role
- Data or telemetry
- Configuration or deploy
- Authentication
- Refusal
Read as text
The Studio asks the eaxScada server what the deploy publishes and shows that meaning. The deployer's password, sent with the hash that was shown, gives a one-time ticket bound to the signer, the project and the manifest hash; when the project was saved since, nothing is signed. The Deploy then carries the ticket: the server runs the deploy checks in order, redeems the ticket against the manifest it builds at that moment, and only when every check passes records DEPLOY, moves the plant e-stop signal if it has to, publishes the signed manifest and records DEPLOY_SIGNED and DEPLOY_DONE.
Participants
- Deployer (person or role): signed in
- Studio (service or process): Deploy dialog
- eaxScada (product): server
- Audit trail (data store)
Steps, in order
- Deployer → Studio (data or telemetry): Clicks Deploy
- Studio → eaxScada (data or telemetry): GET …/deploy-esign
- eaxScada → Studio (reply): subject: hash and meaning. of the manifest built now
- Deployer → Studio (authentication): Password. Sign and deploy
- Studio → eaxScada (authentication): POST …/deploy-esign/ticket. password, purpose "deploy", hash shown
- Nothing is signed:
- eaxScada → Studio (refusal): 409 manifest_changed. saved since: the new subject to sign
- eaxScada → Studio (refusal): No ticket: 403. wrong password, API token or AI co-pilot
- Signed:
- eaxScada → Audit trail (data or telemetry): ESIG_OBJECT_TICKET_ISSUED. recorded first: no record, no ticket
- eaxScada → Studio (reply): One-time ticket, 60 s. bound to signer, project, manifest hash
- Studio → eaxScada (configuration or deploy): POST …/deploy. signature_ticket
- eaxScada: Deploy checks, in order: 1 review before deploy; 2 acknowledgement of changes; 3 e-signature: the ticket; 4 plant e-stop setting; 5 screen errors
- Check 3 refuses:
- eaxScada → Audit trail (data or telemetry): DEPLOY_SIGNATURE_REFUSED
- eaxScada → Studio (refusal): 403 deploy_signature_refused. or deploy_signature_required: no ticket. Nothing changes
- Every check passes:
- eaxScada → Audit trail (data or telemetry): DEPLOY. recorded first
- eaxScada → Audit trail (data or telemetry): PROJECT PLANT_ESTOP_TAG. first, when the e-stop signal moves
- eaxScada: Publishes the manifest: built again under the lock; it has the signed hash
- Note: Saved meanwhile: not published, signal moved back, DEPLOY_SIGNATURE_REFUSED
- eaxScada → Audit trail (data or telemetry): DEPLOY_SIGNED, DEPLOY_DONE
- eaxScada → Studio (reply): Deployed
Audit records
Section titled “Audit records”| Record | Where | Content |
|---|---|---|
DEPLOY |
Operations audit (written before anything is deployed) | Now ends with the preview: deploy preview <hash> acknowledged by <user>, reason: "<reason>"; N screen(s) changed; command targets A added, R removed, C changed; scripts S added, T removed; W write-policy change(s), or the hash, the counts and no command target, script or write-policy change, no acknowledgement needed. |
DEPLOY_PREVIEW_REFUSED |
Access audit and operations audit | A deploy refused by the acknowledgement check (preview_ack_required, preview_stale, preview_ack_refused), with the preview hash and the reason it was refused. |
DEPLOY_FAILED |
Operations audit | Also when the project was saved after the preview was checked and before the deploy was made (409 deploy_preview_stale; the previous deploy stays live). |
DEPLOY_AUTO_PREVIEW |
Access audit and operations audit | An automatic deploy (live editing) whose preview changes command targets, scripts or the write policy: the preview hash, the counts, the manifest and the previous one, once per preview, after its checks passed and before it is published. Never a refusal. Also written, once, when its preview could not be computed. |