@yaks/tracker 0.0.0-stage → 0.2.36

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.
Files changed (198) hide show
  1. package/Histogram.js +71 -0
  2. package/Histogram.js.map +1 -0
  3. package/Histogram.ts +100 -0
  4. package/LICENSE +202 -0
  5. package/README.md +639 -2
  6. package/_dist/brief.d.ts +25 -0
  7. package/_dist/brief.d.ts.map +1 -0
  8. package/_dist/changes.d.ts +9 -0
  9. package/_dist/changes.d.ts.map +1 -0
  10. package/_dist/chart.d.ts +24 -0
  11. package/_dist/chart.d.ts.map +1 -0
  12. package/_dist/digest.d.ts +64 -0
  13. package/_dist/digest.d.ts.map +1 -0
  14. package/_dist/effects.d.ts +73 -0
  15. package/_dist/effects.d.ts.map +1 -0
  16. package/_dist/errors.d.ts +14 -0
  17. package/_dist/errors.d.ts.map +1 -0
  18. package/_dist/everywhere.d.ts +13 -0
  19. package/_dist/everywhere.d.ts.map +1 -0
  20. package/_dist/fault.d.ts +29 -0
  21. package/_dist/fault.d.ts.map +1 -0
  22. package/_dist/file.d.ts +6 -0
  23. package/_dist/file.d.ts.map +1 -0
  24. package/_dist/fixtime.d.ts +20 -0
  25. package/_dist/fixtime.d.ts.map +1 -0
  26. package/_dist/frames.d.ts +6 -0
  27. package/_dist/frames.d.ts.map +1 -0
  28. package/_dist/graph.d.ts +3 -0
  29. package/_dist/graph.d.ts.map +1 -0
  30. package/_dist/group.d.ts +21 -0
  31. package/_dist/group.d.ts.map +1 -0
  32. package/_dist/instrument.d.ts +37 -0
  33. package/_dist/instrument.d.ts.map +1 -0
  34. package/_dist/intake.d.ts +21 -0
  35. package/_dist/intake.d.ts.map +1 -0
  36. package/_dist/merge.d.ts +11 -0
  37. package/_dist/merge.d.ts.map +1 -0
  38. package/_dist/mod.d.ts +7 -0
  39. package/_dist/mod.d.ts.map +1 -0
  40. package/_dist/model.d.ts +20 -0
  41. package/_dist/model.d.ts.map +1 -0
  42. package/_dist/outage.d.ts +7 -0
  43. package/_dist/outage.d.ts.map +1 -0
  44. package/_dist/people.d.ts +3 -0
  45. package/_dist/people.d.ts.map +1 -0
  46. package/_dist/poll.d.ts +101 -0
  47. package/_dist/poll.d.ts.map +1 -0
  48. package/_dist/poll_thread.d.ts +8 -0
  49. package/_dist/poll_thread.d.ts.map +1 -0
  50. package/_dist/reading.d.ts +34 -0
  51. package/_dist/reading.d.ts.map +1 -0
  52. package/_dist/remote.d.ts +61 -0
  53. package/_dist/remote.d.ts.map +1 -0
  54. package/_dist/report.d.ts +324 -0
  55. package/_dist/report.d.ts.map +1 -0
  56. package/_dist/resolution.d.ts +22 -0
  57. package/_dist/resolution.d.ts.map +1 -0
  58. package/_dist/routes.d.ts +33 -0
  59. package/_dist/routes.d.ts.map +1 -0
  60. package/_dist/script.d.ts +8 -0
  61. package/_dist/script.d.ts.map +1 -0
  62. package/_dist/service.d.ts +30 -0
  63. package/_dist/service.d.ts.map +1 -0
  64. package/_dist/sync_health.d.ts +4 -0
  65. package/_dist/sync_health.d.ts.map +1 -0
  66. package/_dist/ticket.d.ts +14 -0
  67. package/_dist/ticket.d.ts.map +1 -0
  68. package/_dist/tools.d.ts +39 -0
  69. package/_dist/tools.d.ts.map +1 -0
  70. package/_dist/trace-intake.d.ts +25 -0
  71. package/_dist/trace-intake.d.ts.map +1 -0
  72. package/_dist/views.d.ts +11 -0
  73. package/_dist/views.d.ts.map +1 -0
  74. package/_dist/vocab.d.ts +9 -0
  75. package/_dist/vocab.d.ts.map +1 -0
  76. package/box.json +51 -0
  77. package/brief.js +86 -0
  78. package/brief.js.map +1 -0
  79. package/brief.ts +120 -0
  80. package/changes.js +57 -0
  81. package/changes.js.map +1 -0
  82. package/changes.ts +70 -0
  83. package/chart.js +186 -0
  84. package/chart.js.map +1 -0
  85. package/chart.ts +193 -0
  86. package/deno.json +1 -0
  87. package/digest.js +329 -0
  88. package/digest.js.map +1 -0
  89. package/digest.ts +406 -0
  90. package/effects.js +136 -0
  91. package/effects.js.map +1 -0
  92. package/effects.ts +178 -0
  93. package/errors.js +130 -0
  94. package/errors.js.map +1 -0
  95. package/errors.ts +185 -0
  96. package/everywhere.js +46 -0
  97. package/everywhere.js.map +1 -0
  98. package/everywhere.ts +66 -0
  99. package/fault.js +65 -0
  100. package/fault.js.map +1 -0
  101. package/fault.ts +107 -0
  102. package/file.js +87 -0
  103. package/file.js.map +1 -0
  104. package/file.ts +93 -0
  105. package/fixtime.js +67 -0
  106. package/fixtime.js.map +1 -0
  107. package/fixtime.ts +86 -0
  108. package/frames.js +77 -0
  109. package/frames.js.map +1 -0
  110. package/frames.ts +69 -0
  111. package/graph.js +7 -0
  112. package/graph.js.map +1 -0
  113. package/graph.ts +8 -0
  114. package/group.js +444 -0
  115. package/group.js.map +1 -0
  116. package/group.ts +533 -0
  117. package/inspect.js +471 -0
  118. package/inspect.js.map +1 -0
  119. package/inspect.ts +693 -0
  120. package/instrument.js +69 -0
  121. package/instrument.js.map +1 -0
  122. package/instrument.ts +93 -0
  123. package/intake.js +43 -0
  124. package/intake.js.map +1 -0
  125. package/intake.ts +84 -0
  126. package/merge.js +126 -0
  127. package/merge.js.map +1 -0
  128. package/merge.ts +115 -0
  129. package/migrate.ts +36 -0
  130. package/mod.js +8 -0
  131. package/mod.js.map +1 -0
  132. package/mod.ts +19 -0
  133. package/model.js +8 -0
  134. package/model.js.map +1 -0
  135. package/model.ts +27 -0
  136. package/outage.js +129 -0
  137. package/outage.js.map +1 -0
  138. package/outage.ts +158 -0
  139. package/package.json +133 -4
  140. package/page.d.ts +2 -0
  141. package/page.js +905 -0
  142. package/people.js +51 -0
  143. package/people.js.map +1 -0
  144. package/people.ts +82 -0
  145. package/poll.js +277 -0
  146. package/poll.js.map +1 -0
  147. package/poll.ts +411 -0
  148. package/poll_thread.js +104 -0
  149. package/poll_thread.js.map +1 -0
  150. package/poll_thread.ts +126 -0
  151. package/poll_worker.ts +45 -0
  152. package/reading.js +122 -0
  153. package/reading.js.map +1 -0
  154. package/reading.ts +162 -0
  155. package/reconcile.js +113 -0
  156. package/reconcile.js.map +1 -0
  157. package/reconcile.ts +130 -0
  158. package/remote.js +312 -0
  159. package/remote.js.map +1 -0
  160. package/remote.ts +397 -0
  161. package/report.js +825 -0
  162. package/report.js.map +1 -0
  163. package/report.ts +944 -0
  164. package/resolution.js +114 -0
  165. package/resolution.js.map +1 -0
  166. package/resolution.ts +123 -0
  167. package/routes.js +130 -0
  168. package/routes.js.map +1 -0
  169. package/routes.ts +163 -0
  170. package/script.js +13 -0
  171. package/script.js.map +1 -0
  172. package/script.ts +16 -0
  173. package/service.js +174 -0
  174. package/service.js.map +1 -0
  175. package/service.ts +215 -0
  176. package/spread.js +94 -0
  177. package/spread.js.map +1 -0
  178. package/spread.ts +101 -0
  179. package/sync_health.js +36 -0
  180. package/sync_health.js.map +1 -0
  181. package/sync_health.ts +65 -0
  182. package/ticket.js +6 -0
  183. package/ticket.js.map +1 -0
  184. package/ticket.ts +24 -0
  185. package/tools.js +305 -0
  186. package/tools.js.map +1 -0
  187. package/tools.ts +411 -0
  188. package/trace-intake.js +164 -0
  189. package/trace-intake.js.map +1 -0
  190. package/trace-intake.ts +148 -0
  191. package/views.js +247 -0
  192. package/views.js.map +1 -0
  193. package/views.ts +254 -0
  194. package/vocab.js +20 -0
  195. package/vocab.js.map +1 -0
  196. package/vocab.json +834 -0
  197. package/vocab.ts +14 -0
  198. package/yak-tracker@.service +22 -0
