@starci/eslint-grammar-core 0.21.11 → 0.21.13

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,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.21.13
4
+
5
+ - Changed: Require the updated FE canon, carry the rule catalog of @starci/hfs 5.1.0 (R368) and align the Grammar family.
6
+ - Changed: `navbar-cluster` (FE-APP-SHELL-3) requires notifications only where the shell has a notification source (a `use...Notification...` call in its file).
7
+ - Fixed: `route-page-is-one-page` declares the blocks its page proof reads as cross-file inputs, so a changed block re-judges the route and the page owner.
8
+ - Changed: `pane-grid-children` (R345) follows a `const` that holds a Pane.
9
+
10
+ ## 0.21.12
11
+
12
+ - Changed: Require the updated FE canon, carry the rule texts of @starci/hfs 5.0.8 and align the Grammar family.
13
+
3
14
  ## 0.21.11
4
15
 
5
16
  - Changed: Require the updated FE canon and align the Grammar family.
package/dist/app-shell.js CHANGED
@@ -12,6 +12,10 @@ import { walk } from "@starci/eslint-canon-fe/lib/ast.mjs";
12
12
  const CANON = "knowledge/ui/composition/app-shell.yaml";
13
13
  const BOTTOM_TABS = /^(?:BottomNavigation|BottomTabBar|MobileBottomNav|MobileTabBar)$/;
14
14
  const EXPECTED_CLUSTER = ["language:IconButton", "theme:Switch", "notifications:IconButton", "account:AvatarButton"];
15
+ /** The cluster of a shell with no notification source (a platform-admin shell with no workspace): notifications are required only where a read feeds them, so a shell without one may omit them. */
16
+ const NO_SOURCE_CLUSTER = EXPECTED_CLUSTER.filter((kind) => !kind.startsWith("notifications:"));
17
+ /** A notification source: a call of a hook that reads notifications (`useNotifications`, `useWorkspaceNotificationFeed`). */
18
+ const NOTIFICATION_READ = /use\w*Notification\w*\s*\(/;
15
19
  const meta = (code, description, messages) => ({
16
20
  type: "problem",
17
21
  docs: { description: `${code}: ${description}`, url: CANON },
@@ -179,10 +183,11 @@ export const navbarCluster = defineRule({
179
183
  return;
180
184
  if (shellHeader && delegatesImportedBar(context, actions.value))
181
185
  return;
182
- const desktop = EXPECTED_CLUSTER.join("|");
183
- const mobile = EXPECTED_CLUSTER.slice(2).join("|");
186
+ const shapes = [EXPECTED_CLUSTER, ...(NOTIFICATION_READ.test(context.sourceCode.text) ? [] : [NO_SOURCE_CLUSTER])];
184
187
  const sequences = alternatives.map((sequence) => sequence.join("|"));
185
- if (!sequences.includes(desktop) || sequences.some((sequence) => sequence !== desktop && sequence !== mobile))
188
+ const desktop = shapes.map((shape) => shape.join("|"));
189
+ const mobile = shapes.map((shape) => shape.slice(2).join("|"));
190
+ if (!sequences.some((sequence) => desktop.includes(sequence)) || sequences.some((sequence) => !desktop.includes(sequence) && !mobile.includes(sequence)))
186
191
  context.report({ node, messageId: "cluster" });
187
192
  } };
188
193
  },
package/dist/index.js CHANGED
@@ -85,5 +85,5 @@ export const coreGrammarConfig = ({ hfs, family = "core" } = {}) => {
85
85
  rules: { ...recommended },
86
86
  }];
87
87
  };
88
- // The result cache of `starci app lint` (contexts/project/check-cache.md) reads the disk inputs the family rules declare.
88
+ // The result cache of `starci app check --gate lint` (contexts/project/check-cache.md) reads the disk inputs the family rules declare.
89
89
  export { crossFileInputs } from "./lib/cross-file-inputs.js";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The files a rule of this canon reads that ESLint's own import graph does not carry.
3
3
  *
