@cratis/pi 7.176.0 → 7.177.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.
Files changed (28) hide show
  1. package/package/corpus/agents/frontend-developer.md +2 -0
  2. package/package/corpus/agents/spec-writer.md +3 -3
  3. package/package/corpus/harnesses/copilot/instructions/components.instructions.md +4 -4
  4. package/package/corpus/harnesses/copilot/instructions/react.instructions.md +3 -21
  5. package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +1 -1
  6. package/package/corpus/harnesses/copilot/instructions/specs.scenarios.csharp.instructions.md +5 -5
  7. package/package/corpus/harnesses/pi/agents/frontend-developer.md +2 -0
  8. package/package/corpus/harnesses/pi/agents/spec-writer.md +3 -3
  9. package/package/corpus/rules/components.md +4 -4
  10. package/package/corpus/rules/react.md +3 -21
  11. package/package/corpus/rules/specs.csharp.md +1 -1
  12. package/package/corpus/rules/specs.scenarios.csharp.md +5 -5
  13. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +16 -13
  14. package/package/corpus/skills/cratis-application-slice-specifications/references/query-and-decision-scenarios.md +73 -26
  15. package/package/corpus/skills/cratis-arc-command/references/command-result.md +69 -17
  16. package/package/corpus/skills/cratis-arc-command/references/decisions-and-routing.md +16 -13
  17. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -5
  18. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +27 -8
  19. package/package/corpus/skills/cratis-arc-react-page/references/availability.md +65 -0
  20. package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +78 -8
  21. package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +24 -0
  22. package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +17 -45
  23. package/package/corpus/skills/cratis-chronicle-decision-reads/SKILL.md +11 -6
  24. package/package/corpus/skills/cratis-chronicle-decision-reads/references/choosing-how-a-rule-holds.md +17 -14
  25. package/package/corpus/skills/cratis-code-review/SKILL.md +5 -1
  26. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +12 -11
  27. package/package/corpus/skills/cratis-specifications-csharp/references/running-specs.md +62 -4
  28. package/package.json +1 -1
@@ -20,7 +20,8 @@ Check package versions and the actual configuration/TFM; the 4.x migration check
20
20
  below applies only when migrating, not as a prerequisite to running an existing suite.
21
21
 
22
22
  Sources: [Running specifications fast](https://github.com/Cratis/Specifications/blob/main/Documentation/running-fast.md),
23
- [The native runner](https://github.com/Cratis/Specifications/blob/main/Documentation/runner.md) and
23
+ [The native runner](https://github.com/Cratis/Specifications/blob/main/Documentation/runner.md),
24
+ [Phase timings](https://github.com/Cratis/Specifications/blob/main/Documentation/phase-timings.md) and
24
25
  [Upgrading to 5.0](https://github.com/Cratis/Specifications/blob/main/Documentation/upgrading-5.0.md).
25
26
 
26
27
  ## Project shape
@@ -44,9 +45,10 @@ is a worked example, including the CI step that runs the built executable.
44
45
 
45
46
  ## Local loop
46
47
 
47
- An xUnit v3 suite costs about 4.5 times more CPU through `dotnet test` than as the
48
- built executable (indicative, from the upstream benchmark). Restore and build once,
49
- then run the executable:
48
+ In the upstream reported benchmark of 1,500 trivial tests on a loaded Mac, an
49
+ xUnit v3 suite used about 4.5 times more CPU through `dotnet test` than as the
50
+ built executable. This is a measurement, not a universal ratio. Restore and build
51
+ once, then run the executable:
50
52
 
51
53
  ```bash
52
54
  dotnet restore Source/MyProject.Specs
@@ -84,6 +86,62 @@ versions, configuration, filters, concurrency/shards and machine fixed; preserve
84
86
  discovered/passed/failed/skipped counts and investigate any change. Do not count
85
87
  restore/build time as test execution or repeat unchanged runs merely for reassurance.
86
88
 
89
+ ### Diagnose before changing the harness
90
+
91
+ Measure the existing suite before a rewrite. Separate restore/build, runner
92
+ startup/discovery and reporting from specification execution. Phase timings do
93
+ not measure total process startup or discovery; compare launch wall time separately.
94
+ For repeated local runs, use the built executable rather than repeatedly invoking
95
+ `dotnet test`/MSBuild. Keep the evaluated runner and its supported flags.
96
+
97
+ Enable phase diagnostics without changing pass/fail behavior. This example assumes
98
+ the Release/net10.0 executable built above and runs from the repository root:
99
+
100
+ ```bash
101
+ mkdir -p .ai-work/spec-timings
102
+ CRATIS_SPECS_TIMINGS=1 CRATIS_SPECS_TIMINGS_FILE="$PWD/.ai-work/spec-timings/phases.json" \
103
+ ./Source/MyProject.Specs/bin/Release/net10.0/MyProject.Specs
104
+ ```
105
+
106
+ Alternatively, set `<CratisSpecificationsPhaseTimings>true</CratisSpecificationsPhaseTimings>`
107
+ in the project. Slow phases default to a 1,000 ms threshold; set
108
+ `<CratisSpecificationsSlowPhaseThreshold>500</CratisSpecificationsSlowPhaseThreshold>`
109
+ for a 500 ms diagnostic threshold, not a performance budget. The JSON file records
110
+ `Establish`, `Because` and `Destroy` durations; native-runner output also records
111
+ facts. Other frameworks time facts through their own runner output. Timings are
112
+ off by default, additive when enabled, and never change whether a spec passes.
113
+
114
+ | Cost observed | Next check |
115
+ | --- | --- |
116
+ | Restore/build | Keep it outside the execution comparison; restore/build once for the local loop. |
117
+ | Runner startup/discovery | Compare the built executable's launch path, not just fact durations. |
118
+ | Repeated `Establish`/`Because` | Check shared lifecycle eligibility and opt-outs before changing packages. |
119
+ | Scenario setup/action | Identify pipeline, mapping or append-time proof a plain call cannot provide. |
120
+ | Slow fact | Keep assertions read-only; inspect the measured operation rather than adding sleeps. |
121
+ | `Destroy` | Measure disposal/cleanup separately from setup and action. |
122
+
123
+ Specifications 5 shares eligible xUnit v2/v3 lifecycle by default. `Establish` and
124
+ `Because` run once per class; facts only read that shared context. Repeating a
125
+ 200 ms `Because` across five facts costs about 1 s instead of about 200 ms in
126
+ this illustrative calculation, before other costs. Remove accidental opt-outs
127
+ rather than weakening assertions; retain `[PerFactSpecificationLifecycle]` only
128
+ where mutation genuinely cannot move into `Because`.
129
+
130
+ Record a before/after comparison, not a claimed universal timing:
131
+
132
+ | Field | Keep or report |
133
+ | --- | --- |
134
+ | Environment | Machine, package versions, configuration/TFM, launch command, filters and unchanged concurrency/shards. |
135
+ | Coverage | Discovered, passed, failed and skipped counts plus the class/method list; investigate any difference. |
136
+ | Execution | Suite wall time, class totals and phase/fact durations in separate result files. |
137
+ | Change | Name the removed repeated cost or the extra framework proof that justifies scenario cost. |
138
+
139
+ Do not merge unrelated behaviors, remove facts or turn off production guards to
140
+ meet a timing target. One class per declarative read model remains the default:
141
+ share a meaningful event sequence, capture intermediate states and assert them
142
+ with many read-only facts; add a class only for a sequence that cannot share it.
143
+ A slow mandatory scenario is an upstream harness gap, not permission to drop proof.
144
+
87
145
  ## Filters
88
146
 
89
147
  The executable accepts the filters of the xUnit v3 runner flavor the project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.176.0",
3
+ "version": "7.177.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [