52 lines
2.4 KiB
Markdown
52 lines
2.4 KiB
Markdown
# Application Orchestration Internals
|
|
|
|
`internal/app` owns top-level generation, batch, collection, inspection, and
|
|
notification ordering after the CLI has parsed arguments and loaded configuration.
|
|
|
|
## Generation
|
|
|
|
`GenerateDetailed` resolves one of the four report definitions, initializes an
|
|
optional debug root, and inspects the exact Promptkit prompt/profile before it
|
|
collects weather or writes managed state. A configured global profile selects
|
|
every report in the action; otherwise the exact prompt selects its default
|
|
logical profile. Inspection keeps only the selected profile ID and effective
|
|
backend/model needed by the project-owned execution contract. It then builds facts and modules,
|
|
saves the YAML data package, persists preparation metadata from the executor
|
|
callback, executes the prepared prompt, saves execution provenance and raw
|
|
output, validates generated text, renders Markdown, and optionally copies or
|
|
notifies from the managed report.
|
|
|
|
After a completed prompt run, each successfully written downstream artifact is
|
|
atomically added to the execution record before the corresponding metadata
|
|
rewrite. Later failures therefore leave the original Promptkit outcome and its
|
|
last durable set of reached paths inspectable.
|
|
|
|
Failure results retain all safe paths reached so far. Validation rejection
|
|
persists raw output and execution provenance but does not render a report.
|
|
|
|
## Batches
|
|
|
|
`RunBatchDetailed` constructs a single debug writer and uses the request's
|
|
single executor. Before collection it inspects Today, Tomorrow, and Daily for
|
|
morning, or Tomorrow and Daily for evening, deduplicating inspection of a
|
|
shared selected profile. It then collects once, plans eligible Daily dates, and calls the
|
|
same prompt-generation core sequentially for each planned report. Per-report
|
|
notification is suppressed; a failed report does not stop later reports.
|
|
|
|
Batch notification is skipped when disabled or when any report failed.
|
|
Successful notification uses the completed managed report paths only. Batch
|
|
items retain preparation, execution, and optional debug paths when reached.
|
|
|
|
## Inspection And Boundaries
|
|
|
|
Inspection loads persisted state only. It does not collect weather, invoke
|
|
Promptkit, or upload reports. The app coordinates project-owned contracts but
|
|
does not parse flags, load YAML, implement transport, construct provider SDKs,
|
|
or define report-period policy.
|
|
|
|
Focused checks:
|
|
|
|
```sh
|
|
go test ./internal/app ./internal/collect
|
|
```
|