@cratis/pi 7.103.4 → 7.103.6

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.
Files changed (21) hide show
  1. package/package/corpus/harnesses/copilot/instructions/local-work-artifacts.instructions.md +7 -7
  2. package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +7 -5
  3. package/package/corpus/hooks/README.md +16 -0
  4. package/package/corpus/hooks/scripts/cratis-cleanup-worktrees.sh +148 -24
  5. package/package/corpus/rules/local-work-artifacts.md +7 -7
  6. package/package/corpus/rules/specs.csharp.md +7 -5
  7. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/SKILL.md +12 -4
  8. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/dependency-map.md +76 -0
  9. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/dotnet-nuget.md +3 -0
  10. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/npm-yarn.md +6 -4
  11. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/train-mode.md +43 -0
  12. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/worked-examples.md +166 -28
  13. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/scripts/cratis-local-packages.sh +1065 -60
  14. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/scripts/dependency-map.tsv +68 -0
  15. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +20 -13
  16. package/package/corpus/skills/cratis-specifications-csharp/references/running-specs.md +90 -0
  17. package/package/corpus/skills/cratis-specifications-csharp/references/shared-lifecycle.md +55 -23
  18. package/package/corpus/skills/cratis-specifications-csharp/verification.json +5 -3
  19. package/package/corpus/skills/filter-syntax/SKILL.md +3 -1
  20. package/package/corpus/skills/run-tests/SKILL.md +1 -1
  21. package/package.json +1 -1
@@ -3,16 +3,28 @@
3
3
 
4
4
  # Worked examples
5
5
 
6
+ ## Contents
7
+
8
+ - Chronicle kernel → Studio integration specs
9
+ - Fundamentals → Arc (NuGet)
10
+ - Components → Studio frontend (npm)
11
+ - Chronicle clients → Direct (NuGet)
12
+ - Screenplay → Stage and Studio (NuGet and npm)
13
+ - Arc → Chronicle (NuGet)
14
+ - Fundamentals → Arc → Chronicle under one stamp
15
+
16
+ Run times below are rounded from one measured run on a shared machine; queue wait is not included.
6
17
  Use absolute producer/consumer paths for your checkouts and the entry point's
7
18
  `local` helper variable. These recipes define work to execute, not pre-verified
8
19
  results. Substitute actual regression filters and CI commands; stop on a failed
9
20
  step. Apply the entry point's check/restore/cleanup sequence to both repositories.
10
21
 
22
+
11
23
  ## Chronicle kernel → Studio integration specs
12
24
 
13
25
  1. Reproduce Studio's integration bug against its released client/kernel. Record
14
26
  the regression filter and inspect Studio's CI build/test commands.
15
- 2. Generate the stamp and pack client packages plus their full dependency closure.
27
+ 2. Generate the stamp and pack client packages plus their dependencies.
16
28
  A client solution filter can omit CodeAnalysis. Include its package explicitly:
17
29
 
