rvlib-shipkit 1.2.0 → 1.4.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/CHANGELOG.md +104 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/asks/asks-queue.ts +4 -2
- package/src/assets/kits/identity-kit.ts +15 -13
- package/src/assets/run-assets.ts +15 -10
- package/src/check.ts +26 -10
- package/src/checks/SK001-package-json-shape.check.ts +34 -5
- package/src/checks/SK002-contracts-fulfillness.check.ts +3 -3
- package/src/checks/SK004-gitignore-policy.check.ts +11 -3
- package/src/checks/SK005-rvlib-versions.check.ts +13 -1
- package/src/checks/SK006-npm-publish-safety.check.ts +5 -0
- package/src/checks/SK007-github-visibility.check.ts +9 -9
- package/src/checks/SK008-reviewer-agent.check.ts +14 -8
- package/src/checks/SK009-commit-ai-tells.check.ts +103 -61
- package/src/checks/SK013-one-way-in-policy.check.ts +10 -2
- package/src/checks/SK014-prose-ste.check.ts +16 -6
- package/src/checks/SK015-nested-repo.check.ts +5 -1
- package/src/checks/SK016-legacy-check-shapes.check.ts +11 -5
- package/src/checks/SK017-vscode-hub-task.check.ts +7 -0
- package/src/checks/SK022-machine-runs-the-pin.check.ts +6 -2
- package/src/checks/SK024-identity-colors.check.ts +5 -0
- package/src/checks/SK025-release-drift.check.ts +58 -0
- package/src/checks/SK026-asks-autoclose.check.ts +44 -0
- package/src/checks/SK027-agent-wiki-links.check.ts +50 -0
- package/src/checks/SK028-readme.check.ts +83 -0
- package/src/cli/cmd_Assets.ts +1 -1
- package/src/cli/cmd_Ci.ts +5 -0
- package/src/cli/cmd_CrossRepoActivity.ts +119 -0
- package/src/cli/cmd_GlobalProcesses.ts +155 -0
- package/src/cli/cmd_Keys.ts +17 -3
- package/src/cli/cmd_Overview.ts +98 -0
- package/src/cli/cmd_Planned.ts +117 -0
- package/src/cli.ts +9 -1
- package/src/collections/checks.ts +3 -2
- package/src/collections/collection-types.ts +15 -0
- package/src/collections/providers.ts +7 -3
- package/src/collections/test-time.ts +10 -1
- package/src/contracts/apply-contracts.ts +9 -8
- package/src/contracts/contract-types.ts +8 -2
- package/src/contracts/contracts-engine.ts +34 -13
- package/src/contracts/manifests/identity.contract.ts +6 -5
- package/src/contracts/manifests/social.contract.ts +4 -2
- package/src/contracts/manifests/steam.contract.ts +7 -3
- package/src/contracts/web-surface.ts +59 -0
- package/src/core/agent-spawn.ts +46 -0
- package/src/core/archived.ts +82 -0
- package/src/core/budget.ts +19 -9
- package/src/core/canonical-scripts.ts +12 -3
- package/src/core/check-runner.ts +66 -17
- package/src/core/discover-checks.ts +10 -5
- package/src/core/file-stamp.ts +20 -0
- package/src/{checks/SK021-github-login.check.ts → core/gh-login.ts} +45 -54
- package/src/core/identity-color.ts +1 -1
- package/src/core/layout.ts +2 -0
- package/src/core/motherhome.ts +88 -66
- package/src/core/repo-facts.ts +14 -0
- package/src/core/retention.ts +14 -5
- package/src/core/retired-checks.ts +7 -0
- package/src/core/run-check.ts +8 -7
- package/src/core/run-ci.ts +46 -15
- package/src/core/run-fix.ts +7 -2
- package/src/core/run-fixers.ts +10 -6
- package/src/core/wire.ts +49 -9
- package/src/fleet/scan-fleet.ts +2 -1
- package/src/home/activity-shape.ts +138 -0
- package/src/home/activity.ts +256 -0
- package/src/home/global-units.ts +3 -2
- package/src/home/gui-app/ShipkitGui.swift +144 -25
- package/src/home/gui-app.ts +93 -30
- package/src/home/home-launchd.ts +10 -2
- package/src/home/home-routes.ts +34 -6
- package/src/home/home-start.ts +33 -5
- package/src/home/machine-stores.ts +4 -2
- package/src/home/open-app.ts +23 -10
- package/src/home/pm-config.ts +15 -11
- package/src/home/pm-inputs.ts +76 -0
- package/src/home/pm.ts +40 -7
- package/src/home/process-rows.ts +222 -0
- package/src/home/resources.ts +99 -20
- package/src/home/run-daemon.ts +12 -7
- package/src/home/run-pm.ts +30 -5
- package/src/home/serve-web.ts +6 -3
- package/src/home/supervise.ts +16 -1
- package/src/home/widget-text.ts +119 -0
- package/src/home/widgets.ts +32 -3
- package/src/hooks/commit-message.ts +2 -3
- package/src/hooks/run-hooks.ts +32 -5
- package/src/ledger/db.ts +1 -1
- package/src/ledger/gate-checks.ts +20 -6
- package/src/ledger/house-runs.ts +43 -0
- package/src/ledger/live-timeline.ts +4 -19
- package/src/ledger/run-log.ts +39 -10
- package/src/ledger/store.ts +30 -2
- package/src/ledger/world-cache.ts +63 -14
- package/src/plan/cadence.ts +21 -5
- package/src/plan/catch-up.ts +37 -0
- package/src/plan/plan-timeline.ts +99 -0
- package/src/plan/planner.ts +138 -13
- package/src/plan/repo-source.ts +120 -8
- package/src/release/run-release.ts +9 -2
- package/src/release/unit-resolve.ts +8 -12
- package/src/repo-config.ts +17 -4
- package/src/serve/house-runs.ts +53 -0
- package/src/serve/hub-app/activity-st.ts +168 -0
- package/src/serve/hub-app/activity-view.tsx +218 -0
- package/src/serve/hub-app/activity.css +78 -0
- package/src/serve/hub-app/admin-svc.ts +41 -0
- package/src/serve/hub-app/admin-view.tsx +42 -0
- package/src/serve/hub-app/chart-view.ts +12 -5
- package/src/serve/hub-app/check-words.ts +2 -0
- package/src/serve/hub-app/checks-svc.ts +2 -1
- package/src/serve/hub-app/col-tables-view.tsx +124 -0
- package/src/serve/hub-app/col-tables.ts +115 -0
- package/src/serve/hub-app/cols-svc.ts +28 -0
- package/src/serve/hub-app/controls.css +32 -0
- package/src/serve/hub-app/cycle-button.tsx +36 -0
- package/src/serve/hub-app/dock-anim.ts +25 -0
- package/src/serve/hub-app/dock-st.ts +329 -0
- package/src/serve/hub-app/dock-view.tsx +68 -0
- package/src/serve/hub-app/dock.css +35 -0
- package/src/serve/hub-app/hash-route.ts +7 -1
- package/src/serve/hub-app/header-bar.tsx +79 -104
- package/src/serve/hub-app/home-st.ts +50 -13
- package/src/serve/hub-app/home-strip.css +81 -23
- package/src/serve/hub-app/home-strip.tsx +243 -102
- package/src/serve/hub-app/home.html +4 -0
- package/src/serve/hub-app/hub-app.tsx +103 -161
- package/src/serve/hub-app/hub-types.ts +6 -3
- package/src/serve/hub-app/hub.css +101 -39
- package/src/serve/hub-app/icons.tsx +27 -3
- package/src/serve/hub-app/index.html +4 -0
- package/src/serve/hub-app/keys.ts +44 -9
- package/src/serve/hub-app/live-svc.ts +24 -64
- package/src/serve/hub-app/machine-st.ts +65 -13
- package/src/serve/hub-app/md.ts +38 -5
- package/src/serve/hub-app/next-run.ts +1 -1
- package/src/serve/hub-app/palette-st.ts +13 -9
- package/src/serve/hub-app/palette-view.tsx +47 -0
- package/src/serve/hub-app/pill-row.tsx +65 -0
- package/src/serve/hub-app/planned-st.ts +21 -85
- package/src/serve/hub-app/planned-view.tsx +12 -7
- package/src/serve/hub-app/planned.css +5 -2
- package/src/serve/hub-app/project-list.css +43 -21
- package/src/serve/hub-app/project-list.tsx +122 -23
- package/src/serve/hub-app/projects-svc.ts +120 -12
- package/src/serve/hub-app/readme-svc.ts +38 -0
- package/src/serve/hub-app/readme-view.tsx +19 -0
- package/src/serve/hub-app/readme.css +11 -0
- package/src/serve/hub-app/repo-sections.tsx +61 -0
- package/src/serve/hub-app/repo-st.ts +26 -7
- package/src/serve/hub-app/runs-tabs.ts +1 -1
- package/src/serve/hub-app/sidebar.tsx +84 -0
- package/src/serve/hub-app/tests-view.tsx +31 -4
- package/src/serve/hub-app/timeline-chart.tsx +31 -27
- package/src/serve/hub-app/timeline-geometry.ts +40 -5
- package/src/serve/hub-app/timeline-svc.ts +2 -2
- package/src/serve/hub-app/timeline-view.tsx +29 -9
- package/src/serve/hub-runtime.ts +17 -9
- package/src/serve/other-repos.ts +8 -45
- package/src/serve/project-gutter-route.ts +100 -20
- package/src/serve/project-gutter.ts +34 -13
- package/src/serve/readme-route.ts +57 -0
- package/src/serve/serve-hub.ts +13 -8
- package/src/serve/tracked-watch.ts +33 -1
- package/src/serve/warm-cell.ts +49 -16
- package/src/shipkit-files.ts +20 -4
- package/src/suite/judge-suites.ts +42 -17
- package/src/suite/suite-cli.ts +5 -8
- package/src/wiki/lint-md.ts +2 -0
- package/src/wiki/scan-md.ts +37 -10
- package/src/checks/SK023-stores-under-cap.check.ts +0 -49
- package/src/checks/contracts.check.ts +0 -20
package/src/shipkit-files.ts
CHANGED
|
@@ -49,9 +49,9 @@ export type GlobalProcessDef = {
|
|
|
49
49
|
probe?: string
|
|
50
50
|
/** a button each beside the switch, by key */
|
|
51
51
|
actions?: Record<string, ProcessAction>
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
|
|
52
|
+
/** what its card wears: an emoji, or a repo-relative image path
|
|
53
|
+
* (png, svg, ico, jpg, webp). Absent: the declaring repo's own icon */
|
|
54
|
+
icon?: string
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export type WidgetDef = {
|
|
@@ -74,6 +74,19 @@ const KEBAB = /^[a-z0-9][a-z0-9-]*$/
|
|
|
74
74
|
const words = (v: unknown): boolean => Array.isArray(v) && v.length > 0 && v.every((w) => typeof w === 'string')
|
|
75
75
|
const httpUrl = (v: unknown): boolean => typeof v === 'string' && /^https?:\/\//.test(v)
|
|
76
76
|
|
|
77
|
+
/** the image types an icon file can be, by extension */
|
|
78
|
+
export const ICON_IMAGE_TYPES: Record<string, string> = { png: 'image/png', svg: 'image/svg+xml', ico: 'image/x-icon', jpg: 'image/jpeg', jpeg: 'image/jpeg', webp: 'image/webp' }
|
|
79
|
+
|
|
80
|
+
/** the image an icon names (its extension), or null when it is text */
|
|
81
|
+
export const iconImageType = (icon: string): string | null => ICON_IMAGE_TYPES[/\.([a-z]+)$/i.exec(icon)?.[1]?.toLowerCase() ?? ''] ?? null
|
|
82
|
+
|
|
83
|
+
function iconProblem(icon: unknown): string | null {
|
|
84
|
+
if (typeof icon !== 'string' || icon.trim() === '') return 'icon is an emoji or a repo relative image path'
|
|
85
|
+
if (iconImageType(icon) != null) return icon.startsWith('/') || icon.split(/[\\/]/).includes('..') ? `icon '${icon}' must be a repo relative path` : null
|
|
86
|
+
if (/[\\/.]/.test(icon) || [...icon].length > 8) return `icon '${icon}' is neither an emoji nor an image path (${Object.keys(ICON_IMAGE_TYPES).join(', ')})`
|
|
87
|
+
return null
|
|
88
|
+
}
|
|
89
|
+
|
|
77
90
|
/** why a global process declaration cannot run, or null */
|
|
78
91
|
export function globalProcessProblem(d: GlobalProcessDef): string | null {
|
|
79
92
|
const at = `globalProcess '${String(d.id)}'`
|
|
@@ -83,7 +96,10 @@ export function globalProcessProblem(d: GlobalProcessDef): string | null {
|
|
|
83
96
|
if (d.url != null && !httpUrl(d.url)) return `${at}: url must be an http url`
|
|
84
97
|
if (d.probe != null && !httpUrl(d.probe)) return `${at}: probe must be an http url`
|
|
85
98
|
if (d.down != null && d.probe == null && d.url == null) return `${at}: a bring-up (one with down) needs probe or url, the only truth of whether it is up`
|
|
86
|
-
if (d.
|
|
99
|
+
if (d.icon !== undefined) {
|
|
100
|
+
const why = iconProblem(d.icon)
|
|
101
|
+
if (why != null) return `${at}: ${why}`
|
|
102
|
+
}
|
|
87
103
|
for (const [k, a] of Object.entries(d.actions ?? {})) {
|
|
88
104
|
if (!KEBAB.test(k)) return `${at}: action '${k}' must be kebab-case`
|
|
89
105
|
if ((a.cmd != null) === (a.run != null)) return `${at}: action '${k}' declares exactly one of cmd or run`
|
|
@@ -18,7 +18,7 @@ export type SerialSuite = {
|
|
|
18
18
|
why: string
|
|
19
19
|
}
|
|
20
20
|
export type TestsConfig = {
|
|
21
|
-
/** per suite time in the quick tier (default 2000). A suite whose wall time goes over it under the parallel run is run again alone, and fails when
|
|
21
|
+
/** per suite time in the quick tier (default 2000). A suite whose wall time goes over it under the parallel run is run again alone, and fails when the smaller of its CPU and its wall passes this, grown with the load share by up to half, or when its wall passes twice this, an allowance that grows with the square of the load share and has no end on a saturated machine. A suite whose CPU inside the parallel run, children included, plus all its worker burned before it stays under it skips that run, unless its wall is past that allowance or it ended with a child not yet reaped. The full tier fails nothing on time */
|
|
22
22
|
budgetMs?: number
|
|
23
23
|
/** suites that break the budget on purpose: the full tier runs them, the quick tier does not */
|
|
24
24
|
slow?: SlowSuite[]
|
|
@@ -190,32 +190,58 @@ export const WAIT_FACTOR = 2
|
|
|
190
190
|
/** how much more CPU the same suite burns on a saturated machine. CPU time is
|
|
191
191
|
* not load free: measured on 8 cores, one suite went from 1.0s of CPU idle to
|
|
192
192
|
* 1.35 to 1.5s with the cores saturated (load 7 to 19), and did not grow past
|
|
193
|
-
* that. So
|
|
193
|
+
* that. So the CPU allowance grows with the load share up to this factor */
|
|
194
194
|
export const LOADED_CPU_FACTOR = 1.5
|
|
195
|
+
|
|
196
|
+
/** how much of the machine the other processes took, 0 idle to 1 saturated:
|
|
197
|
+
* the one load measure every verdict here reads, so no verdict has a step */
|
|
198
|
+
export const loadShare = (load: MachineLoad): number => (load.cores > 0 ? Math.min(1, Math.max(0, load.load1 / load.cores)) : 0)
|
|
199
|
+
/** the CPU a suite may burn at this load: the budget, plus the measured
|
|
200
|
+
* inflation in proportion to how saturated the machine is */
|
|
201
|
+
export const cpuAllowance = (budgetMs: number, load: MachineLoad): number => budgetMs * (1 + (LOADED_CPU_FACTOR - 1) * loadShare(load))
|
|
202
|
+
/** the wall a suite may take before it reads as a WAIT: WAIT_FACTOR times
|
|
203
|
+
* the budget on an idle machine, grown with the square of the load share,
|
|
204
|
+
* and without end once the machine is saturated. A wall on a busy machine
|
|
205
|
+
* is the machine's (measured: 11 to 19s for suites burning 1s of CPU at
|
|
206
|
+
* load 20.5 on 8 cores, far past any fair share), so only a quiet machine
|
|
207
|
+
* can show a suite that sleeps; the ramp keeps the verdict continuous */
|
|
208
|
+
export const waitAllowance = (budgetMs: number, load: MachineLoad): number => {
|
|
209
|
+
const free = 1 - loadShare(load) ** 2
|
|
210
|
+
return free <= 0 ? Infinity : (budgetMs * WAIT_FACTOR) / free
|
|
211
|
+
}
|
|
195
212
|
/** `ms` is the time the verdict used: cpu, or wall for a wait or when no cpu figure exists */
|
|
196
213
|
export type Confirmed = { file: string; ms: number; wallMs: number; cpuMs: number | null; over: 'cpu' | 'wait' | 'wall' | null }
|
|
197
214
|
|
|
198
|
-
/** the verdict on each suspect once it ran alone
|
|
199
|
-
* of every other process on the machine,
|
|
200
|
-
* the budget judges CPU
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
215
|
+
/** the verdict on each suspect once it ran alone, continuous in the load.
|
|
216
|
+
* A wall time carries the load of every other process on the machine, so
|
|
217
|
+
* the budget judges CPU, against an allowance that grows with the load share
|
|
218
|
+
* (cpuAllowance). A suite is charged the SMALLER of its CPU and its wall:
|
|
219
|
+
* JS runs on one thread, so CPU above the wall is bun's GC and JIT threads
|
|
220
|
+
* or children running side by side, time nobody waits on. A wall past its
|
|
221
|
+
* wait allowance fails as a wait (waitAllowance), never on a busy machine */
|
|
204
222
|
export function confirmOver(suspects: Timed[], alone: Record<string, AloneRun>, budgetMs: number, load: MachineLoad): { over: Confirmed[]; cleared: Confirmed[] } {
|
|
205
223
|
const byFile = new Map(Object.entries(alone).map(([f, run]) => [normSuitePath(f), run]))
|
|
206
|
-
const idle = load.load1 < load.cores
|
|
207
224
|
const judged = suspects.map((t): Confirmed => {
|
|
208
225
|
const run = byFile.get(t.file)
|
|
209
226
|
const wallMs = run?.wallMs ?? t.ms
|
|
210
227
|
const cpuMs = run?.cpuMs ?? null
|
|
211
228
|
if (cpuMs == null) return { file: t.file, ms: wallMs, wallMs, cpuMs, over: wallMs > budgetMs ? 'wall' : null }
|
|
212
|
-
|
|
213
|
-
if (
|
|
214
|
-
return { file: t.file, ms:
|
|
229
|
+
const charged = Math.min(cpuMs, wallMs)
|
|
230
|
+
if (charged > cpuAllowance(budgetMs, load)) return { file: t.file, ms: charged, wallMs, cpuMs, over: 'cpu' }
|
|
231
|
+
if (wallMs > waitAllowance(budgetMs, load)) return { file: t.file, ms: wallMs, wallMs, cpuMs, over: 'wait' }
|
|
232
|
+
return { file: t.file, ms: charged, wallMs, cpuMs, over: null }
|
|
215
233
|
})
|
|
216
234
|
return { over: judged.filter((c) => c.over != null), cleared: judged.filter((c) => c.over == null) }
|
|
217
235
|
}
|
|
218
236
|
|
|
237
|
+
const secs = (ms: number): string => `${(ms / 1000).toFixed(1)}s`
|
|
238
|
+
|
|
239
|
+
/** the line a confirmed suite fails with */
|
|
240
|
+
export const overWords = (c: Confirmed, load: MachineLoad, budgetMs: number = DEFAULT_BUDGET_MS): string =>
|
|
241
|
+
c.over === 'cpu' ? `${c.file} ${secs(c.cpuMs ?? c.ms)} of CPU (${secs(c.wallMs)} wall)`
|
|
242
|
+
: c.over === 'wait' ? `${c.file} ${secs(c.wallMs)} wall at load ${load.load1.toFixed(1)} on ${load.cores} cores, past its ${secs(waitAllowance(budgetMs, load))} wait allowance, with ${secs(c.cpuMs ?? 0)} of CPU: it waits (a timer, a sleep, a poll)`
|
|
243
|
+
: `${c.file} ${secs(c.wallMs)} wall (no CPU figure)`
|
|
244
|
+
|
|
219
245
|
/** how the parallel phase's workers hand the runner the CPU of each suite
|
|
220
246
|
* (suite-cpu-preload.ts writes it, readPhaseCpu reads it) */
|
|
221
247
|
export const SUITE_CPU_ENV = 'SHIPKIT_SUITE_CPU'
|
|
@@ -253,16 +279,15 @@ export function readPhaseCpu(text: string, cwd: string): { ran: string[]; cpu: R
|
|
|
253
279
|
* what the worker computed by the suite's end, its whole CPU before the
|
|
254
280
|
* suite (priorMs) plus what the suite burned, and sharing the machine only
|
|
255
281
|
* raises CPU, so a suspect whose sum is inside the budget is inside it alone
|
|
256
|
-
* too. A suspect with no figure (a child not yet reaped) runs alone. Only the
|
|
257
|
-
*
|
|
258
|
-
*
|
|
282
|
+
* too. A suspect with no figure (a child not yet reaped) runs alone. Only the
|
|
283
|
+
* alone run can see a WAIT, so a suite whose wall is past its wait
|
|
284
|
+
* allowance still gets it */
|
|
259
285
|
export function aloneRunsNeeded(suspects: Timed[], parallelCpu: Record<string, PhaseCpu>, budgetMs: number, load: MachineLoad): { rerun: Timed[]; cleared: Confirmed[] } {
|
|
260
|
-
const idle = load.load1 < load.cores
|
|
261
286
|
const rerun: Timed[] = []
|
|
262
287
|
const cleared: Confirmed[] = []
|
|
263
288
|
for (const t of suspects) {
|
|
264
289
|
const f = parallelCpu[t.file]
|
|
265
|
-
const mayWait =
|
|
290
|
+
const mayWait = t.ms > waitAllowance(budgetMs, load)
|
|
266
291
|
if (f != null && f.cpuMs + f.priorMs <= budgetMs && !mayWait) cleared.push({ file: t.file, ms: f.cpuMs, wallMs: t.ms, cpuMs: f.cpuMs, over: null })
|
|
267
292
|
else rerun.push(t)
|
|
268
293
|
}
|
package/src/suite/suite-cli.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { killTree } from '../core/spawn-timeout.ts'
|
|
|
16
16
|
import { parallelCap } from '../core/parallel.ts'
|
|
17
17
|
import { poolDir, poolOccupancy } from '../core/slots.ts'
|
|
18
18
|
import { keepTimings, seedTimings, timingsHome } from './kept-timings.ts'
|
|
19
|
-
import { aloneRunsNeeded, bunfigTest, readPhaseCpu, SUITE_CPU_ENV, type AloneRun, type Confirmed, confirmOver, crashedWorkers,
|
|
19
|
+
import { aloneRunsNeeded, bunfigTest, readPhaseCpu, SUITE_CPU_ENV, type AloneRun, type Confirmed, confirmOver, crashedWorkers, overWords, DEFAULT_BUDGET_MS, FULL_CEILING_MS, failedSuites, failLines, judgeSuites, normSuitePath, parseSuiteFlags, planPhases, QUICK_CEILING_MS, poolWorkers } from './judge-suites.ts'
|
|
20
20
|
|
|
21
21
|
type Phase = { code: number; signal: string | null; stalled: boolean; out: string; timings: Record<string, number>; cpuMs: number | null }
|
|
22
22
|
|
|
@@ -63,11 +63,6 @@ const CPU_PRELOAD = join(import.meta.dir, 'suite-cpu-preload.ts')
|
|
|
63
63
|
|
|
64
64
|
const secs = (ms: number): string => `${(ms / 1000).toFixed(1)}s`
|
|
65
65
|
|
|
66
|
-
const overWords = (c: Confirmed): string =>
|
|
67
|
-
c.over === 'cpu' ? `${c.file} ${secs(c.ms)} of CPU (${secs(c.wallMs)} wall)`
|
|
68
|
-
: c.over === 'wait' ? `${c.file} ${secs(c.wallMs)} wall on an idle machine, more than ${WAIT_FACTOR}x the budget, with ${secs(c.cpuMs ?? 0)} of CPU: it waits (a timer, a sleep, a poll)`
|
|
69
|
-
: `${c.file} ${secs(c.wallMs)} wall (no CPU figure)`
|
|
70
|
-
|
|
71
66
|
/** the suite FILES a phase names: a flag is not a file, and the repo's own
|
|
72
67
|
* `bun test` arguments are not files this runner put there */
|
|
73
68
|
const phaseFiles = (phase: string[], rawArgs: string[]): string[] => phase.filter((a) => !a.startsWith('-') && !rawArgs.includes(a))
|
|
@@ -117,6 +112,9 @@ export async function suiteCli(argv: string[]): Promise<number> {
|
|
|
117
112
|
const kept = timed && parallel ? timingsHome(process.cwd(), unit) : null
|
|
118
113
|
if (kept != null) seedTimings(kept, join(dir, 'parallel.json'))
|
|
119
114
|
const cpuFile = timed && parallel ? join(dir, 'cpu.tsv') : null
|
|
115
|
+
// the load BEFORE this run: read after it, the one minute average
|
|
116
|
+
// carries this run's own parallel phase, which is no other process
|
|
117
|
+
const load = machineLoad()
|
|
120
118
|
const p1At = Date.now()
|
|
121
119
|
const p1 = await runPhase(plan.parallel, timed ? join(dir, 'parallel.json') : null, ceilingMs, tmp, true, cpuFile)
|
|
122
120
|
const p1Ms = Date.now() - p1At
|
|
@@ -148,7 +146,6 @@ export async function suiteCli(argv: string[]): Promise<number> {
|
|
|
148
146
|
// before it can fail the task. One at a time: four alone runs side by
|
|
149
147
|
// side each burned about 40% more CPU than one alone (8 cores)
|
|
150
148
|
const aloneRuns: Record<string, AloneRun> = {}
|
|
151
|
-
const load = machineLoad()
|
|
152
149
|
const parallelCpu = phaseCpu.cpu
|
|
153
150
|
const { rerun, cleared: clearedInPhase } = aloneRunsNeeded(judged.over, parallelCpu, budget, load)
|
|
154
151
|
const aloneAt = Date.now()
|
|
@@ -224,7 +221,7 @@ export async function suiteCli(argv: string[]): Promise<number> {
|
|
|
224
221
|
...(!vacuous && (failedTests > 0 || (phases.some((p) => p.code !== 0 && p.signal == null) && killed.length === 0))
|
|
225
222
|
? [`FAIL: ${failedTests} test(s) failed, Ran ${ran} tests${slowest}`] : []),
|
|
226
223
|
...(over.length > 0
|
|
227
|
-
? [`FAIL: ${over.length} suite(s) over the ${budget}ms budget: ${over.map(overWords).join(', ')} (run alone, load ${load.load1.toFixed(1)} on ${load.cores} cores). Make each fast, or declare it in ${declaredIn}.slow with what it catches and why it cannot be fast`]
|
|
224
|
+
? [`FAIL: ${over.length} suite(s) over the ${budget}ms budget: ${over.map((c) => overWords(c, load, budget)).join(', ')} (run alone, load ${load.load1.toFixed(1)} on ${load.cores} cores before the run). Make each fast, or declare it in ${declaredIn}.slow with what it catches and why it cannot be fast`]
|
|
228
225
|
: []),
|
|
229
226
|
]
|
|
230
227
|
// the most actionable failure prints LAST, where the gate reads its headline
|
package/src/wiki/lint-md.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { scanMd, type MdDanglingRef, type ScanMdConfig } from 'rvlib-shipkit/src
|
|
|
6
6
|
export type MdLintReport = {
|
|
7
7
|
index: string | null // resolved entrypoint (null = neither index.md nor README.md found)
|
|
8
8
|
files: number
|
|
9
|
+
pages: string[] // every scanned .md file, scan-root relative
|
|
9
10
|
orphans: string[] // .md files with no path from the entrypoint
|
|
10
11
|
dangling: MdDanglingRef[] // refs whose target does not exist in the scan
|
|
11
12
|
ok: boolean
|
|
@@ -17,6 +18,7 @@ export function lintMd(cfg: ScanMdConfig): MdLintReport {
|
|
|
17
18
|
return {
|
|
18
19
|
index: scan.index,
|
|
19
20
|
files: scan.graph.nodes.length,
|
|
21
|
+
pages: scan.graph.nodes.map((n) => n.id),
|
|
20
22
|
orphans,
|
|
21
23
|
dangling: scan.dangling,
|
|
22
24
|
ok: scan.index != null && orphans.length === 0 && scan.dangling.length === 0,
|
package/src/wiki/scan-md.ts
CHANGED
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
// → path.md lazy — resolved from the scan root, then file-relative
|
|
5
5
|
// [text](path.md) lazy — file-relative
|
|
6
6
|
// `path.md` lazy — file-relative, then from the scan root
|
|
7
|
+
// [text](dir/) lazy — a folder: an edge to every page under it
|
|
8
|
+
// `dir/` lazy — the same, from a backtick mention
|
|
9
|
+
// A ref that leaves the scan root but stays under `boundary` is checked on
|
|
10
|
+
// disk: no edge, and dangling only when the target is really missing.
|
|
7
11
|
// Depth = 0-1 BFS from the index (eager edge keeps depth, lazy adds 1);
|
|
8
12
|
// unreachable files stay in the graph with no depth (lint-md.ts turns those,
|
|
9
13
|
// plus dangling refs, into failures — the graph itself is a viewer).
|
|
10
|
-
import { readdirSync, readFileSync, statSync } from 'fs'
|
|
14
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
|
|
11
15
|
import { basename, dirname, join, relative, resolve } from 'path'
|
|
12
16
|
import type { MdEdge, MdGraph, MdNode } from 'rvlib-shipkit/src/wiki/md-graph.ts'
|
|
13
17
|
|
|
@@ -15,6 +19,7 @@ export type ScanMdConfig = {
|
|
|
15
19
|
root: string // absolute dir to scan
|
|
16
20
|
index?: string // root-relative entry the BFS starts from (default: index.md AND README.md, both)
|
|
17
21
|
skipDirs?: string[] // dir names to skip on top of node_modules/.git/dist/tmp
|
|
22
|
+
boundary?: string // absolute dir enclosing root (a repo): refs leaving root but staying here resolve on disk
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
export type MdDanglingRef = { from: string; token: string } // an @/→/[](…) ref whose target is not in the scan
|
|
@@ -46,13 +51,33 @@ export function scanMd(cfg: ScanMdConfig): MdScan {
|
|
|
46
51
|
// writers inside a scanned dir often name paths from the REPO root
|
|
47
52
|
// ("agent/architecture.md" while scanning agent/) — accept that form too
|
|
48
53
|
const rootBase = `${basename(cfg.root)}/`
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
if (token.startsWith(rootBase))
|
|
52
|
-
|
|
54
|
+
const cands = (fromRel: string, token: string): string[] => {
|
|
55
|
+
const out = [resolve(join(cfg.root, dirname(fromRel)), token), resolve(cfg.root, token)]
|
|
56
|
+
if (token.startsWith(rootBase)) out.push(resolve(cfg.root, token.slice(rootBase.length)))
|
|
57
|
+
return out
|
|
58
|
+
}
|
|
59
|
+
// pages a ref reaches: one file, every page under a folder (never the
|
|
60
|
+
// root itself), or none. `onDisk` = the target exists in the boundary
|
|
61
|
+
// outside the scan, which is resolved but carries no edge.
|
|
62
|
+
type Hit = { to: string[]; onDisk: boolean }
|
|
63
|
+
const resolveRef = (fromRel: string, token: string): Hit | null => {
|
|
64
|
+
const folder = token.endsWith('/')
|
|
65
|
+
for (const cand of cands(fromRel, token)) {
|
|
53
66
|
const rel = relative(cfg.root, cand)
|
|
54
|
-
if (
|
|
67
|
+
if (rel.startsWith('..')) continue
|
|
68
|
+
if (!folder && inGraph.has(rel)) return { to: [rel], onDisk: false }
|
|
69
|
+
if (folder && rel === '') return { to: [], onDisk: false }
|
|
70
|
+
if (folder) {
|
|
71
|
+
const under = files.filter((f) => f.startsWith(`${rel}/`))
|
|
72
|
+
if (under.length > 0) return { to: under, onDisk: false }
|
|
73
|
+
if (existsSync(cand)) return { to: [], onDisk: true }
|
|
74
|
+
}
|
|
55
75
|
}
|
|
76
|
+
if (cfg.boundary == null) return null
|
|
77
|
+
const cand = resolve(join(cfg.root, dirname(fromRel)), token)
|
|
78
|
+
const inRoot = !relative(cfg.root, cand).startsWith('..')
|
|
79
|
+
const inBoundary = !relative(cfg.boundary, cand).startsWith('..')
|
|
80
|
+
if (!inRoot && inBoundary && existsSync(cand)) return { to: [], onDisk: true }
|
|
56
81
|
return null
|
|
57
82
|
}
|
|
58
83
|
const edgesOf = (rel: string): MdEdge[] => {
|
|
@@ -64,14 +89,16 @@ export function scanMd(cfg: ScanMdConfig): MdScan {
|
|
|
64
89
|
// strict: @/→/[](…) are deliberate wiki refs — a miss is a dangling ref.
|
|
65
90
|
// Backtick spans mention paths casually (other repos, deleted examples) — resolve or ignore, never fail.
|
|
66
91
|
const push = (token: string, eager: boolean, strict: boolean) => {
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
|
|
92
|
+
const hit = resolveRef(rel, token)
|
|
93
|
+
if (hit == null) { if (strict) dangling.push({ from: rel, token }); return }
|
|
94
|
+
for (const to of hit.to) if (to !== rel) out.push({ from: rel, to, eager })
|
|
70
95
|
}
|
|
71
|
-
for (const m of prose.matchAll(/(?:^|[\s(])@([\w][\w./-]*\.md)/gm)) push(m[1]!, true, true)
|
|
96
|
+
for (const m of prose.matchAll(/(?:^|[\s(])@((?:\.{1,2}\/)*[\w][\w./-]*\.md)/gm)) push(m[1]!, true, true)
|
|
72
97
|
for (const m of prose.matchAll(/→\s*([\w][\w./-]*\.md)\b/g)) push(m[1]!, false, true)
|
|
73
98
|
for (const m of prose.matchAll(/\]\(([^)\s:]+\.md)\)/g)) push(m[1]!, false, true)
|
|
99
|
+
for (const m of prose.matchAll(/\]\(([^)\s:]*\/)\)/g)) push(m[1]!, false, true)
|
|
74
100
|
for (const s of spans) for (const m of s.matchAll(/[\w][\w./-]*\.md/g)) push(m[0], false, false)
|
|
101
|
+
for (const s of spans) for (const m of s.matchAll(/(?:^|\s)([\w.][\w./-]*\/)(?=$|[\s<*])/g)) push(m[1]!, false, false)
|
|
75
102
|
return out
|
|
76
103
|
}
|
|
77
104
|
const dangling: MdDanglingRef[] = []
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// SK023 stores under cap (core/retention.ts owns the caps): every store shipkit
|
|
2
|
-
// writes for this repo, and the machine's own when a home dir exists, is
|
|
3
|
-
// inside its declared cap plus the drift one sweep interval allows. Red means
|
|
4
|
-
// the daemon's hourly sweep stopped running, or a store grows faster than its
|
|
5
|
-
// cap assumes. The fix runs the sweep.
|
|
6
|
-
import { existsSync } from 'fs'
|
|
7
|
-
import { check } from '../check.ts'
|
|
8
|
-
import { fmtAge, fmtBytes, measureStores, repoStores, sweepStores, type Store } from '../core/retention.ts'
|
|
9
|
-
import { homeDir } from '../home/home-paths.ts'
|
|
10
|
-
import { machineStores } from '../home/machine-stores.ts'
|
|
11
|
-
|
|
12
|
-
const storesOf = (root: string): Store[] => [...repoStores(root), ...(existsSync(homeDir()) ? machineStores(homeDir()) : [])]
|
|
13
|
-
|
|
14
|
-
const capWords = (s: Store): string =>
|
|
15
|
-
[
|
|
16
|
-
s.cap.maxCount != null ? `${s.cap.maxCount} entries` : null,
|
|
17
|
-
s.cap.maxAgeMs != null ? fmtAge(s.cap.maxAgeMs) : null,
|
|
18
|
-
s.cap.maxFileBytes != null ? `${fmtBytes(s.cap.maxFileBytes)} a file` : null,
|
|
19
|
-
s.cap.maxBytes != null ? fmtBytes(s.cap.maxBytes) : null,
|
|
20
|
-
].filter((x) => x != null).join(', ')
|
|
21
|
-
|
|
22
|
-
export const storesUnderCap = check({
|
|
23
|
-
id: 'SK023',
|
|
24
|
-
blocking: false,
|
|
25
|
-
title: 'stores under cap',
|
|
26
|
-
description: 'every store shipkit writes (answers, run record, logs, jobs) is inside its cap',
|
|
27
|
-
owner: 'build/shipkit/built-in-checks.md',
|
|
28
|
-
when: 'health',
|
|
29
|
-
run: (c) => {
|
|
30
|
-
const all = measureStores(storesOf(c.root))
|
|
31
|
-
const over = all.filter((m) => m.over != null)
|
|
32
|
-
const unread = all.filter((m) => m.use == null)
|
|
33
|
-
for (const m of over) c.fail(`${m.store.id} over its cap: ${m.over} (${m.store.where})`, 'shipkit check --fix SK023 runs the sweep the daemon runs hourly')
|
|
34
|
-
for (const m of unread) c.warn(`${m.store.id} could not be read (${m.store.where})`)
|
|
35
|
-
if (over.length === 0) c.ok(`${all.length} stores inside their caps: ${all.map((m) => `${m.store.id} ${m.use?.count ?? '?'} (cap ${capWords(m.store)})`).join(', ')}`)
|
|
36
|
-
},
|
|
37
|
-
fix: async (c) => {
|
|
38
|
-
const stores = storesOf(c.root)
|
|
39
|
-
const before = measureStores(stores).filter((m) => m.over != null)
|
|
40
|
-
const r = await sweepStores(stores)
|
|
41
|
-
const broke = r.filter((x) => x.error != null)
|
|
42
|
-
return {
|
|
43
|
-
changed: before.length > 0,
|
|
44
|
-
summary: `swept ${stores.length} stores${before.length > 0 ? `, ${before.map((m) => m.store.id).join(', ')} were over` : ''}${broke.length > 0 ? `; failed: ${broke.map((x) => `${x.id} (${x.error})`).join(', ')}` : ''}`,
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
export default storesUnderCap
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// the contracts check — `.shipkit/*` release-contract fulfillness. It shares ONE
|
|
2
|
-
// evaluation with check SK002 (the `contractsResult` scan), and it tags with
|
|
3
|
-
// that id, because the invariant has one owner and two surfaces report it. A
|
|
4
|
-
// venue deploy step deps on it BY NAME, which needs nothing from this end.
|
|
5
|
-
import { applyContractsResult, contractsResult } from '../contracts/apply-contracts.ts'
|
|
6
|
-
import { check } from '../check.ts'
|
|
7
|
-
import { contractsFulfillness } from './SK002-contracts-fulfillness.check.ts'
|
|
8
|
-
|
|
9
|
-
export const contractsCheck = check({
|
|
10
|
-
id: 'contracts',
|
|
11
|
-
title: 'contracts',
|
|
12
|
-
description: 'every declared venue has the `.shipkit/*` release contract it demands',
|
|
13
|
-
owner: 'meta/contracts.md',
|
|
14
|
-
blocking: true,
|
|
15
|
-
run: async (c) => {
|
|
16
|
-
applyContractsResult(c, await c.use(contractsResult), contractsFulfillness)
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
export default contractsCheck
|