@cratis/pi 7.153.10 → 7.155.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 (32) hide show
  1. package/package/corpus/agents/post-mortem.md +78 -0
  2. package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +2 -1
  3. package/package/corpus/harnesses/pi/agents/post-mortem.md +75 -0
  4. package/package/corpus/product-sync.json +1 -0
  5. package/package/corpus/rules/profiles.md +2 -1
  6. package/package/corpus/skills/cratis-engineering-post-mortem/LICENSE +2 -0
  7. package/package/corpus/skills/cratis-engineering-post-mortem/SKILL.md +113 -0
  8. package/package/corpus/skills/cratis-engineering-post-mortem/references/examples/silent-backup-failure.md +201 -0
  9. package/package/corpus/skills/cratis-engineering-post-mortem/references/examples/unintended-release-regression.md +216 -0
  10. package/package/corpus/skills/cratis-engineering-post-mortem/references/public-safe-wording.md +44 -0
  11. package/package/corpus/skills/cratis-engineering-post-mortem/references/review-template.md +168 -0
  12. package/package/corpus/skills/cratis-engineering-post-mortem/verification.json +13 -0
  13. package/package/corpus/skills/cratis-screenplay-availability/LICENSE +2 -0
  14. package/package/corpus/skills/cratis-screenplay-availability/SKILL.md +150 -0
  15. package/package/corpus/skills/cratis-screenplay-availability/references/complete-example.md +78 -0
  16. package/package/corpus/skills/cratis-screenplay-availability/references/review-checks.md +49 -0
  17. package/package/corpus/skills/cratis-screenplay-availability/references/runtime-ownership.md +26 -0
  18. package/package/corpus/skills/cratis-screenplay-availability/verification.json +18 -0
  19. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +2 -0
  20. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +4 -0
  21. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -0
  22. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -0
  23. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -0
  24. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +2 -0
  25. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +16 -0
  26. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +31 -0
  27. package/package/corpus/skills/cratis-screenplay-toolchain/references/language-admission.md +3 -0
  28. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +16350 -11796
  29. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  30. package/package/corpus/skills/cratis-screenplay-ui-composition/references/guarded-interactions.md +8 -0
  31. package/package/profile-catalog.json +2 -0
  32. package/package.json +1 -1