18
30
  ```bash
@@ -60,38 +72,164 @@ requirement the consumer's container setup does not satisfy yet), that is a
60
72
  real finding about the consumer, not about the overlay: read the container log
61
73
  before changing the producer.
62
74
 
63
- ## Fundamentals → Arc
75
+ ## Fundamentals → Arc (NuGet)
76
+
77
+ ```bash
78
+ stamp=$(bash "$local" stamp "$fundamentals")
79
+ (cd "$fundamentals" && bash "$local" pack-nuget . "$stamp" Fundamentals.slnx)
80
+ bash "$local" use-nuget "$arc" "$stamp"
81
+ ```
64
82
 
65
- For a .NET Fundamentals fix, build/spec the producer, generate its stamp and
66
- `pack-nuget` the affected projects and dependency closure. In Arc, run `use-nuget`
67
- with the required Fundamentals package IDs, source the printed env/config, restore,
68
- then build/spec Arc with its CI configuration. Inspect `project.assets.json` to
69
- confirm the actual stamp. No image is required unless the reproducer needs one.
83
+ Gates (Arc `dotnet-build.yml`), run in this order after sourcing the printed env:
84
+ `yarn install --immutable`; in `Source/DotNET/Screenplay.Embedded`: `npm ci --workspaces=false`,
85
+ `npm run typecheck`, `npm test`, `npm run build`; `dotnet build --configuration Release
86
+ -p:CratisSpecsTargetFramework=net10.0`; then `dotnet test <project> --no-build --configuration
87
+ Release --framework net10.0` for each project that `python3 scripts/ci-test-shards.py projects
88
+ --shard specs-N` prints. Finish by listing Arc's `obj/project.assets.json` files for the stamp.
70
89
 
71
- For a JavaScript Fundamentals fix, run the producer's normal build and
72
- `pack-npm`, then `use-npm` in Arc and install. Run Arc frontend build/specs and the
73
- reproducer. Include all affected workspace tarballs so a transitive dependency
74
- cannot silently remain released. A green producer-only spec is not consumer proof.
75
- Finish with the entry point's commit checks, restoration and cleanup.
90
+ - Pass: the Fundamentals IDs in `project.assets.json` are at the stamp, build has 0 warnings and 0 errors, 18 spec projects run and none fail.
91
+ - Time: pack about 4 min, build about 6 min, the spec projects about 18 min.
92
+ - Pitfall: skipping the embedded viewer build makes four `Screenplay.Embedded.Specs` fail
93
+ with a 404 for the viewer. It is the missing step, not the overlay.
94
+ - Pitfall: Arc's own `@cratis/fundamentals` npm line is out of scope for the NuGet stamp.
95
+ - Skip producer specs when the producer is unchanged `origin/main`; its CI covered that SHA.
76
96
 
77
- ## Components → Studio frontend
97
+ For a JavaScript Fundamentals fix, run the producer's build and `pack-npm`, then `use-npm` in
98
+ Arc and install. Include every affected workspace tarball so no transitive copy stays released.
78
99
 
79
- Build/spec Components using its own package scripts, including any required
80
- Storybook gate. Then:
100
+ ## Components → Studio frontend (npm)
81
101
 
82
102
  ```bash
83
- stamp=$(bash "$local" stamp "$producer")
84
- bash "$local" pack-npm "$producer" "$stamp"
85
- bash "$local" use-npm "$consumer" "$stamp"
86
- cd "$consumer"
87
- yarn install
103
+ (cd "$components" && yarn install --immutable && yarn workspace @cratis/components run ci && yarn build)
104
+ stamp=$(bash "$local" stamp "$components")
105
+ (cd "$components" && bash "$local" pack-npm . "$stamp")
106
+ bash "$local" use-npm "$studio" "$stamp"
107
+ (cd "$studio" && yarn install) # not --immutable: the overlay edits the lock
108
+ yarn why @cratis/components
88
109
  ```
89
110
 
90
- Confirm the Components `file:` tarball resolutions. Run Studio's frontend build,
91
- lint/specs and exercise the broken dialog/page. If Vite serves stale assets, stop
92
- the dev server, clear only its `.vite` prebundle and restart. Avoid `link:` and
93
- `portal:` because duplicate React/context instances distort the reproduction.
94
- Overlay-only lockfile changes from Yarn install are restored automatically.
95
- Review npm backups if unrelated changes cause `restore` to refuse; preserve
96
- that work, restore only local changes and retry. Reinstall released packages,
97
- run `check`, and review/apply cleanup for this stamp.
111
+ Gates: from `Source/<App>` run `yarn ci` for each Studio application that uses
112
+ `@cratis/components` (Core, Admin, Editor, EventModels, Viewer, ScreenMigration), `node
113
+ scripts/generate-scene-package-catalog.mjs --check`, then in Core `yarn build` and the
114
+ `initial-bundle-guard.mjs` budget check, and `yarn build-storybook` where the script exists.
115
+
116
+ - Pass: every installed `@cratis/components*` copy is at the stamp (`yarn why` and the installed `package.json` files),
117
+ `yarn why` shows one resolution, and every gate above exits 0.
118
+ - Time: Components `ci` about 7 min, all-workspace build about 1 min, pack about 2 min,
119
+ Studio install under 30 s, Studio gates about 8 min.
120
+ - Pitfall: `yarn workspace @cratis/components run ci` builds only the core package. Run
121
+ `yarn build` at the Components root before `pack-npm`, or the adapter tarballs have no
122
+ `dist` and Studio fails with `Failed to resolve entry for package
123
+ "@cratis/components.primereact"`.
124
+ - Pitfall: the root `package.json` version is a placeholder, so the stamp base comes from tags.
125
+ Resolutions bypass the prerelease ranges that npm would otherwise ignore.
126
+
127
+ ## Chronicle clients → Direct (NuGet)
128
+
129
+ ```bash
130
+ stamp=$(bash "$local" stamp "$chronicle")
131
+ (cd "$chronicle" && dotnet pack Source/Clients/Packages.slnf -c Release -p:PackageVersion=$stamp -p:Version=$stamp \
132
+ -p:IsPackaging=true -p:DisableProxyGenerator=true -p:DisableDockerBuild=true -o "$CRATIS_LOCAL_FEED/nuget")
133
+ bash "$local" use-nuget "$direct" "$stamp"
134
+ ```
135
+
136
+ Gates (Direct `build.yml`): `dotnet build Source/Direct/Direct.csproj -c Release
137
+ -p:DisableProxyGenerator=true`, the same in Debug with `-warnaserror`, `dotnet test` of that
138
+ project with `--no-build`, and `dotnet test Source/Assurance/Assurance.csproj`. Then
139
+ check `project.assets.json`. Image-based specs also need the producer image tag.
140
+
141
+ - Pass for a consumer whose pins lag the producer: every Chronicle ID is in the feed at the
142
+ stamp, the Release build with the owner's floors passes, and `project.assets.json` shows every
143
+ stamped ID at the stamp. The Debug `-warnaserror` build and the specs are gated on the consumer owner's pin
144
+ bump (Arc, Orleans, Screenplay, MongoDB.Driver) and on the analyzer fixes the newer pins
145
+ bring. Record that dependency; do not edit the consumer's source or tracked pins.
146
+ - Time: pack about 5 min; the Release build about 2 min.
147
+ - Pitfall: pass pack properties as `-p:` arguments to `dotnet pack`, never
148
+ as environment variables; `pack-nuget` takes none. An exported `IsPackaging=true` reaches Chronicle's nested
149
+ `dotnet run` code generator and fails with a multi-target error.
150
+ - Pitfall: a consumer whose pins lag the producer's own pins fails with NU1109 or NU1605.
151
+ That is the upgrade the consumer would need anyway; record the bump list.
152
+ - Pitfall: a released umbrella package can pull in a released package that is also stamped
153
+ (here an AspNetCore package). Pin it with a direct reference or treat it as a finding.
154
+
155
+ ## Screenplay → Stage and Studio (NuGet and npm)
156
+
157
+ ```bash
158
+ stamp=$(bash "$local" stamp "$screenplay")
159
+ (cd "$screenplay" && yarn install && yarn workspaces foreach -Rt --from @cratis/screenplay-mcp-app run build \
160
+ && bash "$local" pack-nuget . "$stamp" Screenplay.slnx && yarn build && bash "$local" pack-npm . "$stamp")
161
+ bash "$local" use-nuget "$stage" "$stamp"; bash "$local" use-nuget "$studio" "$stamp"
162
+ bash "$local" use-npm "$studio" "$stamp" # at the workspace root, not the nested app
163
+ ```
164
+
165
+ `closure` exits 2 for this chain until `dependency-map.tsv` has the Screenplay NuGet `ids` (it lists
166
+ only npm IDs); add them from the publish workflow first, then use the printed commands and its one
167
+ `verify-pack`.
168
+
169
+ Gates: Stage's frontend `npm ci`, test and build, then `dotnet build` in Debug and the repository's
170
+ own spec-shard helper; skip probes that need a live kernel or database and say so. Studio:
171
+ `dotnet build` of its solution in Debug with warnings as errors, then the frontend `yarn ci` and
172
+ `yarn build` of every workspace that consumes the language package.
173
+
174
+ - Pass: `project.assets.json` shows the stamp in both NuGet consumers and `yarn why` at the Studio workspace root shows one resolution; specs executed > 0.
175
+ - Pitfall: a repository without a committed lockfile fails `yarn install --immutable`; use plain
176
+ `yarn install` there.
177
+ - Pitfall: yarn hoists to the root `node_modules`; check and install at the root.
178
+ - Pitfall: the packed language tarball must contain its built bundles. `pack-npm` uses `npm pack`;
179
+ a package whose `files` lists a gitignored folder can ship only part of it. Compare the
180
+ tarball file list with the package's `dist` folder.
181
+ - Pitfall: multi-hop. Studio keeps its released Stage; a binary break is a finding.
182
+
183
+ ## Arc → Chronicle (NuGet)
184
+
185
+ ```bash
186
+ stamp=$(bash "$local" stamp "$arc")
187
+ (cd "$arc" && bash "$local" pack-nuget . "$stamp" Arc.slnx)
188
+ bash "$local" use-nuget "$chronicle" "$stamp"
189
+ ```
190
+
191
+ Gates: Chronicle `dotnet build` in Release with `DisableProxyGenerator=true` and
192
+ `DisableDockerBuild=true`, the non-integration specs; Workbench `yarn install` then `yarn ci`
193
+ with `NODE_OPTIONS=--max-old-space-size=4096`.
194
+
195
+ - Pass: Release build clean; every spec assembly passes; `project.assets.json` shows the stamp for
196
+ every Arc ID.
197
+ - Finding when the consumer's other pins lag: the build passes, but the specs fail with
198
+ `MissingMethodException` on a Fundamentals method the newer Arc calls, because Chronicle pins an
199
+ older Fundamentals than Arc was built against. Record it; do not edit the consumer's pins.
200
+ - Pitfall: build the Arc embedded viewer before the .NET build, or the Arc build fails.
201
+ - Pitfall: Chronicle resolves Arc packages to the stamp only where its manifests pin them; a
202
+ released package that depends on a released Arc package keeps that version. Record it.
203
+ - Pitfall: `use-npm` overlays only the consumer repository root `package.json` and has no option to
204
+ target `Source/Workbench`, so this recipe does not put the Arc npm packages under the Workbench.
205
+ To verify them there, run `pack-npm` in Arc, then add `file:` resolutions to the Workbench
206
+ manifest by hand and run `yarn install`; do not claim the Workbench result without that step.
207
+ - Pitfall: the Workbench is its own Yarn project with its own lockfile. `restore` refuses to
208
+ put back a changed lockfile; in a throwaway worktree check out the two manifests and remove the
209
+ helper's backup folder.
210
+
211
+ ## Fundamentals → Arc → Chronicle under one stamp
212
+
213
+ ```bash
214
+ stamp=$(bash "$local" stamp "$arc") # one stamp, reused for every layer
215
+ (cd "$fundamentals" && bash "$local" pack-nuget . "$stamp" Fundamentals.slnx)
216
+ bash "$local" use-nuget "$arc" "$stamp" # Arc builds against the new Fundamentals
217
+ (cd "$arc" && bash "$local" pack-nuget . "$stamp" Arc.slnx)
218
+ bash "$local" restore "$arc"
219
+ bash "$local" use-nuget "$chronicle" "$stamp" # no IDs: every stamped Fundamentals and Arc ID
220
+ ```
221
+
222
+ Gates: Chronicle Release build and the non-integration specs, as above.
223
+
224
+ Without package IDs `use-nuget` overrides every package in the feed carrying the stamp, so Chronicle
225
+ resolves Fundamentals at the stamp both directly and through Arc; naming only the Arc IDs would leave
226
+ its direct Fundamentals pin at the release and bring back the `MissingMethodException`.
227
+
228
+ - Pass: every spec assembly passes (no `MissingMethodException`), which the two-repository run does
229
+ not achieve. A binary mismatch between layers disappears only when every layer carries the same stamp.
230
+ - Order: pack the upstream first, overlay it into the next repository, pack that, and so on;
231
+ inspect the nuspec of each pack before overlaying it.
232
+ - A stamp is tied to the commit of the repository it was generated from. After changing any
233
+ layer, generate a new stamp and repeat the chain.
234
+ - Time: each pack 15–30 minutes with queue waits; the Chronicle build and specs about 5 minutes
235
+ of run time each.