@cratis/pi 7.170.12 → 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.
@@ -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.12",
3
+ "version": "7.171.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [