open-local-audit 0.66.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +34 -1
- package/dist/cli.js +22 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/workflow-config.d.ts +1 -0
- package/dist/workflow-config.js +17 -0
- package/dist/workflow-config.js.map +1 -1
- package/dist/workflow-state.d.ts +35 -0
- package/dist/workflow-state.js +294 -0
- package/dist/workflow-state.js.map +1 -0
- package/dist/workflow-status.d.ts +26 -0
- package/dist/workflow-status.js +154 -0
- package/dist/workflow-status.js.map +1 -0
- package/dist/workflow.d.ts +16 -0
- package/dist/workflow.js +191 -112
- package/dist/workflow.js.map +1 -1
- package/docs/architecture/workflow-command.md +7 -2
- package/docs/architecture/workflow-status.md +137 -0
- package/package.json +3 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Workflow Status
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
`workflow --status` reports the latest persisted state of one configured
|
|
6
|
+
workflow without running a stage or changing local state.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
open-local-audit workflow --config workflow.json --status
|
|
10
|
+
open-local-audit workflow --config workflow.json --status --format json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Status is read-only. It makes no network calls, resolves no API keys, creates
|
|
14
|
+
no directories, and writes no files. It reports persisted state; it does not
|
|
15
|
+
claim that a process recorded as running is still alive.
|
|
16
|
+
|
|
17
|
+
## Current-state manifest
|
|
18
|
+
|
|
19
|
+
A normal workflow run writes `workflow-state.json` below the configured
|
|
20
|
+
`outDir`. The versioned manifest contains:
|
|
21
|
+
|
|
22
|
+
- a fingerprint of the validated effective workflow configuration;
|
|
23
|
+
- the persisted lifecycle phase and current stage;
|
|
24
|
+
- the existing workflow stage summary;
|
|
25
|
+
- start and last-update timestamps;
|
|
26
|
+
- a sanitized failure description when execution fails.
|
|
27
|
+
|
|
28
|
+
The manifest does not contain environment variables, API keys, Google Places
|
|
29
|
+
queries, raw provider responses, or website response bodies. It is replaced
|
|
30
|
+
atomically through the existing guarded workflow output writer.
|
|
31
|
+
|
|
32
|
+
The initial manifest is persisted before the first workflow stage or network
|
|
33
|
+
call. Each stage start updates the current stage. After a stage succeeds, its
|
|
34
|
+
checkpoint is persisted before the manifest records the successful transition.
|
|
35
|
+
A controlled failure records `failed` only when its failure transition is
|
|
36
|
+
persisted; successful completion records `completed`. If persistence of the
|
|
37
|
+
failure transition fails, the last durable state remains authoritative and can
|
|
38
|
+
report as `running-or-interrupted`, while the workflow command still exits with
|
|
39
|
+
the underlying failure. An abrupt process exit also leaves the last persisted
|
|
40
|
+
running state.
|
|
41
|
+
|
|
42
|
+
## Checkpoint correlation
|
|
43
|
+
|
|
44
|
+
The manifest `checkpointHash` is `null` until the first successful checkpoint
|
|
45
|
+
write of the current run. After each successful stage checkpoint write, the
|
|
46
|
+
workflow stores the SHA-256 hash of the exact checkpoint bytes in the manifest.
|
|
47
|
+
`checkpointHash` gates only status `resumeAvailable` and status-generated resume
|
|
48
|
+
recommendations: status accepts correlation only when the manifest hash equals
|
|
49
|
+
the hash of a validated checkpoint. This prevents an older checkpoint for the
|
|
50
|
+
same configuration from enabling status resume advice when a newer run is
|
|
51
|
+
interrupted before writing its first checkpoint. Direct `workflow --resume`
|
|
52
|
+
validates and uses the v1 checkpoint independently; it does not read the state
|
|
53
|
+
manifest and is not gated by this correlation.
|
|
54
|
+
|
|
55
|
+
Failure to persist the initial manifest prevents stage execution. Failure to
|
|
56
|
+
persist a later transition stops the workflow before another stage begins and
|
|
57
|
+
does not discard the last verified checkpoint. The workflow must never report
|
|
58
|
+
completion when the completed state could not be persisted.
|
|
59
|
+
|
|
60
|
+
## Status report
|
|
61
|
+
|
|
62
|
+
Terminal and JSON output are rendered from the same versioned
|
|
63
|
+
`WorkflowStatusReport`. The report status is one of:
|
|
64
|
+
|
|
65
|
+
- `not-started`: no state or checkpoint exists for the configuration;
|
|
66
|
+
- `running-or-interrupted`: execution last persisted a running state, but
|
|
67
|
+
process liveness is unknown;
|
|
68
|
+
- `failed`: execution persisted a controlled failure;
|
|
69
|
+
- `completed`: every enabled stage completed successfully;
|
|
70
|
+
- `invalid`: state, configuration identity, checkpoint, or required managed
|
|
71
|
+
artifacts cannot be trusted.
|
|
72
|
+
|
|
73
|
+
The report includes the current stage, last successful stage, stage summaries,
|
|
74
|
+
last update time, artifact validation result, resume availability, and a
|
|
75
|
+
structured next action. JSON commands use an argument array instead of a shell
|
|
76
|
+
string so callers do not need to parse quoting.
|
|
77
|
+
|
|
78
|
+
`resumeAvailable` is true only when the report is not completed and the current
|
|
79
|
+
configuration has a valid checkpoint with the managed artifacts required by
|
|
80
|
+
resume. A `running-or-interrupted` report warns the operator to confirm that no
|
|
81
|
+
workflow process is still active before using `--resume`. An `invalid` report
|
|
82
|
+
never recommends automatic resume.
|
|
83
|
+
|
|
84
|
+
## Validation and compatibility
|
|
85
|
+
|
|
86
|
+
Status validates:
|
|
87
|
+
|
|
88
|
+
- the state structure and version;
|
|
89
|
+
- the effective configuration fingerprint;
|
|
90
|
+
- the existing checkpoint structure and version when resume state is present;
|
|
91
|
+
- the expected managed paths and required artifact integrity.
|
|
92
|
+
|
|
93
|
+
`workflow-state.json` is not added to `WorkflowManagedPaths` or the existing
|
|
94
|
+
checkpoint output map. The v1 checkpoint and `workflow-summary.json` contracts
|
|
95
|
+
remain unchanged, so checkpoints written by v0.65 and v0.66 remain valid for
|
|
96
|
+
`--resume`.
|
|
97
|
+
|
|
98
|
+
When no state manifest exists but a valid legacy checkpoint does, status derives
|
|
99
|
+
a conservative report from the checkpoint. A fully completed checkpoint reports
|
|
100
|
+
`completed`; any incomplete checkpoint reports `running-or-interrupted` and may
|
|
101
|
+
offer resume after normal checkpoint validation. A malformed or mismatched
|
|
102
|
+
legacy checkpoint reports `invalid`. This fallback does not rewrite or migrate
|
|
103
|
+
the old files.
|
|
104
|
+
|
|
105
|
+
## CLI and exit behavior
|
|
106
|
+
|
|
107
|
+
`--status`, `--check`, `--plan`, and `--resume` are mutually exclusive.
|
|
108
|
+
`--format terminal|json` is accepted with `--status`, `--check`, or `--plan`.
|
|
109
|
+
Supplying `--format` for normal execution or resume remains invalid.
|
|
110
|
+
|
|
111
|
+
`completed`, `not-started`, and `running-or-interrupted` return exit code `0`.
|
|
112
|
+
`failed`, `invalid`, invalid configuration, and invalid CLI usage return exit
|
|
113
|
+
code `1`. JSON mode writes exactly one report object to standard output; usage
|
|
114
|
+
and configuration errors retain the existing standard-error behavior.
|
|
115
|
+
|
|
116
|
+
Recommended next actions are:
|
|
117
|
+
|
|
118
|
+
1. `not-started`: run the workflow normally.
|
|
119
|
+
2. `failed` with a valid checkpoint: run with `--resume`.
|
|
120
|
+
3. `failed` without a checkpoint: run the workflow normally.
|
|
121
|
+
4. `running-or-interrupted`: first confirm that no workflow process is active,
|
|
122
|
+
then use `--resume` only when the report marks it available.
|
|
123
|
+
5. `completed`: no action.
|
|
124
|
+
6. `invalid`: inspect or replace the untrusted local state; do not resume it.
|
|
125
|
+
|
|
126
|
+
## Verification contract
|
|
127
|
+
|
|
128
|
+
Automated coverage must prove:
|
|
129
|
+
|
|
130
|
+
- every manifest lifecycle transition and atomic replacement behavior;
|
|
131
|
+
- not-started, completed, controlled-failure, and interrupted status reports;
|
|
132
|
+
- configuration fingerprint mismatch and managed-artifact modification;
|
|
133
|
+
- resume availability with valid, missing, and invalid checkpoints;
|
|
134
|
+
- v0.65 and v0.66 checkpoint compatibility;
|
|
135
|
+
- CLI option conflicts, terminal and JSON rendering, and exit codes;
|
|
136
|
+
- no writes, directory creation, network calls, or secret resolution during
|
|
137
|
+
status inspection.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-local-audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"description": "Open-source website and local presence auditor for small businesses.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"docs/architecture/workflow-command.md",
|
|
19
19
|
"docs/architecture/workflow-preflight.md",
|
|
20
20
|
"docs/architecture/workflow-plan.md",
|
|
21
|
-
"docs/architecture/workflow-resume.md"
|
|
21
|
+
"docs/architecture/workflow-resume.md",
|
|
22
|
+
"docs/architecture/workflow-status.md"
|
|
22
23
|
],
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "tsc -p tsconfig.build.json",
|