4
- * The result cache of `starci app lint` (contexts/project/check-cache.md, ESLint) re-lints a file when it or a file it reaches through imports
4
+ * The result cache of `starci app check --gate lint` (contexts/project/check-cache.md, ESLint) re-lints a file when it or a file it reaches through imports
5
5
  * changed. A rule that reads another file by path, with `fs` (a sibling, a directory listing, a manifest, a module file it follows by hand),
6
6
  * has an input the import graph cannot see, so the rule declares it here and the cache dirties the files that depend on it:
7
7
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The files a rule of this canon reads that ESLint's own import graph does not carry.
3
3
  *
4
- * The result cache of `starci app lint` (contexts/project/check-cache.md, ESLint) re-lints a file when it or a file it reaches through imports
4
+ * The result cache of `starci app check --gate lint` (contexts/project/check-cache.md, ESLint) re-lints a file when it or a file it reaches through imports
5
5
  * changed. A rule that reads another file by path, with `fs` (a sibling, a directory listing, a manifest, a module file it follows by hand),
6
6
  * has an input the import graph cannot see, so the rule declares it here and the cache dirties the files that depend on it:
7
7
  *
@@ -26,6 +26,8 @@ export const crossFileInputs = [
26
26
  { rule: "page-tabs-in-header", kind: "exists", relativeTo: "side", globs: ["**/src/app", "**/src/app/**"], appliesTo: ["**/src/features/pages/**/*.{ts,tsx}"], reader: "lib/page-frame.ts" },
27
27
  { rule: "route-page-is-one-page", kind: "exists", relativeTo: "side", globs: ["**/src/app", "**/src/app/**"], appliesTo: ["**/src/features/pages/**/*.{ts,tsx}"], reader: "lib/page-frame.ts" },
28
28
  { rule: "route-page-is-one-page", kind: "content", relativeTo: "side", globs: ["**/src/app/**/*.{ts,tsx,js,jsx,mjs,cjs,mts,cts}"], appliesTo: ["**/src/features/pages/**/*.{ts,tsx}"], reader: "lib/page-frame.ts" },
29
+ // the page owner is judged by the blocks it renders as its root (a block that draws the Page, its own sub-blocks and the feature files it imports): a changed block re-judges the owner
30
+ { rule: "route-page-is-one-page", kind: "content", relativeTo: "side", globs: ["**/src/components/{blocks,frames,composites,branches,leaves}/**/*.{ts,tsx}", "**/src/features/**/*.{ts,tsx}"], appliesTo: ["**/src/features/pages/**/*.{ts,tsx}", "**/src/app/**/*.{ts,tsx}"], reader: "lib/page-frame.ts" },
29
31
  // the theme an app defines its tokens in: the route slot's globals.css and the brand slot's brand.css
30
32
  { rule: "no-unresolved-token-class", kind: "content", relativeTo: "side", globs: ["**/globals.css", "**/brand.css"], appliesTo: ["**/*.{ts,tsx}"], reader: "tokens.ts" },
31
33
  ];
package/dist/pane.js CHANGED
@@ -76,8 +76,19 @@ const returnedExpressions = (context, fn) => {
76
76
  };
77
77
  /** True for a function-shaped node. */
