# Workspace Artifact Layout Roadmap ## Purpose This roadmap defines the target local workspace layout for artifacts generated by weatherreporter. Weatherreporter currently writes managed local artifacts for each run and also maps the managed Markdown report into distributor bundle paths. Distributor bundle paths are publication paths and may include overwrite-oriented aliases such as `hourly/index.md`, `today/index.md`, and `daily//index.md`. Local workspace paths have a different job: they preserve run-specific source artifacts for inspection, troubleshooting, retry diagnosis, and future cleanup. ## Locked Decisions - Keep managed local workspace paths separate from distributor bundle paths. - Do not use distributor-style `index.md` aliases as the canonical managed local artifact paths. - Store managed local artifacts as immutable run artifacts. - Group every durable run artifact by artifact family, report artifact group, and local `valid_start_date`. - Use `valid_start_date` in the effective report timezone as the directory key. - Include the RunID in every durable run artifact filename. - Prefer artifact-kind-first filenames: `..`. - Keep optional `--out` and `--out-dir` copies separate from managed workspace artifacts. - Future cleanup should delete old managed artifact date directories by `valid_start_date`; cleanup should be narrow and opt-in. - If a local publication preview is added later, put it in a separate mirror tree and treat it as rebuildable output, not canonical run state. ## Target Managed Layout The target managed workspace layout is: ```text / reports///report..md snapshots///modules..json snapshots///metadata..json snapshots///generated_text_raw..json snapshots///generated_text_result..json snapshots///generated_text..json snapshots///render_context..json data-packages///data_package..yaml preflight///render..json notifications///distributor..json notifications/batches///distributor..json ``` `artifact_group` comes from the report definition. `valid_start_date` is the resolved report valid period start date in the effective report timezone. `batch_start_date` is the batch start date in the effective report timezone. Generated-text-template reports use the generated-text artifacts. Markdown-path reports omit generated-text artifacts they do not produce. ## Cleanup Compatibility The target layout is designed to support a future cleanup command that removes managed local artifacts where `valid_start_date` is more than two days before the current local date. Cleanup can operate by deleting matching date directories across managed artifact families: ```text reports/// snapshots/// data-packages/// preflight/// notifications/// ``` The command should not infer dates from RunIDs when the directory date is available. It should use the effective configured report timezone for "current date" and for interpreting `valid_start_date` directories. Batch notification cleanup should use `batch_start_date` under `notifications/batches//`. A future local publication mirror, if added, should be ignored by cleanup or rebuilt after cleanup; it should not be treated as run history. ## Intended Final State `internal/state` owns the managed workspace layout and path construction. The app layer continues to ask the state store for managed paths and records those paths in metadata and command results. Metadata links every artifact produced for a run using the new managed paths. Inspection and prior-snapshot lookup continue to read metadata rather than rendered Markdown text. Distributor uploads continue to use the managed Markdown report as the source file and map it to separately resolved distributor bundle paths. Existing workspace configuration fields remain meaningful: - `workspace.root` - `workspace.snapshots_dir` - `workspace.reports_dir` - `workspace.data_packages_dir` - `workspace.preflight_dir` - `workspace.notifications_dir` This roadmap does not require a new user-visible workspace path template config surface. ## Deferred Work - A cleanup command for managed local artifacts. - Cleanup dry-run output, retention configuration, and deletion confirmation behavior. - A rebuildable local publication mirror that uses distributor-style paths. - Migration tooling for existing pre-refactor workspace directories.