@cratis/pi 7.170.11 → 7.171.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.
@@ -84,11 +84,12 @@ interface ScriptRun {
84
84
  * writes it exists to refuse. Callers decide what to do with `failed`; this function only reports
85
85
  * it honestly.
86
86
  */
87
- function runScript(script: string, stdinJson: string, cwd: string, signal?: AbortSignal, args: string[] = []): Promise<ScriptRun> {
87
+ function runScript(script: string, stdinJson: string, cwd: string, signal?: AbortSignal, options: { args?: string[]; env?: NodeJS.ProcessEnv } = {}): Promise<ScriptRun> {
88
+ const { args = [], env } = options;
88
89
  return new Promise<ScriptRun>((resolve) => {
89
90
  let proc: ReturnType<typeof spawn>;
90
91
  try {
91
- proc = spawn("bash", [script, ...args], { cwd, stdio: ["pipe", "pipe", "pipe"] });
92
+ proc = spawn("bash", [script, ...args], { cwd, env, stdio: ["pipe", "pipe", "pipe"] });
92
93
  } catch (error) {
93
94
  resolve({ code: 127, stdout: "", stderr: String(error), failed: true });
94
95
  return;
@@ -147,9 +148,10 @@ async function runBlockingGuard(
147
148
  subject: string,
148
149
  payload: object,
149
150
  ctx: ToolCallContext,
150
- fixTarget = "this guard",
151
+ options: { fixTarget?: string; env?: NodeJS.ProcessEnv } = {},
151
152
  ): Promise<{ block: true; reason: string } | undefined> {
152
- const run = await runScript(script, JSON.stringify(payload), ctx.cwd, ctx.signal);
153
+ const { fixTarget = "this guard", env } = options;
154
+ const run = await runScript(script, JSON.stringify(payload), ctx.cwd, ctx.signal, { env });
153
155
  if (run.failed) {
154
156
  return {
155
157
  block: true,
@@ -168,9 +170,10 @@ async function runCommandGuards(
168
170
  guards: Array<[script: string, name: string]>,
169
171
  payload: object,
170
172
  ctx: ToolCallContext,
173
+ sessionEnv?: (script: string) => NodeJS.ProcessEnv | undefined,
171
174
  ): Promise<{ block: true; reason: string } | undefined> {
172
175
  for (const [script, name] of guards.filter(([guard]) => isInstalled(guard))) {
173
- const blocked = await runBlockingGuard(script, name, "command", payload, ctx);
176
+ const blocked = await runBlockingGuard(script, name, "command", payload, ctx, { env: sessionEnv?.(script) });
174
177
  if (blocked) return blocked;
175
178
  }
176
179
  return undefined;
@@ -195,6 +198,7 @@ function isInstalled(script: string): boolean {
195
198
  }
196
199
  }
197
200
 
201
+
198
202
  export default function (pi: ExtensionAPI) {
199
203
  if (isPackagedExtension && fs.existsSync(path.join(process.cwd(), ".cratis", "ai.manifest.json"))) return;
200
204
  const managedScriptsDir = path.join(process.cwd(), ".cratis", "ai", "hooks", "scripts");
@@ -203,6 +207,13 @@ export default function (pi: ExtensionAPI) {
203
207
  const guardStoreMutations = path.join(scriptsDir, "cratis-guard-store-mutations.sh");
204
208
  const guardSecrets = path.join(scriptsDir, "cratis-guard-secrets.sh");
205
209
  const guardShellWrites = path.join(scriptsDir, "cratis-guard-shell-writes.sh");
210
+ // The dependency-manifest policy belongs to the session, so the two write guards are told which repository the session
211
+ // is in. It is fixed here, at start-up, not read from ctx.cwd, which follows the model's own directory changes. The
212
+ // bundled-script fallback would otherwise resolve to the Pi package. The root is always passed, so a session directory
213
+ // that is no longer usable makes the guards fail closed instead of falling back to the script's checkout.
214
+ const sessionRoot = process.cwd();
215
+ const writeGuardEnv = (script: string): NodeJS.ProcessEnv | undefined =>
216
+ script === guardWrites || script === guardShellWrites ? { ...process.env, CLAUDE_PROJECT_DIR: sessionRoot } : undefined;
206
217
  const guardPrBody = path.join(scriptsDir, "cratis-guard-pr-body.sh");
207
218
  const patternScan = path.join(scriptsDir, "cratis-pattern-scan.sh");
208
219
  const qualityGate = path.join(scriptsDir, "cratis-quality-gate.sh");
@@ -231,7 +242,7 @@ export default function (pi: ExtensionAPI) {
231
242
  const command = (event as any).input?.command;
232
243
  if (typeof command !== "string" || !command.trim()) return;
233
244
  const payload = { cwd: ctx.cwd, tool_name: "Bash", tool_input: { command } };
234
- const blocked = await runCommandGuards([[guardStoreMutations, "cratis-guard-store-mutations"], [guardSecrets, "cratis-guard-secrets"], [guardShellWrites, "cratis-guard-shell-writes"]], payload, ctx);
245
+ const blocked = await runCommandGuards([[guardStoreMutations, "cratis-guard-store-mutations"], [guardSecrets, "cratis-guard-secrets"], [guardShellWrites, "cratis-guard-shell-writes"]], payload, ctx, writeGuardEnv);
235
246
  if (blocked) return blocked;
236
247
  if (isInstalled(guardPrBody)) {
237
248
  const run = await runScript(guardPrBody, JSON.stringify(payload), ctx.cwd, ctx.signal);
@@ -245,9 +256,9 @@ export default function (pi: ExtensionAPI) {
245
256
  if (!filePath) return;
246
257
  if (!isInstalled(guardWrites)) return; // no guard installed in this repository - nothing to enforce
247
258
  const payload = { cwd: ctx.cwd, tool_input: { file_path: filePath, content, new_string: newString } };
248
- // The shared script resolves the write target's Git origin and allowDependencyManifestWrites setting;
249
- // keep manifest defaults and generated/.env protection identical to Claude Code.
250
- return runBlockingGuard(guardWrites, "cratis-guard-writes", "write", payload, ctx, "write guards");
259
+ // The shared script takes the manifest policy (allowDependencyManifestWrites, else Git origin) from the session
260
+ // repository, never the write target; keep that and generated/.env protection identical to Claude Code.
261
+ return runBlockingGuard(guardWrites, "cratis-guard-writes", "write", payload, ctx, { fixTarget: "write guards", env: writeGuardEnv(guardWrites) });
251
262
  });
252
263
 
253
264
  // ── Cleanup of delivered worktrees and branches ──
@@ -257,7 +268,7 @@ export default function (pi: ExtensionAPI) {
257
268
  async function sweepDelivered(hookEvent: "PostToolUse" | "SessionStart", command: string | undefined, cwd: string, signal?: AbortSignal): Promise<string> {
258
269
  if (!isInstalled(cleanupWorktrees)) return "";
259
270
  const payload = JSON.stringify({ hook_event_name: hookEvent, cwd, tool_input: command ? { command } : undefined });
260
- const run = await runScript(cleanupWorktrees, payload, cwd, signal, ["--hook"]);
271
+ const run = await runScript(cleanupWorktrees, payload, cwd, signal, { args: ["--hook"] });
261
272
  if (run.failed) return "cratis-cleanup-worktrees is installed but could not be run, so delivered worktrees were not cleaned up.";
262
273
  try {
263
274
  return JSON.parse(run.stdout)?.hookSpecificOutput?.additionalContext?.trim() ?? run.stderr.trim();
@@ -36,9 +36,14 @@ payload omits cwd; glob probing does not. Filesystem check/use races remain: thi
36
36
 
37
37
  The Bash write guard checks manifest and environment-file names against both logical and resolved physical basenames; run `cratis ai update` to receive this change.
38
38
 
39
- A Pi session runs guards from its starting checkout. Refresh the corpus there with `cratis ai update`,
40
- or start a new session in the checkout you change. Selecting a newer installed guard corpus per call
41
- is tracked in [Cratis/AI#1114](https://github.com/Cratis/AI/issues/1114).
39
+ A Pi session runs guards from its starting checkout (or the bundled corpus when that checkout has none). A command or
40
+ file path that targets another checkout is judged by those guards; the bridge never runs the other checkout's scripts,
41
+ because a checkout the agent can write cannot be a trust anchor. The guards do read policy data about the write target's
42
+ repository for dependency-manifest writes, but only to tighten: the session's policy decides, and a target can block
43
+ but never unlock ([Cratis/AI#1256](https://github.com/Cratis/AI/issues/1256); see *Dependency-manifest writes* below). Refresh the corpus in the starting checkout with
44
+ `cratis ai update` (scripts are read per call, so no restart), or start a new session in the checkout you change.
45
+ Proposed in Cratis/AI#1114 and drafted as `decisions/153-pi-hook-bridge-runs-only-the-starting-checkouts-guards.md`
46
+ (status: proposed): do not select the guard corpus per call.
42
47
 
43
48
  Reader glob probes skip directories only when decoded options establish a nonrecursive reader;
44
49
  unknown or recursive grep options keep directory matches conservative. Simple sed print/substitution
@@ -464,14 +469,23 @@ Other protected classes still apply regardless of a generated header.
464
469
 
465
470
  ### Dependency-manifest writes
466
471
 
467
- Manifest writes are allowed **silently by default** when Git's `origin` points to
472
+ The policy comes from the **session**, not from the file being written. The session repository is
473
+ `CLAUDE_PROJECT_DIR` (else the checkout that holds the installed hook; in Pi, the working directory
474
+ Pi was started in). Its `.cratis/ai.json` `allowDependencyManifestWrites` decides; without a boolean, manifest
475
+ writes are allowed **silently by default** when that repository's Git `origin` points to
468
476
  `github.com/Cratis/<repo>` over HTTPS or SSH (including `git@github.com:Cratis/<repo>.git`;
469
- host and owner are case-insensitive). The hook resolves the policy repository from the write
470
- target, resolving relative paths against the tool's working directory, lexically collapsing
471
- repeated separators, `.` and `..`, then walking up to the nearest existing directory for new
472
- files. That directory is resolved physically before Git lookup, so symlinked directories use
473
- the repository they actually point into. Nested directories and linked worktrees work too.
474
- A missing or non-Cratis origin keeps the block; targets outside any Git repository are blocked. Installed corpus files and selected profiles do **not** prove organization
477
+ host and owner are case-insensitive). A missing or non-Cratis origin keeps the block.
478
+
479
+ The repository that owns the write target is consulted only to **tighten** the decision. The hook
480
+ resolves it from the target, resolving relative paths against the tool's working directory, lexically
481
+ collapsing repeated separators, `.` and `..`, then walking up to the nearest existing directory for new
482
+ files; that directory is resolved physically before Git lookup, so symlinked directories use the
483
+ repository they actually point into. The write is allowed only if the session policy **and** the target
484
+ repository's own policy (same rule: its setting, else its Cratis origin) both allow it. A target's `true`
485
+ or Cratis origin can never unlock a session that blocks, so an agent-created repository cannot opt itself
486
+ in. A target outside any Git repository is blocked, and so is any session whose repository cannot be
487
+ determined. `.cratis/ai.json` is itself a protected control, so the agent cannot edit the session policy.
488
+ Installed corpus files and selected profiles do **not** prove organization
475
489
  ownership: consumer applications can have exactly the same installation and profiles.
476
490
 
477
491
  Set a repository-owned boolean in `.cratis/ai.json` to override that default in both Claude Code
@@ -482,7 +496,7 @@ and Pi:
482
496
  ```
483
497
 
484
498
  `false` re-enables the manifest block in a Cratis repository; `true` allows manifest writes
485
- in any repository. Merge this property into the existing configuration. An absent, malformed,
499
+ in any repository, for targets that do not themselves block (see above). Merge this property into the existing configuration. An absent, malformed,
486
500
  or non-boolean setting uses the origin-based default. This setting never permits `.env` writes.
487
501
  The protected basename list is unchanged; `package.json` is not part of this guard's manifest category.
488
502
 
@@ -9,8 +9,12 @@
9
9
  #
10
10
  # While jq is missing the guard cannot read the tool call, so it refuses every call.
11
11
  #
12
- # .cratis/ai.json allowDependencyManifestWrites overrides only the manifest policy:
13
- # true allows them in any repository; false blocks them even in a Cratis repository.
12
+ # The manifest policy belongs to the session, never to the write target. The session repository is
13
+ # CLAUDE_PROJECT_DIR (else the checkout holding this script); its .cratis/ai.json
14
+ # allowDependencyManifestWrites (true allows, false blocks) decides, else its github.com/Cratis origin.
15
+ # The target repository can only tighten that: an explicit false, a non-Cratis origin without a setting,
16
+ # or no Git repository blocks; a target's true or Cratis origin never unlocks a blocking session.
17
+ # A session that cannot be determined blocks. Only manifests are affected; .env stays blocked.
14
18
  #
15
19
  # Escape hatch for the "unless explicitly asked" case — the user asks, you set it for the call:
16
20
  # CRATIS_HOOKS_ALLOW_PROTECTED_WRITES=1
@@ -374,9 +378,43 @@ agent_control_target() {
374
378
  }
375
379
 
376
380
  # ── Dependency manifests, lockfiles, SDK and NuGet configuration ──────────────
381
+ # Policy of one repository root: a boolean allowDependencyManifestWrites wins, else a github.com/Cratis origin.
382
+ repository_manifest_policy() {
383
+ local setting="" root="$1"
384
+ if [ -f "$root/.cratis/ai.json" ]; then
385
+ # Only actual booleans override the default; jq's `// empty` would discard false.
386
+ setting="$(jq -r '.allowDependencyManifestWrites | select(type == "boolean") | tostring' "$root/.cratis/ai.json" 2>/dev/null)" || parser_failed
387
+ fi
388
+ case "$setting" in
389
+ true) return 0 ;;
390
+ false) return 1 ;;
391
+ esac
392
+ repository_origin "$root"
393
+ # Anchor host, owner and the single repository segment; never infer ownership from profiles.
394
+ origin_matches '^(https://github\.com/|git@github\.com:|ssh://git@github\.com(:[0-9]+)?/)cratis/[a-z0-9_.-]+/?$'
395
+ }
396
+
397
+ # The session's policy, computed once. The session is fixed by the harness (CLAUDE_PROJECT_DIR, else the checkout
398
+ # holding this script), never by the write target, the payload cwd or the shell's working directory.
399
+ # Anything that cannot be determined blocks.
400
+ session_manifest_policy=""
401
+ session_manifests_allowed() {
402
+ if [ -z "$session_manifest_policy" ]; then
403
+ local session_root
404
+ session_manifest_policy=1
405
+ # A session the harness named but that is not a directory is undeterminable, never the script's checkout.
406
+ if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ ! -d "$CLAUDE_PROJECT_DIR" ]; then return 1; fi
407
+ if session_root="$(hook_repo_root 2>/dev/null)" && session_root="$(git -C "$session_root" rev-parse --show-toplevel 2>/dev/null)"; then
408
+ if repository_manifest_policy "$session_root"; then session_manifest_policy=0; fi
409
+ fi
410
+ fi
411
+ return "$session_manifest_policy"
412
+ }
413
+
377
414
  manifest_writes_allowed() {
378
- local setting="" directory policy_root start="$PWD"
379
- # Authorization belongs to the write target, which may be outside the session's checkout.
415
+ local directory policy_root start="$PWD"
416
+ # The session decides first; the target is only consulted to tighten it.
417
+ session_manifests_allowed || return 1
380
418
  # New files can have nonexistent parents; find their nearest existing directory first.
381
419
  dir_of "$file"
382
420
  directory="$REPLY"
@@ -390,17 +428,7 @@ manifest_writes_allowed() {
390
428
  directory="$PWD"
391
429
  cd "$start" 2>/dev/null || true
392
430
  policy_root="$(git -C "$directory" rev-parse --show-toplevel 2>/dev/null)" || return 1
393
- if [ -f "$policy_root/.cratis/ai.json" ]; then
394
- # Only actual booleans override the default; jq's `// empty` would discard false.
395
- setting="$(jq -r '.allowDependencyManifestWrites | select(type == "boolean") | tostring' "$policy_root/.cratis/ai.json" 2>/dev/null)" || parser_failed
396
- fi
397
- case "$setting" in
398
- true) return 0 ;;
399
- false) return 1 ;;
400
- esac
401
- repository_origin "$policy_root"
402
- # Anchor host, owner and the single repository segment; never infer ownership from profiles.
403
- origin_matches '^(https://github\.com/|git@github\.com:|ssh://git@github\.com(:[0-9]+)?/)cratis/[a-z0-9_.-]+/?$'
431
+ repository_manifest_policy "$policy_root"
404
432
  }
405
433
 
406
434
  # Return the category, leaving normal Write/Edit diagnostics unchanged below.
@@ -76,7 +76,8 @@ named reference before applying one.
76
76
  tests run serially or several jobs each rebuild. Default: one job builds in
77
77
  `Release`, uploads the output with `actions/upload-artifact`, and a matrix of shard jobs downloads it and runs
78
78
  each built spec executable; only VSTest projects use `dotnet test <project> --no-build`. Pitfall: a shard whose filter matches nothing still
79
- passes, so assert that every shard ran tests. Read
79
+ passes, so assert that every shard ran tests. Each build tuple has one analyzer
80
+ owner (section "One analyzer owner per build tuple"). Read
80
81
  `references/build-once-and-shard.md` when applying or reviewing this.
81
82
 
82
83
  **Fewer, bigger jobs.** Fits queue-bound workflows: every job pays a scheduler
@@ -144,7 +145,10 @@ handle it. Pitfall: without `merge_group` the required check never reports in th
144
145
  queue. Read `references/required-checks-and-path-filters.md`.
145
146
 
146
147
  **Compile once, analyze once.** Fits any workflow where one push compiles the same
147
- code several times. Default: build the spec path without analyzers
148
+ code several times. Exactly one build owns the analyzers per build tuple, never
149
+ zero: by default a parallel required job on the same tuple, while the spec path is
150
+ built by a non-owner; a repository may instead let the shared spec build own them by
151
+ its own decision record. Default: build the spec path without analyzers
148
152
  (`-p:RunAnalyzers=false`) and reuse the output; enforce every analyzer with warnings
149
153
  as errors in one parallel **required** job that fails early on compile and analyzer
150
154
  errors, while the local fast loop may skip analyzers and the pre-push gate runs them.
@@ -4,6 +4,9 @@
4
4
 
5
5
  - When it fits
6
6
  - Shape
7
+ - One analyzer owner per build tuple
8
+ - Order of steps
9
+ - Specs from built executables
7
10
  - Decisions
8
11
  - Pitfalls
9
12
  - Fewer, bigger jobs
@@ -77,7 +80,8 @@ jobs:
77
80
  - run: tar --zstd -xf build-output.tar.zst
78
81
  # Example assumes each xUnit v3 mtp-off AssemblyName matches its directory.
79
82
  # Use evaluated TargetPath for custom outputs; TUnit/native runners need their own report flags.
80
- # Only VSTest uses dotnet test <project> --no-build --configuration Release with --logger/--results-directory.
83
+ # Only VSTest projects use dotnet test <project> --no-build --configuration Release with --logger/--results-directory.
84
+ # The executable must come from the same tuple (configuration, TFM, RID) the build job produced.
81
85
  - name: Test the shard's projects
82
86
  env:
83
87
  PROJECTS: ${{ matrix.projects }}
@@ -122,8 +126,64 @@ To balance, read each shard job's median duration from the slowest-jobs table of
122
126
  re-measure; stop when the spread is within the job start cost. Balance by
123
127
  measured wall time, and confirm the new split on one real CI run before merging it.
124
128
 
129
+ ## One analyzer owner per build tuple
130
+
131
+ A build tuple is the configuration, target framework, runtime identifier and every
132
+ build-affecting property. Every tuple that is built, tested or shipped has
133
+ **exactly one** owning build that runs the analyzers with warnings as errors:
134
+ never zero, and a second owner only repeats the cost.
135
+
136
+ - **Default owner: a parallel required job.** It builds the same tuple as the spec
137
+ build with the analyzers on and warnings as errors, and fails early on compile and
138
+ analyzer errors. The spec build is a non-owner and passes `-p:RunAnalyzers=false`.
139
+ The owning job is a required check: never leave it out of branch protection, and
140
+ the pre-push gate runs the analyzers too (see
141
+ [analyzer cost](test-setup-cost.md#analyzer-cost)).
142
+ - **Alternative owner: the shared spec build.** A repository may choose, by its own
143
+ decision record, that the build feeding the specs owns the analyzers, so the specs
144
+ run on analyzed output. Then no separate analyzer job exists for that tuple.
145
+ - **Non-owners** pass `-p:RunAnalyzers=false` (and `-p:EnforceCodeStyleInBuild=false`
146
+ where code style runs in the build). Use `RunAnalyzers`/`RunAnalyzersDuringBuild`
147
+ as the owner switch: `EnableNETAnalyzers=false` only turns off the .NET SDK's own
148
+ analyzers and leaves other analysis running, so it is not an owner switch. Never
149
+ remove `Analyzer` items either: generators are delivered as analyzer references,
150
+ so the output would lose its generated code.
151
+ - **Check generators survived.** Assert that a known generated file or type is in a
152
+ non-owner build's output before trusting it.
153
+ - **A tuple that is packed or published is always owned**, so shipped binaries were
154
+ analyzed by some build.
155
+ - **Match tuples.** A shard that builds Release/net10.0 after an owner built Debug
156
+ compiles again and leaves its own tuple unowned. Reuse the owner's output, or make
157
+ the second tuple own its analyzers.
158
+
159
+ ## Order of steps
160
+
161
+ 1. Restore once.
162
+ 2. Build the owning tuple.
163
+ 3. Later builds use `--no-restore`.
164
+ 4. Run the specs from the built executables.
165
+ 5. Pack with `--no-build`.
166
+
167
+ Publish and native AOT are separate builds with their own tuple; do not run
168
+ `dotnet publish` nested inside a spec step. Do not split projects to speed up the
169
+ build: measure with `-bl` and `ReportAnalyzer=true` first (see the `msbuild` skill's
170
+ build performance references).
171
+
172
+ ## Specs from built executables
173
+
174
+ xUnit v3 projects are executables: run the built file from the build tuple's output
175
+ directory instead of `dotnet test`, which rebuilds implicitly. Native filters are
176
+ owned by [running-specs](../../cratis-specifications-csharp/references/running-specs.md);
177
+ do not restate the syntax here. Fail closed on counts:
178
+
179
+ - every shard reports executed > 0;
180
+ - the total across shards equals the spec count before the change;
181
+ - repositories with unmigrated v3 consumers track them in their own migration issue.
182
+
125
183
  ## Decisions
126
184
 
185
+ - **Cache dependencies only.** Cache restored packages and installed dependencies,
186
+ never build output; build output travels as an artifact.
127
187
  - **Artifact, not cache, between jobs of one run.** A cache keyed on the commit
128
188
  SHA is immutable: one failed save poisons the key for every later attempt and a
129
189
  rerun cannot recover. An artifact belongs to the run and is the intended
@@ -143,7 +203,8 @@ measured wall time, and confirm the new split on one real CI run before merging
143
203
 
144
204
  ## Pitfalls
145
205
 
146
- - A filter or project list that matches nothing passes `dotnet test`. End every
206
+ - A filter or project list that matches nothing passes: an executable with a
207
+ filter matching nothing exits 0, and so does VSTest `dotnet test`. End every
147
208
  shard with a check that each assigned project or namespace ran at least one test,
148
209
  and print the counts. Zero tests is a failed shard.
149
210
  - Shards balance by test time, not by project count (see the balancing steps
@@ -21,11 +21,13 @@ references/binlog-failure-analysis.md:
21
21
  - Render unimported binlog-failure-analysis routing reference as plain topic text.
22
22
 
23
23
  references/build-perf-baseline.md:
24
+ - Add a labelled Cratis note on analyzer ownership, local incremental measurement and gate scripts.
24
25
  - Render unimported build-perf-baseline routing reference as plain topic text.
25
26
  - Qualify analyzer/warning suppression as timing-only; require the real gate restored.
26
27
  - Add or normalize the top Contents list from existing headings; preserve section content.
27
28
 
28
29
  references/build-perf-diagnostics.md:
30
+ - Add a labelled Cratis note on analyzer ownership per build tuple and keeping generators running.
29
31
  - Render unimported build-perf-diagnostics routing reference as plain topic text.
30
32
  - Qualify analyzer/warning suppression as timing-only; require the real gate restored.
31
33
  - Add or normalize the top Contents list from existing headings; preserve section content.
@@ -418,6 +418,13 @@ Use matching configuration/TFM/RID and restore-affecting properties in each stag
418
418
  `--no-restore` requires current assets; `--no-build` requires successfully built
419
419
  matching test outputs. Keep restore-inclusive and build-only timings separate.
420
420
 
421
+ > **Cratis:** the build that owns a configuration/TFM/RID/property tuple is the one
422
+ > that runs its analyzers; other builds of that tuple reuse its output. Measure local
423
+ > no-op and one-file-edit incremental builds, using `-bl` to see which targets rerun
424
+ > with nothing changed. Gate scripts follow the same one-owner structure. The inner
425
+ > loop may use `-p:RunAnalyzers=false`, but the analyzer-owning gate build is
426
+ > mandatory before push. Report local and CI numbers separately.
427
+
421
428
  ### Skip Unnecessary Targets
422
429
 
423
430
  For an explicitly agreed development scenario where these outputs/checks are
@@ -106,6 +106,14 @@ Use these as investigation hints, not universal budgets or proof of a cause:
106
106
  - **Source generators:** do not assume `RunAnalyzers=false` disables or measures
107
107
  every generator. Preserve required generated code and inspect generator-specific
108
108
  evidence.
109
+
110
+ > **Cratis:** in CI, non-owning builds use `RunAnalyzers`/`RunAnalyzersDuringBuild`,
111
+ > not `EnableNETAnalyzers` (it only disables the .NET SDK's own analyzers, so it is
112
+ > not an owner switch), and never delete `Analyzer` items, which would also remove
113
+ > generators. Each configuration/TFM/RID/property tuple has exactly one analyzer-owning
114
+ > build (see `cratis-ci-pipeline-performance`, `references/build-once-and-shard.md`).
115
+ > Measure with `-bl` and `ReportAnalyzer=true` before and after.
116
+
109
117
  - **GlobalPackageReference:** examine the project, `Directory.Build.props`,
110
118
  `Directory.Packages.props`, and package imports. Active global analyzer
111
119
  references can affect production and test projects; a declaration alone does
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.170.11",
3
+ "version": "7.171.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [