@starci/hfs 4.7.17 → 4.7.19

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 CHANGED
@@ -1,11 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## 4.7.17 - 2026-10-21
3
+ ## 4.7.19 - 2026-10-21
4
+ - Changed: supersedes 4.7.18 (app lint broken: the canons' Sonar way block carries its own ignores, which `starci app lint` refused as an unsupported source scope, so it exited 2 without running ESLint and reported 0 findings); 4.7.18 is not used.
5
+ - Fixed: `starci app lint` reads the canons' flat config as flat config defines it: global ignores prune the source walk and a block's own ignores narrow only that block, so the Sonar way block no longer makes the source scope unavailable (exit 2 without ESLint); a file is a source when some block's files match it and that block's ignores do not.
6
+ - Fixed: the full scaffold's ui package pins react-dom at the react version beside react.
7
+ - Fixed: the scaffolded `migrate-connections.client.spec.ts` mocks an applied migration with only its `name` (the `AppliedMigration` port), so the full scaffold typechecks again.
8
+ - Added: `release.requireCi` (default false, owner ruling release-require-ci-per-project): `starci app release push` waits for the candidate CI only for an app that sets it true; with false it needs the annotated tag and the green L4 record, runs the dry run and pushes atomically, and the L4 record and the output state that CI was not required; canon pins follow the matching package cohort.
9
+
10
+ ## 4.7.18 - 2026-10-21
11
+ - Changed: supersedes 4.7.17, published from a lane whose history the owner refused (an unapproved allowlist entry) and therefore a superseded orphan that is not used; this version carries the same work plus the standalone scaffold fix.
12
+ - Fixed: the managed CI's coverage job runs `starci app coverage verify <lcov>`, the coverage judgement alone over the merged report, instead of `npm run codegen && starci app check --coverage-from` (the whole app check the fast and lint jobs already ran); its default timeout is 15 minutes (`knowledge/hfs/ci-standard.yaml`). NIVO v0.3.0's coverage job took 18m43s of 20 and the tag run was cancelled.
4
13
  - Fixed: the sonar row of `starci app release gate --sonar` no longer passes on the scanner's exit code alone: it reads `.scannerwork/report-task.txt`, polls `api/ce/task` until the analysis ends and reads `api/qualitygates/project_status` with the same token; ERROR is red as `RELEASE_SONAR_GATE_FAILED` naming each failed condition, a 600-second wait is `RELEASE_SONAR_GATE_TIMEOUT` and an unreadable answer `RELEASE_SONAR_GATE_UNREADABLE`; canon pins follow the matching package cohort.
5
14
 
6
- - Fixed: `npx @starci/cli app scaffold` works from the published packages alone: the Sonar exclusions come from the jest preset copy @starci/hfs ships (`runtime/packages/jest-preset/sonar-exclusions.json`, `bundledPresets`), not from a @starci/jest-preset installed beside the CLI (it was `HFS_SYNC_PRESET_MISSING`); `starci app upgrade` reads the same copy instead of a hand-kept list.
15
+ - Fixed: `npx @starci/cli app scaffold` works from the published packages alone: the Sonar exclusions come from the jest preset copy @starci/hfs ships (`runtime/packages/jest-preset/sonar-exclusions.cjs`, `bundledPresets`), not from a @starci/jest-preset installed beside the CLI (it was `HFS_SYNC_PRESET_MISSING`); `starci app upgrade` reads the same copy instead of a hand-kept list.
7
16
  - Fixed: a new scaffold path is git-initialised with an unborn main before any file is written (`HFS_SCAFFOLD_GIT_INIT_FAILED` when git cannot), as the verb promised, so `starci npm ci` can install the hooks; an existing empty unborn main repository is still accepted.
8
17
 
18
+ - Fixed: `BE_UNIT_SPEC_NOT_STAGED` exempts a measured file with nothing to execute (constants and types only), which has nothing a spec could call and whose spec the spec rules refuse; every measured file with a function, method, constructor or accessor still needs its spec staged beside it. It refused the scaffold's own first commit on the constant-only `http-status.policy.ts`; the scaffold now also ships `migrate-connections.client.spec.ts`.
19
+
9
20
  ## 4.7.16 - 2026-10-21
10
21
  - Fixed: `DB_MIGRATION_DESTRUCTIVE` counts a be/src source as a reference of a dropped or altered column only when the source names the column's table too, so a same-named column of another table (`public.brain_lessons.origin` beside a drop of `transactions.origin`) no longer blocks a contract migration; table and other object drops keep the leaf match; canon pins follow the matching package cohort.
11
22
 
package/coverage/cli.mjs CHANGED
@@ -3,14 +3,18 @@
3
3
  // coverage proof, the Codecov upload and the Sonar import read. The merge is the app's installed @starci/jest-preset (`@starci/jest-preset/merge`):
4
4
  // istanbul-lib-coverage merges the shard maps by source location, and the preset's own lcov reporter writes the result exactly as an unsharded run
5
5
  // would. A path is a coverage-final.json or a directory searched for every one below it; no report found refuses (exit 2), never an empty report.
6
+ // `starci app coverage verify <lcov>`: the coverage proof alone (scripts/hfs/coverage-from.mjs, the judgement `starci app check --coverage-from`
7
+ // adds to the whole check): every measured logic file is in the merged lcov at 100 per file. The managed CI's coverage job runs it after the merge,
8
+ // so the job re-runs none of the rules the fast and lint jobs already judged. Exit 0 proved, 1 refused (the report lists every finding), 2 bad usage.
6
9
  import path from 'node:path';
7
10
  import { createRequire } from 'node:module';
11
+ import { coverageFrom, formatCoverageReport } from '../runtime/scripts/hfs/coverage-from.mjs';
8
12
 
9
- const USAGE = 'usage: starci app coverage merge --out <lcov> <coverage-final.json-or-dir>... [--cwd <dir>]';
13
+ const USAGE = 'usage: starci app coverage merge --out <lcov> <coverage-final.json-or-dir>... [--cwd <dir>] | starci app coverage verify <lcov> [--cwd <dir>]';
10
14
 
11
15
  function parse(argv) {
12
16
  const [action, ...rest] = argv;
13
- if (action !== 'merge') throw new Error(USAGE);
17
+ if (action !== 'merge' && action !== 'verify') throw new Error(USAGE);
14
18
  const opts = { inputs: [] };
15
19
  for (let index = 0; index < rest.length; index += 1) {
16
20
  const arg = rest[index];
@@ -22,6 +26,11 @@ function parse(argv) {
22
26
  } else if (arg.startsWith('--')) throw new Error(`unknown flag ${arg}; ${USAGE}`);
23
27
  else opts.inputs.push(arg);
24
28
  }
29
+ opts.action = action;
30
+ if (action === 'verify') {
31
+ if (opts.out !== undefined || opts.inputs.length !== 1) throw new Error(USAGE);
32
+ return opts;
33
+ }
25
34
  if (!opts.out || !opts.inputs.length) throw new Error(USAGE);
26
35
  if (path.basename(opts.out) !== 'lcov.info') throw new Error(`--out names the lcov.info the coverage proof reads; ${USAGE}`);
27
36
  return opts;
@@ -34,11 +43,27 @@ function installedMerge(cwd) {
34
43
  }
35
44
  }
36
45
 
37
- /** Exit 0 merged, 2 bad usage, no preset or no report found. `merge` replaces the installed preset merge in a spec. */
38
- export async function coverageMain(argv, { cwd: baseCwd = process.cwd(), stdout = (s) => process.stdout.write(s), stderr = (s) => process.stderr.write(s), merge } = {}) {
46
+ /** The coverage proof of the app at `cwd` over the lcov `report`: exit 0 proved, 1 refused, 2 when the proof cannot run. */
47
+ function verifyCoverage(cwd, report, { stdout, stderr, prove }) {
48
+ try {
49
+ const result = prove({ repoRoot: cwd, coverageFrom: report });
50
+ stdout(formatCoverageReport(result));
51
+ return result.ok ? 0 : 1;
52
+ } catch (error) {
53
+ stderr(`starci app coverage verify: ${String(error?.message ?? error).split('\n')[0]}\n`);
54
+ return 2;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Exit 0 merged or proved, 1 a refused proof, 2 bad usage, no preset or no report found. `merge` replaces the installed preset merge and
60
+ * `prove` the coverage proof in a spec.
61
+ */
62
+ export async function coverageMain(argv, { cwd: baseCwd = process.cwd(), stdout = (s) => process.stdout.write(s), stderr = (s) => process.stderr.write(s), merge, prove = coverageFrom } = {}) {
39
63
  let opts;
40
64
  try { opts = parse(argv); } catch (error) { stderr(`starci app coverage: ${error.message}\n`); return 2; }
41
65
  const cwd = path.resolve(baseCwd, opts.cwd ?? '.');
66
+ if (opts.action === 'verify') return verifyCoverage(cwd, opts.inputs[0], { stdout, stderr, prove });
42
67
  try {
43
68
  const run = merge ?? installedMerge(cwd);
44
69
  const outDir = path.dirname(path.resolve(cwd, opts.out));
package/lint/run.mjs CHANGED
@@ -137,8 +137,35 @@ const onSide = (changed, side) => changed.filter((file) => file.startsWith(`${si
137
137
  const fileKey = (file) => process.platform === 'win32' ? path.resolve(file).toLowerCase() : path.resolve(file);
138
138
  const inside = (root, file) => { const rel = path.relative(root, file); return rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel); };
139
139
 
140
+ /**
141
+ * The lint scope a flat config declares: `ignored(file)` for its global ignores (a block holding only `ignores` and `name`), which prune
142
+ * the walk, and `source(file)` for a file some block's `files` select while that block's own `ignores` do not (standard flat-config
143
+ * semantics: the Sonar-way block of the canons narrows itself to the scanned files). Negated or non-string selectors cannot prove a
144
+ * scope and are refused.
145
+ */
146
+ export function canonScope(config) {
147
+ const blocks = [], ignored = [];
148
+ for (const block of config) {
149
+ if (!block || typeof block !== 'object') throw new Error('the installed canon returned an invalid config block');
150
+ for (const field of ['files', 'ignores']) {
151
+ if (block[field] === undefined) continue;
152
+ if (!Array.isArray(block[field]) || block[field].some((glob) => typeof glob !== 'string' || glob.startsWith('!'))) throw new Error(`unsupported canon ${field} selectors`);
153
+ }
154
+ const patterns = (globs) => (globs ?? []).flatMap((glob) => braceVariants(glob).map(globExpression));
155
+ const global = block.ignores !== undefined && Object.keys(block).every((key) => ['ignores', 'name'].includes(key));
156
+ if (global) ignored.push(...patterns(block.ignores));
157
+ else if (block.files !== undefined) blocks.push({ files: patterns(block.files), ignores: patterns(block.ignores) });
158
+ }
159
+ if (!blocks.length) throw new Error('the installed canon has no source selectors');
160
+ const matches = (list, file) => list.some((pattern) => pattern.test(file));
161
+ return {
162
+ ignored: (file) => matches(ignored, file),
163
+ source: (file) => blocks.some((block) => matches(block.files, file) && !matches(block.ignores, file)),
164
+ };
165
+ }
166
+
140
167
  /** Read the installed canon's source selectors, then enumerate that scope; unavailable or unsupported selectors cannot prove coverage. */
141
- async function sourceFiles({ repoRoot, cwd, side, scope }) {
168
+ async function sourceFiles({ repoRoot, cwd, side, scope: folderScope }) {
142
169
  const entry = createRequire(path.join(cwd, 'package.json')).resolve(`@starci/eslint-canon-${side}`);
143
170
  // The canon must be the app's own install: resolved inside the app root, or inside the app's node_modules when that folder is a link to the install
144
171
  // (the runtime's examples lint in a sealed copy whose node_modules links the example's own install, scripts/hfs/example-secrets.mjs).
@@ -149,30 +176,19 @@ async function sourceFiles({ repoRoot, cwd, side, scope }) {
149
176
  if (typeof factory !== 'function' || typeof canon.loadHfs !== 'function') throw new Error('the installed canon has no supported config factory');
150
177
  const config = await factory({ hfs: canon.loadHfs(pathToFileURL(path.join(cwd, 'eslint.config.mjs')).href) });
151
178
  if (!Array.isArray(config)) throw new Error('the installed canon did not return a flat config');
152
- const selectors = [], ignored = [];
153
- for (const block of config) {
154
- if (!block || typeof block !== 'object') throw new Error('the installed canon returned an invalid config block');
155
- for (const [field, target] of [['files', selectors], ['ignores', ignored]]) {
156
- if (block[field] === undefined) continue;
157
- if (!Array.isArray(block[field]) || block[field].some((glob) => typeof glob !== 'string' || glob.startsWith('!'))) throw new Error(`unsupported canon ${field} selectors`);
158
- if (field === 'ignores' && Object.keys(block).some((key) => !['ignores', 'name'].includes(key))) throw new Error('unsupported non-global canon ignores');
159
- target.push(...block[field].flatMap((glob) => braceVariants(glob).map(globExpression)));
160
- }
161
- }
162
- if (!selectors.length) throw new Error('the installed canon has no source selectors');
163
- const matches = (patterns, file) => patterns.some((pattern) => pattern.test(file));
179
+ const scope = canonScope(config);
164
180
  const files = [];
165
181
  const visit = (folder) => {
166
182
  for (const child of fs.readdirSync(path.join(cwd, folder), { withFileTypes: true })) {
167
183
  const file = posix(path.join(folder, child.name));
168
184
  // Ask the canon's global ignore patterns before entering output or installed-package trees.
169
- if (matches(ignored, file) || matches(ignored, `${file}/__starci_scope_probe__`)) continue;
185
+ if (scope.ignored(file) || scope.ignored(`${file}/__starci_scope_probe__`)) continue;
170
186
  if (child.isSymbolicLink()) throw new Error(`cannot enumerate symlink ${file}`);
171
187
  if (child.isDirectory()) visit(file);
172
- else if (child.isFile() && matches(selectors, file)) files.push(file);
188
+ else if (child.isFile() && scope.source(file)) files.push(file);
173
189
  }
174
190
  };
175
- visit(scope ?? '');
191
+ visit(folderScope ?? '');
176
192
  return files.sort(byCodeUnit);
177
193
  }
178
194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/hfs",
3
- "version": "4.7.17",
3
+ "version": "4.7.19",
4
4
  "description": "The StarCi app command implementation for scaffolding, linting, checking and synchronizing one product repository.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/release/gate.mjs CHANGED
@@ -16,7 +16,9 @@ import { sonarQualityGate } from './sonar-quality-gate.mjs';
16
16
  export const RELEASE_CODE = 'RELEASE_CONFIG_INVALID';
17
17
  const SONAR_UNREACHABLE = 'SONAR_UNREACHABLE';
18
18
 
19
- const FIELDS = new Set(['gates', 'tagPrefix', 'defaultBranch', 'tagMatchesVersion']);
19
+ const FIELDS = new Set(['gates', 'tagPrefix', 'defaultBranch', 'tagMatchesVersion', 'requireCi']);
20
+ /** The note a release that does not wait for CI carries in its L4 record and its push output (owner ruling release-require-ci-per-project). */
21
+ export const CI_NOT_REQUIRED = 'CI not required by release.requireCi=false (owner ruling release-require-ci-per-project): the local release gate, this L4 record and the annotated tag, is the release proof';
20
22
  const GATE_FIELDS = new Set(['name', 'command', 'summary', 'env']);
21
23
  const GATE_NAME = /^[a-z][a-z0-9-]*$/u;
22
24
  const TOKEN = /^[A-Za-z0-9_@%+=:,./\\-]+$/u;
@@ -117,14 +119,17 @@ export function normalizeRelease(block, scripts = {}, services = {}, options = {
117
119
  const tagPrefix = raw.tagPrefix ?? 'v';
118
120
  const defaultBranch = raw.defaultBranch ?? 'main';
119
121
  const tagMatchesVersion = raw.tagMatchesVersion ?? false;
122
+ // The candidate CI of `release push` is an app's choice and off by default (owner ruling release-require-ci-per-project); the local gate never is.
123
+ const requireCi = raw.requireCi ?? false;
120
124
  if (typeof tagPrefix !== 'string' || !PREFIX.test(tagPrefix)) problems.push(`release.tagPrefix: must match ${PREFIX}`);
121
125
  if (!refName(defaultBranch)) problems.push(`release.defaultBranch: must match ${REF_NAME}`);
122
126
  if (typeof tagMatchesVersion !== 'boolean') problems.push('release.tagMatchesVersion: must be true or false');
127
+ if (typeof requireCi !== 'boolean') problems.push('release.requireCi: must be true or false');
123
128
  const quality = releaseServices(services, options);
124
129
  const audit = auditGate(quality.audit);
125
130
  const gates = raw.gates === undefined ? defaultGates(scripts, audit) : gatesOf(raw.gates, problems);
126
131
  if (raw.gates !== undefined && audit && !gates.some((gate) => gate.name === 'audit')) gates.push(audit);
127
- return problems.length === 0 ? { config: { gates, tagPrefix, defaultBranch, tagMatchesVersion, services: quality } } : { problems };
132
+ return problems.length === 0 ? { config: { gates, tagPrefix, defaultBranch, tagMatchesVersion, requireCi, services: quality } } : { problems };
128
133
  }
129
134
 
130
135
  /* ---- git through the seam */
@@ -345,10 +350,11 @@ function assertUnmoved(ctx, head) {
345
350
  if (dirty.length > 0) throw failure('RELEASE_TREE_DIRTY', `the gates left ${dirty.length} changed or untracked path(s) (first: ${dirty[0].slice(0, 100)}): generated files differ from HEAD. Commit or ignore them properly, then rerun. No record.`);
346
351
  }
347
352
 
348
- function writeRecord(ctx, { head, tag, results, recordPath }) {
353
+ function writeRecord(ctx, { head, tag, results, recordPath, requireCi }) {
349
354
  const record = {
350
355
  schema: 'starci-app-l4-record/1', head, tag, createdAt: new Date(ctx.now()).toISOString(), producedBy: 'starci app release gate',
351
356
  note: 'Required gates passed on a clean HEAD; optional provider skips are explicit and every entry links its log and sha256.',
357
+ ci: requireCi === true ? { required: true, note: 'starci app release push waits for the candidate CI of this sha (release.requireCi=true)' } : { required: false, note: CI_NOT_REQUIRED },
352
358
  gates: results,
353
359
  };
354
360
  fs.mkdirSync(path.dirname(recordPath), { recursive: true });
@@ -394,7 +400,7 @@ export async function releaseGate(ctx, config, options = {}) {
394
400
  const failed = results.filter((result) => !result.pass && !result.skipped);
395
401
  if (failed.length > 0) return { ok: false, lines: [...plan, ...report, `gate(s) red: ${failed.map((item) => item.name).join(', ')}. No L4 record, no tag.`], data: { ...base, executed: true, results } };
396
402
  assertUnmoved(ctx, facts.head);
397
- writeRecord(ctx, { head: facts.head, tag: facts.chosen.tag, results, recordPath });
403
+ writeRecord(ctx, { head: facts.head, tag: facts.chosen.tag, results, recordPath, requireCi: config.requireCi });
398
404
  const created = facts.chosen.state !== 'on-head';
399
405
  if (created) git(ctx, ['tag', '-a', facts.chosen.tag, '-m', `release ${facts.chosen.tag}: required gates passed on ${facts.head.slice(0, 12)} (L4 record ${path.basename(recordPath)})`, facts.head]);
400
406
  const tagged = created ? `annotated tag ${facts.chosen.tag} created on ${facts.head.slice(0, 10)}` : `annotated tag ${facts.chosen.tag} already on ${facts.head.slice(0, 10)}`;
package/release/index.mjs CHANGED
@@ -53,7 +53,7 @@ function readPackage(root) {
53
53
  try { return JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')); } catch { throw refusal('RELEASE_PACKAGE_UNREADABLE', 'package.json is not readable JSON'); }
54
54
  }
55
55
 
56
- /** The normalised `release:` block (tolerant of absence) with the package version: { root, version, gates, tagPrefix, defaultBranch, tagMatchesVersion }. */
56
+ /** The normalised `release:` block (tolerant of absence) with the package version: { root, version, gates, tagPrefix, defaultBranch, tagMatchesVersion, requireCi }. */
57
57
  function loadReleaseConfig(root) {
58
58
  const pkg = readPackage(root);
59
59
  if (typeof pkg.version !== 'string' || !VERSION.test(pkg.version)) throw refusal(RELEASE_CODE, 'package.json needs a version like 1.2.3 (the release tag derives from it)');
package/release/push.mjs CHANGED
@@ -3,11 +3,13 @@
3
3
  // head and tag. `git push --dry-run --atomic` always runs first (the hook's verdict is the proof) and any failure refuses the push.
4
4
  // With --execute the exact sha first goes to its candidate ref refs/heads/release/candidate-<version> and the push waits for the ci.yml run of that sha
5
5
  // (candidate-ci.mjs, OWNER RULING candidate-ci 2026-10-18): only a green candidate (or the owner's sha-bound override record) moves the branch and the tag.
6
+ // That wait runs only for an app that sets release.requireCi: true; the default false (owner ruling release-require-ci-per-project) pushes after the
7
+ // local gate and the dry run alone and says so. The tag, the L4 record and the dry run are never skipped.
6
8
  import fs from 'node:fs';
7
9
  import path from 'node:path';
8
10
  import { firstLine } from '../stack/context.mjs';
9
11
  import { failure, refusal } from '../stack/errors.mjs';
10
- import { annotatedOnHead, git, refName, releaseDir } from './gate.mjs';
12
+ import { CI_NOT_REQUIRED, annotatedOnHead, git, refName, releaseDir } from './gate.mjs';
11
13
  import { candidateRef, candidateStep } from './candidate-ci.mjs';
12
14
 
13
15
  const VERDICT = /RIGHTS_PUSH_NOT_RELEASE|pre-push|failed to push|Everything up|->/u;
@@ -98,8 +100,10 @@ export async function releasePush(ctx, config, options = {}) {
98
100
  const red = [];
99
101
  const refs = [...branchRefs(ctx, { head, remote, branch }, red).refs, ...tagRefs(ctx, { remote, tag: gate.tag }, red)];
100
102
  data.refs = refs;
101
- const candidate = refs.length > 0 ? candidateRef(gate.tag, config.tagPrefix) : null;
103
+ const requireCi = config.requireCi === true;
104
+ const candidate = refs.length > 0 && requireCi ? candidateRef(gate.tag, config.tagPrefix) : null;
102
105
  if (candidate) out.push(`plan git push ${remote} +${head.slice(0, 10)}:${candidate}, wait for its ci.yml run to be green, then git push --atomic ${remote} ${refs.join(' ')}`);
106
+ else if (refs.length > 0) out.push(`plan git push --atomic ${remote} ${refs.join(' ')}`, `ci ${CI_NOT_REQUIRED}`);
103
107
  else out.push(`plan git push --atomic ${remote} (nothing)`);
104
108
  if (refs.length === 0 && red.length === 0) return { ok: true, lines: [...out, `already pushed: ${remote}/${branch} holds HEAD and ${gate.tag} is on ${remote}. Nothing to do.`], data };
105
109
  if (refs.length > 0) {
@@ -109,10 +113,12 @@ export async function releasePush(ctx, config, options = {}) {
109
113
  }
110
114
  if (red.length > 0) return refuse(out, red, data, options.execute === true ? 'nothing pushed.' : 'dry run: nothing pushed.');
111
115
  if (options.execute !== true) return { ok: true, lines: [...out, 'dry run: nothing pushed. ready; re-run with --execute.'], data };
112
- const judged = await candidateStep(ctx, { head, tag: gate.tag, prefix: config.tagPrefix, remote, wait: options.candidateWait });
113
- data.candidate = judged.data;
114
- out.push(...judged.lines);
115
- if (!judged.ok) return { ok: false, lines: [...out, `nothing pushed to ${branch} or ${gate.tag}.`], data };
116
+ if (requireCi) {
117
+ const judged = await candidateStep(ctx, { head, tag: gate.tag, prefix: config.tagPrefix, remote, wait: options.candidateWait });
118
+ data.candidate = judged.data;
119
+ out.push(...judged.lines);
120
+ if (!judged.ok) return { ok: false, lines: [...out, `nothing pushed to ${branch} or ${gate.tag}.`], data };
121
+ } else data.candidate = { required: false, note: CI_NOT_REQUIRED };
116
122
  const run = git(ctx, ['push', '--atomic', remote, ...refs], { allowFail: true });
117
123
  if (run.code !== 0) return { ok: false, lines: [...out, `push failed: ${firstLine(run.stderr)}`], data };
118
124
  return { ok: true, lines: [...out, `pushed to ${remote}: ${refs.join(' ')}`], data: { ...data, pushed: true } };
@@ -29,14 +29,14 @@ pins:
29
29
  source: packages/grammar/package.json
30
30
  why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
31
31
  '@starci/eslint-canon-be':
32
- version: 3.4.25
32
+ version: 3.4.27
33
33
  group: starci
34
34
  install: registry
35
35
  side: be
36
36
  source: packages/eslint/be/package.json
37
37
  why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
38
38
  '@starci/eslint-canon-fe':
39
- version: 8.4.24
39
+ version: 8.4.26
40
40
  group: starci
41
41
  install: registry
42
42
  side: fe
@@ -62,7 +62,7 @@ pins:
62
62
  side: both
63
63
  source: packages/prettier-config/package.json
64
64
  '@starci/jest-preset':
65
- version: 2.3.3
65
+ version: 2.3.4
66
66
  group: starci
67
67
  install: registry
68
68
  side: be
@@ -76,14 +76,14 @@ pins:
76
76
  source: packages/test-world/package.json
77
77
  why: 'the shared e2e library of every back end (R47, R48), a devDependency of every back end: the warm stack behind toxiproxy, the network-edge fakes, the Nest boot, the typed useTestWorld handle, useSandbox for contract specs and the outage lock. Kafka is real own infra (the one digest-pinned apache/kafka KRaft image, a broker listener and proxy per slot, slot-prefixed topics, consumer groups and client ids) and Postgres is schema-per-context (a schema and a login role per context in a shared database). Each worker has its own data slot (<ns>_w<k>) with its own databases, Keycloak realm, leased Redis DB, bucket/collection/topic prefixes, fakes host, toxiproxy proxies and outage lock; a run provisions min(jest workers, workers cap, default 2) slots, and state file protocol 2 pairs exactly with @starci/jest-preset (TEST_WORLD_PAIR_MISMATCH otherwise). A modules world boots real peer apps beside its modules, world.apps.<name>.during(fn) is the outage of a peer app, w.keycloak.clientSecret(client) answers the run-generated secret of a confidential realm client, world.keycloak.events/sessions read the realm user events and live sessions, world.infra.postgresql.connection(name) takes one database connection down while the others serve, and world.resolve and scope.resolve take any Nest token. Every path a declaration names (`stack`, seeds, the realm, Dockerfiles) resolves from the app root (the directory of hfs.json); the globalSetup registers the path aliases as TypeScript resolves them. Its CLI main is exported at ./cli for starci app stack.'
78
78
  '@starci/cli':
79
- version: 1.7.17
79
+ version: 1.7.19
80
80
  group: starci
81
81
  install: registry
82
82
  side: both
83
83
  source: packages/cli/package.json
84
84
  why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
85
85
  '@starci/hfs':
86
- version: 4.7.17
86
+ version: 4.7.19
87
87
  group: starci
88
88
  install: registry
89
89
  side: both
@@ -19,15 +19,17 @@ jobs:
19
19
  # The per-job settings the managed CI renders when .starcistacks/application-stacks.yaml ci.jobs leaves them out (ci.jobs.<job>.timeoutMinutes,
20
20
  # ci.jobs.test.shards). Sized from a real run (NIVO v0.2.3 on the 2-vCPU GitHub runner, 2026-10-18): the be lint with the Sonar import took 11.5 minutes and the
21
21
  # fe lint more than 8 in one 20-minute job, and ~900 unit suites ran at ~4 s each (670 of 904 in 45 minutes). One lint job per side, and 6 shards of ~150 suites
22
- # (~10 minutes each plus the install) leave each job well inside its timeout.
22
+ # (~10 minutes each plus the install) leave each job well inside its timeout. The coverage job installs, downloads the shards, merges them and runs
23
+ # the coverage judgement alone (starci app coverage verify, seconds): ~5 minutes, so 15 leaves three times that. Its earlier whole app check took
24
+ # 18m43s on NIVO v0.3.0 and the 20-minute bound cancelled the tag run (39592175266).
23
25
  defaults:
24
26
  shards: 6
25
- timeoutMinutes: {fast: 20, lint: 30, test: 25, coverage: 20, build: 30, sonar: 20, db-types: 30}
27
+ timeoutMinutes: {fast: 20, lint: 30, test: 25, coverage: 15, build: 30, sonar: 20, db-types: 30}
26
28
 
27
29
  # The steps that need a raised Node heap on the GitHub runner, matched on their `run` text, and the least heap they must declare in NODE_OPTIONS.
28
30
  heap:
29
31
  minMiB: 6144
30
- steps: ['npm run typecheck', 'npm run lint', 'app lint', 'app check --coverage-from', 'npm run db:lint']
32
+ steps: ['npm run typecheck', 'npm run lint', 'app lint', 'app coverage verify', 'npm run db:lint']
31
33
 
32
34
  items:
33
35
  - id: candidate-trigger
@@ -1608,7 +1608,7 @@ BE_TYPE_ESCAPE:
1608
1608
  BE_UNIT_SPEC_NOT_STAGED:
1609
1609
  title: "A new back-end logic file is committed without its unit spec"
1610
1610
  title_vi: "Tệp logic back-end mới được commit mà không có unit spec"
1611
- meaning_vi: "Commit thêm `<file>`, một tệp `<name>.<role>.ts` có vai trò logic mà unit coverage đo ở mức 100 mỗi tệp, nhưng index không có `<name>.<role>.spec.ts` bên cạnh nó: mã được viết trước, spec để sau."
1611
+ meaning_vi: "Commit thêm `<file>`, một tệp `<name>.<role>.ts` có vai trò logic mà unit coverage đo ở mức 100 mỗi tệp, nhưng index không có `<name>.<role>.spec.ts` bên cạnh nó: mã được viết trước, spec để sau. Tệp chỉ có hằng số và kiểu (không có hàm, phương thức nào để chạy) không cần spec riêng."
1612
1612
  causes_vi:
1613
1613
  - "Agent viết mã trước rồi định sửa lint và spec sau, thay vì chạy vòng op `starci gate read` → mã + spec → `starci gate run`"
1614
1614
  - "Spec đã viết nhưng chưa được stage cùng tệp"
@@ -1,7 +1,7 @@
1
1
  // GENERATED by scripts/cli/gen-catalog.mjs — do not edit
2
2
  export const CATALOG = {
3
3
  "schema": "starci/cli-catalog@1",
4
- "hash": "ce01a03c949f8154644bec5d1068bf0b5316478f328b2231b2369c937f89e118",
4
+ "hash": "fb2a551d3cb254cc42fa5c95dc1a32af973df14313385f03703bc209b2badb8a",
5
5
  "global": [
6
6
  {
7
7
  "name": "json",
@@ -790,13 +790,14 @@ export const CATALOG = {
790
790
  "runtimeSide": "host"
791
791
  },
792
792
  "coverage": {
793
- "summary": "merge the coverage of the sharded unit run into one lcov report",
793
+ "summary": "merge the sharded unit coverage into one lcov report, or prove that report at 100 per file",
794
794
  "owner": "@starci/hfs",
795
795
  "positional": [
796
796
  {
797
797
  "name": "action",
798
798
  "enum": [
799
- "merge"
799
+ "merge",
800
+ "verify"
800
801
  ],
801
802
  "required": true,
802
803
  "variadic": false
@@ -820,12 +821,14 @@ export const CATALOG = {
820
821
  }
821
822
  ],
822
823
  "exit": {
823
- "0": "merged",
824
+ "0": "merged or proved",
825
+ "1": "the coverage proof refused a measured file",
824
826
  "2": "bad usage, no installed preset or no report found"
825
827
  },
826
828
  "json": "none",
827
829
  "examples": [
828
- "starci app coverage merge --out be/coverage/lcov.info be/coverage/shards"
830
+ "starci app coverage merge --out be/coverage/lcov.info be/coverage/shards",
831
+ "starci app coverage verify be/coverage/lcov.info"
829
832
  ],
830
833
  "editions": [
831
834
  "full",
@@ -838,7 +841,8 @@ export const CATALOG = {
838
841
  "merge runs the app's installed @starci/jest-preset/merge: istanbul-lib-coverage joins the shard maps by source location",
839
842
  "the merged lcov is written by the preset's own lcov reporter, as an unsharded run writes it",
840
843
  "a path is a coverage-final.json or a directory searched for every one below it; no report found refuses (exit 2)",
841
- "the coverage proof (starci app check --coverage-from) refuses a measured file the merge does not hold"
844
+ "verify <lcov> is the coverage proof alone: every measured logic file in the report at 100 per file, a missing one refused",
845
+ "verify runs none of the other rules of starci app check; the managed CI coverage job runs it after the merge"
842
846
  ],
843
847
  "runtimeSide": "host"
844
848
  },
@@ -1238,7 +1242,9 @@ export const CATALOG = {
1238
1242
  "OK passes; ERROR is red as RELEASE_SONAR_GATE_FAILED naming each failed condition, as is a FAILED or CANCELED task",
1239
1243
  "a task still running after 600 s is RELEASE_SONAR_GATE_TIMEOUT; no report-task, an HTTP error or no gate is RELEASE_SONAR_GATE_UNREADABLE",
1240
1244
  "OWNER RULING candidate-ci (2026-10-18): the gate no longer reads the default-branch CI; the verdict is the candidate run of the sha",
1241
- "push --execute sends HEAD to refs/heads/release/candidate-<version> first and waits for its ci.yml run (it triggers on release/candidate-*)",
1245
+ "release.requireCi (default false, owner ruling release-require-ci-per-project) decides whether push waits for CI; the local gate is never skipped",
1246
+ "requireCi false: push needs the tag and the green L4 record, runs the dry run, pushes atomically and states CI was not required",
1247
+ "requireCi true: push --execute sends HEAD to refs/heads/release/candidate-<version> first and waits for its ci.yml run",
1242
1248
  "green moves the branch and the tag in one atomic push; red refuses RELEASE_CANDIDATE_CI_RED naming the failing jobs",
1243
1249
  "no run, or no end in time, refuses RELEASE_CANDIDATE_CI_TIMEOUT; unreadable GitHub refuses RELEASE_CI_UNKNOWN; nothing reaches the branch",
1244
1250
  "only the owner's starci release ci-override --sha <sha> --reason <text> record lets a red candidate through; there is no --no-ci-check flag",
@@ -0,0 +1,8 @@
1
+ "use strict"
2
+
3
+ /**
4
+ * Sonar `sonar.exclusions`: specs, e2e specs, dist and coverage output are not analysed at all. A plain list with no require, so
5
+ * @starci/hfs ships this file byte for byte (packages/hfs/runtime, scripts/hfs/sync-runtime.mjs) and `starci app scaffold` renders
6
+ * the same exclusions before any app dependency is installed.
7
+ */
8
+ module.exports = Object.freeze(["**/*.spec.ts", "**/*.e2e-spec.ts", "**/dist/**", "**/coverage/**"])
@@ -28,6 +28,9 @@ const DIGEST_PIN = /@sha256:[0-9a-f]{64}$/;
28
28
 
29
29
  let cached = null;
30
30
  /** The standard (knowledge/hfs/ci-standard.yaml), read once. */
31
+ /** The coverage proof step: the coverage judgement over the merged lcov (`starci app coverage verify`), never the whole app check. */
32
+ const COVERAGE_PROOF = /app coverage verify\b/;
33
+
31
34
  function ciStandard() {
32
35
  if (!cached) {
33
36
  const doc = parseYaml(fs.readFileSync(STANDARD_FILE, 'utf8'));
@@ -56,7 +59,7 @@ function jobShape(doc, edition, standard, say) {
56
59
  const withStep = (match) => jobsOf(doc).filter(([, job]) => stepsOf(job).some((step) => match(step))).map(([id]) => id);
57
60
  const unit = withStep((step) => step.name === 'unit');
58
61
  const upload = withStep((step) => usesOf(step).startsWith('codecov/codecov-action@'));
59
- const proof = withStep((step) => /app check --coverage-from/.test(runOf(step)));
62
+ const proof = withStep((step) => COVERAGE_PROOF.test(runOf(step)));
60
63
  if (unit.join() !== 'test') out.push(say('job-shape', `the unit run must be a step of the test job alone, not of ${unit.join(', ') || 'no job'}`));
61
64
  if (proof.join() !== 'coverage') out.push(say('job-shape', `the coverage proof must be a step of the coverage job alone, not of ${proof.join(', ') || 'no job'}`));
62
65
  if (upload.length && upload.join() !== 'coverage') out.push(say('job-shape', `the Codecov upload must be a step of the coverage job alone, not of ${upload.join(', ')}`));
@@ -79,7 +82,7 @@ function testSharding(doc, say) {
79
82
  if (unit && !runOf(unit).includes('--coverageThreshold={}')) out.push(say('test-sharding', 'a shard measures without the per-file threshold (--coverageThreshold={}); the coverage job proves it on the merged report'));
80
83
  const coverage = record(doc.jobs?.coverage) ? stepsOf(doc.jobs.coverage) : [];
81
84
  const merge = coverage.findIndex((step) => /app coverage merge\b/.test(runOf(step)));
82
- const proof = coverage.findIndex((step) => /app check --coverage-from/.test(runOf(step)));
85
+ const proof = coverage.findIndex((step) => COVERAGE_PROOF.test(runOf(step)));
83
86
  if (merge < 0 || (proof >= 0 && merge > proof)) out.push(say('test-sharding', 'the coverage job must merge the shard reports (starci app coverage merge) before the coverage proof'));
84
87
  return out;
85
88
  }
@@ -1,8 +1,11 @@
1
1
  // staged-specs.mjs - BE_UNIT_SPEC_NOT_STAGED (R47): the commit that adds a back-end logic file adds its unit spec beside it. A new
2
2
  // file `be/<path>/<name>.<role>.ts` that the coverage scope measures (scripts/hfs/coverage-scope.mjs isMeasured: a role of
3
- // ruleParams.be.logicRoles below a measured root, outside its none folders) needs `<name>.<role>.spec.ts` in the same index.
4
- // `starci app hygiene` judges the files the index adds (packages/hfs/sync/hygiene.mjs, run by the managed pre-commit hook), so a
5
- // coding agent cannot commit the code first and its spec afterwards. A file that already exists is the coverage gate's.
3
+ // ruleParams.be.logicRoles below a measured root, outside its none folders) and that holds executable logic (a function, a method, a
4
+ // constructor, an accessor) needs `<name>.<role>.spec.ts` in the same index. A measured file with nothing to execute (constants and
5
+ // types only, such as an error-kind to HTTP-status table) has nothing a spec could call, and the spec rules refuse a spec of it
6
+ // (spec-infra-double-from-kit); the coverage gate still reaches it through its callers. `starci app hygiene` judges the files the
7
+ // index adds (packages/hfs/sync/hygiene.mjs, run by the managed pre-commit hook), so a coding agent cannot commit the code first and
8
+ // its spec afterwards. A file that already exists is the coverage gate's.
6
9
  import { isMeasured } from '../coverage-scope.mjs';
7
10
 
8
11
  const SPEC_NOT_STAGED = 'BE_UNIT_SPEC_NOT_STAGED';
@@ -11,13 +14,30 @@ const BE = 'be/';
11
14
  /** The unit spec beside an app-relative `<name>.<role>.ts`: `<name>.<role>.spec.ts`. */
12
15
  const siblingSpec = (file) => file.replace(/\.ts$/u, '.spec.ts');
13
16
 
17
+ /** The syntax kinds that execute: a body a spec can call. */
18
+ const EXECUTABLE_KINDS = ['FunctionDeclaration', 'FunctionExpression', 'ArrowFunction', 'MethodDeclaration', 'Constructor', 'GetAccessor', 'SetAccessor'];
19
+
20
+ /**
21
+ * Whether TypeScript `text` holds executable logic. Without a TypeScript parser (`ts` null) or without the text, the file counts as
22
+ * logic: the gate never relaxes on what it cannot read.
23
+ */
24
+ function holdsLogic(ts, text) {
25
+ if (!ts || typeof text !== 'string') return true;
26
+ const kinds = new Set(EXECUTABLE_KINDS.map((name) => ts.SyntaxKind[name]));
27
+ const source = ts.createSourceFile('subject.ts', text, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
28
+ const visit = (node) => kinds.has(node.kind) || ts.forEachChild(node, visit) === true;
29
+ return ts.forEachChild(source, visit) === true;
30
+ }
31
+
14
32
  /**
15
33
  * The findings `{ file, code, message }` of the app-relative files the index adds (`added`) whose sibling spec is not among the
16
- * paths the index holds (`indexed`, a Set). `manifest` is the slot manifest the coverage scope reads.
34
+ * paths the index holds (`indexed`, a Set). `manifest` is the slot manifest the coverage scope reads; `staged(file)` answers the
35
+ * staged text of a file and `ts` the TypeScript parser, which tell a logic file from a constants-only one.
17
36
  */
18
- export function stagedSpecFindings(manifest, added, indexed) {
37
+ export function stagedSpecFindings(manifest, added, indexed, { ts = null, staged = () => null } = {}) {
19
38
  return added
20
39
  .filter((file) => file.startsWith(BE) && !file.endsWith('.spec.ts') && isMeasured(manifest, file.slice(BE.length)) && !indexed.has(siblingSpec(file)))
40
+ .filter((file) => holdsLogic(ts, staged(file)))
21
41
  .map((file) => ({
22
42
  file,
23
43
  code: SPEC_NOT_STAGED,
package/scaffold/app.mjs CHANGED
@@ -216,7 +216,7 @@ const LITE_FE_APP_DEPENDENCIES = Object.freeze({
216
216
  * ./routing, client-safe: the default locale a client boundary reads).
217
217
  */
218
218
  const FE_PACKAGES = Object.freeze({
219
- ui: { exports: ['.'], dependencies: { '@heroui/react': null, '@starci/grammar': null, '@starci/heroicons': null, '@xyflow/react': null, 'next-intl': null, react: null } },
219
+ ui: { exports: ['.'], dependencies: { '@heroui/react': null, '@starci/grammar': null, '@starci/heroicons': null, '@xyflow/react': null, 'next-intl': null, react: null, 'react-dom': null } },
220
220
  i18n: { exports: ['.', './proxy', './routing'], dependencies: { next: null, 'next-intl': null, 'server-only': null } },
221
221
  });
222
222