2026-05-23 04:51:16 +00:00
|
|
|
# Stage: publish
|
2026-05-18 22:03:59 -05:00
|
|
|
|
|
|
|
|
## Purpose
|
2026-08-09 21:50:21 +00:00
|
|
|
|
2026-05-23 12:57:59 +00:00
|
|
|
Upload run/session outputs to object storage and atomically advance remote current state.
|
|
|
|
|
|
|
|
|
|
## Inputs
|
2026-08-09 21:50:21 +00:00
|
|
|
|
|
|
|
|
- successful preceding stages from the [canonical stage set](overview.md#pipeline-stage-set)
|
|
|
|
|
- invocation-scoped run files
|
|
|
|
|
- resolved publish output rules
|
2026-05-23 12:57:59 +00:00
|
|
|
- effective publish locks (static + remote merged lock set)
|
2026-08-09 21:50:21 +00:00
|
|
|
- durable previous-session cache files when present
|
2026-05-23 12:57:59 +00:00
|
|
|
|
|
|
|
|
## Outputs
|
2026-08-09 21:50:21 +00:00
|
|
|
|
|
|
|
|
- uploaded invocation record and selected publish outputs;
|
|
|
|
|
- uploaded durable previous-session cache files when present;
|
|
|
|
|
- updated remote current manifest; and
|
|
|
|
|
- remote current-run commit marker, written last.
|
|
|
|
|
|
|
|
|
|
Exact remote placement and the operator workflow belong in
|
|
|
|
|
[Operations](../operations.md#publish-workflow).
|
2026-05-23 12:57:59 +00:00
|
|
|
|
|
|
|
|
## Key Behavior
|
2026-08-09 21:50:21 +00:00
|
|
|
|
2026-05-23 12:57:59 +00:00
|
|
|
- stage can self-skip when publish disabled or run upload disabled.
|
|
|
|
|
- validates prerequisite stage success and object-store availability.
|
2026-08-10 02:10:37 +00:00
|
|
|
- collects a deterministic run file list plus run `manifest.json`, excluding
|
|
|
|
|
`audio/**` and the run-local `extract/notarius-output/**` staging bundle.
|
|
|
|
|
- keeps run-local Notarius receipt and stderr diagnostics eligible for the run
|
|
|
|
|
archive.
|
2026-05-23 12:57:59 +00:00
|
|
|
- resolves publish output sources through runtime artifact catalog and manifest-aware resolution.
|
2026-08-10 02:10:37 +00:00
|
|
|
- publishes extraction lanes only through explicit configured output rules;
|
|
|
|
|
neither run-local nor durable Notarius bundles are scanned or uploaded wholesale.
|
2026-05-23 12:57:59 +00:00
|
|
|
- selected artifact filter applies to configured artifact sources only.
|
|
|
|
|
- locked outputs are skipped intentionally (including required ones).
|
|
|
|
|
- optional missing outputs are skipped; required missing unlocked outputs fail.
|
|
|
|
|
- writes remote current manifest before current run pointer.
|
|
|
|
|
|
|
|
|
|
## Metadata Signals
|
2026-08-09 21:50:21 +00:00
|
|
|
|
2026-05-23 12:57:59 +00:00
|
|
|
Includes counts/lists for:
|
|
|
|
|
- run uploads
|
|
|
|
|
- published output uploads
|
|
|
|
|
- previous uploads
|
|
|
|
|
- skipped optional outputs
|
|
|
|
|
- skipped unselected outputs
|
|
|
|
|
- locked outputs
|
|
|
|
|
- current-state key paths
|
|
|
|
|
- `current_pointer_written`
|
|
|
|
|
|
|
|
|
|
## Invariants
|
2026-08-09 21:50:21 +00:00
|
|
|
|
2026-05-23 12:57:59 +00:00
|
|
|
- `current/run_id.txt` is the remote commit marker and is written last.
|
2026-08-10 02:10:37 +00:00
|
|
|
- run upload excludes `audio/**` and `extract/notarius-output/**`.
|
|
|
|
|
- `extract/notarius.receipt.json` and `extract/notarius.stderr.log` remain
|
|
|
|
|
eligible run-record diagnostics.
|
2026-05-23 12:57:59 +00:00
|
|
|
- publish locks are not overridden by `--force`.
|
2026-08-09 21:50:21 +00:00
|
|
|
|
|
|
|
|
The commit boundary and cleanup gate are normative architecture invariants; see
|
|
|
|
|
[Architecture](../policy/architecture.md#publish-commit-boundary).
|
|
|
|
|
|
|
|
|
|
## Related Contracts And Tests
|
|
|
|
|
|
|
|
|
|
- [Configuration](../config.md#publish-configuration-summary) owns output and
|
|
|
|
|
static-lock fields.
|
|
|
|
|
- [Operations](../operations.md#publish-locks) owns remote lock lifecycle and
|
|
|
|
|
physical remote state.
|
|
|
|
|
- [Artifact Internals](artifacts.md) explains source resolution and current-state
|
|
|
|
|
helpers.
|
|
|
|
|
- Implementation and tests: `internal/stage/publish.go`,
|
|
|
|
|
`internal/stage/publish_test.go`, `internal/app/operator_helpers_test.go`,
|
|
|
|
|
`internal/app/post_publish_cleanup_test.go`
|