@rt-tools/agent-kit 0.24.0 → 0.27.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/agents/business-analyst.md +51 -50
- package/assets/agents/cargo-writer.md +54 -0
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epic-link.github.mjs +29 -0
- package/assets/checks/board-epics.github.mjs +286 -49
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +29 -25
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-pull-state.github.mjs +168 -0
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-task-dirs.github.mjs +98 -0
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +133 -194
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +131 -263
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +91 -88
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +74 -71
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +138 -39
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +104 -84
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/epic-table.github.mjs +268 -0
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +187 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/specs-for.mjs +214 -0
- package/assets/checks/task-new.github.mjs +315 -61
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/night.md +115 -0
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +108 -97
- package/assets/defaults/project.sh +232 -185
- package/assets/defaults/shell.sh +73 -68
- package/assets/defaults/turn-map.md +47 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +16 -12
- package/assets/hooks/browser-guard-device-id.sh +34 -28
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +14 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +50 -43
- package/assets/hooks/dispatch.sh +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/epic-over.sh +49 -0
- package/assets/hooks/epic-stop-guard.sh +108 -0
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +41 -36
- package/assets/hooks/git-guard-delivery-draft.sh +48 -38
- package/assets/hooks/git-guard-delivery-epic.sh +167 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +119 -53
- package/assets/hooks/git-guard-delivery.sh +223 -183
- package/assets/hooks/git-guard-main.sh +38 -34
- package/assets/hooks/git-guard-push-tests.sh +99 -87
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +45 -25
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +67 -58
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +49 -24
- package/assets/hooks/qa-dataid-guard.sh +83 -58
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +39 -34
- package/assets/hooks/rule-source-guard.sh +47 -42
- package/assets/hooks/skill-gate-layers.sh +63 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +10 -6
- package/assets/hooks/sql-guard-parse.sh +71 -66
- package/assets/hooks/sql-guard-request.sh +51 -46
- package/assets/hooks/sql-guard-target.sh +60 -51
- package/assets/hooks/sql-guard-write.sh +87 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +43 -37
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +260 -204
- package/assets/hooks/turn-exit-patterns.sh +63 -0
- package/assets/hooks/utf8.sh +14 -11
- package/assets/hooks/waiting-turn-guard.sh +104 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +99 -44
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +170 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -124
- package/assets/laws/work-conduct.md +250 -244
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +124 -88
- package/assets/patterns/browser-verification-stand.md +169 -157
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +55 -37
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +94 -87
- package/assets/patterns/git-workflow-commit.github.md +160 -142
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -90
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +102 -94
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +127 -122
- package/assets/patterns/git-workflow-pr.github.md +186 -177
- package/assets/patterns/git-workflow-pr.gitlab.md +139 -132
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +136 -107
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +48 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +234 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +228 -202
- package/assets/patterns/testing-e2e.md +102 -101
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +172 -142
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +270 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +87 -74
- package/assets/rules/browser-verification.md +223 -214
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +201 -173
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +268 -239
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -143
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +279 -260
- package/assets/rules/status-report.md +62 -58
- package/assets/rules/styling-bem.md +81 -77
- package/assets/rules/task-flow.md +303 -270
- package/assets/rules/testing.md +224 -209
- package/assets/rules/turn-conduct.md +262 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +259 -233
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +8 -1
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo-prose.d.ts +41 -0
- package/lib/cargo-prose.d.ts.map +1 -0
- package/lib/cargo-prose.js +88 -0
- package/lib/cargo-prose.js.map +1 -0
- package/lib/cargo.d.ts +12 -1
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +8 -2
- package/lib/cargo.js.map +1 -1
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +5 -2
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +12 -3
- package/lib/enroll.js.map +1 -1
- package/lib/fate.d.ts +29 -0
- package/lib/fate.d.ts.map +1 -0
- package/lib/fate.js +147 -0
- package/lib/fate.js.map +1 -0
- package/lib/override-marks.d.ts +7 -0
- package/lib/override-marks.d.ts.map +1 -1
- package/lib/override-marks.js +14 -0
- package/lib/override-marks.js.map +1 -1
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +29 -9
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +44 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.fixture.d.ts +8 -1
- package/lib/shipment.fixture.d.ts.map +1 -1
- package/lib/shipment.fixture.js +9 -0
- package/lib/shipment.fixture.js.map +1 -1
- package/lib/shipment.js +38 -5
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.27.0.tgz +0 -0
- package/rt-tools-agent-kit-0.24.0.tgz +0 -0
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Audit of the work queue against what the delivery law requires of a task and its PR.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The delivery guard refuses a miss at the moment it is made, but it acts only on the agent's
|
|
6
|
+
* commands: a task created past it and a PR opened by hand it does not see. This audit answers
|
|
7
|
+
* a different question — "is the whole queue in order right now" — and so it looks at the state,
|
|
8
|
+
* not at the command.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* It judges only what is open. Closed tasks and merged PRs are history: of the last forty merged
|
|
11
|
+
* PRs, thirty-six came from branches with no task behind them, and a check that is red forever
|
|
12
|
+
* would be no different from no check at all.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* PR
|
|
16
|
-
*
|
|
14
|
+
* It does not judge the branch name. An open PR cannot have its branch renamed — that is a new
|
|
15
|
+
* branch and a new PR — and a check that demands the impossible gets bypassed, not carried out.
|
|
16
|
+
* The branch name is watched by the guard at the moment of `git checkout -b` and `gh pr create`.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The task's column is judged by its PR: an open PR means review, none means no review. The
|
|
19
|
+
* moment a task is taken into work is not visible from here at all — the board has no branch —
|
|
20
|
+
* and "In progress" is required of nobody here.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* The run on the head is asked by this audit too: a PR page without a run looks the same as a
|
|
23
|
+
* page with a green one — it has no colour in either case — and a head with no run behind it is
|
|
24
|
+
* found only when someone opens the list of runs by hand.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
* перестаёт что-либо значить.
|
|
26
|
+
* No network or no token — exit code zero: a check that fails on a plane stops meaning anything.
|
|
28
27
|
*
|
|
29
|
-
*
|
|
28
|
+
* A non-zero exit code and the list of discrepancies.
|
|
30
29
|
*/
|
|
31
30
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
32
31
|
import { join } from 'node:path';
|
|
@@ -49,42 +48,51 @@ import {
|
|
|
49
48
|
numberFromTitle,
|
|
50
49
|
taskDirs,
|
|
51
50
|
} from './board.mjs';
|
|
52
|
-
import {
|
|
51
|
+
import { checkBranchFolders } from './board-folders.mjs';
|
|
52
|
+
import { checkConflicting, checkHeadRun } from './board-pull-state.mjs';
|
|
53
53
|
import { checkLongWork } from './board-long-work.mjs';
|
|
54
|
-
import { HAS_PIPELINE, deployLag,
|
|
55
|
-
import { checkEpicLinks } from './board-epics.mjs';
|
|
54
|
+
import { HAS_PIPELINE, deployLag, lastDeploy } from './board-runs.mjs';
|
|
55
|
+
import { checkEpicLinks, checkEpicPullBase, checkEpicState, checkEpicSubIssues } from './board-epics.mjs';
|
|
56
56
|
import { similarTitles } from './board-titles.mjs';
|
|
57
57
|
import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
|
|
58
58
|
|
|
59
59
|
const IN_REVIEW = STATUS_OPTIONS[IN_REVIEW_STATUS].name;
|
|
60
60
|
const TASKS_DIR = join(ROOT, CONFIG.tasksDir);
|
|
61
|
-
/**
|
|
61
|
+
/** Age of an abandoned draft after which it stops looking like one started today. */
|
|
62
62
|
const DRAFT_DAYS = 7;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* The tree's pipeline. Runs are asked for only where they have somewhere to come from: a tree
|
|
65
|
+
* without a pipeline would get a line for every open PR, and about nothing.
|
|
66
66
|
*/
|
|
67
|
-
const RUN_GRACE_MINUTES = 10;
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
68
|
+
* The rollout workflow and the branch production is compared with. A tree that names no workflow
|
|
69
|
+
* gets no production audit — and the audit says so out loud: silence would read as "production
|
|
70
|
+
* matches".
|
|
71
71
|
*/
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
* предложения. Задачами они не являются: заголовок у них без номера, исполнителя нет, на борде
|
|
79
|
-
* их нет, — и сверка печатала на каждую по три строки, среди которых настоящее расхождение уже
|
|
80
|
-
* не читалось. Заводить такие записи в очередь перестали, а заведённые прежним порядком оттуда
|
|
81
|
-
* никуда не денутся: закрывать их — решение владельца, а не сверки.
|
|
73
|
+
* Labels that mark cargo in the work queue — incident analyses and proposals sent by trees. They
|
|
74
|
+
* are not tasks: their title has no number, they have no executor, they are not on the board — and
|
|
75
|
+
* the audit printed three lines for each, among which a real discrepancy could no longer be read.
|
|
76
|
+
* Such records are no longer created in the queue, and those created the old way are not going
|
|
77
|
+
* anywhere: closing them is the owner's decision, not the audit's.
|
|
82
78
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
79
|
+
* The label name names the tree: each has its own, and an invented default would match nothing
|
|
80
|
+
* and silently switch the filtering off. A tree that names no label is judged as before.
|
|
81
|
+
*
|
|
82
|
+
* The label alone is not enough to recognise cargo: a tree puts it on the tasks that grew out of
|
|
83
|
+
* cargo too — that is how the reader sees where the work came from. Read by the label alone, such
|
|
84
|
+
* a task fell out of the whole task half at once: neither the executor, nor the board, nor the
|
|
85
|
+
* link with an epic, nor a matching title was asked about it, and a request about it got the line
|
|
86
|
+
* "the task is not among the open ones". So a title with a number outweighs the label: that is
|
|
87
|
+
* what the tree itself tells a task by.
|
|
85
88
|
*/
|
|
86
89
|
const CARGO_LABELS = new Set(CONFIG.board?.cargoLabels ?? []);
|
|
87
90
|
|
|
91
|
+
/** A record of the cargo: the label of one, and no title of a task. */
|
|
92
|
+
function isCargo(issue) {
|
|
93
|
+
return numberFromTitle(issue.title) === null && (issue.labels ?? []).some((label) => CARGO_LABELS.has(label.name));
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
const DEPLOY_WORKFLOW = CONFIG.deploy?.workflow ?? '';
|
|
89
97
|
const MAIN_BRANCH = CONFIG.deploy?.mainBranch ?? 'main';
|
|
90
98
|
|
|
@@ -92,10 +100,10 @@ const problems = [];
|
|
|
92
100
|
const report = (message) => problems.push(message);
|
|
93
101
|
|
|
94
102
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
103
|
+
* The grill of the owner's request goes before the task is created and lives in `_draft-<slug>`.
|
|
104
|
+
* Abandoned halfway, it stays on disk outside history and looks the same as one started today:
|
|
105
|
+
* the second session takes up the same thing anew. Age is the only sign available here: there is
|
|
106
|
+
* no task behind the draft yet, and nobody to ask about it.
|
|
99
107
|
*/
|
|
100
108
|
function checkDrafts() {
|
|
101
109
|
const now = Date.now();
|
|
@@ -105,34 +113,35 @@ function checkDrafts() {
|
|
|
105
113
|
}
|
|
106
114
|
const age = Math.floor((now - statSync(join(TASKS_DIR, name)).mtimeMs) / 86400000);
|
|
107
115
|
if (age >= DRAFT_DAYS) {
|
|
108
|
-
report(`${CONFIG.tasksDir}/${name}/:
|
|
116
|
+
report(`${CONFIG.tasksDir}/${name}/: the grill was abandoned ${age} days ago — create the task or delete the folder`);
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
*
|
|
122
|
+
* The meaningful words of a title: the task key and short function words are thrown out.
|
|
115
123
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
124
|
+
* The parsing is deliberately rough — a match of words here is not a verdict but a reason to
|
|
125
|
+
* look: exact comparison of titles finds nothing, because a duplicate is written in other words.
|
|
118
126
|
*/
|
|
119
127
|
function closesNumbers(body) {
|
|
120
128
|
return [...String(body ?? '').matchAll(/\bCloses\s+#(\d+)\b/gi)].map((match) => Number(match[1]));
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
132
|
+
* The bypass line in the PR body. The form is the same one the delivery guard reads: it starts
|
|
133
|
+
* the line and accepts no placeholders — otherwise a text that names this line would lift the
|
|
134
|
+
* requirement by itself.
|
|
126
135
|
*/
|
|
127
136
|
const FOLDER_SKIP = /^[ \t]*Task-folder-skip:[ \t]*[^\s<"'][^\s"']{2,}/im;
|
|
128
137
|
|
|
129
138
|
/**
|
|
130
|
-
*
|
|
139
|
+
* Whether the PR branch carries its task folder.
|
|
131
140
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
141
|
+
* The branch is asked, not the working tree: a folder removed on the machine and not committed
|
|
142
|
+
* arrives together with the branch. Local references are of little use here — the PR branch may
|
|
143
|
+
* not be fetched here at all — so the contents are taken from the hosting. The refusal "no such
|
|
144
|
+
* path" means there is no folder; everything else goes up and is treated as no connection.
|
|
136
145
|
*/
|
|
137
146
|
function folderInBranch(branch, options) {
|
|
138
147
|
const path = `${CONFIG.tasksDir}/${branch}`;
|
|
@@ -148,156 +157,11 @@ function folderInBranch(branch, options) {
|
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
159
|
|
|
151
|
-
/**
|
|
152
|
-
* Прогон на вершине открытого PR.
|
|
153
|
-
*
|
|
154
|
-
* Молчание страницы и зелёный прогон читаются одинаково, а событие до хостинга доходит не
|
|
155
|
-
* всегда: в час его отказов пуш прошёл, а прогона за ним не встало. Сверка называет такую
|
|
156
|
-
* вершину, пока PR ещё открыт, — после слияния об этом узнавать поздно.
|
|
157
|
-
*
|
|
158
|
-
* Считается сам факт прогона, а не его цвет. Идущий и упавший прогон видны на странице PR оба;
|
|
159
|
-
* невидимо только отсутствие, и говорит сверка ровно о нём.
|
|
160
|
-
*
|
|
161
|
-
* Свежая вершина не судится: между пушем и прогоном проходит время, и красная строка на этом
|
|
162
|
-
* промежутке значила бы «подожди», а не «чини».
|
|
163
|
-
*
|
|
164
|
-
* У конфликтующей заявки прогона не бывает вовсе, и причина не в потерянном событии: конвейер
|
|
165
|
-
* проверяет слияние ветки с базой, а слияния при конфликте нет. Совет вернуть событие
|
|
166
|
-
* выполняется буквально и не помогает — за один заход заявка перезакрывалась дважды подряд, и
|
|
167
|
-
* прогон встал только после вливания главной ветки. Строка поэтому называет ту причину, которая
|
|
168
|
-
* чинится.
|
|
169
|
-
*/
|
|
170
|
-
function checkHeadRun(pull, options) {
|
|
171
|
-
if (checkEvicted(pull, options)) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (runsOnHead(pull.headRefOid, options) > 0) {
|
|
176
|
-
checkReadyDraft(pull, options);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const minutes = Math.floor((Date.now() - headCommittedAt(pull.headRefOid, options)) / 60000);
|
|
181
|
-
if (minutes < RUN_GRACE_MINUTES) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (onlyIgnoredPaths(pull, options)) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (pull.mergeable === 'CONFLICTING') {
|
|
190
|
-
report(
|
|
191
|
-
`PR #${pull.number}: на вершине ${pull.headRefOid.slice(0, 8)} прогона нет и не будет, пока она конфликтует — ` +
|
|
192
|
-
`конвейер проверяет слияние ветки с базой, а слияния при конфликте нет; влей главную ветку и запушь, ` +
|
|
193
|
-
`перезакрытие PR тут не помогает`
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Заявка поверх соседней прогона не получает: рабочий поток слушает заявки в главную ветку и
|
|
200
|
-
// событий с другой базой не видит. Строка о потерянном событии здесь неверна дважды: событие
|
|
201
|
-
// не терялось, и перезакрытие его не вернёт — совет исполняется буквально, прогон не
|
|
202
|
-
// запускается, и на второй попытке поломку начинают искать в хостинге.
|
|
203
|
-
if (pull.baseRefName && pull.baseRefName !== MAIN_BRANCH) {
|
|
204
|
-
report(
|
|
205
|
-
`PR #${pull.number}: на вершине ${pull.headRefOid.slice(0, 8)} прогона нет и не будет — ` +
|
|
206
|
-
`заявка открыта в ветку «${pull.baseRefName}», а рабочий поток слушает заявки в главную; ` +
|
|
207
|
-
`перенеси базу на «${MAIN_BRANCH}», когда нижняя заявка влита`
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
report(
|
|
214
|
-
`PR #${pull.number}: на вершине ${pull.headRefOid.slice(0, 8)} прогона нет, а лежит она ${minutes} мин — ` +
|
|
215
|
-
`конвейер события не получил; верни его новым коммитом либо перезакрытием PR ` +
|
|
216
|
-
`(gh pr close ${pull.number} && gh pr reopen ${pull.number})`
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Прогон вершины, вытесненный из очереди конвейера.
|
|
222
|
-
*
|
|
223
|
-
* Группа очереди бережёт идущий прогон и не бережёт ждущего: хостинг держит в группе один
|
|
224
|
-
* ждущий, и следующий встающий вытесняет прежний. Ветка за таким прогоном не проверялась ни
|
|
225
|
-
* строчкой, а по очереди работ выглядит проверенной — прогон на вершине есть, и сверка считает
|
|
226
|
-
* именно факт.
|
|
227
|
-
*
|
|
228
|
-
* Судится раньше отсутствия прогона и раньше цвета: иначе одна вершина получает две строки об
|
|
229
|
-
* одном. Отвечает `true`, когда строка сказана, и остальные проверки вершины пропускаются.
|
|
230
|
-
*
|
|
231
|
-
* Строка называет обе команды и в том порядке, в каком их зовут. Перезапуск отбивает гард, пока
|
|
232
|
-
* за тот же ход не читался журнал этого задания, и порядок в строке выполняет требование сам:
|
|
233
|
-
* исполнитель зовёт написанное и не упирается в отказ на втором шаге.
|
|
234
|
-
*/
|
|
235
|
-
function checkEvicted(pull, options) {
|
|
236
|
-
const evicted = evictedOnHead(pull.headRefOid, options);
|
|
237
|
-
if (evicted.length === 0) {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const run = evicted[0];
|
|
242
|
-
report(
|
|
243
|
-
`PR #${pull.number}: прогон ${run} на вершине ${pull.headRefOid.slice(0, 8)} вытеснен из очереди конвейера — ` +
|
|
244
|
-
`заданий у него ноль, ветка не проверялась, а в списке он выглядит упавшим; ` +
|
|
245
|
-
`прочитай прогон и перезапусти его (gh run view ${run} && gh run rerun ${run})`
|
|
246
|
-
);
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Готовая работа, оставленная черновиком.
|
|
252
|
-
*
|
|
253
|
-
* У черновика кнопка слияния заблокирована самим хостингом, поэтому зелёная страница PR
|
|
254
|
-
* владельцу ничего не разрешает: список, в котором всё серое, читается как «работа не сделана».
|
|
255
|
-
* Гард снятия черновика сюда не достаёт — он судит один ход и молчит, пока ветка везёт папку
|
|
256
|
-
* своей задачи; сверка же смотрит на состояние очереди целиком.
|
|
257
|
-
*
|
|
258
|
-
* Четыре PR так и простояли черновиками двое суток — разбор
|
|
259
|
-
* запись «2026-08-18-ready-work-left-in-drafts» в приёме.
|
|
260
|
-
*/
|
|
261
|
-
function checkReadyDraft(pull, options) {
|
|
262
|
-
if (pull.isDraft !== true) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (verdictOnHead(pull.headRefOid, options) !== 'success') {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
report(
|
|
270
|
-
`PR #${pull.number}: прогон на вершине ${pull.headRefOid.slice(0, 8)} зелёный, а PR черновик — ` +
|
|
271
|
-
`разбери папку задачи и сними черновик (gh pr ready ${pull.number}) либо скажи владельцу, чего ждёшь`
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Заявка, конфликтующая с главной веткой.
|
|
277
|
-
*
|
|
278
|
-
* Конфликт приезжает в отданную заявку чужим слиянием, без единого действия её автора: основание,
|
|
279
|
-
* проверенное на открытии, устаревает в ту минуту, когда владелец влил соседнюю работу. Гард
|
|
280
|
-
* снятия черновика сюда не достаёт — он судит один ход, а заявка стоит в очереди днями.
|
|
281
|
-
*
|
|
282
|
-
* Судится только прямое «конфликтует»: `UNKNOWN` означает, что хостинг сливаемость ещё считает,
|
|
283
|
-
* и строка о нём краснела бы на каждой свежей вершине. Две заявки так и ушли в разбор с
|
|
284
|
-
* конфликтом — разбор запись «2026-08-20-drafts-cleared-without-re-reading-pr-state» в приёме.
|
|
285
|
-
*/
|
|
286
|
-
function checkConflicting(pull) {
|
|
287
|
-
if (pull.mergeable !== 'CONFLICTING') {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
report(
|
|
292
|
-
`PR #${pull.number}: конфликтует с главной веткой — влей её в ветку задачи, разбери конфликт и запушь; ` +
|
|
293
|
-
`слить эту заявку владелец не может, а по странице это видно только внутри неё`
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
160
|
let checked = { issues: 0, pulls: 0, cargo: 0 };
|
|
298
161
|
|
|
299
|
-
//
|
|
162
|
+
// Drafts are judged by the disk and so are checked always: no connection is needed for that.
|
|
300
163
|
checkDrafts();
|
|
164
|
+
checkBranchFolders(report, MAIN_BRANCH);
|
|
301
165
|
|
|
302
166
|
let offline = false;
|
|
303
167
|
try {
|
|
@@ -305,33 +169,37 @@ try {
|
|
|
305
169
|
const board = fetchBoard(options);
|
|
306
170
|
const issues = fetchIssues('all', options);
|
|
307
171
|
const allOpen = issues.filter((issue) => issue.state === 'OPEN');
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
//
|
|
311
|
-
|
|
172
|
+
// Filtering happens once and before all task checks: a cargo record is not a task as a whole,
|
|
173
|
+
// not by half — it is judged neither by title, nor by executor, nor by the board, nor by the
|
|
174
|
+
// digest of matching titles, nor by the link to an epic. A card with a title of a task is not
|
|
175
|
+
// such a record, whatever labels it wears.
|
|
176
|
+
const open = CARGO_LABELS.size === 0 ? allOpen : allOpen.filter((issue) => !isCargo(issue));
|
|
312
177
|
const pulls = fetchOpenPulls(options);
|
|
313
178
|
checked = { issues: issues.length, pulls: pulls.length, cargo: allOpen.length - open.length };
|
|
314
179
|
|
|
315
180
|
for (const item of board.foreign) {
|
|
316
|
-
report(
|
|
181
|
+
report(`the board: ${item} — the board holds tasks, not PRs about them`);
|
|
317
182
|
}
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
183
|
+
// The board is checked only for open tasks. A closed one left the queue by a merge, and the
|
|
184
|
+
// board has no column for it: a line about it has nothing to close it with. Six such lines
|
|
185
|
+
// hung in every run and drowned out the real task that never made it to the board.
|
|
321
186
|
for (const issue of open) {
|
|
322
187
|
if (!board.issues.has(issue.number)) {
|
|
323
|
-
report(`#${issue.number}:
|
|
188
|
+
report(`#${issue.number}: the task is not on the board — nobody watches it`);
|
|
324
189
|
}
|
|
325
190
|
if (numberFromTitle(issue.title) !== issue.number) {
|
|
326
|
-
report(`#${issue.number}:
|
|
191
|
+
report(`#${issue.number}: the title does not start with [${TASK_KEY}-${issue.number}] — «${issue.title}»`);
|
|
327
192
|
}
|
|
328
193
|
if (issue.assignees.length === 0) {
|
|
329
|
-
report(`#${issue.number}:
|
|
194
|
+
report(`#${issue.number}: the task has no assignee — by the work queue there is no seeing who took it`);
|
|
330
195
|
}
|
|
331
196
|
}
|
|
332
197
|
|
|
333
198
|
similarTitles(open);
|
|
334
199
|
checkEpicLinks(open, report);
|
|
200
|
+
checkEpicPullBase(open, pulls, report);
|
|
201
|
+
checkEpicState(open, pulls, report);
|
|
202
|
+
checkEpicSubIssues(open, report, options);
|
|
335
203
|
checkLongWork(open, report);
|
|
336
204
|
|
|
337
205
|
const openNumbers = new Set(open.map((issue) => issue.number));
|
|
@@ -339,40 +207,40 @@ try {
|
|
|
339
207
|
for (const pull of pulls) {
|
|
340
208
|
const titleNumber = numberFromTitle(pull.title);
|
|
341
209
|
if (titleNumber === null) {
|
|
342
|
-
report(`PR #${pull.number}:
|
|
210
|
+
report(`PR #${pull.number}: the title does not start with [${TASK_KEY}-<number>] — «${pull.title}»`);
|
|
343
211
|
continue;
|
|
344
212
|
}
|
|
345
213
|
if (!closesNumbers(pull.body).includes(titleNumber)) {
|
|
346
|
-
report(`PR #${pull.number}:
|
|
214
|
+
report(`PR #${pull.number}: the body carries no line «Closes #${titleNumber}» — on the board it will not attach to the task`);
|
|
347
215
|
}
|
|
348
216
|
if (!openNumbers.has(titleNumber)) {
|
|
349
|
-
report(`PR #${pull.number}:
|
|
217
|
+
report(`PR #${pull.number}: the task #${titleNumber} is not among the open ones — a task has one branch`);
|
|
350
218
|
}
|
|
351
219
|
if (claimed.has(titleNumber)) {
|
|
352
|
-
report(`PR #${pull.number}:
|
|
220
|
+
report(`PR #${pull.number}: the task #${titleNumber} is already closed by PR #${claimed.get(titleNumber)} — a task has one branch`);
|
|
353
221
|
} else {
|
|
354
222
|
claimed.set(titleNumber, pull.number);
|
|
355
223
|
}
|
|
356
224
|
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
//
|
|
361
|
-
//
|
|
225
|
+
// A task folder lying in the branch of an open PR is a discrepancy from the PR's first
|
|
226
|
+
// minute: the clean-up comes before it opens, and opening with the folder in place is
|
|
227
|
+
// refused by the delivery guard. A folder that got this far means a bypass — or a PR
|
|
228
|
+
// opened past the guard. Said after the merge, this line is no longer fixed by the same
|
|
229
|
+
// PR: the work has moved on, and a second task is created for the clean-up.
|
|
362
230
|
if (HAS_PIPELINE && pull.headRefOid) {
|
|
363
|
-
checkHeadRun(pull, options);
|
|
231
|
+
checkHeadRun(pull, report, MAIN_BRANCH, options);
|
|
364
232
|
}
|
|
365
233
|
|
|
366
|
-
checkConflicting(pull);
|
|
234
|
+
checkConflicting(pull, report);
|
|
367
235
|
|
|
368
|
-
//
|
|
369
|
-
//
|
|
370
|
-
//
|
|
236
|
+
// The PR falling behind the main branch: the guard judges the base once, at the minute of
|
|
237
|
+
// opening, and a PR stands for days. Merged while behind, it carries into main a
|
|
238
|
+
// combination nobody checked — and the PR page does not show this: the run on it is green.
|
|
371
239
|
const behind = behindMain(pull.headRefName, MAIN_BRANCH, options);
|
|
372
240
|
if (behind > 0) {
|
|
373
241
|
report(
|
|
374
|
-
`PR #${pull.number}:
|
|
375
|
-
|
|
242
|
+
`PR #${pull.number}: the branch lags «${MAIN_BRANCH}» by ${behind} commits — the run went from a base ` +
|
|
243
|
+
`the main branch no longer carries. Merge the main branch in, revise the check set by what the branch carries now, and run again`
|
|
376
244
|
);
|
|
377
245
|
}
|
|
378
246
|
|
|
@@ -380,45 +248,45 @@ try {
|
|
|
380
248
|
const folder = folderInBranch(pull.headRefName, options);
|
|
381
249
|
if (folder !== null) {
|
|
382
250
|
report(
|
|
383
|
-
`PR #${pull.number}:
|
|
251
|
+
`PR #${pull.number}: the branch carries the task folder «${folder}/» — the request opens after the folder is taken apart. Take it apart by this same PR or put the line «Task-folder-skip: <reason>» into the body`
|
|
384
252
|
);
|
|
385
253
|
}
|
|
386
254
|
}
|
|
387
255
|
}
|
|
388
256
|
|
|
389
|
-
//
|
|
390
|
-
//
|
|
391
|
-
//
|
|
257
|
+
// The task's column and its PR are audited both ways: an open PR with the task in "Backlog"
|
|
258
|
+
// reads as work not yet started, and "In review" without an open PR as a review nobody is
|
|
259
|
+
// waiting for.
|
|
392
260
|
for (const issue of open) {
|
|
393
261
|
const status = board.items.get(issue.number)?.status ?? null;
|
|
394
262
|
const pull = claimed.get(issue.number);
|
|
395
263
|
if (pull !== undefined && status !== IN_REVIEW) {
|
|
396
264
|
report(
|
|
397
|
-
`#${issue.number}: PR #${pull}
|
|
265
|
+
`#${issue.number}: PR #${pull} is open, and the task stands at «${status ?? 'outside the columns'}» — npm run task:move -- ${issue.number} ${IN_REVIEW_STATUS}`
|
|
398
266
|
);
|
|
399
267
|
}
|
|
400
268
|
if (pull === undefined && status === IN_REVIEW) {
|
|
401
|
-
report(`#${issue.number}:
|
|
269
|
+
report(`#${issue.number}: the task awaits review, and there is no open PR behind it — the column lags the work`);
|
|
402
270
|
}
|
|
403
271
|
}
|
|
404
272
|
|
|
405
|
-
//
|
|
406
|
-
//
|
|
407
|
-
//
|
|
273
|
+
// The task folder dies with the task: what explains a settled decision moves to
|
|
274
|
+
// `docs/archive/`, the rest is deleted. Left next to the current ones, it reads as current —
|
|
275
|
+
// the more convincingly, the older it is.
|
|
408
276
|
for (const name of taskDirs()) {
|
|
409
277
|
const number = numberFromTaskDir(name.split('/').pop());
|
|
410
278
|
if (number === null || openNumbers.has(number)) {
|
|
411
279
|
continue;
|
|
412
280
|
}
|
|
413
281
|
if (issues.some((issue) => issue.number === number)) {
|
|
414
|
-
report(`${CONFIG.tasksDir}/${name}/:
|
|
282
|
+
report(`${CONFIG.tasksDir}/${name}/: the task #${number} is closed, and the folder lies among the current ones — take it apart`);
|
|
415
283
|
}
|
|
416
284
|
}
|
|
417
285
|
} catch (error) {
|
|
418
286
|
if (error instanceof OfflineError) {
|
|
419
|
-
//
|
|
420
|
-
//
|
|
421
|
-
console.log(`check-board:
|
|
287
|
+
// The work queue cannot be checked without a connection, but the folders on disk can:
|
|
288
|
+
// staying silent about them would mean losing the only thing that can still be said here.
|
|
289
|
+
console.log(`check-board: the work queue is skipped, there is nothing to check with — ${error.message}`);
|
|
422
290
|
offline = true;
|
|
423
291
|
} else {
|
|
424
292
|
console.error(`check-board: ${String(error.message ?? error)}`);
|
|
@@ -426,60 +294,60 @@ try {
|
|
|
426
294
|
}
|
|
427
295
|
}
|
|
428
296
|
|
|
429
|
-
//
|
|
430
|
-
//
|
|
431
|
-
//
|
|
297
|
+
// Production is audited against the main branch by the last successful rollout. A task leaves the
|
|
298
|
+
// queue by a merge, but a merge is not yet production: where the rollout is started by hand, any
|
|
299
|
+
// number of commits may lie between them, and there is nowhere to notice this from.
|
|
432
300
|
if (!offline && DEPLOY_WORKFLOW) {
|
|
433
301
|
try {
|
|
434
302
|
const token = botToken() ?? undefined;
|
|
435
303
|
const lag = deployLag(DEPLOY_WORKFLOW, MAIN_BRANCH, { token });
|
|
436
304
|
if (lag === null) {
|
|
437
|
-
report(
|
|
305
|
+
report(`there was not a single rollout by «${DEPLOY_WORKFLOW}» — there is nothing to compare production against`);
|
|
438
306
|
} else if (lag.behind > 0) {
|
|
439
307
|
report(
|
|
440
|
-
|
|
308
|
+
`production lags «${MAIN_BRANCH}» by ${lag.behind} commits: the last rollout is ${lag.sha.slice(0, 8)} of ${String(lag.at).slice(0, 10)}`
|
|
441
309
|
);
|
|
442
310
|
}
|
|
443
311
|
|
|
444
|
-
//
|
|
445
|
-
//
|
|
446
|
-
//
|
|
312
|
+
// Why production fell behind, the lag does not say: it is counted by the last SUCCESSFUL
|
|
313
|
+
// rollout, and "not started" and "failed" look the same through it. They lead to different
|
|
314
|
+
// things — the first is started, the second is read by its output and fixed.
|
|
447
315
|
const deploy = lastDeploy(DEPLOY_WORKFLOW, { token });
|
|
448
316
|
if (deploy.verdict === 'failure') {
|
|
449
317
|
report(
|
|
450
|
-
|
|
451
|
-
|
|
318
|
+
`the rollout «${DEPLOY_WORKFLOW}» failed on ${String(deploy.sha).slice(0, 8)} of ${String(deploy.at).slice(0, 10)}: ` +
|
|
319
|
+
`the main branch is ahead of production, and merges on top will travel the same way — ${deploy.url}`
|
|
452
320
|
);
|
|
453
321
|
}
|
|
454
322
|
} catch (error) {
|
|
455
323
|
if (error instanceof OfflineError) {
|
|
456
|
-
console.log(`check-board:
|
|
324
|
+
console.log(`check-board: production was not checked — ${error.message}`);
|
|
457
325
|
} else {
|
|
458
326
|
throw error;
|
|
459
327
|
}
|
|
460
328
|
}
|
|
461
329
|
}
|
|
462
330
|
|
|
463
|
-
//
|
|
331
|
+
// What was not checked is named out loud: silence about runs would read as "the runs are there".
|
|
464
332
|
if (!offline && !DEPLOY_WORKFLOW) {
|
|
465
|
-
console.log('check-board:
|
|
333
|
+
console.log('check-board: production was not checked against the main branch — the rollout workflow is not named in the tree config');
|
|
466
334
|
}
|
|
467
335
|
|
|
468
|
-
//
|
|
469
|
-
//
|
|
336
|
+
// What was filtered out is named by number: silent filtering is indistinguishable from a broken
|
|
337
|
+
// audit — a label named with a typo would switch the check off entirely and say nothing about it.
|
|
470
338
|
if (!offline && checked.cargo > 0) {
|
|
471
|
-
console.log(`check-board:
|
|
339
|
+
console.log(`check-board: cargo records in the queue ${checked.cargo} — they are not judged as tasks`);
|
|
472
340
|
}
|
|
473
341
|
|
|
474
342
|
if (!offline && !HAS_PIPELINE) {
|
|
475
|
-
console.log('check-board:
|
|
343
|
+
console.log('check-board: the runs on the tips were not asked — the tree has no pipeline file');
|
|
476
344
|
}
|
|
477
345
|
|
|
478
346
|
if (problems.length > 0) {
|
|
479
|
-
console.error(`check-board:
|
|
347
|
+
console.error(`check-board: divergences ${problems.length}\n`);
|
|
480
348
|
problems.forEach((problem) => console.error(` ${problem}`));
|
|
481
|
-
console.error('\
|
|
482
|
-
console.error('
|
|
349
|
+
console.error('\nA task is created by the command npm run task:new — it does all four steps at once.');
|
|
350
|
+
console.error('The task folder and taking it apart — the rule task-flow.');
|
|
483
351
|
process.exit(1);
|
|
484
352
|
}
|
|
485
353
|
|
|
@@ -487,4 +355,4 @@ if (offline) {
|
|
|
487
355
|
process.exit(0);
|
|
488
356
|
}
|
|
489
357
|
|
|
490
|
-
console.log(`check-board:
|
|
358
|
+
console.log(`check-board: tasks ${checked.issues}, open PRs ${checked.pulls}, no divergences`);
|