package/README.md CHANGED
@@ -1,3 +1,640 @@
1
- # Temporary Holding Version
1
+ # @yaks/tracker
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An **error** is a sample of a mistake, representing `error.hits` occurrences
4
+ (one when omitted); a **bug** groups errors with the same fault: the broken
5
+ entity's kind, the message without its volatile parts and the top frame of the
6
+ stack. A failure Cloudflare names by its `reference` is the platform's, so its
7
+ fault has no frame: one storage reset caught by several calls is one bug. Intake
8
+ keeps a reporter's UUID so a queue or spool resend is the same sample. Grouping
9
+ runs downstream and atomically links it and adds its hits to `bug.hits`. All
10
+ references may name entities in other stores.
11
+
12
+ Capture keeps no request query, headers, body or console arguments, and no
13
+ credential an address carries: a page token or link code in a `~` segment, a
14
+ ticket after `_preview/`, a URL's user and password, or a query parameter named
15
+ for a secret (`./report` `redacted`). It withholds them from every component of
16
+ every row it captures, so no bug title, occurrence, letter or digest quotes one.
17
+
18
+ | Export | Owns |
19
+ | -------------- | --------------------------------------------------------------------------------------------------- |
20
+ | `.` | Fault keys, grouping patches, regression and retention |
21
+ | `./vocab` | Tracker words, RAM computations and SQL-derived expressions |
22
+ | `./report` | Capture, transport, `coalesce` and a page's reports |
23
+ | `./instrument` | A class whose construction and every method run inside a given reporting boundary |
24
+ | `./page` | Classic browser capture script and twenty breadcrumbs |
25
+ | `./effects` | `error_group`, `error_frames`, `bug_settle`, `bug_digest` |
26
+ | `./views` | Bug pages, list rows, error frames and the Bugs destination |
27
+ | `./tools` | `bug_list`, `bug_show`, `bug_resolve`, `bug_archive`, `bug_reopen`, `tracker_retry`, `tracker_drop` |
28
+ | `./service` | Spool record admission and acknowledgement |
29
+ | `./remote` | Signed remote reads, bug marks and durable error delivery |
30
+ | `./poll` | A polled watch of the platform tracker's bugs, or a space tracker's, with marks |
31
+ | `./fixtime` | Time to fix: first seen (or regressed) to resolved |
32
+ | `./digest` | The daily digest of bugs: its letter, its wake and its sending |
33
+ | `./chart` | The digest's chart as a PNG, drawn from its address's query string |
34
+ | `./errors` | The admin_errors report: unresolved bugs, newest first, and their time to fix |
35
+ | `./everywhere` | One read of every tracker on yaks.app: the platform's and each space's it lists |
36
+ | `./graph` | The precondition refusing an unexplained resolution |
37
+ | `./resolution` | A resolution's explanation: its check and how it reads |
38
+
39
+ ```ts
40
+ import { normalize } from '@yaks/tracker'
41
+
42
+ normalize('T-42 failed at /srv/app.ts:10:3 after 300 tries')
43
+ // '# failed at # after # tries'
44
+ ```
45
+
46
+ ## Resolving a bug
47
+
48
+ A bug is resolved only by an agent that fixed its cause and saw the fix live,
49
+ and every resolved bug says how. The resolver writes the explanation on its
50
+ mark, `resolved{at, by, via, broke, cause, since, fix, live, recur}`: what broke
51
+ and whom it reached, in plain words (`broke`); why (`cause`); the commits that
52
+ introduced it (`since`) and fixed it (`fix`), each by its full sha (the tool
53
+ reads a short one as Git does); and whether it can come back, and why (`recur`).
54
+ A fix that is not a commit, such as a key put in the vault, is said in `cause`.
55
+ When the fix's deploy time is known, pass it as `--live <timestamp>` so the
56
+ tracker can distinguish samples that include time before the fix. The `./graph`
57
+ facet refuses a bug's resolution without `cause` and `recur`, or with a commit
58
+ named by anything but a full sha, at every door. The tool asks for `broke` too:
59
+
60
+ ```sh
61
+ yak bug resolve <bug> --broke '…' --cause '…' --since <sha> --fix <sha> --recur '…'
62
+ ```
63
+
64
+ Nothing resolves a bug on its own. A bug that stopped, went quiet or passed on a
65
+ rerun is not resolved: it stays open until an agent finds its cause, fixes it
66
+ and sees the fix live. A fixer resolves its bug as its last step
67
+ ([heal](../heal/README.md)). A bug resolved without its cause fixed is reopened,
68
+ which takes the resolution back and leaves the bug open, with its occurrences
69
+ and thread as they were; a bug whose opening was told is not told again:
70
+
71
+ ```sh
72
+ yak bug reopen <bug>
73
+ ```
74
+
75
+ The bug's page, `yak bug show` and `yak admin errors` read the same explanation
76
+ (`explained` in `./resolution`). Bugs resolved before explanations were kept
77
+ have none, and say so.
78
+
79
+ ## Host interface
80
+
81
+ Load `trackerDoc` with @yaks/kernel, @yaks/provenance, @yaks/tools, @yaks/api,
82
+ @yaks/doc and @yaks/mail. RAM takes `computed`; SQL storage takes `derived`.
83
+ `bug.status` comes from the resolved/archived marks. `bug.people` counts the
84
+ distinct people its retained occurrences reached, by their `user_id` tag, and
85
+ `bug.account` is `person` when any reached a person or a person's space and
86
+ `test` when only test accounts: a customer's bug reads apart from a probe's. Who
87
+ wrote an occurrence is the reporting process, never whom it reached. `bug.hits`
88
+ is historical and does not shrink when occurrences are trimmed.
89
+
90
+ `report(error, context)` never throws. Context supplies `sink`, the failing
91
+ work's `actor`, commit/version, global `during` references, and optionally a
92
+ request bundle. `caught` excludes refusals. Request bodies, headers and query
93
+ strings and console argument arrays are not sent. A failed sink uses the
94
+ fallback, or console, without reporting itself recursively.
95
+
96
+ `coalesce(sink)` is a sink wrapper with a 60-second window per app and fault,
97
+ using the same `faultKey` and explicit `error.fault` as grouping. The first
98
+ sample reaches the sink immediately with its stack and context. Repeats keep
99
+ only the latest sample and accumulate hits; the timer sends that sample once
100
+ with the repeat count and forgets the window. The next occurrence goes at once.
101
+ One minute bounds a continuous flood to two deliveries per fault per minute
102
+ while keeping first-failure notification immediate. Options accept a `window` in
103
+ milliseconds and a `clock` with `now()` and `after(ms, run)` returning a cancel
104
+ function. `flush()` ends current windows; `close()` also cancels timers and
105
+ waits for deliveries. A forced process exit can lose unflushed repeats.
106
+
107
+ ```ts
108
+ import { equal } from '@yaks/testing'
109
+ import { coalesce, report, spool } from '@yaks/tracker/report'
110
+
111
+ let records: string[] = []
112
+ let sink = coalesce(spool((line) => {
113
+ records.push(line)
114
+ }))
115
+ await report('missing row 42', { sink })
116
+ await report('missing row 99', { sink })
117
+ await report('missing row 100', { sink })
118
+ await sink.close()
119
+ equal(records.map((line) => JSON.parse(line)[0].error.hits ?? 1), [1, 2])
120
+ ```
121
+
122
+ The queue sink takes a binding with `send`; the spool sink takes an append
123
+ function; the post sink takes a URL and an optional fetch implementation. The
124
+ box service takes a `source()` yielding `{rows, ack}` records. It calls `ack`
125
+ only after graph admission. The `/file` adapter appends one fsynced JSONL
126
+ segment per record and removes it only on acknowledgement. An incomplete tail
127
+ stays on disk while complete records continue. Segments use independent names,
128
+ so concurrent processes never share an append offset.
129
+
130
+ `effects({graph}, options)` accepts an `enrich` function for frame resolution,
131
+ and the digest's mail `to`, `from`, tracker web `url`, global tracker `store`
132
+ eid and `chart` address. Local CLI composition turns the configured
133
+ `code: {cwd, url, origins}` into frame enrichment through the fleet catalog and
134
+ a commit resolver for the bug tools.
135
+
136
+ No effect writes a letter about one bug. Agents hear of each new bug at once
137
+ from the open-bug watch (@yaks/heal), which files its task and knocks; a person
138
+ reads the daily digest (below), which the platform tracker sends to its `to`.
139
+
140
+ ### The daily digest
141
+
142
+ The owner reads one letter a morning about bugs, not one per bug. Its wake
143
+ (`wake()` in `./digest`, `digest{}` beside a recurring `wake` at 07:00
144
+ America/Detroit) fires `bug_digest`, which writes that day's letter to `to` from
145
+ the bug rows: the bugs that opened (first seen or regressed) and were fixed in
146
+ the day before, each fix's time to fix and their median, every open bug with how
147
+ long it has been open and the task a fixer took it for (`taken.task`, "nobody"
148
+ without one), and whom each reached, a person's in bold. Each table lists
149
+ fifteen, those that reached a person first, then the most hit (the slowest fix
150
+ among fixes), and counts the rest; a headline is cut to one short line. A day
151
+ owns one letter (its eid derives from the store, recipient and day), so a
152
+ retried firing writes nothing more. Each new scheduled digest withdraws older
153
+ pending scheduled deliveries. When the sender returns, only the newest scheduled
154
+ digest can still go out.
155
+
156
+ Above the tables is a chart of the last fourteen days: bugs opened (red) and
157
+ fixed (green) each day, the warnings caught that day (grey), and the median time
158
+ to fix of the day's fixes (amber). It is a PNG, since a mail client draws no SVG
159
+ and fetches what it shows: the letter's image points at the `chart` option's
160
+ `/chart.png` with the days in its query string (`query()` in `./chart`), and
161
+ `serve()` draws it from that alone, so the door that serves it reads nothing and
162
+ needs no ticket.
163
+
164
+ ```ts
165
+ import { equal } from '@yaks/testing'
166
+ import { days, query } from '@yaks/tracker/chart'
167
+
168
+ let week = [{ day: '2026-11-19', opened: 3, fixed: 1, warned: 5, fix: 240_000 }]
169
+ equal(days(new URLSearchParams(query(week))), week)
170
+ ```
171
+
172
+ Retention keeps the newest hundred plus the first occurrence of each commit (or
173
+ version without a commit) in the active graph. Every admitted occurrence is
174
+ stored with its stack and tags before retention moves older ones into graph
175
+ trash. Its identity remains, so redelivery never recounts an occurrence in
176
+ trash. Bugs, letters and their lifecycle remain readable. Grouping reads its
177
+ bug's counters, and an earlier occurrence only after a resolution, to ask
178
+ whether one shares its release; trimming reads each occurrence's time and
179
+ release, and none while the bug's hits are within the newest it keeps. Reframing
180
+ writes a bug's culprit or spot only where it moved.
181
+
182
+ An occurrence regresses a resolved bug when its `error.at` is later than
183
+ `resolved.at`, unless its commit (or version without a commit) was seen in the
184
+ group by then: that is old code still running. One naming no release, such as a
185
+ systemd unit's failure reported from outside the unit, regresses on its time
186
+ alone. Earlier occurrences and occurrences at the resolution timestamp still
187
+ count, but retain `resolved` and `notified` without adding `regressed`.
188
+
189
+ A report measured over an interval carries `error{at, window_start, …}`. The
190
+ interval can reopen its bug if it starts at or after the fix went live
191
+ (`resolved.live`, with `resolved.at` as the fallback). The reporting process's
192
+ commit is kept on the occurrence for diagnosis. A sample spanning the deploy
193
+ still counts and keeps the resolution in place.
194
+
195
+ An occurrence whose `error.level` is `warning`, a failure near its line such as
196
+ a press or an open slower than its budget but within twice it, joins no bug: the
197
+ digest's chart counts it on its day. Its grouping deletes the warnings older
198
+ than the chart's fourteen days.
199
+
200
+ ### Probes
201
+
202
+ A **probe** is an occurrence sent to prove the path from a reporter to grouping,
203
+ as the tracker Worker's deploy canary is: an `error` beside `probe{grouped}`. It
204
+ is delivered, admitted and handed to `error_group` like any occurrence, and
205
+ grouping reads what it reads for one, then writes only the probe's receipt,
206
+ `probe.grouped`: no bug, so nothing notifies and nothing reaches a fixer. Its
207
+ sender reads the receipt. Each probe's grouping deletes the probes grouped over
208
+ an hour before, so they do not accumulate.
209
+
210
+ A bug wears `during{session, entity, kind}` from the occurrence that opened it,
211
+ first or reopening, when that occurrence names a session: the session whose work
212
+ raised it, the work it was doing and its kind, so the bug goes to them
213
+ (@yaks/heal). A `ci` kind says CI on main blamed the commit that session landed
214
+ (`bench/ci.ts`); any other names a session that only saw the failure. An opening
215
+ that names none clears it.
216
+
217
+ ## Browsing
218
+
219
+ The tracker writes the first error's exception type and value, or its
220
+ `error.message` when nothing was thrown, to `doc.title`. A bug's **headline** is
221
+ the first line of that title, with terminal colours left out, an address without
222
+ its query and an id or a long number cut to its start. Wherever a bug is named
223
+ (a list row, a link, a card's bar) it reads as its headline; its page shows the
224
+ whole message on a press. `bug.fault` is the grouping key, on the bug's page
225
+ behind a press. The `./views` facet exports portable bug and error readings, and
226
+ inspector views whose `asks` request the bug's errors. The host answers those
227
+ asks and draws each error through the same registry. The count includes trimmed
228
+ errors.
229
+
230
+ The box config sets `@yaks/web`’s `with.home` (`title` and `query`) to list open
231
+ bugs by descending `bug.hits` (worst first); resolved and archived bugs remain
232
+ addressable but leave that list. The box config enables human ids, so each bug
233
+ has an address such as `/B-7`. The same list is available through
234
+ `yak --config ~/.yak/tracker.json bug list`.
235
+
236
+ Notification links use the tracker's `url` option when supplied, for example
237
+ `"url": "https://bugs.example.com"` beside `to` and `store`. A box host
238
+ otherwise uses its configured web port (`http://127.0.0.1:5175` in `box.json`);
239
+ a host without a web address uses the bug's relative path. `code.url` and
240
+ `code.origins` name the separate code catalog and its served source origins, not
241
+ the tracker web.
242
+
243
+ ```ts
244
+ import { equal } from '@yaks/testing'
245
+ import { occurrences, openBugs } from '@yaks/tracker/views'
246
+
247
+ equal(openBugs, '.bug.status=open * .order=-bug.hits')
248
+ equal(occurrences('bug'), '.error.bug=bug * .order=-error.at')
249
+ ```
250
+
251
+ ## The box role
252
+
253
+ Copy `box.json` to `~/.yak/tracker.json` and `yak-tracker@.service` to the user
254
+ systemd unit directory. The tracker uses `~/.yak/tracker.db`, never `yak.db`.
255
+ Its command is
256
+ `yak work --config ~/.yak/tracker.json --roles effects,@yaks/tracker,@yaks/mail`:
257
+ composition opens graph, effects, intake and outbound mail, with the standard
258
+ leases and process wind-down. It imports no web routes.
259
+
260
+ Add `"tracker": {"spool": "tracker-spool"}` to the watched graph's config.
261
+ `compose()` connects tool, effect, request and duty failures to that spool
262
+ without opening the tracker graph. The reporting process stamps its startup
263
+ commit and global process eid. A tool preserves the failing call's `$actor`.
264
+ Console telemetry remains alongside reporting. Intake commits the full bundles
265
+ before acknowledging them; a crash in between resends the same eids.
266
+
267
+ After copying the template, run `systemctl --user daemon-reload` and enable
268
+ `yak-tracker@boot.service`. `yak restart` hands over the primary workers and web
269
+ and the active tracker workers and web, each replacement ready before any old
270
+ unit is asked to stop. Both tracker workers use the same tracker config and
271
+ spool; its leased intake finishes an admitted record before releasing the lease.
272
+ The tracker web units (`yak-tracker-web@.service`) run
273
+ `yak serve --no-duties --share --ready <file> --config ~/.yak/tracker.json`,
274
+ independently of intake, and share :5175 with their replacement while it takes
275
+ over. No mail recipient is configured by default. The sample plugin options name
276
+ the box checkout and fleet HTTP catalog; adjust `code.cwd`, `code.url` and
277
+ served `code.origins` for another machine. No source records are copied into the
278
+ tracker. Loading the mail vocabulary alone sends nothing.
279
+
280
+ ## Frames and code
281
+
282
+ `stackFrames(stack)` parses Deno/V8 and Firefox/Safari stacks in top-first
283
+ order, including causes. It bounds stacks and frames and removes URL query
284
+ strings. `error_group` commits parsed text and counts the occurrence without
285
+ contacting the code catalog. `error_frames` enriches it separately, so catalog
286
+ downtime cannot stall intake or grouping. A temporarily unavailable catalog
287
+ keeps the same effect pending and checks again after five seconds without
288
+ spending attempts or reporting an outage as another bug. A terminal catalog
289
+ error remains failed across restarts until explicitly retried. Editing an
290
+ occurrence's stack or commit owes fresh frame resolution without recounting it.
291
+
292
+ The box resolver accepts paths only under its repository's Git checkout roots,
293
+ or HTTP module URLs at explicitly configured origins. It checks regular files in
294
+ `error.commit`, never mutable checkout bytes. It asks the fleet's `/query` door
295
+ for the derived file and exported-symbol eids. A module resolves only when its
296
+ catalog blob matches that commit; a symbol resolves only by its exact export
297
+ name in that module. No catalog record means no link. A known repository frame
298
+ is in-app even while its catalog is missing or outdated; dependencies are not.
299
+ Non-exported functions and anonymous arrows can resolve a module only.
300
+
301
+ `bug.culprit` is the first in-app frame with a resolved symbol. Until one
302
+ resolves, `bug.spot` keeps the top in-app frame, or the first text frame when
303
+ none is known. Later enrichment fills the culprit and removes its text fallback.
304
+ The canvas now serves `/web/app.js` as a bundle, so those frames, worker bundles
305
+ and hosted app files remain text: v1 supplies no source-map guesses.
306
+
307
+ ## Transition boundaries
308
+
309
+ The browser capture script (`./page`) is woven inline into each page an app
310
+ serves (workers/yak/page-script.ts) and into the box's web page (@yaks/web). It
311
+ reads its door off its tag's `data-yak-at` and the page's release off
312
+ `data-yak-version`, and posts each uncaught error, unhandled rejection, failed
313
+ fetch and `console.error` to `<at>api/report`, tagged with the `mechanism` that
314
+ caught it and the breadcrumbs before it. An error logged to the console goes
315
+ with its stack and its `cause` chain, as a server's reporter keeps them. A fetch
316
+ of the page's own origin that never had an answer (the server away, the person
317
+ leaving) is no break, and a caller leaving its rejection uncaught, handing it to
318
+ `reportError` or logging it, as itself or as another error's cause, does not
319
+ make it one. While the page's client waits out a dropped connection it raises
320
+ `yak-reconnecting` (`detail` true, then false), and the page shows
321
+ "Reconnecting…" meanwhile. `broken(body, refusal)` in `./report` reads either
322
+ door's body, the reporter's, the browser's Reporting API's, or a native shell's
323
+ (the reporter's, naming itself as `type` and adding `tags` its door may keep),
324
+ into breaks, leaving out an answer `refusal` calls a no somebody meant (default:
325
+ a 4xx) and a fetch of the page's own origin that had no answer, which the
326
+ reporter woven into a tab opened before T-124729 still sends. `door(filing)` is
327
+ the report door both serve: it drops what a page a verified bot renders sends
328
+ (Cloudflare's `cf.verifiedBotCategory`), answers 429 while `flooding`
329
+ (`flood(rate)` counts a key's passes a minute), and files each break with the
330
+ release its page named, else the one `serving` says. The platform admits
331
+ captured failures into the tracker; the box hands them to the host's reporter,
332
+ which spools them like any other.
333
+
334
+ [@yaks/tools](../tools/README.md) declares `exception{type, value}` for what was
335
+ thrown in an answer or transcript entry. Tracker extends it with `stack`,
336
+ `frames` and `mechanism` on an error occurrence. Catch boundaries report the
337
+ original failure separately; recording a failed call's history never creates
338
+ another occurrence.
339
+
340
+ Bundle content hashes are omitted from fault keys and the bug's fallback spot,
341
+ including nested esbuild bundle names. Captured stacks keep their original
342
+ bytes. `./merge` consolidates older hash-split groups, preserving historical
343
+ counts and occurrences. Duplicate identities carry `merged{into}`; bug reads and
344
+ marks follow them to the survivor, so issued links keep working.
345
+
346
+ Groups made solely from imported historical occurrences inherit a lifecycle mark
347
+ only when every occurrence carries it, keeping the latest historical stamp.
348
+ Importing an unmarked occurrence clears an inherited mark. Existing reporter
349
+ groups and later actions on a group retain their own lifecycle; historical
350
+ imports count without causing a release regression.
351
+
352
+ ## Box delivery
353
+
354
+ The CLI reporter writes each caught failure to the durable spool, with its
355
+ handler and target. The tracker service admits those records into the box
356
+ tracker independently of the remote forwarding loop. When `remote` is
357
+ configured, local admission atomically renames an error segment to
358
+ `.local.jsonl` and fsyncs the spool directory. That durable receipt survives
359
+ restarts and local occurrence retention without recounting. Remote delivery
360
+ reads only admitted error records and their request companions through the
361
+ Worker's signed platform intake; acknowledgement moves the segment into
362
+ filesystem trash only after success. Delivery combines admitted records into
363
+ batches of at most 100 bundles, so a flood does not open one TLS connection per
364
+ occurrence. Each loop retries on its own clock, so even a stalled remote
365
+ connection cannot delay local admission. Sources supplied by a host must support
366
+ independent replayable scans; file sources supply `admitted` and `admit`
367
+ receipts. A failed delivery leaves its original record for retry and never adds
368
+ a delivery error to the same outbox. Immutable global eids make interrupted and
369
+ repeated delivery safe.
370
+
371
+ The delivery and standing syncs decide what a failed pass is as the poll below
372
+ does (`./outage.ts`): a pass the Worker could not answer for now (`Unavailable`
373
+ from `./remote`: a delivery answered 408, 429 or 5xx, or not answered at all; a
374
+ read refused 503 or 504) is a log line, and its answering again another. A sync
375
+ left unanswered for five minutes (`OUTAGE`) is reported once, by the first
376
+ failed pass that finds it so (@yaks/effects/outage). A 429 with `retry-after`
377
+ (`Stopped` from `./remote`, the Worker's object past its rows) is an answer, not
378
+ an outage: the stop was reported where it happened, as its runaway, so the sync
379
+ logs it once, asks nothing until the wait is over, and reports nothing, while
380
+ the outbox keeps its captures. A delivery stops at the first batch the Worker
381
+ could not answer, the rest left for the next pass, so each pass ends within a
382
+ request's minute while the Worker is down. A pass still running after five
383
+ minutes has hung on this side: it is reported once as that, never as the Worker
384
+ not answering, its signal aborts, and the next pass runs. A pass this side
385
+ cannot set up (`Misconfigured` from `./remote`: no address, no secret, or an
386
+ address it does not send to; a read refused 500) is reported at once, and once
387
+ until a pass ends otherwise; the remote is read at each use, so the pass after a
388
+ fix goes out, and logs that the tracker is set up again. Any other failure (a
389
+ refusal of what was sent or asked, a bad page, a failure on this side) is
390
+ reported at once. Each report is admitted directly to the local tracker as
391
+ `Tracker <direction> sync failed: <what failed>`, with the failure as its
392
+ `cause`, a flood coalesced, and stays open in the box tracker's bug list
393
+ (`yak --config ~/.yak/tracker.json bug list`).
394
+
395
+ A **standing pass** reads remote bug marks every thirty seconds and reconciles
396
+ matching box groups by global eid or their fault and app. The Worker owns
397
+ resolved, archived, taken and regressed marks; the box retains its own
398
+ occurrences and counters. Remote-only bugs are not imported, and newer local
399
+ evidence is not closed by an older remote snapshot. A reopening the box grouped
400
+ itself keeps its own `regressed` stamp, since the Worker's names the same
401
+ reopening on another clock; only a reopening after a resolution the box saw
402
+ takes the Worker's. A guarded patch leaves a group changed concurrently for the
403
+ next pass.
404
+
405
+ Both the standing pass and the poll below read what moved, not every bug
406
+ (`./poll`'s `since`): each sends the tag of what it last read, a Worker where
407
+ nothing moved answers 304, and one where something did names the bugs that moved
408
+ (workers/tracker's `GET /bugs?since=`), which are read again by id. A first
409
+ read, and one whose tag the Worker no longer knows what moved since, read every
410
+ bug.
411
+
412
+ The heal service opens the platform `./poll` watch on the open bugs in its work
413
+ host, and reads a closed bug by id with the watch's `get`, a page of ids to a
414
+ request, while work on the box is still open about it. Its watches share
415
+ `./poll`'s `changes` feed: one conditional `/changes` read every 30 seconds
416
+ names the scopes whose bugs moved. Each watch acknowledges its scope's version
417
+ only after reading its bugs successfully. Idle spaces make no bug requests;
418
+ first reads and failed reads still fetch the answer. The feed retains its tag
419
+ and each scope's version in memory; a restarted follower reads them afresh.
420
+ Reads by id remember which bugs a scope does not hold until its version changes,
421
+ so work about another tracker's bug causes no repeated empty reads. On-demand
422
+ bug lists skip trackers known to have no bugs, open or closed, using
423
+ `/scopes?bugs=true`; unknown trackers are still read. Its signed reads and marks
424
+ run on a dedicated worker event loop, not alongside the host's synchronous
425
+ graph/effect work: signing, fetch, whole-body reads and attempt deadlines stay
426
+ together even when the host is CPU-bound. The worker opens no graph or duties;
427
+ closing the service terminates its shared worker and rejects outstanding calls.
428
+ An unexpected worker failure rejects those calls and the next poll starts a
429
+ replacement. `PollOpts.doors` still overrides the transport for an embedding
430
+ host or a test. The signed transport starts with a five-second attempt, then
431
+ doubles each attempt's allowance within a one-minute request budget. Every
432
+ attempt uses a fresh connection and reads the whole body before it succeeds; a
433
+ caller's cancellation ends the request immediately. A slow unchanged read can
434
+ therefore finish without every attempt cancelling it after five seconds. Read
435
+ conflicts (409) retry on fresh connections with increasing pauses, from 250 ms
436
+ to two seconds, within that same budget and twelve attempts. A conflict that
437
+ persists is an unavailable tracker, as a 503 is; mark responses are never
438
+ retried by status.
439
+
440
+ A poll the Worker cannot answer for now (a read refused 503 or 504, see `read`'s
441
+ statuses) is a log line, and the next poll tries again. A Worker that has not
442
+ answered for five minutes (`OUTAGE`) is reported once, with the last failure as
443
+ its cause: when the platform tracker is down, the box is what says so. A poll
444
+ still running after five minutes has hung on this side, and is reported once as
445
+ that; the next poll runs. A poll this side cannot set up (a read refused 500) is
446
+ reported at once, once, and the poll worker is handed the remote with each read,
447
+ so a fix reaches the next poll. Any other failed poll (a refusal of what was
448
+ asked, an invalid page, a failed worker) is reported at once. The standing pass
449
+ reads through the same pages (`./poll`'s `pages`), and both syncs decide through
450
+ the same `./outage.ts`.
451
+
452
+ `./remote` shares the signed transport with the read-through routes. Intake and
453
+ bug marks each carry a separate capability, so a reader's ticket cannot submit
454
+ errors or mark bugs. Box captures carry `error.tags.source=box`, and a person's
455
+ app failures `source=app`; the platform tracker records both, so its digest
456
+ covers them. Reports retain their capture time across retries. Host shutdown
457
+ waits for every report's durable spool write.
458
+
459
+ ## Bounded trace admission
460
+
461
+ `./intake` exports `traceBatch` and `reserveTrace` for a host that bounds stored
462
+ trace writes. `traceBatch` accepts only complete captures of at most ten bundles
463
+ with trace, span, context and independent metric components. References to the
464
+ trace and parent spans must stay within the capture. Unknown properties,
465
+ identity metadata and write controls are refused. This deliberately does not
466
+ limit error intake or the box's portable immutable intake.
467
+
468
+ `reserveTrace` keeps pending reservations charged until their host records a
469
+ successful delivery's expiry. The
470
+ [tracker Worker](../../workers/tracker/README.md) uses this with its
471
+ platform-wide authority and durable metadata; no package creates a Worker or
472
+ decides which space owns a capture.
473
+
474
+ ## Bug views
475
+
476
+ `@yaks/tracker/views` contributes bug and occurrence readings through the host's
477
+ shared renderer and inspector contracts. Open bugs are ranked by historical
478
+ hits, not retained sample size. A bug's row gives its headline, hits, where it
479
+ was thrown, and when it was last and first seen.
480
+
481
+ A bug page shows when it happened, as a histogram of the retained occurrences
482
+ from the first to now; where it ran, as the few values most occurrences share
483
+ for each commit, tag and context reference, the rest on a press, and the commit
484
+ it was first seen in; the newest occurrence's stack with the app's own frames
485
+ marked; and the retained occurrences, newest first, each by its moment, commit
486
+ and tags. An occurrence's page shows where it was thrown, its context, its stack
487
+ and the breadcrumbs before it.
488
+
489
+ An occurrence links traces with the same recorded request identity. Without that
490
+ identity, it asks for traces of the same store/process, scoped by app and space,
491
+ within five minutes of the occurrence; that context is labeled as nearby rather
492
+ than causal. Traces are drawn by the host registry: their trees, metrics,
493
+ flamegraphs and comparisons belong to
494
+ [`@yaks/timing/views`](../timing/README.md#trace-views), not this package.
495
+
496
+ For a box browser, configure this package and `@yaks/timing` beside the browser
497
+ application and use this home query:
498
+
499
+ ```text
500
+ .bug.status=open * .order=-bug.hits
501
+ ```
502
+
503
+ The trace list is at `/?.trace`. Missing affected context or missing traces are
504
+ stated; they are not inferred from a stack's text.
505
+
506
+ ## Reading remote bugs and traces on the box
507
+
508
+ The `./routes` facet owns read-through access to the independent
509
+ [tracker Worker](../../workers/tracker/README.md). It signs a one-minute
510
+ platform-admin ticket on the server and forwards only `/bugs`, `/traces` and
511
+ `/trace`. The box keeps no remote bundles. The timing views use the returned
512
+ bundles for both sides, label them `box` or `yaks.app`, and keep comparisons
513
+ within the selected remote scope and matching request/store context.
514
+
515
+ Set the Worker's URL and signing secret in this plugin's `with`:
516
+
517
+ ```json
518
+ {
519
+ "use": "@yaks/tracker",
520
+ "with": {
521
+ "remote": {
522
+ "url": "https://your-tracker-worker.example",
523
+ "secret": { "secret": "TRACKER_SECRET" }
524
+ }
525
+ }
526
+ }
527
+ ```
528
+
529
+ Preserve the plugin's other options. The CLI resolves the secret from its vault
530
+ each time it is read; never put its value in a config. The secret must match the
531
+ Worker's `TRACKER_SECRET`. `./ticket` signs the ticket shared by the box and
532
+ Worker authorization.
533
+
534
+ With `@yaks/timing` composed, open `/?.trace`, choose `yaks.app`, and read
535
+ `platform` or supply a space's global eid in **Tracker scope**. The independent
536
+ Worker has no directory binding and cannot enumerate spaces. Each list page
537
+ contains up to 100 traces; **Older traces** follows the Worker's cursor. Opening
538
+ a trace reads every span page before drawing its flamegraph. Comparison uses the
539
+ latest hundred traces in that scope. Missing configuration, unavailable
540
+ credentials and refused reads show as errors, not empty lists. Tickets never
541
+ reach the browser, redirects are refused, and HTTP remote URLs are allowed only
542
+ on loopback for local probes.
543
+
544
+ Bug tools select the platform tracker with `--source yaks.app`; `box` is the
545
+ default. Both reads answer `{source: "box" | "yaks.app", rows: [...]}` as text
546
+ and `output.value`, including an empty `rows` array when no bugs match. Read
547
+ these rows with `valueIn(answer).rows` from `@yaks/tools/value`. Neither read
548
+ applies those rows to the box graph. Remote queries, ordering and limits run in
549
+ the Worker before selecting the returned bugs. Remote show takes a global bug
550
+ eid, since numbered ids belong to their own store. Resolve, archive and reopen
551
+ accept the same source selection, and a resolution carries its explanation to
552
+ each store it marks. A box mark reaches the configured Worker under the bug's
553
+ global eid before returning the local patch. Missing credentials, unavailable
554
+ transport or a refused remote mark refuse the command without marking the box
555
+ copy. Without a remote configuration, box marks remain local. A `yaks.app` mark
556
+ requires remote configuration and marks the Worker, the platform's tracker or
557
+ the space's `--scope` names; the standing pass brings its marks to a matching
558
+ box group without importing remote-only bugs. Retrying a mark is safe, including
559
+ when the box copy is already marked.
560
+
561
+ A config whose graph holds no bugs of its own, as the box's default yak composes
562
+ the tracker's `vocab` and `tools` beside `admin errors`, names `yaks.app` its
563
+ `source`: its bug tools read and mark the Worker with no `--source` named.
564
+ `bug list` there reads every tracker on yaks.app, the platform's and each
565
+ space's the platform lists (`./everywhere`), `--limit` from each; a space
566
+ tracker's rows name its space in `$scope`, which `bug show` and the marks take
567
+ as `--scope`, and one that could not be read is said in `unread`. It names the
568
+ box tracker's graph as `box`, its base URL, and `--source box` reads that graph
569
+ through its `/query` and marks it through its `/apply`, by the references that
570
+ graph keeps (`B-7`, a short handle, a title), naming the calling run in `x-via`.
571
+ The tracker's `box.json` composes `@yaks/api` with `who` set to the box's base
572
+ URL, so its door asks the box who that run is and a mark records the agent in
573
+ `by` and its session in `via`, whether it came this way or from
574
+ `yak --config ~/.yak/tracker.json`. So one set of tools serves both trackers.
575
+ The `code.cwd` option names the checkout a resolution's commits are read from,
576
+ so `--since` and `--fix` take a short sha as Git reads it:
577
+
578
+ ```json
579
+ {
580
+ "use": "@yaks/tracker",
581
+ "facets": ["vocab", "tools"],
582
+ "with": {
583
+ "source": "yaks.app",
584
+ "box": "http://127.0.0.1:5175",
585
+ "code": { "cwd": "/home/me/code/yak" },
586
+ "remote": {
587
+ "url": "https://tracker.example",
588
+ "secret": { "secret": "TRACKER_SECRET" }
589
+ }
590
+ }
591
+ }
592
+ ```
593
+
594
+ ```sh
595
+ yak bug list --source yaks.app --limit 20
596
+ yak bug list '.bug.status=resolved' --source yaks.app
597
+ yak bug show <global-bug-eid> --source yaks.app
598
+ yak bug resolve <global-bug-eid> --source yaks.app --scope <space eid> --broke '…' --cause '…' --fix <sha> --recur '…'
599
+ yak bug resolve <global-bug-eid> --source yaks.app --broke '…' --cause '…' --fix <sha> --recur '…'
600
+ yak bug show B-7 --source box
601
+ yak bug archive <box-bug-id> --source box --reason '…'
602
+ yak bug reopen <global-bug-eid> --source yaks.app
603
+ ```
604
+
605
+ For an Operator `Slow turn` occurrence, read its timing parts with
606
+ `yak tracker turn <turn eid>` under the same tracker config. Use the
607
+ occurrence's `error.tags.turn`, not its session eid. The platform tracker
608
+ already records the space and session alongside the timing parts when known, so
609
+ this read does not need a browser or a query to every space. Pass `--after` with
610
+ the returned `next` eid when there are more parts.
611
+
612
+ ### File spool recovery
613
+
614
+ A **record** is the immutable bundle array in a complete newline-terminated
615
+ JSONL segment. An incomplete segment remains untouched and does not block later
616
+ complete records. Intake visits complete records in filename order. A temporary
617
+ failure, such as a locked database, leaves that record retryable and does not
618
+ block later records in the pass. A graph refusal renames its segment to
619
+ `.refused`: its bytes are preserved, but automatic intake no longer offers it.
620
+ Repairing a refused record requires inspecting the refusal and its references;
621
+ renaming it back without repair repeats the refusal.
622
+
623
+ With remote delivery configured, successful local admission renames `.jsonl` to
624
+ `.local.jsonl`. This is the durable local receipt: retries do not re-admit a
625
+ record even if local retention has removed its occurrence. Remote delivery may
626
+ trash the segment only after that receipt and a successful remote response. A
627
+ remote failure keeps the receipt and does not block local intake. Immutable
628
+ occurrence ids make remote redelivery idempotent if acknowledgement fails. Each
629
+ pass reports failures after visiting the remaining records; it is not a backlog
630
+ size limit. A live stop finishes the record in hand and leaves the rest.
631
+
632
+ Acknowledged segments remain under the spool's `.trash` directory. Each entry
633
+ holds the original bytes in `data` and the original path in `source.json`.
634
+ Sampling and grouping never erase that source record. Recovery copies `data`
635
+ back to its original segment path; trash has no automatic purge.
636
+
637
+ For a bounded recovery check, copy at most the selected complete segments into
638
+ an isolated spool and use a scratch graph and transport. Do not rename, delete,
639
+ or manually replay the live backlog to infer unattended health. Prove the live
640
+ path with a fresh reporter occurrence and read back its remote bug receipt.