@rt-tools/agent-kit 0.38.0 → 0.39.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/assets/checks/check-turn-map.mjs +4 -4
- package/assets/checks/decision-table.json +91 -24
- package/assets/checks/flow-data.mjs +22 -23
- package/assets/checks/flow-forecast.mjs +12 -8
- package/assets/checks/flow-guard.mjs +365 -163
- package/assets/checks/flow-step.mjs +188 -58
- package/assets/checks/flow-verdict.mjs +124 -9
- package/assets/checks/record-count.mjs +27 -0
- package/assets/checks/task-flow-script.mjs +33 -7
- package/assets/checks/work-result.mjs +92 -11
- package/assets/commands/night.md +3 -3
- package/assets/defaults/turn-map.md +4 -2
- package/assets/docs/GLOSSARY.md +1 -1
- package/assets/hooks/ask-judge.md +4 -2
- package/assets/hooks/facts.sh +66 -0
- package/assets/hooks/git-guard-delivery-epic.sh +2 -2
- package/assets/hooks/git-guard-delivery-rerun.sh +17 -5
- package/assets/hooks/git-guard-push-ahead.sh +24 -2
- package/assets/hooks/git-guard-push-marks.sh +209 -12
- package/assets/hooks/git-guard-push-tests.sh +29 -2
- package/assets/hooks/pre-push.sh +26 -2
- package/assets/hooks/push-ahead-call-guard.sh +447 -0
- package/assets/hooks/push-set.sh +31 -8
- package/assets/hooks/turn-exit-guard.sh +1 -1
- package/assets/hooks/turn-judge.md +16 -6
- package/assets/patterns/doc-style-human.md +36 -76
- package/assets/pitfalls/doc-style-human.md +112 -0
- package/assets/pitfalls/epic-flow.md +92 -0
- package/assets/pitfalls/mockups.needs-mockups.md +87 -0
- package/assets/pitfalls/observability.needs-app.md +186 -0
- package/assets/pitfalls/platform-access.md +94 -0
- package/assets/pitfalls/queue-audit.github.md +78 -0
- package/assets/pitfalls/task-flow-archive.md +2 -1
- package/assets/pitfalls/task-flow-close.2.md +2 -1
- package/assets/pitfalls/task-flow-owner.md +29 -0
- package/assets/pitfalls/task-flow-resume.md +2 -2
- package/assets/pitfalls/task-flow-start.md +1 -1
- package/assets/pitfalls/turn-conduct.md +1 -1
- package/assets/rules/autonomous-work.md +1 -1
- package/assets/rules/epic-flow.md +24 -63
- package/assets/rules/mockups.needs-mockups.md +25 -64
- package/assets/rules/observability.needs-app.md +43 -172
- package/assets/rules/platform-access.md +28 -75
- package/assets/rules/queue-audit.github.md +25 -52
- package/assets/rules/task-flow-owner.md +6 -6
- package/assets/rules/turn-conduct.md +22 -19
- package/assets/task-flow/flow.js +10 -14
- package/assets/task-flow/flow.md +7 -8
- package/assets/task-flow/measure/ci.mjs +184 -0
- package/assets/task-flow/measure/owner.mjs +13 -6
- package/assets/task-flow/measure/session.mjs +92 -15
- package/assets/task-flow/source/git.mjs +179 -11
- package/assets/task-flow/source/host.mjs +105 -0
- package/assets/task-flow/source/owner.mjs +33 -13
- package/assets/task-flow/source/session.mjs +47 -10
- package/lib/agent-checks.d.ts.map +1 -1
- package/lib/agent-checks.js +14 -2
- package/lib/agent-checks.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,185 +7,56 @@ description: Rule under the observability law. Load when editing the logger, the
|
|
|
7
7
|
|
|
8
8
|
# Observability — how it works here
|
|
9
9
|
|
|
10
|
-
Rule under the law `docs/constitution/observability.md`.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
| the
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
| the generic error text going outside | an internal error without details |
|
|
24
|
-
| scrubbing secrets | replacing values by field name |
|
|
25
|
-
| a failure in the store | what the failures domain saved: a failure group and its occurrences |
|
|
26
|
-
| what the application came up with | the startup digest: one log line with the version, the port, the storage address and the lists of features — enabled, disabled and broken |
|
|
27
|
-
|
|
28
|
-
## Where it lives
|
|
29
|
-
|
|
30
|
-
In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
|
|
31
|
-
travels between repositories, the layout does not, and a path named in the rule lies in the
|
|
32
|
-
first tree that keeps its code differently.
|
|
33
|
-
|
|
34
|
-
## Flow
|
|
35
|
-
|
|
36
|
-
The flow of handling a request through the eyes of observability: where the request number is
|
|
37
|
-
created, how a failure differs from a breakage and what goes outside.
|
|
38
|
-
|
|
39
|
-
```mermaid
|
|
40
|
-
flowchart TD
|
|
41
|
-
A[A request arrives] --> B{The request number came from outside}
|
|
42
|
-
B -->|Yes| C[Cleaned and shortened]
|
|
43
|
-
B -->|No| D[Created anew, one for the whole request]
|
|
44
|
-
C --> E[Stands in every log line about this request]
|
|
45
|
-
D --> E
|
|
46
|
-
E --> F{How the work ended}
|
|
47
|
-
F -->|Done| G[The response leaves with the request number in the header]
|
|
48
|
-
F -->|Input or rights| H[Written apart from a breakage and without a stack: a check that fired]
|
|
49
|
-
F -->|Breakage| I[The cause is parsed in one place, the line fields are always scrubbed]
|
|
50
|
-
H --> J[Outside — a code and a generic text; the details stay in the logs]
|
|
51
|
-
I --> J
|
|
52
|
-
J --> K[The request number stands in the failure details too]
|
|
53
|
-
G --> L[Done]
|
|
54
|
-
K --> L
|
|
55
|
-
```
|
|
10
|
+
Rule under the law `docs/constitution/observability.md`. Cold part: `pitfalls.md`; paths: `implementation.md`.
|
|
11
|
+
|
|
12
|
+
| In the law | Here
|
|
13
|
+
| --- | ---
|
|
14
|
+
| what the application writes about itself | application logs: one line per logger call, in machine form
|
|
15
|
+
| the step of importance | the level: from debugging details to a failure that took the process down
|
|
16
|
+
| the request number | the request id, also the response header
|
|
17
|
+
| the marker by which all failures of one request are found | the same request number — it stands in every log line
|
|
18
|
+
| failure details | the parsed cause: class, text, protocol code, code and details from the storage, a trimmed stack
|
|
19
|
+
| the generic error text going outside | an internal error without details
|
|
20
|
+
| scrubbing secrets | replacing values by field name
|
|
21
|
+
| a failure in the store | what the failures domain saved: a failure group and its occurrences
|
|
22
|
+
| what the application came up with | the startup digest: one log line with the version, the port, the storage address and the lists of features — enabled, disabled and broken
|
|
56
23
|
|
|
57
24
|
## How the law applies here
|
|
58
25
|
|
|
59
|
-
- **The request number is created once per request and stands in every log line about it.**
|
|
60
|
-
|
|
61
|
-
- **The request number goes to the caller as a response header and in the failure details.** It
|
|
62
|
-
also stands in the logs, so a number named by a person is found by a direct filter. The header
|
|
63
|
-
is open to a page of a foreign domain: without explicit permission the browser does not hand
|
|
64
|
-
it over.
|
|
26
|
+
- **The request number is created once per request and stands in every log line about it.**
|
|
27
|
+
- **The request number goes to the caller as a response header and in the failure details.** Expose it cross-origin.
|
|
65
28
|
- **A number that came from outside is cleaned and shortened, and an empty one is created anew.**
|
|
66
|
-
|
|
67
|
-
- **
|
|
68
|
-
|
|
69
|
-
- **A
|
|
70
|
-
|
|
71
|
-
- **
|
|
72
|
-
|
|
73
|
-
- **A
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- **
|
|
79
|
-
|
|
80
|
-
- **
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
production settings over ssh.
|
|
84
|
-
- **The startup digest holds the names of features and their state, but not the values of
|
|
85
|
-
variables.** The states are laid out as three lists, not as a map "name → state": scrubbing
|
|
86
|
-
works by key name, and the map would arrive in the log scrubbed exactly where the state is
|
|
87
|
-
needed.
|
|
88
|
-
- **A feature enabled by a pair of keys knows a third state.** The halves of the pair lie on
|
|
89
|
-
different sides of the delivery, and exactly one can be filled; then the feature is neither off
|
|
90
|
-
nor on but broken — a list of two states has no name for this case, and it reads as enabled.
|
|
91
|
-
- **The level threshold decides whether a log line appears in the output, but not in the failure
|
|
92
|
-
store.** The threshold is set for the volume of output, and under a high threshold the selected
|
|
93
|
-
lines of a lower level would silently vanish from the store.
|
|
94
|
-
- **A selected log line is saved to the store as a failure.** Selected are the failure level and
|
|
95
|
-
everything above it, and lines of a lower level — by a list of names declared in the code.
|
|
96
|
-
- **The logger hands a failure to the sink and does not see the store.** The sink interface is
|
|
97
|
-
declared next to the logger, the failures domain implements it, and it is set from outside at
|
|
98
|
-
startup.
|
|
99
|
-
- **Log lines of the storage client, the failures domain and the alerts domain do not go to the
|
|
100
|
-
sink.** The source is cut off, not the moment of writing: a slow insert into the failures table
|
|
101
|
-
itself produces a log line of the storage client, and a marker "I am inside a write" cannot
|
|
102
|
-
catch it. The alerts domain is cut off for the same reason: a failed alert would become a new
|
|
103
|
-
failure, and that one — a new alert.
|
|
104
|
-
- **A call to a foreign service goes with an explicit wait limit.** Without it a silent — not
|
|
105
|
-
failed — service holds the connection up to the environment default, and that is minutes: there
|
|
106
|
-
is no failure, nothing to record, and to the owner such silence is indistinguishable from
|
|
107
|
-
healthy work. The limit is named as a number next to the client, because the price of waiting
|
|
108
|
-
differs per service.
|
|
109
|
-
- **A send outside creates its own line before the call, and the outcome is appended to it
|
|
110
|
-
after.** The line is created by whoever sees the store, not by whoever sends: the client of the
|
|
111
|
-
external service does not see the store at all. The line also serves as a lock — a second call
|
|
112
|
-
on the same record does not leave — and an unclosed line shows the difference between "running
|
|
113
|
-
right now" and "fell in the middle of sending".
|
|
114
|
-
- **Recording a failure does not delay the response and does not take the request down.**
|
|
115
|
-
Between the logger and the store stands a bounded queue; a full queue drops the new failure and
|
|
116
|
-
counts what was dropped.
|
|
117
|
-
- **The request context is captured at the moment of the logger call, not at the moment of
|
|
118
|
-
writing.** By the time of writing the execution storage has already been handed to the next
|
|
119
|
-
request.
|
|
120
|
-
- **The owner reads what was recorded in their own section, closed by a separate right.** The
|
|
121
|
-
groups that are theirs, and under a group — its occurrences with the cause, the log line fields
|
|
122
|
-
and the bodies.
|
|
29
|
+
- **Outside goes the code and a generic error text; the details stay in the logs.**
|
|
30
|
+
- **A failure on input or rights is written apart from a breakage and without a stack.** A level below breakage.
|
|
31
|
+
- **The cause of a failure is parsed in one place.**
|
|
32
|
+
- **A field added to the answer of a refusal is added where the answer is assembled, not where the refusal is thrown.**
|
|
33
|
+
- **The fields of a log line are always scrubbed, not at the discretion of whoever writes.** A foreign-body key is checked against the key lists.
|
|
34
|
+
- **At startup the application writes what it came up with.**
|
|
35
|
+
- **The startup digest holds the names of features and their state, but not the values of variables.**
|
|
36
|
+
- **A feature enabled by a pair of keys knows a third state.** One half filled — broken.
|
|
37
|
+
- **The level threshold decides whether a log line appears in the output, but not in the failure store.**
|
|
38
|
+
- **A selected log line is saved to the store as a failure.** Failure level up; lower by a declared list.
|
|
39
|
+
- **The logger hands a failure to the sink and does not see the store.**
|
|
40
|
+
- **Log lines of the storage client, the failures domain and the alerts domain do not go to the sink.** Cut by source, not by moment.
|
|
41
|
+
- **A call to a foreign service goes with an explicit wait limit.**
|
|
42
|
+
- **A send outside creates its own line before the call, and the outcome is appended to it after.** Made where the store is seen; also the lock.
|
|
43
|
+
- **Recording a failure does not delay the response and does not take the request down.** A full queue drops the new one and counts.
|
|
44
|
+
- **The request context is captured at the moment of the logger call, not at the moment of writing.**
|
|
45
|
+
- **The owner reads what was recorded in their own section, closed by a separate right.**
|
|
123
46
|
- **The store does not grow without limit: once a day the excess and the old are removed.**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
- **The
|
|
128
|
-
|
|
129
|
-
- **The owner learns of a new failure by themselves — by an event journal line and by mail.**
|
|
130
|
-
Both roads are opened by one threshold: a new group, or a group silent for longer than a day.
|
|
131
|
-
- **The mail holds nothing that is closed by the right to the failures screen.** It goes to an
|
|
132
|
-
address closed by no right, and details in it would bypass the right by mail.
|
|
133
|
-
- **The owner reads the failure rate as a curve above the feed: a bar is a bucket of the chosen
|
|
134
|
-
period.** The group counter says how many times it happened, but not when: by it a breakage
|
|
135
|
-
streaming right now cannot be told from one accumulated over a month.
|
|
136
|
-
- **The alarm is raised by growth in breakages, not in all failures.** A rejected call is a check
|
|
137
|
-
that fired, and those are nine in ten: against them growth in breakages is not visible at all.
|
|
47
|
+
- **The store limit is named in rows, not bytes.**
|
|
48
|
+
- **The owner learns of a new failure by themselves — by an event journal line and by mail.** On a new group or one silent a day.
|
|
49
|
+
- **The mail holds nothing that is closed by the right to the failures screen.**
|
|
50
|
+
- **The owner reads the failure rate as a curve above the feed: a bar is a bucket of the chosen period.**
|
|
51
|
+
- **The alarm is raised by growth in breakages, not in all failures.**
|
|
138
52
|
- **A spike is counted over the last closed bucket; the current one is not given to the rule.**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- **The rate is analysed by a schedule tick, not by a screen request.** The curve computes the
|
|
142
|
-
alarm on every response, but the owner may never open the screen, and must learn of a spike
|
|
143
|
-
without it.
|
|
144
|
-
- **The owner learns of a spike by a journal line and by mail; a repeat of the mail is held by a
|
|
145
|
-
fuse.** One incident takes one line in the feed, and a mail about a lasting breakage is needed
|
|
146
|
-
the next day too.
|
|
53
|
+
- **The rate is analysed by a schedule tick, not by a screen request.**
|
|
54
|
+
- **The owner learns of a spike by a journal line and by mail; a repeat of the mail is held by a fuse.** One feed line per incident; a lasting breakage mails next day too; fuse keyed by subject.
|
|
147
55
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
does not exist yet at that moment. Such failures stay only in the container output. A failure of
|
|
152
|
-
the store itself goes there too: its log lines are excluded from failures entirely, otherwise a
|
|
153
|
-
breakage of the store produces a stream that speeds itself up.
|
|
154
|
-
|
|
155
|
-
The list of selected lower-level names is checked against nothing. A new place that needs the
|
|
156
|
-
store appends itself to it by hand, and a forgotten one silently stays only in the output.
|
|
157
|
-
|
|
158
|
-
Nothing checks that the level was chosen right. A new place decides on its own which level to
|
|
159
|
-
take, and the mistake shows only when the code is read.
|
|
160
|
-
|
|
161
|
-
The completeness of the startup digest is checked by nothing. Feature names are listed by hand,
|
|
162
|
-
while the environment variable is read by dozens of files across all domains: a new feature that
|
|
163
|
-
forgot to append itself to the digest silently lands in none of the three lists — and in
|
|
164
|
-
production looks not disabled but nonexistent. That is why reading an environment variable
|
|
165
|
-
itself demands this rule as a second layer: the guard sees the access to the environment in the
|
|
166
|
-
text of the edit, but not whether the digest was appended.
|
|
56
|
+
By hand, unchecked: a lower-level name joins the selected list; an environment-read feature
|
|
57
|
+
joins the digest, or is in no list; the level. A failure before startup stays in container output.
|
|
58
|
+
Serialising a log line must not throw. An unwrapped stream's failure never reaches the logs.
|
|
167
59
|
|
|
168
60
|
## Patterns
|
|
169
61
|
|
|
170
|
-
- `observability-record` —
|
|
171
|
-
|
|
172
|
-
## Pitfalls
|
|
173
|
-
|
|
174
|
-
- **The request context lives in the execution storage and does not move into deferred work.** A
|
|
175
|
-
deferred write reads the context of the request that took the place of the original one. The
|
|
176
|
-
context is captured at the moment of the logger call.
|
|
177
|
-
- **The logger is set on the whole application, so the framework lines go the same way as our
|
|
178
|
-
own.** Everything the framework writes about itself lands in the same output and the same
|
|
179
|
-
selection.
|
|
180
|
-
- **A stream failure arrives after the response has started.** Control returns when only the
|
|
181
|
-
header has been sent. Without a wrapper such a failure does not reach the logs at all.
|
|
182
|
-
- **Serialising a log line must not throw.** Otherwise a circular reference in the fields takes
|
|
183
|
-
down the request whose log the fields were assembled for.
|
|
184
|
-
- **The key that wraps a foreign body for scrubbing is chosen by the scrubbing rules.** Scrubbing
|
|
185
|
-
works by key name, and a bare value passes it entirely — but a key that itself counts as free
|
|
186
|
-
text carries the whole body into the store as one scrubbing mark. A new wrapper is checked
|
|
187
|
-
against the key lists before it gets such a name.
|
|
188
|
-
- **A repeat fuse whose key is built from what measures time never fires.** When the analysis
|
|
189
|
-
tick equals the bucket width, every analysis sees an empty lock and sends again. From the
|
|
190
|
-
outside it looks working: the fuse is declared, the binding matches, mails go out every hour.
|
|
191
|
-
The key is taken from the subject of the alert, not from the stretch of time it is counted by.
|
|
62
|
+
- `observability-record` — a new log line.
|
|
@@ -7,93 +7,46 @@ description: Rule under the frontend-application law. Load when an edit touches
|
|
|
7
7
|
|
|
8
8
|
# Browser environment — how it works here
|
|
9
9
|
|
|
10
|
-
Rule under the law `docs/constitution/frontend-application.md`.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`api-layer`. All five under one law.
|
|
14
|
-
|
|
15
|
-
The rule is about the front end: `libs/api/**` and `apps/api/**` are NestJS, the environment there
|
|
16
|
-
is its own, and nothing of the listed applies.
|
|
10
|
+
Rule under the law `docs/constitution/frontend-application.md`. Cold part: `pitfalls.md`; paths:
|
|
11
|
+
`implementation.md`. Not for `libs/api/**` and `apps/api/**`: NestJS. Same law:
|
|
12
|
+
`angular-patterns`, `component-structure`, `styling-bem`, `api-layer`.
|
|
17
13
|
|
|
18
14
|
## What it is called here
|
|
19
15
|
|
|
20
|
-
| Direct call
|
|
21
|
-
|
|
|
22
|
-
| `globalThis.open(...)`, `window.open()`
|
|
23
|
-
| `globalThis.crypto.randomUUID()`
|
|
24
|
-
| `isPlatformBrowser(inject(PLATFORM_ID))` | `inject(PlatformService).isPlatformBrowser`
|
|
25
|
-
| `document.defaultView`
|
|
26
|
-
| direct `document`
|
|
27
|
-
| DOM initialisation after rendering
|
|
16
|
+
| Direct call | Here |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `globalThis.open(...)`, `window.open()` | `inject(WINDOW).open(...)` |
|
|
19
|
+
| `globalThis.crypto.randomUUID()` | `inject(WINDOW).crypto.randomUUID()` |
|
|
20
|
+
| `isPlatformBrowser(inject(PLATFORM_ID))` | `inject(PlatformService).isPlatformBrowser` |
|
|
21
|
+
| `document.defaultView` | `inject(WINDOW)` |
|
|
22
|
+
| direct `document` | `inject(DOCUMENT)` from `@angular/common` — as before |
|
|
23
|
+
| DOM initialisation after rendering | `afterNextRender()` |
|
|
28
24
|
|
|
29
25
|
`WINDOW`, `PlatformService` and `StorageService` come from `@rt-tools/core`.
|
|
30
26
|
|
|
31
|
-
## Where it lives
|
|
32
|
-
|
|
33
|
-
In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
|
|
34
|
-
travels between repositories, the layout does not, and a path named in the rule lies in the first
|
|
35
|
-
tree that keeps its code differently.
|
|
36
|
-
|
|
37
|
-
## Flow
|
|
38
|
-
|
|
39
|
-
The flow of reaching the runtime: how the global object is taken, where the environment is checked
|
|
40
|
-
and what is done in a file without dependency injection.
|
|
41
|
-
|
|
42
|
-
```mermaid
|
|
43
|
-
flowchart TD
|
|
44
|
-
A[Code needs the global object or the environment] --> B{Where it lies}
|
|
45
|
-
B -->|A class with dependency injection| C[The global object comes by a token, not taken directly]
|
|
46
|
-
B -->|A pure function| D[The window is taken as a parameter: there is no injection there]
|
|
47
|
-
C --> E{It matters where the code runs}
|
|
48
|
-
D --> E
|
|
49
|
-
E -->|Yes| F[The platform service is asked, not the presence of a name in the environment]
|
|
50
|
-
E -->|No| G[Work goes on]
|
|
51
|
-
F --> G
|
|
52
|
-
G --> H{The class is created at application startup}
|
|
53
|
-
H -->|Yes| I[Server-side page rendering is checked too: the linter does not see it]
|
|
54
|
-
H -->|No| J[Done]
|
|
55
|
-
I --> J
|
|
56
|
-
```
|
|
57
|
-
|
|
58
27
|
## How the law applies here
|
|
59
28
|
|
|
60
|
-
- **The global object comes by the `WINDOW` token, not taken directly.**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
are banned on the front-end trees; the three places where direct access is deliberate are taken
|
|
68
|
-
out from under the ban by a list in the config, not by a disable on the line.
|
|
29
|
+
- **The global object comes by the `WINDOW` token, not taken directly.** Cast it to `Window & typeof
|
|
30
|
+
globalThis`; DI-less `*.logic.ts` and `*.util.ts` take it as a parameter.
|
|
31
|
+
- **The environment is checked through `PlatformService`, not through `typeof window`.** Storage
|
|
32
|
+
needs none: `StorageService` falls back to memory.
|
|
33
|
+
- **A direct call to the global object is refused by the linter.** Sixteen names on front-end trees;
|
|
34
|
+
deliberate places sit in the config, never disabled per line. Banned by name, not path:
|
|
35
|
+
`this.#document.defaultView` on an injected document is lawful; a bypass looks alike.
|
|
69
36
|
|
|
70
37
|
## What of the law is not here
|
|
71
38
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
came by injection — but a real bypass would look the same, and it can be seen only by reading.
|
|
39
|
+
Direct access stays in three places: the inline theme script in `index.html`, the startup failure
|
|
40
|
+
handler in `main.ts`, `page.evaluate` in end-to-end specs. A new one: the owner's word.
|
|
75
41
|
|
|
76
|
-
|
|
77
|
-
`apps/site/src/index.html` (it runs before the application starts), the startup failure handler in
|
|
78
|
-
`apps/*/src/main.ts`, and the code inside `page.evaluate` in the end-to-end specs — it runs in the
|
|
79
|
-
page, outside DI. A new place is not added to this list without the owner's explicit agreement.
|
|
80
|
-
|
|
81
|
-
## Patterns
|
|
42
|
+
## Pitfalls
|
|
82
43
|
|
|
83
|
-
- `
|
|
44
|
+
- **The `WINDOW` factory throws if the document has no `defaultView`.** `Window is not
|
|
45
|
+
available`. SSR has one: a root service's field inject is safe; a DOM-less service takes it in a method
|
|
46
|
+
under a platform check.
|
|
47
|
+
- **A service created at startup that gains `WINDOW` is checked on a running SSR server too.**
|
|
48
|
+
- **An end-to-end spec does not prepare state by writing to storage.** It walks the user's steps.
|
|
84
49
|
|
|
85
|
-
##
|
|
50
|
+
## Patterns
|
|
86
51
|
|
|
87
|
-
-
|
|
88
|
-
server-side page rendering `defaultView` exists, and an inject as a class field in a root service
|
|
89
|
-
is safe, but a service that must work without a DOM at all takes the window inside a method under
|
|
90
|
-
an environment check.
|
|
91
|
-
- **After an edit that adds `WINDOW` to a service created at startup, not only the build is needed
|
|
92
|
-
but also a running page-rendering server.** The site is real SSR, and the failure shows only
|
|
93
|
-
there.
|
|
94
|
-
- **No environment check is needed around storage:** `StorageService` falls back to memory outside
|
|
95
|
-
the browser anyway, and an extra `if (!isBrowser)` around a read and a write is dead code.
|
|
96
|
-
- **There is no DI in `*.logic.ts` and `*.util.ts`:** the window is taken as a parameter, and the
|
|
97
|
-
calling component injects it.
|
|
98
|
-
- **Preparing the state of an end-to-end spec by writing to storage is not allowed:** the spec walks
|
|
99
|
-
the same steps as the user.
|
|
52
|
+
- `platform-access-di` — ready injects and checks.
|
|
@@ -7,72 +7,45 @@ description: Rule under the delivery law for a tree on GitHub — the work queue
|
|
|
7
7
|
|
|
8
8
|
# Work queue audit — how it works here
|
|
9
9
|
|
|
10
|
-
Rule under the law `docs/constitution/delivery.md`.
|
|
11
|
-
|
|
12
|
-
task, a branch and a PR is the rule `git-workflow`.
|
|
10
|
+
Rule under the law `docs/constitution/delivery.md`. Cold part: `pitfalls.md`. Where it lives: the
|
|
11
|
+
table in `implementation.md` next to it. A task, a branch and a PR are the rule `git-workflow`.
|
|
13
12
|
|
|
14
13
|
## What it is called here
|
|
15
14
|
|
|
16
|
-
| In the law
|
|
17
|
-
|
|
|
18
|
-
| the work queue
|
|
19
|
-
| a discrepancy of the queue | a line of the audit; a run with lines exits with code 1
|
|
20
|
-
| the audit run
|
|
21
|
-
|
|
22
|
-
## Where it lives
|
|
23
|
-
|
|
24
|
-
In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
|
|
25
|
-
travels between repositories, the layout does not, and a path named in the rule lies in the first
|
|
26
|
-
tree that keeps its code differently.
|
|
27
|
-
|
|
28
|
-
## Flow
|
|
29
|
-
|
|
30
|
-
What the audit reads, in the order it reads it.
|
|
31
|
-
|
|
32
|
-
```mermaid
|
|
33
|
-
flowchart TD
|
|
34
|
-
A[The audit starts] --> B[Open tasks and their columns]
|
|
35
|
-
B --> C[Epics: links both ways, the base of task PRs, long work]
|
|
36
|
-
C --> D[Open PRs: column, lag behind the base, conflict]
|
|
37
|
-
D --> E{The pipeline wakes for the base}
|
|
38
|
-
E -->|Yes| F[The run on the tip: absent, pushed out, green on a draft]
|
|
39
|
-
E -->|No| G[One line for all such PRs, not a discrepancy]
|
|
40
|
-
F --> H[The last run of the main branch]
|
|
41
|
-
G --> H
|
|
42
|
-
H --> I[Lines are printed, the exit code says whether any were]
|
|
43
|
-
```
|
|
15
|
+
| In the law | Here |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| the work queue | the project board; a task is an issue on it |
|
|
18
|
+
| a discrepancy of the queue | a line of the audit; a run with lines exits with code 1 |
|
|
19
|
+
| the audit run | `npm run check:board` |
|
|
44
20
|
|
|
45
21
|
## How the law applies here
|
|
46
22
|
|
|
47
|
-
- **A lagging column is found by the queue audit, not by eye.**
|
|
48
|
-
|
|
49
|
-
- **A branch with an open PR lags behind its base silently.** The guard judges the base
|
|
50
|
-
opening, and the run does not see what merged after. The
|
|
51
|
-
|
|
52
|
-
- **The link between a task and an epic is read by the audit both ways.**
|
|
53
|
-
|
|
23
|
+
- **A lagging column is found by the queue audit, not by eye.** Both ways: an open PR with the task
|
|
24
|
+
not in review, and review with no open PR.
|
|
25
|
+
- **A branch with an open PR lags behind its base silently.** The guard judges the base only at
|
|
26
|
+
opening, and the run does not see what merged after. The audit counts the lag in a summary line
|
|
27
|
+
and refuses nothing: the host merges a lag without a conflict itself.
|
|
28
|
+
- **The link between a task and an epic is read by the audit both ways.** The audit also judges the
|
|
29
|
+
base of a task's PR: a base past the epic branch and its chain takes the task out of the epic.
|
|
54
30
|
- **Work that one session cannot close is marked in two places, and they are audited.** The board
|
|
55
|
-
label and the sessions line
|
|
56
|
-
does not split is marked.
|
|
31
|
+
label and the sessions line of the epic plan say the same; only what legitimately does not split is marked.
|
|
57
32
|
- **The tip of an open PR without a run is seen by the work queue audit, unless the pipeline does
|
|
58
|
-
not wake for its base.**
|
|
59
|
-
|
|
33
|
+
not wake for its base.** There it is silent about that PR; one summary line counts all such PRs,
|
|
34
|
+
and it is not a discrepancy.
|
|
60
35
|
- **A run pushed out of the pipeline queue gets a separate audit line.** It looks failed though it
|
|
61
|
-
never checked the branch
|
|
36
|
+
never checked the branch; the step count tells them apart.
|
|
62
37
|
- **The last run of the main branch is judged by the audit too: red and pushed out get lines of
|
|
63
38
|
their own.** The merge itself is checked by nobody; a pipeline asleep on a push to main is named.
|
|
64
|
-
- **A draft with a green run on its tip is an audit discrepancy.**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
before the merge the miss does not show. A request to the author does not count, so a PR opened
|
|
70
|
-
by a person shows here too; the author apart is not judged.
|
|
39
|
+
- **A draft with a green run on its tip is an audit discrepancy.** The host locks its button.
|
|
40
|
+
- **A conflicting open PR is a work queue audit discrepancy.** The host shows the mark only inside
|
|
41
|
+
the PR.
|
|
42
|
+
- **An open PR without a reviewer is a work queue audit discrepancy.** A request to the author does
|
|
43
|
+
not count, so a PR opened by a person shows too; the author apart is not judged.
|
|
71
44
|
|
|
72
45
|
## What of the law is not here
|
|
73
46
|
|
|
74
|
-
The audit reads the queue and the host, not the tree:
|
|
75
|
-
|
|
47
|
+
The audit reads the queue and the host, not the tree: it does not judge a PR body, and sees a
|
|
48
|
+
column moved by hand only on the next run.
|
|
76
49
|
|
|
77
50
|
## Patterns
|
|
78
51
|
|
|
@@ -7,7 +7,7 @@ description: Rule under the work-conduct law — the owner's word and the sessio
|
|
|
7
7
|
|
|
8
8
|
# Work conduct — the owner's word and the session
|
|
9
9
|
|
|
10
|
-
Rule under the law `docs/constitution/work-conduct.md`. Cold part: `pitfalls.md
|
|
10
|
+
Rule under the law `docs/constitution/work-conduct.md`. Cold part: `pitfalls.md`.
|
|
11
11
|
|
|
12
12
|
## How the law applies here
|
|
13
13
|
|
|
@@ -15,12 +15,12 @@ Rule under the law `docs/constitution/work-conduct.md`. Cold part: `pitfalls.md`
|
|
|
15
15
|
- **A stop the owner sets on a later step is written down the moment it is said.**
|
|
16
16
|
- **A reply to the owner's order begins with the result, not with intent or its justification.**
|
|
17
17
|
- **The last run of the main branch is read first thing in a session and after every known merge.**
|
|
18
|
-
- **A session does not start work by itself.** An empty message,
|
|
19
|
-
- **A refusal by an external limiter removes the way, not the task.**
|
|
20
|
-
- **A question written by a past session does not become a question to the owner.** It goes to the handover's author;
|
|
18
|
+
- **A session does not start work by itself.** An empty message, a word or a path orders nothing.
|
|
19
|
+
- **A refusal by an external limiter removes the way, not the task.** A guard that names the fix gives the way.
|
|
20
|
+
- **A question written by a past session does not become a question to the owner.** It goes to the handover's author; a work step closes some.
|
|
21
21
|
- **The owner's instruction holds until they cancel it, and a new fact against it is a line in the reply about the cost, not a new question.**
|
|
22
22
|
- **An answer in the owner's message counts the same as an answer in a document.**
|
|
23
|
-
- **The owner's word about the design is a task setting, not a decision.**
|
|
23
|
+
- **The owner's word about the design is a task setting, not a decision.** Checked against the tree first; a mismatch goes to the owner.
|
|
24
24
|
- **A tool the owner named is used, and a substitute is named in the same reply.** With the reason.
|
|
25
25
|
- **A rule of the tree outweighs a standing instruction of the host.**
|
|
26
26
|
- **An instruction to work by a rule or by the progress is an instruction to do all its steps, including those that change history.**
|
|
@@ -28,7 +28,7 @@ Rule under the law `docs/constitution/work-conduct.md`. Cold part: `pitfalls.md`
|
|
|
28
28
|
- **Work ordered in words becomes a task in the queue in the same turn.** Postponed work names a date.
|
|
29
29
|
- **An improvement of a rule names the metric it should move, and the next report judges it.**
|
|
30
30
|
- **Work is judged by the role `goal-critic` against the owner's words.**
|
|
31
|
-
- **A mission is set by the owner.** A session
|
|
31
|
+
- **A mission is set by the owner.** A session proposes a wording and waits for approval.
|
|
32
32
|
- **Building by a sample begins with reading the sample itself, whole, by walking the directories.**
|
|
33
33
|
- **Exploration of a tree that holds a code graph begins with the graph.**
|
|
34
34
|
- **The path to a sample lies outside the history, the permission to work outside the epic — in the main branch.**
|
|
@@ -19,7 +19,7 @@ demand, not with the rule.
|
|
|
19
19
|
| In the law | Here |
|
|
20
20
|
| --- | --- |
|
|
21
21
|
| turn | one pass of the agent: from the owner's message to the reply |
|
|
22
|
-
| a turn exit | the end of the scenario or the owner's
|
|
22
|
+
| a turn exit | the end of the scenario or the owner's Esc; the other release cases of the task flow description |
|
|
23
23
|
| the guard of turn exits | a guard at the turn's end: asks the engine to measure the branch by the task flow description |
|
|
24
24
|
| the agent hook of the turn's end | a model at the turn's end: reads the owner's last message, the reply and the calls of the turn |
|
|
25
25
|
| a statement about the state of the tree | a word in the reply to the owner backed by a command of the same turn and its output |
|
|
@@ -28,15 +28,16 @@ demand, not with the rule.
|
|
|
28
28
|
|
|
29
29
|
## Turn exits
|
|
30
30
|
|
|
31
|
-
A turn ends when the scenario is over or when the owner
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
A turn ends when the scenario is over or when the owner pressed Esc. No typed word stops the work:
|
|
32
|
+
the owner wants no command that lets the agent do nothing, and a wait for a long process of its own
|
|
33
|
+
is a release case, not a stop. The exit guard measures the branch by the task flow description and
|
|
34
|
+
holds every other turn with the one move that comes next, unless a release case below is met.
|
|
34
35
|
|
|
35
36
|
<!-- flow:turn-end -->
|
|
36
37
|
The engine lets a turn end before the scenario does when a case is met, asked in this order:
|
|
37
38
|
|
|
38
39
|
- **1** · the end of the scenario — `any(measure.epic.finished, all(measure.copy.outsideEpic, measure.pr.handed))`
|
|
39
|
-
- **2** ·
|
|
40
|
+
- **2** · the owner interrupted the turn — `measure.owner.interrupted`
|
|
40
41
|
- **3** · a background task of the session runs — `all(measure.session.waiting, not(measure.pr.handed))`
|
|
41
42
|
- **4** · no write to the tree, or a branch outside the scenario — `any(measure.copy.outOfScenario, all(not(measure.session.wrote), not(measure.owner.nudged)))`
|
|
42
43
|
- **5** · a role session — `measure.session.role`
|
|
@@ -47,7 +48,8 @@ The engine lets a turn end before the scenario does when a case is met, asked in
|
|
|
47
48
|
A question to the owner, a guard's refusal, a handover and handed-in work do not end a turn. A
|
|
48
49
|
question waits for its answer inside the turn, a refusal is answered by the next call, and handed-in
|
|
49
50
|
work is followed by the next task. A step that another guard refuses twice
|
|
50
|
-
goes to the owner as one menu with the options of the description: «отложить RT-N»,
|
|
51
|
+
goes to the owner as one menu with the options of the description: «отложить RT-N», «подскажу
|
|
52
|
+
путь»; the owner writes the way in its free field, and the agent goes on with the same step by it.
|
|
51
53
|
|
|
52
54
|
The queue is asked by a command in the same turn: "there are no tasks" is a statement about the
|
|
53
55
|
tree, and the executor's memory does not confirm it.
|
|
@@ -74,11 +76,11 @@ One turn: what it ends with, what is checked before its end and what the owner i
|
|
|
74
76
|
flowchart TD
|
|
75
77
|
A[The turn is going] --> B{The engine measures the branch}
|
|
76
78
|
B -->|The scenario is over| L[The epic table shown]
|
|
77
|
-
B -->|The owner
|
|
79
|
+
B -->|The owner pressed Esc| I
|
|
78
80
|
B -->|Another release case of the description| I
|
|
79
81
|
B -->|None| D{The next move}
|
|
80
82
|
D -->|The executor's step| G[Done in the same turn: a question, a refusal, a handover never end it]
|
|
81
|
-
D -->|Another guard refuses it twice| M[One menu: «отложить RT-N»,
|
|
83
|
+
D -->|Another guard refuses it twice| M[One menu: «отложить RT-N», «подскажу путь»]
|
|
82
84
|
M --> A
|
|
83
85
|
G --> A
|
|
84
86
|
L --> I{The reply speaks of the tree}
|
|
@@ -165,7 +167,7 @@ flowchart TD
|
|
|
165
167
|
over is held whatever stood last, unless a release case is met.
|
|
166
168
|
- **Waiting for someone else's step is never the last action of a turn.** While they are waited for,
|
|
167
169
|
the work stays where it stood. The last action is judged: waiting mid-turn is lawful, and so is a
|
|
168
|
-
launch in the background mid-turn. Standing last, it ends the turn only as a wait the record shows: a background task of the session with no end, younger than
|
|
170
|
+
launch in the background mid-turn. Standing last, it ends the turn only as a wait the record shows: a background task of the session with no end, younger than ninety minutes, once per task and not after the work is handed over. A watch of a CI run is such a task, a server is not; an older task is hung, and the hold names it. What does not depend on it is done first.
|
|
169
171
|
- **The handover is written even where the branch has no name.** All of it lies in the tree and is
|
|
170
172
|
reachable on a detached head; one file needs a name, and a short snapshot of the head gives it.
|
|
171
173
|
Otherwise compaction comes without a handover, and the next session starts from a blank.
|
|
@@ -184,22 +186,23 @@ flowchart TD
|
|
|
184
186
|
- **A step of the plan that is not done forbids a stop, and a report about the done is not an
|
|
185
187
|
exception.** The engine counts the steps by their marks, and a running stage holds the turn
|
|
186
188
|
whatever the report says.
|
|
187
|
-
- **The
|
|
188
|
-
|
|
189
|
-
- **Until the scenario is over a turn ends only by the owner's
|
|
190
|
-
handover and a second pass are the turn going on: the exit guard returns
|
|
191
|
-
named. The other release cases of the
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
- **The stop is read from the owner's Esc, not from the executor.** Otherwise the stop is declared
|
|
190
|
+
by whoever finds it convenient, and the ban holds until the first inconvenience.
|
|
191
|
+
- **Until the scenario is over a turn ends only by the owner's Esc or by a release case.** A
|
|
192
|
+
question, a refusal, a handover and a second pass are the turn going on: the exit guard returns
|
|
193
|
+
each with the next move named. A typed word stops nothing. The other release cases of the
|
|
194
|
+
description are not the executor's to choose.
|
|
195
|
+
- **The owner's Esc is read from the record of the session, not from the progress.** A stop written
|
|
196
|
+
on disk by the executor is a retelling. The host writes Esc into the record as the owner's entry,
|
|
197
|
+
and it releases the turns a background notice wakes only while it is the owner's last word.
|
|
195
198
|
- **The session is ended by the owner and by nobody else.** The tool that closes the conversation is
|
|
196
199
|
refused by a guard always, with no lawful form of bypass: an assignment stands until the owner
|
|
197
200
|
cancels it, and a session that must close is closed by them.
|
|
198
201
|
- **A refusal of a guard never ends the turn.** It is answered by the next call: the condition met,
|
|
199
202
|
another step taken, or the owner's menu put to them. A refused stop — the
|
|
200
203
|
closing tool — is no exit either.
|
|
201
|
-
- **The phrase "waiting for your word" is a stop declared by the executor.** Without the owner's
|
|
202
|
-
|
|
204
|
+
- **The phrase "waiting for your word" is a stop declared by the executor.** Without the owner's
|
|
205
|
+
Esc, waiting for their word is a report, not work. A decision that is theirs goes to them as a
|
|
203
206
|
menu, and the turn waits for the answer inside itself. The agent hook judges it by meaning.
|
|
204
207
|
- **A statement about the tree's state is watched by the agent hook, not by the executor's
|
|
205
208
|
memory.** Everything the reply says about the tree carries a command and its output; said without
|