78
78
  const isFunction = (node) => node !== undefined && (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression");
79
+ /**
80
+ * The initializer of a `const` the identifier names in this file: a variable that holds a Pane (`const side = <Pane area="side" />`) renders that Pane, so it is
81
+ * followed to what it holds. A `let`, a parameter, an import or a destructured name holds nothing that can be proved here.
82
+ */
83
+ const constInitializer = (context, identifier) => {
84
+ const definition = variableOf(context, identifier)?.defs.find((entry) => entry.type === "Variable");
85
+ const declarator = definition?.node;
86
+ if (declarator?.type !== "VariableDeclarator" || declarator.id.type !== "Identifier" || declarator.init === null)
87
+ return null;
88
+ return declarator.parent.type === "VariableDeclaration" && declarator.parent.kind === "const" ? declarator.init : null;
89
+ };
79
90
  /** The leaves an expression can render. */
80
- const leavesOfExpression = (context, expression) => {
91
+ const leavesOfExpression = (context, expression, followed = new Set()) => {
81
92
  switch (expression.type) {
82
93
  case "JSXEmptyExpression":
83
94
  return [];
@@ -91,26 +102,33 @@ const leavesOfExpression = (context, expression) => {
91
102
  if (typeof expression.value === "string" && expression.value.trim() === "")
92
103
  return [];
93
104
  return [{ kind: "opaque", node: expression }];
94
- case "Identifier":
95
- return expression.name === "undefined" ? [] : [{ kind: "opaque", node: expression }];
105
+ case "Identifier": {
106
+ if (expression.name === "undefined")
107
+ return [];
108
+ const init = constInitializer(context, expression);
109
+ if (init === null || followed.has(init))
110
+ return [{ kind: "opaque", node: expression }];
111
+ // a named value reports on the name, where the author wrote it in the grid, however deep the initializer is followed
112
+ return leavesOfExpression(context, init, new Set([...followed, init])).map((leaf) => (leaf.kind === "opaque" ? { kind: "opaque", node: expression } : leaf.kind === "element" && nameOf(leaf.node.openingElement.name) === "Pane" ? leaf : { kind: "opaque", node: expression }));
113
+ }
96
114
  case "TSAsExpression":
97
115
  case "TSNonNullExpression":
98
116
  case "TSSatisfiesExpression":
99
- return leavesOfExpression(context, expression.expression);
117
+ return leavesOfExpression(context, expression.expression, followed);
100
118
  case "ConditionalExpression":
101
- return [...leavesOfExpression(context, expression.consequent), ...leavesOfExpression(context, expression.alternate)];
119
+ return [...leavesOfExpression(context, expression.consequent, followed), ...leavesOfExpression(context, expression.alternate, followed)];
102
120
  case "LogicalExpression":
103
121
  return expression.operator === "&&"
104
- ? leavesOfExpression(context, expression.right)
105
- : [...leavesOfExpression(context, expression.left), ...leavesOfExpression(context, expression.right)];
122
+ ? leavesOfExpression(context, expression.right, followed)
123
+ : [...leavesOfExpression(context, expression.left, followed), ...leavesOfExpression(context, expression.right, followed)];
106
124
  case "ArrayExpression":
107
- return expression.elements.flatMap((element) => (element === null ? [] : leavesOfExpression(context, element)));
125
+ return expression.elements.flatMap((element) => (element === null ? [] : leavesOfExpression(context, element, followed)));
108
126
  case "CallExpression": {
109
127
  const callee = expression.callee;
110
128
  const method = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" ? callee.property.name : null;
111
129
  const callback = expression.arguments[0];
112
130
  if ((method === "map" || method === "flatMap") && isFunction(callback))
113
- return returnedExpressions(context, callback).flatMap((returned) => leavesOfExpression(context, returned));
131
+ return returnedExpressions(context, callback).flatMap((returned) => leavesOfExpression(context, returned, followed));
114
132
  return [{ kind: "opaque", node: expression }];
115
133
  }
116
134
  default:
@@ -135,7 +153,7 @@ const leavesOf = (context, parent) => renderedChildren(parent.children).flatMap(
135
153
  export const paneGridChildren = exemptFreestyle(defineRule({
136
154
  meta: {
137
155
  type: "problem",
138
- docs: { description: "R345: a PaneGrid child is a Pane element (directly, in a conditional or in a map), never a wrapper component, a fragment or a variable.", url: "knowledge/hfs/rules.yaml#R345" },
156
+ docs: { description: "R345: a PaneGrid child is a Pane element (directly, in a conditional or in a map, or a `const` that holds one), never a wrapper component, a fragment or a variable the file cannot prove holds a Pane.", url: "knowledge/hfs/rules.yaml#R345" },
139
157
  schema: [],
140
158
  messages: {
141
159
  notPane: "{{what}} is a child of `PaneGrid`, which places only `Pane` elements by their `area` and drops the rest: this cell renders blank. Write the `<Pane area=\"...\">` here (inline it, or return a `Pane` element from a `cond ? <Pane/> : null`, `cond && <Pane/>` or `.map` expression), and move the wrapper's content into that Pane's PaneSections.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-grammar-core",
3
- "version": "0.21.11",
3
+ "version": "0.21.13",
4
4
  "description": "ESLint rules for the core Grammar's component, token and composition contracts.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -41,7 +41,7 @@
41
41
  "node": ">=22"
42
42
  },
43
43
  "peerDependencies": {
44
- "@starci/eslint-canon-fe": "9.9.11",
44
+ "@starci/eslint-canon-fe": "9.10.0",
45
45
  "eslint": ">=9",
46
46
  "typescript": ">=5.9"
47
47
  },
@@ -31,42 +31,42 @@ pins:
31
31
  source: packages/event-stream/package.json
32
32
  why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
33
33
  '@starci/grammar':
34
- version: 0.21.11
34
+ version: 0.21.13
35
35
  group: starci
36
36
  install: registry
37
37
  side: fe
38
38
  source: packages/grammar/package.json
39
39
  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.'
40
40
  '@starci/eslint-canon-be':
41
- version: 3.11.18
41
+ version: 3.12.0
42
42
  group: starci
43
43
  install: registry
44
44
  side: be
45
45
  source: packages/eslint-canon-be/package.json
46
46
  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.'
47
47
  '@starci/eslint-canon-fe':
48
- version: 9.9.11
48
+ version: 9.10.0
49
49
  group: starci
50
50
  install: registry
51
51
  side: fe
52
52
  source: packages/eslint-canon-fe/package.json
53
53
  why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe 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; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
54
54
  '@starci/eslint-grammar-core':
55
- version: 0.21.11
55
+ version: 0.21.13
56
56
  group: starci
57
57
  install: registry
58
58
  side: fe
59
59
  source: packages/eslint-grammar-core/package.json
60
60
  why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
61
61
  '@starci/eslint-grammar-offset-pop':
62
- version: 0.21.11
62
+ version: 0.21.13
63
63
  group: starci
64
64
  install: registry
65
65
  side: fe
66
66
  source: packages/eslint-grammar-offset-pop/package.json
67
67
  why: 'the Offset Pop Grammar component API lint, versioned with @starci/grammar; its shared component contract comes from the StarCi family lint without copying rules.'
68
68
  '@starci/stylelint-canon':
69
- version: 2.5.0
69
+ version: 2.5.1
70
70
  group: starci
71
71
  install: registry
72
72
  side: fe
@@ -92,7 +92,7 @@ pins:
92
92
  source: packages/jest-preset/package.json
93
93
  why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeQueryBuilder, queueQueryBuilders, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
94
94
  '@starci/test-world':
95
- version: 1.3.3
95
+ version: 1.3.4
96
96
  group: starci
97
97
  install: registry
98
98
  side: be
@@ -106,7 +106,7 @@ pins:
106
106
  source: packages/ai-router/package.json
107
107
  why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
108
108
  '@starci/hfs':
109
- version: 5.0.7
109
+ version: 5.1.0
110
110
  group: starci
111
111
  install: registry
112
112
  side: both
@@ -21,9 +21,9 @@ version: 3.1.0
21
21
  gates:
22
22
  pre-commit: the managed L0 hook runs app check --staged, managed-file drift, ESLint per side and stylelint on staged source, and prettier on staged files; typecheck and targeted specs belong to the op gate under R225
23
23
  pre-push: the managed app hook invokes the bundled push policy under R225; it starts no source check, build or test
24
- settle: the op gate `starci gate run` over the op's changed files (merge guard, starci app lint --changed, codegen, tsc, the slice's specs; only findings new against the workflow's previous checkpoint block), re-read at starci kernel settle, which refuses a red done; a green settle commits the op's checkpoint on wf-<workflowId>
24
+ settle: the op gate `starci gate run` over the op's changed files (merge guard, starci app check, codegen, tsc, the slice's specs; only findings new against the workflow's previous checkpoint block), re-read at starci kernel settle, which refuses a red done; a green settle commits the op's checkpoint on wf-<workflowId>
25
25
  land: the workflow's finish, the only time main is touched - gate.mjs over the whole workflow branch against its merge-base with main, the merge guard, review.verify of the exact head that lands, the branch rebased onto main, then main fast-forwarded and pushed
26
- ci: GitHub Actions runs the same pinned starci app lint, format:check, typecheck, unit with the per-file coverage threshold, build:be and build:fe, then the Sonar scan and gate
26
+ ci: GitHub Actions runs the same pinned starci app check --gate lint, format:check, typecheck, unit with the per-file coverage threshold, build:be and build:fe, then the Sonar scan and gate
27
27
  sonar: Sonar quality gate (knowledge/sonar-gate.yaml) - the imported lint findings, duplication, cognitive complexity and the coverage of the logic of be/src/modules at 100
28
28
  runtime: "`starci runtime check` (npm run check) of the StarCi runtime repository itself: scripts/checks/check-runtime.mjs runs node --check, scripts/hfs/runtime-check.mjs with knowledge/hfs/runtime-slots.yaml, and the retained self-checks"
29
29
  enforcerKinds:
@@ -229,7 +229,7 @@ rules:
229
229
  editions: [lite, full]
230
230
  docs: [docs/hfs-legacy-tooling.md#ci-and-hooks]
231
231
  code: "HFS_CI_MISSING_CANON"
232
- law: "CI runs the pinned `starci app lint` (`npm run lint`), a clone never redirects `core.hooksPath` away from husky, and the folder a set `core.hooksPath` names holds the installed hooks in every checkout (husky's dispatcher in `.husky/_`), so no commit lands without the pre-commit gate."
232
+ law: "CI runs the pinned `starci app check --gate lint` (`npm run lint`), a clone never redirects `core.hooksPath` away from husky, and the folder a set `core.hooksPath` names holds the installed hooks in every checkout (husky's dispatcher in `.husky/_`), so no commit lands without the pre-commit gate."
233
233
  kinds: [check, codemod]
234
234
  gates: [land, ci]
235
235
  failureCodes: ["HFS_CI_MISSING_CANON", "HFS_HOOKS_PATH_REDIRECTED", "HFS_HOOKS_NOT_INSTALLED"]
@@ -924,7 +924,7 @@ rules:
924
924
  code: "BE_TEST_TOPOLOGY"
925
925
  editions: [lite, full]
926
926
  docs: [docs/quality-bar.md#r47-test-topology]
927
- law: "One jest config, projects `unit`, `integration`, `e2e` and `contract`, live by folder, `diagnostics: false`; unit specs are `<name>.<role>.spec.ts` beside the file they test: required for the roles of `ruleParams.be.unitRoles` (`<name>.service.spec.ts` beside a `<name>.service.ts`, `<name>.cli.spec.ts` beside a cli command `<name>.cli.ts` of `src/features/cli`), optional for any other logic role (`ruleParams.be.logicRoles`) inside a slot whose `coverage` is required and beside a logic file such a slot declares (`logic`: `passport.tokens.spec.ts` beside `passport.tokens.ts`), except that the commit adding a measured logic file stages its `<name>.<role>.spec.ts` beside it (owner 2026-10-20, judged by `starci app check --staged` in the pre-commit hook), and nowhere else but beside a webhook or realtime door that has no service of its own (`<provider>.webhook.spec.ts`, `<channel>.gateway.spec.ts`, `<x>.subscription.spec.ts`) (every unit-tested subject has exactly one; any other `*.spec.ts` outside `be/src/tests/{world,integration,e2e,contract}` is a finding, including specs in apps), and the unit project collects coverage from the logic roles of the measured roots and the logic files their slots declare only (the scope derived from the slot manifest, R204) with a per-file threshold of 100 on lines, branches, functions and statements (`test` runs `--coverage`; `importHelpers` and `tslib`); `be/src/tests/world/` is the ONLY test infrastructure: `global-setup.ts` starts the app's own stack (`.starcistacks/<env>`, named by `stack` in `test-world.config.ts`, the declaration of the test-world library in its one named form `export const { useTestWorld, useSandbox } = defineTestWorld({...})` (a default export is not read): every service it declares runs REAL, behind toxiproxy, images and versions read from the stack at run time, never spelled in test source) or attaches to a warm one that answers, and runs the migrations once over the cli app's connections (the runner of the cli migrate command); `global-teardown.ts` stops only what its setup started; `use-test-world.ts` exports `useTestWorld({ apps } | { modules })` (`world.apps.<name>.api`, `world.db.<connection>`, `world.infra.<service>` with `latency(ms)`, `cut()` and `restore()` on the real service, `world.fake.<provider>`, `world.waitFor`) and `fakes/<provider>/` holds the network-edge fakes (`failNext`, `replayWebhook`, `delay`, payload fixtures) of external SaaS the team does not operate ONLY: a fake of a service the stack declares is refused, except stateless compute that needs special hardware or an external model (GPU inference, a self-hosted embedding model), whose `stacks` entry in `test-world.config.ts` declares `{ fakedBy: <fake>, reason }` with a non-empty `reason` (a stateful service, or one with a persistent volume, is never accepted); it alone owns containers, DataSource, migrations and `process.env`; nothing under `be/src/tests` overrides a provider or DI token; `be/src/tests/integration/<capability>/*.integration-spec.ts` (`{ modules }`, with the real peer apps its client calls beside them as `apps`; real infrastructure, no HTTP door of ours), `be/src/tests/e2e/<area>/*.e2e-spec.ts` (`{ apps }`) and `be/src/tests/contract/<provider>/*.contract-spec.ts` (provider sandboxes, skipped without sandbox config, run only by `test:contract`, never by `test` or `test:e2e`) agree folder with suffix; an integration or e2e spec passes `useTestWorld` one object literal with plain keys (no variable, spread or computed key) and calls it; the contract layer has no skip either: a contract spec writes `sandbox.describe(...)` from the test-world library's `useSandbox(...)`, and when the sandbox config is absent that describe registers one failing test naming the missing keys (the body never runs), and every `fakes/<provider>/` that serves payload fixtures (`payloads/*.json`) has a `contract/<provider>/*.contract-spec.ts` that references those fixtures and asserts `shapeOf(real)` equals `shapeOf(fixture)` (the helper `shapeOf` is named by `ruleParams.be.contractShape` of the slot manifest; fakes the test-world library provides are guarded by the library); no `.test.ts`, `int-spec` or `harness-spec`, no `live/` and no `be/src/tests/e2e/world`."
927
+ law: "One jest config, projects `unit`, `integration`, `e2e` and `contract`, live by folder, `diagnostics: false`; unit specs are `<name>.<role>.spec.ts` beside the file they test: required for the roles of `ruleParams.be.unitRoles` (`<name>.service.spec.ts` beside a `<name>.service.ts`, `<name>.cli.spec.ts` beside a cli command `<name>.cli.ts` of `src/features/cli`), optional for any other logic role (`ruleParams.be.logicRoles`) inside a slot whose `coverage` is required and beside a logic file such a slot declares (`logic`: `passport.tokens.spec.ts` beside `passport.tokens.ts`), except that the commit adding a measured logic file stages its `<name>.<role>.spec.ts` beside it (owner 2026-10-20, judged by `starci app check --staged` in the pre-commit hook), and nowhere else but beside a webhook or realtime door that has no service of its own (`<provider>.webhook.spec.ts`, `<channel>.gateway.spec.ts`, `<x>.subscription.spec.ts`) (every unit-tested subject has exactly one; any other `*.spec.ts` outside `be/src/tests/{world,integration,e2e,contract}` is a finding, including specs in apps), and the unit project collects coverage from the logic roles of the measured roots and the logic files their slots declare only (the scope derived from the slot manifest, R204) with a per-file threshold of 100 on lines, branches, functions and statements (`test` runs `--coverage`; `importHelpers` and `tslib`); `be/src/tests/world/` is the ONLY test infrastructure: `global-setup.ts` starts the app's own stack (`.starcistacks/<env>`, named by `stack` in `test-world.config.ts`, the declaration of the test-world library in a named form: `export const { useTestWorld, useSandbox } = defineTestWorld({...})`, or `const world: TestWorldApi = defineTestWorld({...})` with `useTestWorld` and `useSandbox` exported typed from it (a default export is not read): every service it declares runs REAL, behind toxiproxy, images and versions read from the stack at run time, never spelled in test source) or attaches to a warm one that answers, and runs the migrations once over the cli app's connections (the runner of the cli migrate command); `global-teardown.ts` stops only what its setup started; `use-test-world.ts` exports `useTestWorld({ apps } | { modules })` (`world.apps.<name>.api`, `world.db.<connection>`, `world.infra.<service>` with `latency(ms)`, `cut()` and `restore()` on the real service, `world.fake.<provider>`, `world.waitFor`) and `fakes/<provider>/` holds the network-edge fakes (`failNext`, `replayWebhook`, `delay`, payload fixtures) of external SaaS the team does not operate ONLY: a fake of a service the stack declares is refused, except stateless compute that needs special hardware or an external model (GPU inference, a self-hosted embedding model), whose `stacks` entry in `test-world.config.ts` declares `{ fakedBy: <fake>, reason }` with a non-empty `reason` (a stateful service, or one with a persistent volume, is never accepted); it alone owns containers, DataSource, migrations and `process.env`; nothing under `be/src/tests` overrides a provider or DI token; `be/src/tests/integration/<capability>/*.integration-spec.ts` (`{ modules }`, with the real peer apps its client calls beside them as `apps`; real infrastructure, no HTTP door of ours), `be/src/tests/e2e/<area>/*.e2e-spec.ts` (`{ apps }`) and `be/src/tests/contract/<provider>/*.contract-spec.ts` (provider sandboxes, skipped without sandbox config, run only by `test:contract`, never by `test` or `test:e2e`) agree folder with suffix; an integration or e2e spec passes `useTestWorld` one object literal with plain keys (no variable, spread or computed key) and calls it; the contract layer has no skip either: a contract spec writes `sandbox.describe(...)` from the test-world library's `useSandbox(...)`, and when the sandbox config is absent that describe registers one failing test naming the missing keys (the body never runs), and every `fakes/<provider>/` that serves payload fixtures (`payloads/*.json`) has a `contract/<provider>/*.contract-spec.ts` that references those fixtures and asserts `shapeOf(real)` equals `shapeOf(fixture)` (the helper `shapeOf` is named by `ruleParams.be.contractShape` of the slot manifest; fakes the test-world library provides are guarded by the library); no `.test.ts`, `int-spec` or `harness-spec`, no `live/` and no `be/src/tests/e2e/world`."
928
928
  kinds: [check, codemod, lint]
929
929
  gates: [land, ci]
930
930
  failureCodes: ["BE_TEST_TOPOLOGY", "BE_CONTRACT_UNGUARDED", "BE_UNIT_SPEC_NOT_STAGED"]
@@ -2503,7 +2503,7 @@ rules:
2503
2503
  - {path: packages/hfs/src/legacy-monorepo-coverage.spec.mjs, edition: full, codes: [HFS_MONO_WORKSPACES]}
2504
2504
  - id: R144
2505
2505
  code: "HFS_MONO_FE_WORKSPACE"
2506
- law: "Every fe app `fe/apps/<app>` is an npm workspace: its `package.json` is named `@<project>/<app>`, is private, declares its own runtime dependencies and has exactly the scripts `build: next build`, `dev: next dev`, `lint: starci app lint --workspace .`, `start: next start` and `typecheck: tsc --noEmit`; every fe package `fe/packages/<pkg>` is private with `build`, `typecheck` and the same workspace `lint` script."
2506
+ law: "Every fe app `fe/apps/<app>` is an npm workspace: its `package.json` is named `@<project>/<app>`, is private, declares its own runtime dependencies and has exactly the scripts `build: next build`, `dev: next dev`, `start: next start` and `typecheck: tsc --noEmit`; every fe package `fe/packages/<pkg>` is private with `build` and `typecheck`; no workspace has a `lint` script, the app is linted once from the root with `starci app check --gate lint`."
2507
2507
  kinds: [check]
2508
2508
  gates: [settle, land, ci]
2509
2509
  failureCodes: ["HFS_MONO_FE_WORKSPACE"]
@@ -6525,3 +6525,54 @@ rules:
6525
6525
  source: owner
6526
6526
  quote: "The skeleton is the ready structure with its data missing; it is drawn from isLoading alone and from the reads the region shows."
6527
6527
  ruling: "Several reads feed one frame: loading is any read loading with no data; a key change reloads only the region keyed by it; a refresh keeps the content."
6528
+ - id: R368
6529
+ code: "HFS_EXPLICIT_EXPORT_SURFACE"
6530
+ law: "An exported declaration states its type where it is exported: the return type of an exported function, the type of an exported variable and the type of its parameters are written, not inferred from a body or from other files, because the isolated declaration emit must be able to write the file's surface alone. A component that returns only JSX is explicit. Each export that cannot be written is reported at its place with what to annotate, in a front-end and a back-end file alike."
6531
+ kinds: [lint]
6532
+ gates: [pre-commit, settle, land, ci]
6533
+ failureCodes: ["HFS_EXPLICIT_EXPORT_SURFACE"]
6534
+ enforcers:
6535
+ - {kind: eslint-fe, id: explicit-export-surface}
6536
+ - {kind: eslint-be, id: explicit-export-surface}
6537
+ editions: [lite, full]
6538
+ docs: [contexts/code/shared/typing.md]
6539
+ templateNa: "A template exports nothing the lint result cache keys on."
6540
+ proves:
6541
+ - {path: packages/eslint-canon-fe/src/explicit-surface.spec.ts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6542
+ - {path: packages/eslint-canon-be/src/explicit-surface.spec.ts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6543
+ - {path: packages/hfs/src/explicit-surface.spec.mts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6544
+ exemplifiedBy:
6545
+ - {path: packages/eslint-canon-fe/src/explicit-surface.spec.ts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6546
+ witness:
6547
+ - {path: packages/eslint-canon-fe/src/explicit-surface.spec.ts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6548
+ - {path: packages/eslint-canon-be/src/explicit-surface.spec.ts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6549
+ - {path: packages/hfs/src/explicit-surface.spec.mts, editions: [lite, full], codes: [HFS_EXPLICIT_EXPORT_SURFACE]}
6550
+ cases:
6551
+ - id: case-1
6552
+ date: "2026-11-03"
6553
+ source: owner
6554
+ quote: "enforce it by lint"
6555
+ ruling: "A file whose exported surface is inferred is open in the lint result cache: one body edit lints every importer again. The exported surface is written out, and the rule reports exactly what the cache counts as open."
6556
+ - id: R369
6557
+ code: "FE_DIRECTIVE_FIRST"
6558
+ law: "A `use client` or `use server` directive is the first statement of its module, above every import: below another statement it is an expression that does nothing (Prettier writes it as a parenthesised string) and next build refuses the file."
6559
+ kinds: [lint]
6560
+ gates: [pre-commit, settle, land, ci]
6561
+ failureCodes: ["FE_DIRECTIVE_FIRST"]
6562
+ enforcers:
6563
+ - {kind: eslint-fe, id: directive-first}
6564
+ editions: [lite, full]
6565
+ docs: [contexts/code/fe/boundaries.md]
6566
+ templateNa: "A template places its directives first."
6567
+ proves:
6568
+ - {path: packages/eslint-canon-fe/src/directive-first.spec.ts, editions: [lite, full], codes: [FE_DIRECTIVE_FIRST]}
6569
+ exemplifiedBy:
6570
+ - {path: packages/eslint-canon-fe/src/directive-first.spec.ts, editions: [lite, full], codes: [FE_DIRECTIVE_FIRST]}
6571
+ witness:
6572
+ - {path: packages/eslint-canon-fe/src/directive-first.spec.ts, editions: [lite, full], codes: [FE_DIRECTIVE_FIRST]}
6573
+ cases:
6574
+ - id: case-1
6575
+ date: "2026-11-03"
6576
+ source: owner
6577
+ quote: "no lint caught it"
6578
+ ruling: "A directive below an import broke Nivo's CI build on 2026-11-02; the directive is the first statement of its module and a lint reports it elsewhere."