Repository navigation
Commit ce3462c
authored
🔎 Read a workflow run back without advancing it (#458)
* 🔎 Read a workflow run back without advancing it
`xmd workflow status`, `list` and `history` answer from immutable lifecycle
snapshots. The Deno provider opens each run's database read-only, on a
connection outside the pool execution uses, so what a reading command may do is
enforced by SQLite rather than promised: bytes, rows and file modes are the ones
it found. One foreign, damaged or unparseable candidate fails the whole list —
a shorter list would answer a question nobody asked.
History is lossless. Every retained event keeps its exact id, its complete
filtered protocol event and the Workspace root its row was already associated
with. An authored durable operation now carries where it was written under the
stable namespaced `executablemd.source-position` field, threaded from the
scanner through component imports, code-block contexts, bound-command snapshots
and every authored `createDurableOperation` call rather than parsed back out of
a formatted name. Only `type` and `name` decide replay, so identity is
unchanged. A present field that does not parse makes the entry unreadable, and
the diagnostic repeats nothing the field held.
The grammar is by action: only `start` reaches Git and a document, only `list`
takes a status filter, only the three inspections produce JSON, and an option an
action does not have is refused rather than ignored. `cancel` and `delete` are
actions of the same grammar and report that no lifecycle provider answers them;
their behavior, the executor lease and atomic transitions are the rest of #367.
* 🔒 Refuse a run database found where another run's id would put it
`list` recognized every candidate structurally and then trusted it. A healthy
version-1 database copied or renamed to another valid `<64-hex>.sqlite` name is
structurally perfect, so it came back as a second, entirely genuine-looking run
— retained identity accepted from a location implying a different one.
The check now belongs to the read-only snapshot every read passes rather than to
the one caller that had an id to compare against: a run's file name is the hash
of its id, so a database whose retained id does not name its file is a collision
or a copy, and the whole list fails with that condition. Exact inspection keeps
its own question — whether the run found is the run asked for — and both leave
every candidate unchanged.
WLI5b constructs the case: with the check removed it reports two runs.
* 🧾 Hold a retained run id to the rule a requested one is held to
`readRunRecord` checked that `workflow_run.run_id` was non-empty text; a request
was checked against that plus the NUL rule. Two checks that happened to agree
about most values are two checks, and the retained side was the weaker one — so
storage could hold an id no caller could ever name and hand it back as though it
addressed something.
`parseRunId` is now the one rule, and each side keeps its own vocabulary for
breaking it: a caller asked for something impossible, and storage holds a column
that does not parse. It states the rule without naming a host, because the
module it lives in is the provider-neutral one.
WLI5c constructs the case the rule is about — a retained id whose stored bytes
no reader sees, at that id's own hashed filename — and pins what actually
refuses it. On this host that is the location check, not the id rule: SQLite
keeps all fourteen bytes while every read stops at the NUL, so the reader
compares `release` against a file named for the longer string. The parity is
therefore a contract this commit settles, not something the regression proves.
* 🆔 Let a run id spell itself, wildcard characters and all
`status` and `history` refused a run id containing `*` or `?` as forbidden
wildcard syntax. A run id is opaque and carries no meaning beyond equality and
lifecycle addressing: the local caller may choose any storage-valid non-empty
id, and hashing is what keeps it from becoming a path. So `xmd workflow start
--id=release-*` created a run that no command could then ask about — the grammar
read a character in an id as a pattern nothing ever evaluates.
Every management action now hands its argument on exactly as written. Deletion's
contract is unchanged and was never this check: it expands nothing, so
`delete release-*` addresses the run called `release-*` and never a set of runs.
WFI11 starts `release-*`, `release-?` and `release-1` and inspects each from a
directory that is not a working tree; WLI9 does the same through the provider
with storage and Git spies installed. Both prove one id reaches one run and
matches neither neighbour. Restoring the refusal fails WFI11.
* 🎯 Attribute a wildcard-named run's history to that exact run
WLI9 proved `history release-*` returned three entries. Three runs of one
fixture have three histories that look exactly alike, so a lookup redirected to
a neighbour would have satisfied it — the assertion described the shape of an
answer rather than whose answer it was.
The fixture now stamps each run's id into the events it retains, so two runs
differ by what they hold and not only by the ids SQLite assigned. WLI9 reads
`release-*`'s rows straight out of its own file, outside the provider, and
compares event ids, events and Workspace roots whole; then it shows those ids
and events are neither neighbour's, and that each neighbour reads back as itself
on the same terms. The roots are compared against the independent read rather
than across runs, because three runs that never mutated a Workspace share the
one empty root and so it attributes nothing.
Redirecting `release-*`'s history to `release-?` now fails WLI9. Under the same
mutation the previous assertion passed: the neighbour also holds three rows.
---------
Co-authored-by: Taras Mankovski <[email protected]>1 parent a1de026 commit ce3462c
43 files changed
Lines changed: 2675 additions & 128 deletions
File tree
- packages
- cli
- src
- tests
- core
- src
- agent
- components
- tests
- test-agent/src/worker
- testing/src
- web/src
- workflow
- src
- deno
- workspace
- lifecycle
- storage
- tests
- specs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2028 | 2028 | | |
2029 | 2029 | | |
2030 | 2030 | | |
2031 | | - | |
| 2031 | + | |
| 2032 | + | |
2032 | 2033 | | |
2033 | 2034 | | |
2034 | 2035 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
1282 | 1285 | | |
1283 | 1286 | | |
1284 | 1287 | | |
| 1288 | + | |
1285 | 1289 | | |
1286 | 1290 | | |
1287 | 1291 | | |
1288 | 1292 | | |
1289 | 1293 | | |
1290 | | - | |
1291 | | - | |
| 1294 | + | |
| 1295 | + | |
1292 | 1296 | | |
1293 | 1297 | | |
1294 | 1298 | | |
| |||
1718 | 1722 | | |
1719 | 1723 | | |
1720 | 1724 | | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
1724 | 1728 | | |
1725 | 1729 | | |
1726 | 1730 | | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
1727 | 1737 | | |
1728 | 1738 | | |
1729 | 1739 | | |
| |||
1735 | 1745 | | |
1736 | 1746 | | |
1737 | 1747 | | |
1738 | | - | |
| 1748 | + | |
1739 | 1749 | | |
1740 | 1750 | | |
1741 | 1751 | | |
| |||
1745 | 1755 | | |
1746 | 1756 | | |
1747 | 1757 | | |
1748 | | - | |
| 1758 | + | |
1749 | 1759 | | |
1750 | | - | |
1751 | | - | |
| 1760 | + | |
| 1761 | + | |
1752 | 1762 | | |
1753 | 1763 | | |
1754 | 1764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
0 commit comments