Document shared glossaries and downstream preflight
This commit is contained in:
@@ -61,10 +61,10 @@ state without constructing or invoking stage-execution adapters. The shared
|
||||
command configuration loader may still use object storage to retrieve a missing
|
||||
remote session file before planning begins.
|
||||
|
||||
Before a run starts stage attempts, the application projects selected work and
|
||||
uses the invocation's Scriptorium runner for any needed requirements checks.
|
||||
The same runner is then available to generation. Explicit session validation
|
||||
uses an invocation-owned factory and the shared checker. See
|
||||
After preparation, the application projects remaining selected work and uses
|
||||
invocation-owned Audita and Scriptorium runners for applicable readiness checks.
|
||||
The same runners are available to processing. Explicit session validation uses
|
||||
existing prepared inputs and invocation-owned factories. See
|
||||
[preflight internals](preflight.md).
|
||||
|
||||
Notarius is composed only when extraction is enabled; the extract stage owns
|
||||
|
||||
@@ -37,8 +37,9 @@ from `pipeline.notarius.outputs`; the Notarius index has no selectable source
|
||||
ID.
|
||||
|
||||
Prepared stable source IDs are `narratio.input.players`,
|
||||
`narratio.input.party`, `narratio.input.glossary`, and
|
||||
`narratio.input.spell_catalog`. Artifact policy owns their canonical manifest
|
||||
`narratio.input.party`, `narratio.input.glossary.party`,
|
||||
`narratio.input.glossary.campaign`, `narratio.input.glossary.setting`,
|
||||
`narratio.input.glossary.spells`, and `narratio.input.spell_catalog`. Artifact policy owns their canonical manifest
|
||||
kind and prepared filename vocabulary. Canonical party mode preserves the
|
||||
party source bytes in the party record and supplies the players record from the
|
||||
deterministic `derived_from_party` projection; both remain ordinary prepared
|
||||
|
||||
@@ -37,8 +37,8 @@ Restore planner action kinds:
|
||||
|
||||
Planner behavior:
|
||||
|
||||
- prepared campaign, session, and party inputs are restored from their declared
|
||||
immutable run objects to their canonical local input paths;
|
||||
- prepared campaign, session, party, and all four glossary inputs are restored
|
||||
from declared immutable run objects to their canonical local input paths;
|
||||
- a new-protocol restore uses only the selected commit's declared artifact set;
|
||||
each action carries that artifact's immutable key, checksum, size, and
|
||||
generation;
|
||||
|
||||
@@ -61,6 +61,15 @@ redaction and credential reference metadata. Load failures retain native errors
|
||||
and source evidence; domain commands use `ckconfig.AdaptDiagnostics` for their
|
||||
presentation without rewriting diagnostic records.
|
||||
|
||||
## Glossary Derivation
|
||||
|
||||
`internal/config` adapts resolved selections and canonical party context to
|
||||
`internal/glossary`. That owner loads native vocabulary, validates the pinned
|
||||
schema, projects the roster, and serializes four deterministic documents.
|
||||
Preparation and resume comparison share this resolver. Derived vocabulary does
|
||||
not replace the authored ConfigKit results used by native inspection. Catalog
|
||||
entry imports use the source file's native relative context.
|
||||
|
||||
## Canonical Party And Derived Catalog
|
||||
|
||||
File-backed party loading supports imports; contextless `ParseParty` accepts
|
||||
@@ -86,7 +95,7 @@ External roster shape belongs in the [party contract](../integrations/party.md).
|
||||
|
||||
## Safe Persistence And Semantic Resume
|
||||
|
||||
Preparation materializes standalone campaign/session/party/players inputs and
|
||||
Preparation materializes standalone campaign/session/party/players and four glossary inputs and
|
||||
a secret-safe pipeline projection. The projection preserves credential names,
|
||||
family declarations, numeric values, and null/empty distinctions. It is a
|
||||
persistence service, not a fabricated native result. An effective digest is
|
||||
|
||||
@@ -374,3 +374,12 @@ where the last session transition can require operator interpretation.
|
||||
- Package tests: `internal/manifest/*_test.go`
|
||||
- Assembled execution behavior: `internal/app/runner_test.go`,
|
||||
`internal/app/run_selection_test.go`
|
||||
|
||||
## Prepared Glossary Evidence
|
||||
|
||||
Preparation records four distinct glossary input kinds with canonical paths,
|
||||
checksums, sizes, and provenance. Polish records the resolved glossary identity
|
||||
evidence used for its result; preflight itself records no stage success. Publish
|
||||
and restore carry the prepared inputs using their declared manifest identities.
|
||||
See [prepare](stage-prepare.md), [polish](stage-polish.md), and
|
||||
[artifact internals](artifacts.md).
|
||||
|
||||
@@ -28,10 +28,9 @@ progress and artifact services resolve durable inputs and outputs.
|
||||
|
||||
The pipeline runner follows one explicit invocation lifecycle: inspect bounded
|
||||
prerequisites without mutation, prepare the workspace layout, acquire one
|
||||
session lock, load or create the authoritative session manifest, check projected
|
||||
Scriptorium work, compose only
|
||||
the collaborators needed by the selected range, execute each selected stage in
|
||||
order, finalize terminal state, release resources, and return a possibly partial
|
||||
session lock, load or create the authoritative session manifest, complete or
|
||||
reuse selected preparation, check projected downstream work, compose only the
|
||||
collaborators needed by selected work, execute each selected stage in order, finalize terminal state, release resources, and return a possibly partial
|
||||
summary with preserved failure causes. Narrow terminal local persistence detaches
|
||||
cancellation; active work retains the canceled operation context. Cleanup, when
|
||||
selected, is the ordinary final stage rather than runner finalization work.
|
||||
@@ -46,7 +45,8 @@ failed stage or required manifest save prevents later stages from starting.
|
||||
| Application orchestration | `internal/app` | Native CommandKit declarations/reporting, lazy configuration selection, secret-file environment loading, production composition, session locking, planning, execution, restore, and user-facing reporting. |
|
||||
| Configuration | [`internal/config`](configuration.md) | Typed ConfigKit results and lifecycle defaults, imports/overlays, canonical party loading, separate catalog/player/publication derivation, session templating, and validation. |
|
||||
| Pipeline stages | `internal/stage` | Canonical stage registry, shared stage contract, execution dependencies, and implemented stage behavior. |
|
||||
| Prompt preflight | [`internal/preflight`](preflight.md) | Assess native prompt requirements against intended bindings for execution and validation. |
|
||||
| Glossaries | `internal/glossary` | Native vocabulary resolution, schema validation, party projection, and deterministic documents. |
|
||||
| Downstream preflight | [`internal/preflight`](preflight.md) | Assess Audita readiness and native prompt requirements for execution and validation. |
|
||||
| External boundaries | `internal/adapters`, `internal/audio` | WhisperX HTTP, downstream subprocesses, notification, object storage, and S3 audio materialization behind Narratio contracts. |
|
||||
| Manifests | `internal/manifest` | Durable session progress, stage transitions, validation, and atomic persistence. |
|
||||
| Artifacts and paths | `internal/artifacts`, `internal/pathsafe` | Artifact identities and resolution, local and remote path/key models, current-state discovery, and confined relative destinations. |
|
||||
|
||||
@@ -1,37 +1,33 @@
|
||||
# Internal: Prompt Requirements Preflight
|
||||
# Internal: Downstream Preflight
|
||||
|
||||
The application selects intended Scriptorium requests after acquiring final
|
||||
domain configuration. For execution, it projects the bounded plan against a
|
||||
clone of the locked manifest using the same stage decisions and analysis work
|
||||
planner as `session plan`. Enabled trim is inspected when projected to run;
|
||||
analysis targets come from the projected execution order, including scheduled
|
||||
disabled prerequisites and excluding reusable work. The projection is not an
|
||||
execution commitment: earlier outputs can change later decisions.
|
||||
The application performs downstream checks after selected preparation completes
|
||||
or is reused and before remaining selected processing. It projects remaining
|
||||
work against a clone of the locked manifest using the same stage decisions and
|
||||
analysis planner as `session plan`. Projected polish selects Audita; projected
|
||||
enabled trim and analysis select Scriptorium requirements. A projection is not
|
||||
an execution commitment. Empty target sets invoke no checker.
|
||||
|
||||
For `session validate`, the application selects enabled definitions and their
|
||||
configured prerequisite closure independently of output reuse. Both entry
|
||||
points construct effective contexts through stage-owned helpers and call
|
||||
`internal/preflight`. Input-map keys remain prompt binding names, distinct from
|
||||
Narratio source IDs. No artifact is materialized or fetched for this check.
|
||||
Audita receives the verified four prepared glossary files and the same
|
||||
processing selectors and destinations, with an embedded synthetic transcript.
|
||||
The adapter runs native preflight with provider smoke enabled, captures its
|
||||
transient diagnostics, and preserves exit classification. No preflight result
|
||||
is cached as a stage. A failure stops later processing without presenting it as
|
||||
complete.
|
||||
|
||||
The checker invokes the adapter sequentially and assesses native structured
|
||||
findings. Definite missing required bindings and unsupplied required variables
|
||||
are errors. An optional source for a required prompt input, conditional
|
||||
requirements, incomplete discovery, and discovery issues produce warnings.
|
||||
It retains earlier findings and underlying inspection errors, and stops on
|
||||
cancellation. The application formats findings for its invocation reporter or
|
||||
validation report; the checker does not mutate manifests or acquire config.
|
||||
For `session validate`, the application selects enabled downstream definitions
|
||||
independently of reuse and checks the existing prepared manifest. It does not
|
||||
resolve live files into candidate glossary projections or run prepare. The
|
||||
Audita probe under `runs/.validation` can create or probe directories and contact
|
||||
providers; it does not update the session manifest. Discovery and provider
|
||||
checks do not establish real-transcript feasibility or editorial quality.
|
||||
|
||||
The run hook executes before stage attempts or live pre-execution invalidation.
|
||||
It reuses an injected Scriptorium runner or creates the invocation-owned runner
|
||||
that generation later uses. Empty target sets invoke no inspector. Validation
|
||||
uses its own invocation-owned factory and creates no execution workspace,
|
||||
run directory, lock, report file, or manifest update. Discovery can read
|
||||
Scriptorium configuration and resources, but does not call a model or establish
|
||||
future input contents. Actual execution and input resolution remain authoritative.
|
||||
Scriptorium input-map keys remain binding names distinct from Narratio source
|
||||
IDs. Missing required bindings or variables and inspection failures are errors;
|
||||
optional sources for required inputs, conditional requirements, incomplete
|
||||
discovery, and discovery issues produce warnings. The checker preserves earlier
|
||||
findings and stops on cancellation. Actual input resolution remains authoritative.
|
||||
|
||||
See the [Scriptorium contract](../integrations/scriptorium.md),
|
||||
See [Audita](../integrations/audita.md), [Scriptorium](../integrations/scriptorium.md),
|
||||
[CLI](../cli.md#session-validate), and [operations](../operations.md#prompt-requirements-preflight).
|
||||
Implementation and focused tests are in `internal/preflight`,
|
||||
`internal/app/preflight_targets.go`, `internal/app/runner_preflight.go`,
|
||||
`internal/app/session_inspection_command.go`, and `internal/stage/scriptorium_vars.go`.
|
||||
Implementation and tests are in `internal/preflight`, `internal/app/runner_preflight.go`,
|
||||
`internal/app/session_inspection_command.go`, and `internal/adapters/audita/preflight.go`.
|
||||
|
||||
@@ -20,7 +20,7 @@ dependency order, and safely materialize validated outputs.
|
||||
Supported source families:
|
||||
- built-ins: `narratio.transcript.*`, `narratio.bounds.session`
|
||||
- prepared stable inputs: `narratio.input.players`, `narratio.input.party`,
|
||||
`narratio.input.glossary`, `narratio.input.spell_catalog`
|
||||
`narratio.input.glossary.{party,campaign,setting,spells}`, `narratio.input.spell_catalog`
|
||||
- configured artifacts: `narratio.artifact.<key>`
|
||||
- extraction lanes: `narratio.extraction.<key>`
|
||||
- previous-session cache: `narratio.previous_session.artifact.<key>`
|
||||
|
||||
@@ -1,58 +1,23 @@
|
||||
# Stage: polish
|
||||
|
||||
## Purpose
|
||||
Polish resolves the base transcript from verified merge evidence and all four
|
||||
prepared glossary documents from manifest-backed input records. It invokes the
|
||||
Audita adapter with those paths and configured downstream selectors, then
|
||||
validates the returned transcript before promoting `transcripts/polished.json`.
|
||||
The transcript is the only canonical output. Available ordinary reports,
|
||||
stdout/stderr, and the generated invocation record are run-local diagnostics;
|
||||
Audita's work directory is separately selected. The [Audita contract](../integrations/audita.md)
|
||||
owns invocation and diagnostic behavior.
|
||||
|
||||
Run Audita polishing on base transcript and produce polished transcript.
|
||||
Polish records the prepared glossary identities as resume evidence alongside
|
||||
semantic configuration. Changes to effective glossary content require new
|
||||
polish work through ordinary prepare invalidation. Credentials, executable,
|
||||
timeout, and diagnostics are operational. Narratio does not fingerprint the
|
||||
contents of Audita-owned configuration or profiles: force polish after changing
|
||||
those files behind unchanged selectors. Older evidence is reconsidered when
|
||||
polish is selected; a downstream-only invocation does not eagerly run it.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `transcripts/base.json`
|
||||
- `inputs/glossary.yml`
|
||||
|
||||
## Outputs
|
||||
|
||||
- `transcripts/polished.json`
|
||||
|
||||
The transcript is the only canonical output. Available `errors.yml`,
|
||||
`recoveries.yml`, and `report.md` remain beside the run-local transcript and
|
||||
are recorded as diagnostics, not artifact outputs.
|
||||
|
||||
## Key Behavior
|
||||
|
||||
- resolves base transcript only from verified merge manifest output evidence.
|
||||
- invokes an Audita v2 runner with external configuration selectors and
|
||||
explicitly forwarded provider credentials; the invocation supplies paths.
|
||||
- validates processed transcript structure (`segments` array required).
|
||||
- validates reported diagnostic paths against the three fixed adjacent names.
|
||||
- materializes only the canonical transcript; records available reports with
|
||||
stdout/stderr logs, generated invocation, and safe adapter metadata.
|
||||
|
||||
## Invariants
|
||||
|
||||
- polished transcript schema validation is mandatory.
|
||||
- reports are optional diagnostics; Audita's external configuration may disable
|
||||
them. A failed invocation never promotes an incidental transcript.
|
||||
|
||||
## Resume Semantics
|
||||
|
||||
Version 2 semantic evidence covers Audita's config path, downstream overlay,
|
||||
proposal and validation profile selectors, ordered module selection (including
|
||||
the distinction between omission and an explicit empty list), transcript
|
||||
description, output schema, and canonical polished-transcript identity.
|
||||
Credentials, executable path, timeout, and diagnostics are operational and do
|
||||
not invalidate a successful result. Public credential reference names may
|
||||
participate in configuration provenance but never expose resolved values.
|
||||
|
||||
Narratio fingerprints selections, not the contents of Audita-owned config or
|
||||
profiles. Force `polish` after changing those files behind unchanged selections.
|
||||
When polish is selected, older semantic evidence is reconsidered and the stage
|
||||
reruns; a downstream-only invocation does not eagerly run polish.
|
||||
|
||||
## Related Contracts And Tests
|
||||
|
||||
- [Audita](../integrations/audita.md) owns subprocess, validation, and failure
|
||||
semantics.
|
||||
- [Configuration](../config.md#pipeline) owns operator-selected Audita values.
|
||||
- Implementation and tests: `internal/stage/polish.go`,
|
||||
`internal/stage/polish_test.go`,
|
||||
`internal/stage/semantic_contracts_refinement.go`
|
||||
A failed invocation does not promote an incidental output. Preflight is an
|
||||
invocation check after preparation, not a successful polish record. See
|
||||
[preflight internals](preflight.md), `internal/stage/polish.go`,
|
||||
`internal/stage/polish_resume.go`, and their focused tests.
|
||||
|
||||
@@ -7,7 +7,7 @@ Materialize canonical current-session inputs before processing stages.
|
||||
## Inputs
|
||||
|
||||
- resolved campaign, session, and pipeline configuration
|
||||
- stable input files (`speakers`, `autocorrect`, `glossary`, `players`, `party`)
|
||||
- stable speakers and autocorrect inputs, the canonical party, and optional glossary selections
|
||||
- optional spell-catalog overlay
|
||||
- one resolved local or S3 audio source
|
||||
- enabled configured artifact input requirements for previous-session sources
|
||||
@@ -19,7 +19,7 @@ Materialize canonical current-session inputs before processing stages.
|
||||
- `inputs/pipeline.resolved.yml`
|
||||
- `inputs/speakers.yml`
|
||||
- `inputs/autocorrect.yml`
|
||||
- `inputs/glossary.yml`
|
||||
- `inputs/glossaries/{party,campaign,setting,spells}.yml`
|
||||
- `inputs/players.yml`
|
||||
- `inputs/party.yml`
|
||||
- optional `inputs/spell_catalog.json`
|
||||
@@ -30,7 +30,9 @@ Materialize canonical current-session inputs before processing stages.
|
||||
|
||||
## Key Behavior
|
||||
|
||||
- validates required config/store state.
|
||||
- validates required config/store state and resolves selected vocabulary before audio work.
|
||||
- derives the party glossary and resolves the remaining named collections through
|
||||
`internal/glossary`; writes all four with checksum, size, and provenance.
|
||||
- enforces local audio vs S3 audio mutual exclusivity.
|
||||
- rejects duplicate explicit local audio sources after resolution.
|
||||
- gives distinct local source paths with the same basename deterministic unique
|
||||
@@ -76,8 +78,8 @@ canonical names, and effective bytes are equivalent.
|
||||
The fingerprint deliberately does not read or rehash large audio. Prepared
|
||||
input checksums remain the content provenance. Before reusing success, prepare
|
||||
validates every durable prepared copy and compares current stable-input bytes,
|
||||
effective campaign/session, canonical party and derived-player bytes, local audio
|
||||
membership/checksums, or S3 key/size/entity-tag identity with that provenance.
|
||||
effective campaign/session, canonical party, derived-player and resolved glossary
|
||||
bytes, local audio membership/checksums, or S3 key/size/entity-tag identity with that provenance.
|
||||
Source relocation with equivalent effective documents, names, and bytes remains
|
||||
reusable; changed or unavailable evidence causes a normal prepare rerun.
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ supports remote loading when no authored session override is available. The
|
||||
canonical file, aggregate output, stale/failed/unselected record, or
|
||||
mismatched path, size, or checksum remains unavailable. Built-in and
|
||||
extraction sources likewise require their own current manifest evidence.
|
||||
- includes the four manifest-backed prepared glossary documents with their
|
||||
declared input identities for restore;
|
||||
- publishes extraction lanes only through explicit configured output rules;
|
||||
neither run-local nor durable Notarius bundles are scanned or uploaded wholesale.
|
||||
- selected artifact filter applies to configured artifact sources only.
|
||||
|
||||
@@ -32,6 +32,9 @@ materialized into canonical session paths before stage success. Managed
|
||||
previous-session cache paths remain session-durable and are never redirected
|
||||
into run-local output space.
|
||||
|
||||
Polish uses run-local transcript, report/log, and debug destinations; validation
|
||||
probes use `runs/.validation`. These are not latest-attempt views.
|
||||
|
||||
Extraction uses run-local receipt, stderr, and output-root helpers, then
|
||||
validates and renames the external bundle to the unique immutable Notarius
|
||||
bundle path supplied by `internal/artifacts`. Exact physical paths belong in
|
||||
|
||||
Reference in New Issue
Block a user