@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.
Files changed (59) hide show
  1. package/assets/checks/check-turn-map.mjs +4 -4
  2. package/assets/checks/decision-table.json +91 -24
  3. package/assets/checks/flow-data.mjs +22 -23
  4. package/assets/checks/flow-forecast.mjs +12 -8
  5. package/assets/checks/flow-guard.mjs +365 -163
  6. package/assets/checks/flow-step.mjs +188 -58
  7. package/assets/checks/flow-verdict.mjs +124 -9
  8. package/assets/checks/record-count.mjs +27 -0
  9. package/assets/checks/task-flow-script.mjs +33 -7
  10. package/assets/checks/work-result.mjs +92 -11
  11. package/assets/commands/night.md +3 -3
  12. package/assets/defaults/turn-map.md +4 -2
  13. package/assets/docs/GLOSSARY.md +1 -1
  14. package/assets/hooks/ask-judge.md +4 -2
  15. package/assets/hooks/facts.sh +66 -0
  16. package/assets/hooks/git-guard-delivery-epic.sh +2 -2
  17. package/assets/hooks/git-guard-delivery-rerun.sh +17 -5
  18. package/assets/hooks/git-guard-push-ahead.sh +24 -2
  19. package/assets/hooks/git-guard-push-marks.sh +209 -12
  20. package/assets/hooks/git-guard-push-tests.sh +29 -2
  21. package/assets/hooks/pre-push.sh +26 -2
  22. package/assets/hooks/push-ahead-call-guard.sh +447 -0
  23. package/assets/hooks/push-set.sh +31 -8
  24. package/assets/hooks/turn-exit-guard.sh +1 -1
  25. package/assets/hooks/turn-judge.md +16 -6
  26. package/assets/patterns/doc-style-human.md +36 -76
  27. package/assets/pitfalls/doc-style-human.md +112 -0
  28. package/assets/pitfalls/epic-flow.md +92 -0
  29. package/assets/pitfalls/mockups.needs-mockups.md +87 -0
  30. package/assets/pitfalls/observability.needs-app.md +186 -0
  31. package/assets/pitfalls/platform-access.md +94 -0
  32. package/assets/pitfalls/queue-audit.github.md +78 -0
  33. package/assets/pitfalls/task-flow-archive.md +2 -1
  34. package/assets/pitfalls/task-flow-close.2.md +2 -1
  35. package/assets/pitfalls/task-flow-owner.md +29 -0
  36. package/assets/pitfalls/task-flow-resume.md +2 -2
  37. package/assets/pitfalls/task-flow-start.md +1 -1
  38. package/assets/pitfalls/turn-conduct.md +1 -1
  39. package/assets/rules/autonomous-work.md +1 -1
  40. package/assets/rules/epic-flow.md +24 -63
  41. package/assets/rules/mockups.needs-mockups.md +25 -64
  42. package/assets/rules/observability.needs-app.md +43 -172
  43. package/assets/rules/platform-access.md +28 -75
  44. package/assets/rules/queue-audit.github.md +25 -52
  45. package/assets/rules/task-flow-owner.md +6 -6
  46. package/assets/rules/turn-conduct.md +22 -19
  47. package/assets/task-flow/flow.js +10 -14
  48. package/assets/task-flow/flow.md +7 -8
  49. package/assets/task-flow/measure/ci.mjs +184 -0
  50. package/assets/task-flow/measure/owner.mjs +13 -6
  51. package/assets/task-flow/measure/session.mjs +92 -15
  52. package/assets/task-flow/source/git.mjs +179 -11
  53. package/assets/task-flow/source/host.mjs +105 -0
  54. package/assets/task-flow/source/owner.mjs +33 -13
  55. package/assets/task-flow/source/session.mjs +47 -10
  56. package/lib/agent-checks.d.ts.map +1 -1
  57. package/lib/agent-checks.js +14 -2
  58. package/lib/agent-checks.js.map +1 -1
  59. package/package.json +1 -1
@@ -2,113 +2,73 @@
2
2
  name: doc-style-human
3
3
  kind: pattern
4
4
  rule: doc-style
5
- description: Pattern of rule doc-style. Load when writing a task in the work queue, a PR description and a chat reply to the owner. Samples of "so" and "not so" for each of the three texts and the words that get replaced in them. The shape of a status reply is named by rule status-report.
5
+ description: Pattern of rule doc-style. Load when writing a task in the work queue, a PR description and a chat reply to the owner. Samples and the words to replace; a status reply — rule status-report.
6
6
  ---
7
7
 
8
8
  # A task, a PR description and a reply to the owner
9
9
 