@@ -0,0 +1,216 @@
1
+ # Example: an unrelated release shipped a regression to production
2
+
3
+ ## Contents
4
+
5
+ - Summary
6
+ - Status and scope
7
+ - Impact
8
+ - Timeline (UTC)
9
+ - Evidence
10
+ - Verified facts
11
+ - Unverified claims
12
+ - Detection
13
+ - Root causes
14
+ - What went well
15
+ - What went poorly
16
+ - Where we were lucky
17
+ - Actions
18
+ - Lessons
19
+ - Redaction note
20
+
21
+ **What this example shows.** A regression introduced in a dependency reached
22
+ production by an accident of how the deploy works, then stayed hidden behind
23
+ checks that could not see it. It shows a UTC timeline with `Verified`,
24
+ `Inferred` and `Unverified` rows, durations computed from the outage
25
+ start and end, shared root causes, a numbered list of detection gaps, and
26
+ actions with one owner and one linked issue each. Names, identifiers and
27
+ versions are generalized.
28
+
29
+ ---
30
+
31
+ # Post-mortem: Live data broken after an edge proxy upgrade
32
+
33
+ Blameless. Status: **Final**. Times UTC; `<date>` is the day of the outage and
34
+ `<date-n>` is n days earlier. A time marked approximate is never Verified. Every claim carries a confidence: Verified, Inferred or Unverified.
35
+ Evidence was gathered read-only from pipeline runs, change requests and
36
+ issues; no cluster access, so pod facts come from cited run data.
37
+
38
+ ## Summary
39
+ A change to the edge proxy made it answer 404 to every path under a reserved
40
+ prefix that it did not own. The application serves its live queries, commands
41
+ and queries under that prefix, so signed-in users got no live data. The change
42
+ had been merged six minutes after opening, with no review, and released three
43
+ days earlier. It reached production because the pipeline for an unrelated
44
+ release checked out the moving main branch instead of the release commit, and
45
+ that branch already carried the new proxy version. Smoke and health checks
46
+ stayed green. A fix was released at 15:39 and the fixed proxies ran at 18:21.
47
+ Exposure was about 8h13m.
48
+
49
+ ## Status and scope
50
+ Window: 10:08:12Z to 18:21:28Z. Severity: high (a core feature unavailable for
51
+ signed-in users). Systems: the edge proxy, the application deploy pipeline,
52
+ the smoke checks. Over; remaining exposure is under Impact.
53
+
54
+ ## Impact
55
+ Live data was unavailable to signed-in users for 8h13m: 5h31m to the fix
56
+ release and 2h42m from the fix release to the reported deployment (change
57
+ request timestamps). How much of that was queueing alone is unknown: 1h53m
58
+ passed before the deploy pipeline started (build, specs, schema
59
+ acknowledgement, replica recovery).
60
+
61
+ **Affected**
62
+ - Signed-in users relying on live data (Confidence: Verified, from the fix
63
+ change request); the number affected is Unverified
64
+ - Plain HTTP commands and queries, which also returned 404 (Confidence:
65
+ Verified, per the fix change request)
66
+ - Two other products pinned an older proxy version below the affected range
67
+ (Confidence: Inferred, from repository configuration, not from running pods)
68
+ - Users of the public image outside the organization (Confidence: Unverified)
69
+
70
+ ## Timeline (UTC)
71
+ | Time (UTC) | Event | Source | Confidence |
72
+ |---|---|---|---|
73
+ | <date-3> 19:48Z | Proxy change opened by an automated agent identity, no linked issue | Change request | Verified |
74
+ | <date-3> 19:54:52Z | Merged with 0 reviews; released. The release note does not disclose the routing refusal | Change request, release | Verified |
75
+ | <date-3> to <date> (approximate; no single instant) | Several later proxy releases all carry the bug | Release list | Unverified (release times not anchored here) |
76
+ | <date-1> (approximate; time of day unknown) | A targeted upgrade review of the proxy exists and missed the routing regression | Review notes | Unverified (review time not recorded) |
77
+ | <date> 09:49:55Z | Application change merged with 0 reviews; moves the production proxy pin to an affected version | Change request | Verified |
78
+ | **<date> 10:08:12Z** | **The pipeline for an unrelated release checks out the main branch (not the release commit) and updates both proxy deployments. Outage start** | Pipeline run | Verified |
79
+ | <date> 10:29Z to 10:31Z | A later pipeline run updates only the application; smoke passes | Pipeline run | Verified |
80
+ | <date> 10:47Z to 11:08Z | A manual production deploy fails rollout verification; unrelated to the bug | Pipeline run | Inferred (from the failure being in rollout verification of a different deployment) |
81
+ | <date> morning (approximate) | Agents report production healthy; the health endpoint and TCP probes cannot see the path | Incident notes | Unverified (time not anchored) |
82
+ | <date> 15:33Z | Fix change request opened by a maintainer, with the earliest diagnosis comment found | Fix change request | Verified |
83
+ | <date> 15:33Z | A first user report is mentioned; its author and time are not cited | Fix change request | Unverified |
84
+ | <date> 15:39:17Z | Fix merged; released at 15:39:31Z | Fix change request | Verified |
85
+ | <date> 15:46Z | Application pin change opened; root-cause comment at 15:47Z | Change request | Verified |
86
+ | <date> 16:11Z | An event-schema acknowledgement is added; without it the pipeline stops at the schema guard | Change request comment | Verified |
87
+ | <date> about 16:20Z (approximate) | A manual break-glass patch is blocked: it needs an override from the owner, and the proposed rollback target was the broken version | Incident notes | Unverified (approximate time) |
88
+ | <date> about 16:25Z (approximate) | The application deployment is scaled to zero by an unknown actor; a comment says another operator changed replicas | Change request comment | Unverified |
89
+ | <date> 16:41Z | Scaled back to one | Change request comment | Verified |
90
+ | <date> 17:32:32Z | Pin change merged; pipeline starts 17:32:36Z, behind two queued runs | Change request | Verified |
91
+ | **<date> 18:21:28Z** | **Both proxies on the fixed version; application ready 18:21:30. Outage end** | Change request comment | Verified |
92
+ | <date> 18:31:49Z | Anonymous public check: live paths now answer 401 instead of 404 | Change request comment | Verified |
93
+ | <date> 18:31:49Z | Signed-in confirmation of the fix | Change request comment | Unverified |
94
+
95
+ Durations: total 8h13m16s; to fix release 5h31m; fix release to deployed 2h42m.
96
+
97
+ ## Evidence
98
+ - Pipeline runs for the unrelated release, the later application run and the
99
+ manual deploy, with the workflow definition.
100
+ - The proxy change request, its release, the fix change request and the
101
+ application pin change requests, with their comments.
102
+ - The smoke script and the release list.
103
+ - Incident notes kept by the people responding.
104
+
105
+ **Evidence gaps:** proxy access logs, the cluster audit log and any user-report
106
+ records were not read, so the first failed request, the actor behind the scale
107
+ to zero and the number of affected users are unknown.
108
+
109
+ ## Verified facts
110
+ - The release commit's proxy pin was not what the pipeline deployed; the
111
+ pipeline deployed the main branch (pipeline run, workflow definition).
112
+ - The smoke step accepts either 401 or 404 for anonymous requests under the
113
+ reserved prefix (smoke script).
114
+ - The deep live-query check runs in-cluster against the application and
115
+ bypasses the proxy (smoke script).
116
+
117
+ ## Unverified claims
118
+ - The first failed user request was after the deploy (raised by a reviewer).
119
+ Confidence: Unverified. Why unverified: no access log was read. How to
120
+ verify: read proxy access logs for the window.
121
+ - No data corruption occurred (raised by a maintainer). Confidence: Inferred,
122
+ from the bug failing closed on live paths only. Why not verified: writes were
123
+ not examined. How to verify: compare writes before and after.
124
+ - Another operator scaled the deployment to zero (raised by an engineer).
125
+ Confidence: Unverified. Why unverified: no audit entry is cited. How to
126
+ verify: read the cluster audit log.
127
+
128
+ ## Detection
129
+ Found by a human, hours after rollout; no alert, smoke or agent check fired.
130
+ Why it was not found sooner:
131
+ 1. The smoke sign-in step accepts 401 or 404, so the bug's 404 passed.
132
+ 2. The deep check runs in-cluster against the application, bypassing the
133
+ proxy.
134
+ 3. The health endpoint and root path never touch the reserved prefix; proxy
135
+ probes are TCP-only.
136
+ 4. No external synthetic probe and no alert on live data.
137
+ 5. Smoke cannot roll anything back.
138
+ 6. The proxy had no consumer test against a real application; its own specs
139
+ encoded the bug.
140
+ 7. The upgrade review read release notes, which omitted the change.
141
+
142
+ ## Root causes
143
+ - **Trigger:** the application pipeline for an unrelated release deployed the
144
+ main branch, not the release commit, picking up the new proxy pin.
145
+ - **Root cause 1:** **Primary** Production ran a bad proxy because an unrelated
146
+ release deployed it, because the pipeline deploys a moving branch instead of
147
+ an immutable release reference, so an unrelated release ships every merge
148
+ made since.
149
+ - **Root cause 2:** **Primary** The bad change existed because a routing change
150
+ to security-critical infrastructure was merged in minutes, because required
151
+ review was not enforced on the repository.
152
+ - **Root cause 3:** It stayed live for hours because the checks accepted
153
+ "something answered" and could not see the failing path, because smoke
154
+ accepted 401 or 404 and the deep check bypassed the proxy.
155
+ - **Contributing factors:**
156
+ - Release notes did not disclose the behavior change, so a notes-based review
157
+ could not find it.
158
+ - No rollback path independent of building the application; the manual
159
+ override was blocked and named the broken version as the target.
160
+ - Incident fixes queued behind normal runs in the shared pipeline.
161
+ - **Detection and response gaps:** see Detection; reports of "healthy" did not
162
+ name what the check could not cover.
163
+
164
+ ## What went well
165
+ - The maintainer diagnosed and shipped the fix within six minutes of opening;
166
+ it uses an explicit owned-path list rather than a revert.
167
+ - Cause and affected paths are clearly written in the fix and the pin change.
168
+ - The other products' pins sat below the affected range.
169
+
170
+ ## What went poorly
171
+ - About 8h13m of exposure; 5h31m before a fix existed, 2h42m after.
172
+ - The smoke check was shaped so the failure passed.
173
+ - An unreviewed merge to an authentication component, and a deploy that
174
+ carried unreviewed main-branch content inside an unrelated release.
175
+ - The scale-to-zero by an unknown actor cost about 16 minutes.
176
+
177
+ ## Where we were lucky
178
+ - The bug failed closed (404), not as an authentication bypass.
179
+ - No data corruption is known (Inferred, from live paths only).
180
+ - A maintainer could diagnose from a signed-in browser.
181
+
182
+ ## Actions
183
+ | # | Action | Type | Owner | Issue | Status |
184
+ |---|---|---|---|---|---|
185
+ | 1 | Forward service-owned paths in the proxy | fix | @proxy-maintainer | <owner/repo>#<n> | Done |
186
+ | 2 | Pin the fixed version in the application | fix | @release-owner | <owner/repo>#<n> | Done |
187
+ | 3 | Deploy the release commit's configuration and record the image and version per deploy | prevent | @release-owner | <owner/repo>#<n> | Open |
188
+ | 4 | Add consumer tests against a real application and a breaking-change release-note rule | prevent | @proxy-maintainer | <owner/repo>#<n> | In progress |
189
+ | 5 | Assert the exact anonymous status and add a rollback step to smoke | detect | @release-owner | <owner/repo>#<n> | In progress |
190
+ | 6 | Add a signed-in smoke check from CI | detect | @release-owner | <owner/repo>#<n> | Open, blocked on a CI identity |
191
+ | 7 | Move auth infrastructure pins one minor version at a time, or prove them by smoke | prevent | @release-owner | <owner/repo>#<n> | Open |
192
+ | 8 | Audit every proxy reference against the affected range | verify | @release-owner | <owner/repo>#<n> | Open |
193
+ | 9 | A rollback procedure for the proxy independent of building the application, with a recorded last-known-good | mitigate | @platform-lead | <owner/repo>#<n> | In progress |
194
+ | 10 | Make the review workflow a required check on security repositories | prevent | @platform-lead | <owner/repo>#<n> | Open |
195
+ | 11 | External synthetic probe and alert on authenticated live queries | detect | @infrastructure-team | <owner/repo>#<n> | In progress |
196
+ | 12 | Identify who scaled the deployment to zero | verify | @platform-lead | <owner/repo>#<n> | Open |
197
+
198
+ ## Lessons
199
+ - Deploy what was released; a deploy from a moving branch ships every merge
200
+ since.
201
+ - A check that accepts "something answered" proves nothing; assert the exact
202
+ status and a real payload.
203
+ - A probe that bypasses the component under change does not test it.
204
+ - Routing and authentication changes are breaking whatever the version says; a
205
+ notes-based review cannot find what the notes omit, so test the consumer
206
+ contract.
207
+ - A rule that depends on someone choosing to ask for review is not a rule;
208
+ enforce it.
209
+ - Have a rollback you can run without building the thing that is broken.
210
+ - "Healthy" in a report must name what was and was not checked.
211
+
212
+ ## Redaction note
213
+ Generalized: product, repository and host names, people and agent identities,
214
+ run, job and change-request identifiers, commit hashes, versions, file and
215
+ line citations, unrelated incidents seen in the window, and internal
216
+ coordination details. Action owners and issue links are placeholders.
@@ -0,0 +1,44 @@
1
+ # Public-safe wording
2
+
3
+ A post-mortem and the issues filed from it may be public. Run this pass last,
4
+ over the review and over every issue body.
5
+
6
+ ## Remove or generalize
7
+
8
+ - Secrets of any kind: tokens, keys, passwords, connection strings. Write
9
+ `<redacted: kind>`; never the value, not even partly.
10
+ - Internal hostnames, addresses, cluster and bucket names, and local
11
+ filesystem paths. Use a role such as `<database-cluster>` or a repository
12
+ relative path.
13
+ - Personal names, emails and handles. Use roles: "the on-call engineer", "the
14
+ release owner".
15
+ - Customer names, and private repository or ticket titles that reveal
16
+ confidential work.
17
+ - Run, job and commit identifiers that only resolve in a private system. Keep a
18
+ stable public link, or write `<run-link>`.
19
+ - Speculation about a third party's fault. State what was observed.
20
+
21
+ ## Before and after
22
+
23
+ | Before | After |
24
+ |---|---|
25
+ | Alex approved it without review | The change was merged without review |
26
+ | Failed on db-07.corp.example | Failed on `<database-cluster>` |
27
+ | Read from a local home directory path | Read from `<local-config>` |
28
+ | Connection string pasted from the log | `<redacted: connection string>` |
29
+ | The vendor's bug broke our upload | Uploads failed after the tool upgrade; the cause is Unverified |
30
+
31
+ ## Scan checklist
32
+
33
+ Search the review and each issue body for these before publishing. A match is
34
+ either removed or justified as a public link.
35
+
36
+ - Local path prefixes for user home directories.
37
+ - `@` followed by a name, and email addresses.
38
+ - The words `token`, `key`, `password`, `secret`, `bearer`.
39
+ - IPv4 addresses and internal hostname suffixes.
40
+ - Long hexadecimal strings, which are often commit or key material.
41
+ - Private tracker identifiers that do not resolve publicly.
42
+
43
+ Finish with a **Redaction note** in the review naming the categories removed,
44
+ never the values.
@@ -0,0 +1,168 @@
1
+ # Post-mortem review template
2
+
3
+ ## Contents
4
+
5
+ - Template
6
+ - Column and value rules
7
+ - Synthetic example
8
+
9
+ Copy the template below, fill every section and delete the guidance in
10
+ parentheses. A section with nothing to say states that in one line; it is never
11
+ removed. The synthetic example at the end shows the level of detail.
12
+
13
+ ## Template
14
+
15
+ ```markdown
16
+ # Post-mortem: <short title>
17
+
18
+ Blameless. Status: **Draft | Final**. Times UTC. Every claim carries a
19
+ confidence: Verified, Inferred or Unverified. (State when tracker status was
20
+ read, for example "as read at write time".)
21
+
22
+ ## Summary
23
+ (3-5 sentences, facts only: what failed, the exposure window with start, end
24
+ and total duration, who or what was affected, how it was fixed, how it was
25
+ found. Only Verified material is stated as fact.)
26
+
27
+ ## Status and scope
28
+ (Incident window in UTC, severity, repositories and systems involved, review
29
+ date, whether the incident is over, what is still exposed.)
30
+
31
+ ## Impact
32
+ (A short text: how long, how much and how, with the measure and source of each
33
+ number; estimates say so. Remaining exposure. Mitigations that held, how each
34
+ was verified and its limits.)
35
+
36
+ **Affected**
37
+ - <who or what> (Confidence: Verified)
38
+ - <who or what> (Confidence: Inferred, from <the evidence it is derived from>)
39
+ - <who or what> (Confidence: Unverified)
40
+
41
+ ## Timeline (UTC)
42
+ | Time (UTC) | Event | Source | Confidence |
43
+ |---|---|---|---|
44
+ | <date> HH:MM:SSZ | <what happened> | <link> | Verified |
45
+ | **<date> HH:MM:SSZ** | **<outage start>** | <link> | Verified |
46
+ | <date> HH:MM:SSZ | <what follows from the evidence> | <link> | Inferred (from <evidence>) |
47
+ | <date> HH:MM:SSZ | <what someone reported> | <link> | Unverified |
48
+ | **<date> HH:MM:SSZ** | **<outage end>** | <link> | Verified |
49
+
50
+ (Durations: total, start to fix released, fix released to deployed.)
51
+
52
+ ## Evidence
53
+ (Every source with a stable link and what was read.)
54
+
55
+ **Evidence gaps:** (sources that could not be read, and what is unknown as a
56
+ result.)
57
+
58
+ ## Verified facts
59
+ (Each fact followed by its source.)
60
+
61
+ ## Unverified claims
62
+ - <claim> (raised by <role>). Confidence: Unverified | Inferred (from
63
+ <evidence>). Why unverified: <reason>. How to verify: <step>.
64
+
65
+ ## Detection
66
+ - <how and when it was found>
67
+ - <a reason it was not found sooner: the check that could not see it, the
68
+ status it accepted, the signal that does not exist>
69
+
70
+ ## Root causes
71
+ - **Trigger:** (the event that started it.)
72
+ - **Root cause:** **Primary** (why-chain: <effect> because <cause> because
73
+ <cause>, until the last cause is something a change can prevent.)
74
+ - **Root cause:** (another why-chain; mark it **Primary** only if it is one of
75
+ the main causes. A cause shared by several actions is named once.)
76
+ - **Contributing factors:** (conditions that made it worse or longer.)
77
+ - **Detection and response gaps:** (what slowed finding or fixing it.)
78
+
79
+ ## What went well
80
+ - <item>
81
+
82
+ ## What went poorly
83
+ - <item>
84
+
85
+ ## Where we were lucky
86
+ - <item>
87
+
88
+ ## Actions
89
+ | # | Action | Type | Owner | Issue | Status |
90
+ |---|---|---|---|---|---|
91
+ | 1 | <outcome, one action> | prevent | @<team-or-person> | <owner/repo>#<n> | Open |
92
+
93
+ (Type: prevent, detect, mitigate, fix, verify or process. Status: Needs
94
+ decision, Open, In progress, Done or Declined with the reason. In a **Draft**
95
+ review the Owner may be a proposed owner (a role or team) and Status may be
96
+ "Needs decision"; the Issue may be pending. The review becomes **Final** only
97
+ when every action has one named accountable owner and one linked issue, in the
98
+ repository that owns the work. Never "TBD" or "everyone" in a Final review. Add
99
+ a Filing column with `linked-existing` or `filed-new` when actions are filed
100
+ by an agent.)
101
+
102
+ ## Lessons
103
+ - <one line, phrased as a rule that can become a gate>
104
+
105
+ ## Redaction note
106
+ (Categories removed or generalized, not their values.)
107
+ ```
108
+
109
+ ## Column and value rules
110
+
111
+ - **Time.** ISO-8601 UTC. When the source used a local zone, convert and keep
112
+ the original in the Event cell ("09:15 local, converted").
113
+ - **Confidence.** Exactly `Verified`, `Inferred` or `Unverified`, in the
114
+ timeline, the Affected list and the claims. `Verified` needs a source.
115
+ `Inferred` means derived from verified evidence but not directly observed,
116
+ and names what it is inferred from. Everything else is `Unverified`.
117
+ - **Type.** Prefer `prevent` and `detect` actions that add or change a gate
118
+ over `process` reminders. A hold, freeze or override action carries an
119
+ expiry and a watcher.
120
+ - **One action, one issue.** Never cover two actions with one issue; never file
121
+ without a duplicate search.
122
+
123
+ ## Synthetic example
124
+
125
+ A short, fictional review that shows the shape; the worked examples in
126
+ `examples/` show a full one.
127
+
128
+ ```markdown
129
+ # Post-mortem: Nightly export skipped for three days
130
+
131
+ Blameless. Status: **Final**. Times UTC. Every claim carries a confidence.
132
+
133
+ ## Summary
134
+ The nightly export did not run from <date> 02:00Z to <date+3> 02:00Z, a gap of
135
+ 72 hours. A scheduler upgrade reset the job's enabled flag. A user noticed the
136
+ missing file and the job was re-enabled the same hour.
137
+
138
+ ## Impact
139
+ Three nightly exports were missed (72 hours), counted from the scheduler log.
140
+
141
+ **Affected**
142
+ - The downstream report that reads the export (Confidence: Verified)
143
+ - Two partner dashboards (Confidence: Inferred, from their read of the same
144
+ report)
145
+
146
+ ## Timeline (UTC)
147
+ | Time (UTC) | Event | Source | Confidence |
148
+ |---|---|---|---|
149
+ | <date> 01:40Z | Scheduler upgraded | deploy run link | Verified |
150
+ | **<date> 02:00Z** | **Export job did not start** | scheduler log link | Verified |
151
+ | <date+3> 09:12Z | User reports missing file | support ticket link | Verified |
152
+ | **<date+3> 09:48Z** | **Job re-enabled; export ran** | scheduler log link | Verified |
153
+
154
+ ## Unverified claims
155
+ - "The old version also dropped jobs" (raised by the on-call engineer).
156
+ Confidence: Unverified. Why unverified: no log of earlier runs is retained.
157
+ How to verify: check run history exports.
158
+
159
+ ## Root causes
160
+ - **Root cause:** **Primary** The job did not run because its enabled flag was
161
+ off, because the upgrade reset scheduler settings, because upgrades are not
162
+ followed by a check that jobs are enabled.
163
+
164
+ ## Actions
165
+ | # | Action | Type | Owner | Issue | Status |
166
+ |---|---|---|---|---|---|
167
+ | 1 | Alert when no export has finished in 26 hours | detect | @platform-team | <owner/repo>#<n> | Open |
168
+ ```
@@ -0,0 +1,13 @@
1
+ {
2
+ "skill": "cratis-engineering-post-mortem",
3
+ "input": "Write a post-mortem from an incident record with linked runs and a hearsay claim, with owned and linked actions.",
4
+ "fixtures": [],
5
+ "assertions": [
6
+ { "kind": "skill-contains", "value": "UTC" },
7
+ { "kind": "skill-contains", "value": "is derived from verified evidence" },
8
+ { "kind": "skill-contains", "value": "**Primary**" },
9
+ { "kind": "skill-contains", "value": "exactly one" },
10
+ { "kind": "skill-contains", "value": "search that tracker for an existing item" },
11
+ { "kind": "skill-contains", "value": "../../rules/secrets.md" }
12
+ ]
13
+ }
@@ -0,0 +1,2 @@
1
+ Copyright (c) Cratis. All rights reserved.
2
+ Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: cratis-screenplay-availability
3
+ description: Use when a Screenplay model must decide whether a module, feature or slice exists for a tenant, user or system, or when it provides ambient `$context` values. Not for who may act; use cratis-screenplay-command-surface for `authorize`.
4
+ license: MIT
5
+ ---
6
+
7
+ # Availability, audiences and context values
8
+
9
+ Read [preferred syntax](../cratis-screenplay-toolchain/references/preferred-syntax.md) when writing or reviewing `.play`.
10
+ Product facts come from Screenplay `availability.md`, `context.md`, `personas.md`
11
+ and `policies.md` under `Documentation/screenplay/`; run examples at the pinned
12
+ compiler before relying on them.
13
+
14
+ ## Pick the right mechanism
15
+
16
+ | Question | Use |
17
+ | --- | --- |
18
+ | Is this part there at all for this tenant, user or system (a package, a rollout, an incident switch)? | `audience`, `availability`, `available` |
19
+ | May this caller do it, given who they are and what they can prove? | `policy` and `authorize` ([command surface](../cratis-screenplay-command-surface/SKILL.md)) |
20
+ | Is this input acceptable? | `rule` and validation on the command |
21
+ | Does a gate or code need a value that is not in the request (the vessel viewed, the project worked in)? | `provide` and `$context.<name>` |
22
+ | Which tenant-level commercial module is bought? | Box Office module entitlements; outside the model |
23
+
24
+ Availability is decided **before** `authorize`. A part that is not available is refused as
25
+ `NotAvailable`, which a client can tell apart from not allowed, so it can hide an entry or
26
+ explain the package. Do not model a package, rollout or kill switch as a policy, and do not
27
+ model a role check as an audience.
28
+
29
+ ## The forms
30
+
31
+ ```screenplay excerpt
32
+ audience Plus
33
+ description "Customers on the Plus commercial package"
34
+
35
+ audience Preview
36
+ description "Tenants taking part in the preview"
37
+
38
+ availability DataQuality
39
+ description "Sold with Plus, once the vessel has reported"
40
+ for Plus
41
+ when $context.vessel.hasReported == true
42
+
43
+ module Fleet
44
+ feature DataQuality
45
+ available with DataQuality
46
+
47
+ slice StateView QualityScores
48
+ available for Plus or Preview
49
+ ```
50
+
51
+ - `audience <Name>` is a named group with a `description` and nothing else. The model
52
+ never says who is in it; membership is granted at runtime, so nothing ships as an accidental entitlement.
53
+ - `availability <Name>` is a reusable rule. Its `for`, `when` and `with` lines must all hold;
54
+ `with` builds on another availability. A `with` cycle is PLAY1137.
55
+ - `available for <audiences>`, `available when <condition>`, `available with <Availability>`.
56
+ `for` and `with` combine names with `and`, `or` and parentheses. A `when` is one condition with its own
57
+ `and`/`or`. One line holds one form; to mix forms, name them in an `availability` and use `with`.
58
+ Several `available` lines on one construct all have to hold.
59
+ - A gate is allowed on a module, feature, slice, command, query and screen. Gates AND down the
60
+ path from module to construct. Gate at the highest level that is true for everything beneath it.
61
+ - The runtime context carries `$context.audiences`, the union of the tenant's, user's and
62
+ system caller's audiences. Withdrawing a grant removes it from its own level only.
63
+
64
+ ## Rules the language holds
65
+
66
+ - **Unknown never opens a gate.** A missing audience, a missing value, an unresolved condition or an
67
+ undecided result leaves the part unavailable. An undeclared audience or availability is a warning
68
+ (PLAY1135, PLAY1136), not an error, and the gate stays closed.
69
+ - **Failure is not denial.** A lookup that errors fails the request as a retryable error; it is never
70
+ reported as `NotAvailable`.
71
+ - **Specifications always run with everything available.** They verify behavior, not entitlement. There is
72
+ no `given availability` form; do not invent one, and do not write a specification to prove a gate.
73
+ - **Events and observers are unaffected.** A reaction that produces into an unavailable slice is fine and
74
+ projections keep running, so switching a part on needs no replay. A reaction is never gated and runs with
75
+ the tenant's and system's audiences, never a user's.
76
+ - **Persona `audience` lines are authoring only.** `audience Plus` under a `persona` tells the board, Studio
77
+ and docs which audiences the persona is in. It changes nothing at runtime and is not in the executable model.
78
+ - **Cross-slice warning (PLAY1139).** A screen action, form or reaction that `invokes` a command whose audiences
79
+ can be off while the invoker's are on can be refused as not available. Align the audiences, or accept and say
80
+ why. `when` conditions are opaque and skipped, never guessed.
81
+
82
+ ## Three things called audience
83
+
84
+ | Name | Is |
85
+ | --- | --- |
86
+ | Screenplay `audience` | Who a part of the application is available to; membership granted at runtime |
87
+ | Chronicle routing audience | An event-routing label in event options; never an event field of the model |
88
+ | Token `aud` claim | Who a token is for; read as `$context.identity.claims.aud` |
89
+
90
+ They are unrelated. Never use `aud` to decide availability by name-matching an audience.
91
+ A gate needing both an audience and a Box Office entitlement reads a host value
92
+ (`provide entitlements from host`) in `available when`.
93
+
94
+ ## Provided context values
95
+
96
+ `provide <name> <Type>[ optional] from <source>` adds `$context.<name>` for everything beneath the level it
97
+ is written at: application, module, feature (features nest) or slice.
98
+
99
+ ```screenplay excerpt
100
+ module Fleet
101
+ provide region String from "Nordics"
102
+
103
+ feature DataQuality
104
+ slice StateView Vessels
105
+ provide vessel Vessel optional from query VesselByKey by $context.arguments.vesselId
106
+ ```
107
+
108
+ - **Sources:** `query <Query> [by <expression>, ...]` (a declared, keyed, snapshot, non-observable query whose
109
+ result type equals the provided type), `host`, a literal, an expression over other `$context` values,
110
+ or a `file`/inline code body under the line (not both with `from`).
111
+ - **Levels:** the nearest declaration of a name wins and must keep the type (PLAY1125). The same name twice at one level
112
+ is PLAY1123. Resolved once per request, lazily.
113
+ - **Reserved names:** `tenant`, `identity`, `causedBy`, `causation`, `occurred`, `audiences`, `command`, `arguments`
114
+ cannot be provided (PLAY1124).
115
+ - **State the key per job at the slice.** A slice states `$context.command.<key>` for a command and
116
+ `$context.arguments.<key>` for a query. A feature-level provider cannot do both; override at the slice.
117
+ - **Required versus optional.** Without `optional` the value is required: when absent, the request is refused with a
118
+ clear reason. With `optional`, code sees `null` and a gate reading it denies.
119
+ - **Absence versus failure.** Absence (no key, no row, host did not supply) is unknown, not an error. Failure (store down,
120
+ body throws, timeout) fails the request as a retryable error, never a denial.
121
+ - Code reads `context.Values.<Name>` or `ValuesAs<T>()` on `CommandContext`, `QueryContext`, `RuleContext`,
122
+ `PolicyContext` and `ProvideContext`.
123
+ - `host`, inline code and `file` sources are opaque: the reference evaluator reports a gate that reads one as
124
+ unsupported, never allowed or denied. Executing `provide` reports PLAY0268 until the toolchain admits it; model
125
+ it, review it, do not promise it runs.
126
+ - **Identity stays out of rules by default.** `RuleContext` sees `CausedBy`, not `Identity`; roles and claims belong in a
127
+ `policy`. A `provide` derived from `$context.identity` makes that value readable in a rule, so write it
128
+ only deliberately and say why.
129
+
130
+ ## A complete model
131
+
132
+ Read [complete example](references/complete-example.md) for a model that compiles with gates, an availability, a persona audience and a provided value.
133
+
134
+ ## Who owns what
135
+
136
+ Read [runtime ownership](references/runtime-ownership.md) when a request asks where a gate is enforced, how
137
+ audiences are granted, or whether application code can check one. Applications never call these directly.
138
+
139
+ ## Review checks
140
+
141
+ Read [review checks](references/review-checks.md) before accepting a model that uses `available` or `provide`.
142
+
143
+ ## Diagnostics
144
+
145
+ PLAY1119-1129 are `provide` (line shape, source, body, duplicates, reserved names, type override, query source, cycle).
146
+ PLAY1130-1141 are `audience`, `availability` and `available` (shape, duplicates, undeclared, cycle, unprovided value,
147
+ cross-slice invocation, gate tokens and parentheses). The full table is in the toolchain
148
+ [diagnostics](../cratis-screenplay-toolchain/references/diagnostics.md).
149
+ Fix by changing the model: declare the audience, name the availability, provide the value or correct the key; never remove a
150
+ gate to silence a warning.