10
- Pattern of the rule `doc-style`. Three texts are read by a person from outside: they remember
11
- the product and have not read a single rule of the layer. Here — how they are written; what must
12
- be true is said by the "Texts for a person" section of the rule itself.
10
+ Pattern of rule `doc-style`, section "Texts for a person": the reader knows the product, not
11
+ the rules. Cold part: `pitfalls.md`.
13
12
 
14
13
  ## When to use
15
14
 
16
- - A task is created in the work queue.
17
- - A PR description is written.
18
- - A chat reply to the owner is written — except a reply about the work state: its shape is
19
- named by the rule `status-report`.
15
+ - A task, a PR description, a chat reply; a status reply — rule `status-report`.
20
16
 
21
17
  ## Words that get replaced
22
18
 
23
- The left column holds the words of the rules layer. They are right inside the layer and empty to
24
- whoever does not look into it.
25
-
26
- | Layer word | What to say to the owner |
27
- | ----------------- | ---------------------------------------------------------- |
28
- | PR | the change that waits for your word |
29
- | run, suite | checks; "the checks passed", "the checks are red" |
30
- | guard, gate | what exactly did not let it through, and why |
31
- | agreement | what was agreed about this screen |
32
- | change size | what changes on the screen and where |
33
- | resource layout | updating the rules on the machine |
19
+ | Layer word | What to say to the owner |
20
+ | --- | --- |
21
+ | PR | the change that waits for your word |
22
+ | run, suite | checks; "the checks passed", "the checks are red" |
23
+ | guard, gate | what exactly did not let it through, and why |
24
+ | agreement | what was agreed about this screen |
25
+ | change size | what changes on the screen and where |
26
+ | resource layout | updating the rules on the machine |
34
27
 
35
28
  ## Task
36
29
 
37
- The title names the subject, the body — what the person cannot do. The red check stands in the
38
- body as the last line: it says where to look and does not say why to fix it.
30
+ The title names the subject, the body — what the person cannot do. The red check is the last line:
31
+ where to look, not why.
39
32
 
40
- ```text
41
- ✗ Сквозная спека берёт пункт заглушкой, а прогон на вершине не доходит до выкатки
42
- ✓ Раздел «Отчёты» не открывается у пользователя, и из-за этого не идёт выкатка.
43
- Красная проверка — сквозной набор, шаг «отчёты».
44
- ```
33
+ > ✓ Раздел «Отчёты» не открывается у пользователя, и из-за этого не идёт выкатка.
34
+ > Красная проверка — сквозной набор, шаг «отчёты».
45
35
 
46
36
  ## PR description
47
37
 
48
- The first paragraph — what changes for the person. Then — what confirms it. File names belong at
49
- the end, not in place of the first paragraph.
38
+ First what changes for the person, then what confirms it; file names last.
50
39
 
51
- ```text
52
- ✗ Ярус личности вызова получил второй признак, набор гейта зелёный
53
- ✓ Заявки от машинной записи больше не открываются от имени владельца: теперь перед открытием
54
- спрашивается, кто приходит по токену. Проверки прошли, 26 сценариев.
55
- ```
40
+ > ✗ Ярус личности вызова получил второй признак
56
41
 
57
42
  ## Chat reply
58
43
 
59
- Answers the question asked in the first sentence. A statement about the tree goes together with
60
- the command and its output — the rule `status-report` requires it, and in chat it holds the same.
44
+ The first sentence answers the question; a claim about the tree comes with its command and output.
61
45
 
62
- ```text
63
- ✗ Работа отдана, красное въехало в главную, откат прикрыт гардом
64
- ✓ Правку я отправил, она ждёт вашего слова. В главной ветке сейчас красный шаг «сборка витрины»
65
- — упал не на этой правке, вывод: 76 из 76 сценариев не поднялись, витрина лежит.
66
- ```
46
+ > ✗ Работа отдана, красное въехало в главную
67
47
 
68
48
  ## The language of the text
69
49
 
70
- The rules layer is written in English, and the three texts for a person in the owner's language.
71
- A session that has just read a rule writes the task in the rule's words and language; the
72
- addressee is checked before the first line — together with the register.
73
-
74
- ```text
75
- ✗ [RT-1849] Prose, glossary and description checks only count Cyrillic
76
- ✓ [RT-1849] Проверки слога, словаря и описаний считают только кириллицу
77
-
78
- ✗ - **A path named in a document exists.** (a rule article written into the task body)
79
- ✓ Пути, названные в задаче, проверяет команда `npm run check:docs`; она красная на двух.
80
- ```
50
+ The texts are in the language of the owner's chat and cards, English included. Addressee and
51
+ register are checked before the first line; the usual miss is a task in the words and language of
52
+ a rule just read, or with a rule article copied in.
81
53
 
82
- The owner's language is the one they write in chat and on cards. An owner writing in English
83
- gets an English task, and that is no miss: the miss is a text in a language the addressee did
84
- not choose.
54
+ > ✓ [RT-1849] Проверки слога, словаря и описаний считают только кириллицу
85
55
 
86
56
  ## A guide for an executor in another tree
87
57
 
88
- Its reader has neither the author's memory nor the author's conversation, so the guide is checked
89
- step by step before it is handed over: each step is done from the text alone. Addresses, access
90
- and the state of name records are written in. A solution already found and verified goes in as a
91
- recipe; "decide later" stands only where no way was verified. The ban on naming another tree covers
92
- its name, not the infrastructure its reader needs.
58
+ Each step is done from the text alone before hand-over. Addresses, access and name-record state are
59
+ written in; a verified solution goes in as a recipe, "decide later" only where no way was
60
+ verified. Not naming another tree bans its name, not the infrastructure its reader needs.
93
61
 
94
- ```text
95
- ✗ Шаг 1. Подготовьте узел. Адрес и доступ решим позже.
96
- ✓ Шаг 1. Узел — таблица «Где узел»: адрес, порт почты, вход по ключу. Запись DNS ставит владелец
97
- домена, и в задаче она названа его действием.
98
- ```
62
+ > ✗ Адрес и доступ решим позже.
99
63
 
100
64
  ## Pitfalls
101
65
 
102
- - **A promise about the behaviour of an outside service names what backs it.** A host or a bot is
103
- promised to do something only with a quote of its documentation or a run that did it; where it
104
- cannot be checked before the merge, the text says exactly that.
66
+ - **A promise about the behaviour of an outside service names what backs it.** A quote of its docs
67
+ or a run; unchecked before the merge — said so.
105
68
  - **What a text says about another record is read from that record in the same turn.** A release
106
- note names a task by the title read in the tracker at that minute, and a commit without a task
107
- number does not go into it: a number taken from memory lands on someone else's task.
108
-
109
- - **Shorter does not mean clearer.** A text in the layer's words comes out a third shorter and
110
- is useless to whoever decides whether the work is urgent.
111
- - **"Not X but Y" looks like an explanation and explains nothing.** The owner learns what was
112
- not there and does not learn what is.
113
- - **The word "done" without a number reads as a verified fact.** The number is the run id, how
114
- many scenarios out of how many, the time of the check.
69
+ note: task titles from the tracker that minute, no commit without a task number.
70
+ - **Shorter does not mean clearer.** Layer words make a text shorter and useless to whoever judges
71
+ urgency.
72
+ - **"Not X but Y" looks like an explanation and explains nothing.**
73
+ - **The word "done" without a number reads as a verified fact.** The number: run id,
74
+ scenarios out of how many, time of the check.
@@ -0,0 +1,112 @@
1
+ # A task, a PR description and a reply to the owner — cold part
2
+
3
+ What the pattern `doc-style-human` handed over when cut to its conventions, every section whole,
4
+ with all its samples and reasons. Its hot part keeps each convention and one sample of it.
5
+
6
+ ## The pattern whole
7
+
8
+ Pattern of the rule `doc-style`. Three texts are read by a person from outside: they remember
9
+ the product and have not read a single rule of the layer. Here — how they are written; what must
10
+ be true is said by the "Texts for a person" section of the rule itself.
11
+
12
+ ## When to use
13
+
14
+ - A task is created in the work queue.
15
+ - A PR description is written.
16
+ - A chat reply to the owner is written — except a reply about the work state: its shape is
17
+ named by the rule `status-report`.
18
+
19
+ ## Words that get replaced
20
+
21
+ The left column holds the words of the rules layer. They are right inside the layer and empty to
22
+ whoever does not look into it.
23
+
24
+ | Layer word | What to say to the owner |
25
+ | ----------------- | ---------------------------------------------------------- |
26
+ | PR | the change that waits for your word |
27
+ | run, suite | checks; "the checks passed", "the checks are red" |
28
+ | guard, gate | what exactly did not let it through, and why |
29
+ | agreement | what was agreed about this screen |
30
+ | change size | what changes on the screen and where |
31
+ | resource layout | updating the rules on the machine |
32
+
33
+ ## Task
34
+
35
+ The title names the subject, the body — what the person cannot do. The red check stands in the
36
+ body as the last line: it says where to look and does not say why to fix it.
37
+
38
+ ```text
39
+ ✗ Сквозная спека берёт пункт заглушкой, а прогон на вершине не доходит до выкатки
40
+ ✓ Раздел «Отчёты» не открывается у пользователя, и из-за этого не идёт выкатка.
41
+ Красная проверка — сквозной набор, шаг «отчёты».
42
+ ```
43
+
44
+ ## PR description
45
+
46
+ The first paragraph — what changes for the person. Then — what confirms it. File names belong at
47
+ the end, not in place of the first paragraph.
48
+
49
+ ```text
50
+ ✗ Ярус личности вызова получил второй признак, набор гейта зелёный
51
+ ✓ Заявки от машинной записи больше не открываются от имени владельца: теперь перед открытием
52
+ спрашивается, кто приходит по токену. Проверки прошли, 26 сценариев.
53
+ ```
54
+
55
+ ## Chat reply
56
+
57
+ Answers the question asked in the first sentence. A statement about the tree goes together with
58
+ the command and its output — the rule `status-report` requires it, and in chat it holds the same.
59
+
60
+ ```text
61
+ ✗ Работа отдана, красное въехало в главную, откат прикрыт гардом
62
+ ✓ Правку я отправил, она ждёт вашего слова. В главной ветке сейчас красный шаг «сборка витрины»
63
+ — упал не на этой правке, вывод: 76 из 76 сценариев не поднялись, витрина лежит.
64
+ ```
65
+
66
+ ## The language of the text
67
+
68
+ The rules layer is written in English, and the three texts for a person in the owner's language.
69
+ A session that has just read a rule writes the task in the rule's words and language; the
70
+ addressee is checked before the first line — together with the register.
71
+
72
+ ```text
73
+ ✗ [RT-1849] Prose, glossary and description checks only count Cyrillic
74
+ ✓ [RT-1849] Проверки слога, словаря и описаний считают только кириллицу
75
+
76
+ ✗ - **A path named in a document exists.** (a rule article written into the task body)
77
+ ✓ Пути, названные в задаче, проверяет команда `npm run check:docs`; она красная на двух.
78
+ ```
79
+
80
+ The owner's language is the one they write in chat and on cards. An owner writing in English
81
+ gets an English task, and that is no miss: the miss is a text in a language the addressee did
82
+ not choose.
83
+
84
+ ## A guide for an executor in another tree
85
+
86
+ Its reader has neither the author's memory nor the author's conversation, so the guide is checked
87
+ step by step before it is handed over: each step is done from the text alone. Addresses, access
88
+ and the state of name records are written in. A solution already found and verified goes in as a
89
+ recipe; "decide later" stands only where no way was verified. The ban on naming another tree covers
90
+ its name, not the infrastructure its reader needs.
91
+
92
+ ```text
93
+ ✗ Шаг 1. Подготовьте узел. Адрес и доступ решим позже.
94
+ ✓ Шаг 1. Узел — таблица «Где узел»: адрес, порт почты, вход по ключу. Запись DNS ставит владелец
95
+ домена, и в задаче она названа его действием.
96
+ ```
97
+
98
+ ## Pitfalls
99
+
100
+ - **A promise about the behaviour of an outside service names what backs it.** A host or a bot is
101
+ promised to do something only with a quote of its documentation or a run that did it; where it
102
+ cannot be checked before the merge, the text says exactly that.
103
+ - **What a text says about another record is read from that record in the same turn.** A release
104
+ note names a task by the title read in the tracker at that minute, and a commit without a task
105
+ number does not go into it: a number taken from memory lands on someone else's task.
106
+
107
+ - **Shorter does not mean clearer.** A text in the layer's words comes out a third shorter and
108
+ is useless to whoever decides whether the work is urgent.
109
+ - **"Not X but Y" looks like an explanation and explains nothing.** The owner learns what was
110
+ not there and does not learn what is.
111
+ - **The word "done" without a number reads as a verified fact.** The number is the run id, how
112
+ many scenarios out of how many, the time of the check.
@@ -0,0 +1,92 @@
1
+ # Epics — how it works here — cold part
2
+
3
+ What the rule `epic-flow` handed over when cut to its statements, every article whole.
4
+
5
+ Rule under the law `docs/constitution/work-conduct.md`. The law says that a series of tasks is
6
+ declared an epic before the first of them and keeps the order assigned at planning; the law
7
+ `docs/constitution/delivery.md` adds that the main branch takes the epic whole. Here — how a series
8
+ of tasks is held together as one epic. The course of
9
+ one task is rule `task-flow`, the end of a turn is `turn-conduct`, both under the same law.
10
+
11
+ **Requires:** `hooks/tree-assignment-guard.sh`, `checks/tree-assignment.mjs`
12
+
13
+ ## What it is called here
14
+
15
+ | In the law | Here |
16
+ | --- | --- |
17
+ | an epic — the unit of delivery | a card in the work queue with the epic label, a branch of its own from the main branch and a plan next to it. The plan holds the capability, the tasks and their order |
18
+ | the epic branch | `<КЛЮЧ>-<номер эпика>-<короткий-slug>`; the branches of its tasks are taken from it, and their PRs go into it |
19
+ | the epic plan | a record outside the task folder: the folder dies with the merge, the epic outlives it; the directory — in the rule's companion |
20
+ | who leads which epic | the table of assignments: a row for each working copy, written by the owner |
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
+ The course of an epic from the series of tasks the grill gave to the request into the main branch.
31
+
32
+ ```mermaid
33
+ flowchart TD
34
+ A[The grill gave a series of tasks] --> B[The epic is declared: a card, a plan and all its tasks at once]
35
+ B --> C[The epic branch is taken from the main branch before the first task]
36
+ C --> D[The first task is taken, and the epic card moves to in progress]
37
+ D --> E{Tasks of the epic are left}
38
+ E -->|Yes| F[The next task is taken from the epic plan]
39
+ F --> E
40
+ E -->|No| G[Every folder is taken apart, then the request of the epic into the main branch opens]
41
+ ```
42
+
43
+ ## How the law applies here
44
+
45
+ - **Work begins with the epic, and a task outside one is not taken.** The main branch takes the
46
+ whole or does not take it. Work outside an epic exists only by
47
+ the owner's word about that work, said about that work.
48
+ - **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
49
+ leaves the first task on the main branch.
50
+ - **The epic card moves to in progress by the same turn that takes its first task.** The owner
51
+ follows the epic by one card: left in place, it reads as never started.
52
+ - **The next task is taken from the epic plan, and the queue list is asked only where there is no
53
+ epic.** A list of numbers does not tell someone else's epic from one's own.
54
+ - **Which epic this working copy leads is read from the table of assignments, and the owner writes
55
+ it.** A card of the queue is not an order; a guard refuses every call that takes work until
56
+ their word.
57
+ - **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is
58
+ called checked only with a command and its output.
59
+ - **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
60
+ them one at a time hides the volume.
61
+ - **A task of an epic is linked to the epic card as a sub-issue, not only named in the plan.** The
62
+ board reads no text: without the link it looks like a task outside one. Closed tasks are linked.
63
+ - **The epic plan names how the branches of its tasks stand, on a par with their order.** Two
64
+ arrangements: each branch from the epic branch, or a stack — each from the previous. The written
65
+ arrangement binds whoever creates the branch.
66
+ - **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
67
+ left in the epic branch reaches the main branch with it. Until then nobody is offered the epic
68
+ branch: its button means the whole epic.
69
+ - **The epic plan lies where it is found without the network and after the merge.** The card holds
70
+ no task order, and the folder dies with the merge. What the owner names along the way is appended
71
+ there by the turn that took it.
72
+
73
+ ## What of the law is not here
74
+
75
+ Nothing compares the makeup of the tasks in the plan with the cards in the queue: the audit reads
76
+ the pair "card and plan", not the list. The order of the tasks and the arrangement of the branches
77
+ are prose of the plan, and no check reads them; they are held by whoever creates the next branch.
78
+
79
+ Nothing tells a sign of the end of an epic checked by a command from one confirmed by reading: both
80
+ leave the same line in the plan.
81
+
82
+ The rules gate demands this rule only where an epic is declared or a task of it is created. Taking
83
+ the epic branch, choosing the next task and opening the request of the epic do not demand it: the
84
+ rule is loaded there by its description.
85
+
86
+ ## Patterns
87
+
88
+ - `epic-flow-declare` — declaring an epic with its card, plan and tasks, then taking its branch.
89
+
90
+ ## Pitfalls
91
+
92
+ No trap of this rule is recorded yet. A trap met on an edit lands here, under this heading.
@@ -0,0 +1,87 @@
1
+ # Mockups — how it works here — cold part
2
+
3
+ What the rule `mockups` handed over when cut to its statements, every article whole.
4
+
5
+ Rule under the law `docs/constitution/mockups.md`. The law says what the owner must see before
6
+ the code is written; here — what it is called in this tree, where it lives and what is not checked.
7
+
8
+ ## What it is called here
9
+
10
+ | In the law | Here |
11
+ | ----------------------------------- | ---------------------------------------------------------------------------- |
12
+ | mockup | a frame on a sheet of the design tool |
13
+ | the screen the mockup draws | the page or panel in the application that carries the same name |
14
+ | a sheet of the design file | a file page, never a page of the application |
15
+ | the description of the behaviour | the domain spec in `docs/specs/<domain>/` |
16
+ | the agreement | the product agreement of the task, `docs/specs/<domain>/proposed/<feature>/` |
17
+ | approved | shown to the owner and accepted in their words |
18
+
19
+ ## Where it lives
20
+
21
+ In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
22
+ travels between repositories, the layout does not, and a path named in the rule lies in the
23
+ first tree that keeps its code differently.
24
+
25
+ ## Flow
26
+
27
+ The flow of a mockup from the first frame to the code: what is read before drawing, what is
28
+ measured before showing, and what is checked before work starts by the agreement.
29
+
30
+ ```mermaid
31
+ flowchart TD
32
+ A[A screen is to be drawn or changed] --> B{The behaviour already exists in the tree}
33
+ B -->|Yes| C[The spec of its domain is read before the first frame]
34
+ B -->|No| D[A sample is asked per screen]
35
+ C --> E{A component of the kit goes on the sheet}
36
+ D --> E
37
+ E -->|Yes| F[It is measured in the running showcase and compared with the copy by numbers]
38
+ E -->|No| G[The frames are drawn]
39
+ F --> G
40
+ G --> H[The coordinates of the frames are measured]
41
+ H --> I[The owner approves the mockups]
42
+ I --> J{The agreement has visual rules}
43
+ J -->|Yes| K[Each rule is found on the mockup of every width; a rule the mockups do not show goes to the owner]
44
+ J -->|No| L[The code is written]
45
+ K --> L
46
+ ```
47
+
48
+ ## How the law applies here
49
+
50
+ - **A kit component on a design-tool sheet is a copy of the kit, and the copy drifts.** The source
51
+ of look is the kit's styles in code. Before a component from the sheet goes into a mockup, it is
52
+ measured in the running showcase, and its sizes, alignment and controls are compared with the
53
+ bounds of the copy's nodes by numbers. Reading the styles does not show what the layout computes:
54
+ the height of a row, where unselected items sit, a control that replaces an icon. A divergence is
55
+ a question to the owner, and the answer is fixed once in the copy.
56
+ - **A mockup of behaviour the tree already has starts with reading the spec of its domain.** A
57
+ screen in a design tool looks like work without code, so exploration stops at the sheet of earlier
58
+ mockups. How a payment is taken, what a window asks and which fields a form holds are already
59
+ described by the spec and carried out by code. The spec is read before the first frame, and the
60
+ sample question is asked per screen: one sheet named as the sample of the whole set leaves the
61
+ other screens without one.
62
+ - **The agreement is checked against the approved mockups before work by it.** Every visual rule of
63
+ the agreement is found on the mockup of each width. A rule the mockups do not show goes to the
64
+ owner as a question. Found after the code, it costs a code edit and an agreement edit together.
65
+ - **A mockup is measured by node coordinates before it is shown.** The technique is the pattern
66
+ `mockups-measure`.
67
+ - **An audit of a design file is accepted only when every file page that draws a kit component is
68
+ captured, measured and compared with the code of that component.** Names, properties and the list
69
+ of variants say what a node is called, not what it draws: an arc drawn as a sector and a rounded
70
+ field drawn as a capsule keep correct names. The technique and the report are the pattern
71
+ `mockups-measure`.
72
+ - **A design-tool call asks the rules gate for this rule,** like the browser driver does for its
73
+ own: without that the measurement pattern stays unread for the whole mockup task.
74
+
75
+ ## What of the law is not here
76
+
77
+ Nothing checks that a mockup matches the screen it draws or that the owner approved it: both live
78
+ outside the tree, in the design tool and in the owner's words. The checks above are held by reading.
79
+
80
+ ## Patterns
81
+
82
+ - `mockups-measure` — reading the bounds of frames and buttons in one call and what the numbers
83
+ mean.
84
+
85
+ ## Pitfalls
86
+
87
+ No trap of this rule is recorded yet. A trap met on an edit lands here, under this heading.
@@ -0,0 +1,186 @@
1
+ # Observability — how it works here — cold part
2
+
3
+ What the rule `observability` handed over when cut to its statements, every article whole.
4
+
5
+ Rule under the law `docs/constitution/observability.md`. The law says what the owner must know
6
+ about the running application; here — what it is called in this tree, where it lives and what
7
+ is not here yet.
8
+
9
+ ## What it is called here
10
+
11
+ | In the law | Here |
12
+ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
13
+ | what the application writes about itself | application logs: one line per logger call, in machine form |
14
+ | the step of importance | the level: from debugging details to a failure that took the process down |
15
+ | the request number | the request id, also the response header |
16
+ | the marker by which all failures of one request are found | the same request number — it stands in every log line |
17
+ | failure details | the parsed cause: class, text, protocol code, code and details from the storage, a trimmed stack |
18
+ | the generic error text going outside | an internal error without details |
19
+ | scrubbing secrets | replacing values by field name |
20
+ | a failure in the store | what the failures domain saved: a failure group and its occurrences |
21
+ | 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 |
22
+
23
+ ## Where it lives
24
+
25
+ In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
26
+ travels between repositories, the layout does not, and a path named in the rule lies in the
27
+ first tree that keeps its code differently.
28
+
29
+ ## Flow
30
+
31
+ The flow of handling a request through the eyes of observability: where the request number is
32
+ created, how a failure differs from a breakage and what goes outside.
33
+
34
+ ```mermaid
35
+ flowchart TD
36
+ A[A request arrives] --> B{The request number came from outside}
37
+ B -->|Yes| C[Cleaned and shortened]
38
+ B -->|No| D[Created anew, one for the whole request]
39
+ C --> E[Stands in every log line about this request]
40
+ D --> E
41
+ E --> F{How the work ended}
42
+ F -->|Done| G[The response leaves with the request number in the header]
43
+ F -->|Input or rights| H[Written apart from a breakage and without a stack: a check that fired]
44
+ F -->|Breakage| I[The cause is parsed in one place, the line fields are always scrubbed]
45
+ H --> J[Outside — a code and a generic text; the details stay in the logs]
46
+ I --> J
47
+ J --> K[The request number stands in the failure details too]
48
+ G --> L[Done]
49
+ K --> L
50
+ ```
51
+
52
+ ## How the law applies here
53
+
54
+ - **The request number is created once per request and stands in every log line about it.** By
55
+ time the lines of one request cannot be picked out: there are a dozen requests a second.
56
+ - **The request number goes to the caller as a response header and in the failure details.** It
57
+ also stands in the logs, so a number named by a person is found by a direct filter. The header
58
+ is open to a page of a foreign domain: without explicit permission the browser does not hand
59
+ it over.
60
+ - **A number that came from outside is cleaned and shortened, and an empty one is created anew.**
61
+ The value from the header comes from anyone, and it lands in a filter over the store.
62
+ - **Outside goes the code and a generic error text; the details stay in the logs.** Otherwise a
63
+ guest on a broken rollout reads a column name and the storage layout.
64
+ - **A failure on input or rights is written apart from a breakage and without a stack.** It is a
65
+ check that fired. On one level with breakages it floods the alarm with guests' typos.
66
+ - **The cause of a failure is parsed in one place.** Otherwise the same error arrives in the logs
67
+ in three different shapes.
68
+ - **A field added to the answer of a refusal is added where the answer is assembled, not where the
69
+ refusal is thrown.** The application parses failures in one place and builds the body there out
70
+ of what it knows: every throw may name the field, and the body carries none of them. Neither the
71
+ linter nor the tests next to the throws see it — the loss shows on the screen of whoever reads
72
+ the answer.
73
+ - **The fields of a log line are always scrubbed, not at the discretion of whoever writes.**
74
+ Deciding on every call whether the fields hold a secret means being wrong once.
75
+ - **At startup the application writes what it came up with.** Half of the features are enabled by
76
+ the presence of an environment variable and are silently off without it. Otherwise the
77
+ question "why does it not work there when it works locally" is answered by reading the
78
+ production settings over ssh.
79
+ - **The startup digest holds the names of features and their state, but not the values of
80
+ variables.** The states are laid out as three lists, not as a map "name → state": scrubbing
81
+ works by key name, and the map would arrive in the log scrubbed exactly where the state is
82
+ needed.
83
+ - **A feature enabled by a pair of keys knows a third state.** The halves of the pair lie on
84
+ different sides of the delivery, and exactly one can be filled; then the feature is neither off
85
+ nor on but broken — a list of two states has no name for this case, and it reads as enabled.
86
+ - **The level threshold decides whether a log line appears in the output, but not in the failure
87
+ store.** The threshold is set for the volume of output, and under a high threshold the selected
88
+ lines of a lower level would silently vanish from the store.
89
+ - **A selected log line is saved to the store as a failure.** Selected are the failure level and
90
+ everything above it, and lines of a lower level — by a list of names declared in the code.
91
+ - **The logger hands a failure to the sink and does not see the store.** The sink interface is
92
+ declared next to the logger, the failures domain implements it, and it is set from outside at
93
+ startup.
94
+ - **Log lines of the storage client, the failures domain and the alerts domain do not go to the
95
+ sink.** The source is cut off, not the moment of writing: a slow insert into the failures table
96
+ itself produces a log line of the storage client, and a marker "I am inside a write" cannot
97
+ catch it. The alerts domain is cut off for the same reason: a failed alert would become a new
98
+ failure, and that one — a new alert.
99
+ - **A call to a foreign service goes with an explicit wait limit.** Without it a silent — not
100
+ failed — service holds the connection up to the environment default, and that is minutes: there
101
+ is no failure, nothing to record, and to the owner such silence is indistinguishable from
102
+ healthy work. The limit is named as a number next to the client, because the price of waiting
103
+ differs per service.
104
+ - **A send outside creates its own line before the call, and the outcome is appended to it
105
+ after.** The line is created by whoever sees the store, not by whoever sends: the client of the
106
+ external service does not see the store at all. The line also serves as a lock — a second call
107
+ on the same record does not leave — and an unclosed line shows the difference between "running
108
+ right now" and "fell in the middle of sending".
109
+ - **Recording a failure does not delay the response and does not take the request down.**
110
+ Between the logger and the store stands a bounded queue; a full queue drops the new failure and
111
+ counts what was dropped.
112
+ - **The request context is captured at the moment of the logger call, not at the moment of
113
+ writing.** By the time of writing the execution storage has already been handed to the next
114
+ request.
115
+ - **The owner reads what was recorded in their own section, closed by a separate right.** The
116
+ groups that are theirs, and under a group — its occurrences with the cause, the log line fields
117
+ and the bodies.
118
+ - **The store does not grow without limit: once a day the excess and the old are removed.**
119
+ Occurrences are removed: first the excess beyond the limit, then the old beyond the age.
120
+ A group left with no occurrence after that goes in a third step — and only if it is older than
121
+ an hour: between its creation and its first occurrence a separate request passes.
122
+ - **The store limit is named in rows, not bytes.** Deletion does not shrink the physical size of
123
+ the table, and the condition "size under the limit" would never become true.
124
+ - **The owner learns of a new failure by themselves — by an event journal line and by mail.**
125
+ Both roads are opened by one threshold: a new group, or a group silent for longer than a day.
126
+ - **The mail holds nothing that is closed by the right to the failures screen.** It goes to an
127
+ address closed by no right, and details in it would bypass the right by mail.
128
+ - **The owner reads the failure rate as a curve above the feed: a bar is a bucket of the chosen
129
+ period.** The group counter says how many times it happened, but not when: by it a breakage
130
+ streaming right now cannot be told from one accumulated over a month.
131
+ - **The alarm is raised by growth in breakages, not in all failures.** A rejected call is a check
132
+ that fired, and those are nine in ten: against them growth in breakages is not visible at all.
133
+ - **A spike is counted over the last closed bucket; the current one is not given to the rule.**
134
+ It is still filling, and at the start of every period a comparison with it would show a drop in
135
+ the rate.
136
+ - **The rate is analysed by a schedule tick, not by a screen request.** The curve computes the
137
+ alarm on every response, but the owner may never open the screen, and must learn of a spike
138
+ without it.
139
+ - **The owner learns of a spike by a journal line and by mail; a repeat of the mail is held by a
140
+ fuse.** One incident takes one line in the feed, and a mail about a lasting breakage is needed
141
+ the next day too.
142
+
143
+ ## What of the law is not here
144
+
145
+ A failure that happened before the application came up has nowhere to be recorded: the store
146
+ does not exist yet at that moment. Such failures stay only in the container output. A failure of
147
+ the store itself goes there too: its log lines are excluded from failures entirely, otherwise a
148
+ breakage of the store produces a stream that speeds itself up.
149
+
150
+ The list of selected lower-level names is checked against nothing. A new place that needs the
151
+ store appends itself to it by hand, and a forgotten one silently stays only in the output.
152
+
153
+ Nothing checks that the level was chosen right. A new place decides on its own which level to
154
+ take, and the mistake shows only when the code is read.
155
+
156
+ The completeness of the startup digest is checked by nothing. Feature names are listed by hand,
157
+ while the environment variable is read by dozens of files across all domains: a new feature that
158
+ forgot to append itself to the digest silently lands in none of the three lists — and in
159
+ production looks not disabled but nonexistent. That is why reading an environment variable
160
+ itself demands this rule as a second layer: the guard sees the access to the environment in the
161
+ text of the edit, but not whether the digest was appended.
162
+
163
+ ## Patterns
164
+
165
+ - `observability-record` — how to add a new log line.
166
+
167
+ ## Pitfalls
168
+
169
+ - **The request context lives in the execution storage and does not move into deferred work.** A
170
+ deferred write reads the context of the request that took the place of the original one. The
171
+ context is captured at the moment of the logger call.
172
+ - **The logger is set on the whole application, so the framework lines go the same way as our
173
+ own.** Everything the framework writes about itself lands in the same output and the same
174
+ selection.
175
+ - **A stream failure arrives after the response has started.** Control returns when only the
176
+ header has been sent. Without a wrapper such a failure does not reach the logs at all.
177
+ - **Serialising a log line must not throw.** Otherwise a circular reference in the fields takes
178
+ down the request whose log the fields were assembled for.
179
+ - **The key that wraps a foreign body for scrubbing is chosen by the scrubbing rules.** Scrubbing
180
+ works by key name, and a bare value passes it entirely — but a key that itself counts as free
181
+ text carries the whole body into the store as one scrubbing mark. A new wrapper is checked
182
+ against the key lists before it gets such a name.
183
+ - **A repeat fuse whose key is built from what measures time never fires.** When the analysis
184
+ tick equals the bucket width, every analysis sees an empty lock and sends again. From the
185
+ outside it looks working: the fuse is declared, the binding matches, mails go out every hour.
186
+ The key is taken from the subject of the alert, not from the stretch of time it is counted by.