project-brain 0.24.0 → 0.26.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 (61) hide show
  1. package/README.md +1 -1
  2. package/package.json +6 -6
  3. package/templates/project.claude.md +1 -1
  4. package/templates/skills/brain-audit/SKILL.md +17 -7
  5. package/templates/skills/brain-audit/references/abuse.md +36 -11
  6. package/templates/skills/brain-audit/references/accessibility.md +50 -22
  7. package/templates/skills/brain-audit/references/ai.md +39 -15
  8. package/templates/skills/brain-audit/references/analytics.md +34 -11
  9. package/templates/skills/brain-audit/references/api.md +38 -13
  10. package/templates/skills/brain-audit/references/backend.md +41 -9
  11. package/templates/skills/brain-audit/references/browser.md +146 -0
  12. package/templates/skills/brain-audit/references/complexity.md +22 -12
  13. package/templates/skills/brain-audit/references/concurrency.md +36 -18
  14. package/templates/skills/brain-audit/references/consistency.md +32 -9
  15. package/templates/skills/brain-audit/references/contract-drift.md +34 -16
  16. package/templates/skills/brain-audit/references/cost.md +45 -23
  17. package/templates/skills/brain-audit/references/cross-surface-parity.md +38 -11
  18. package/templates/skills/brain-audit/references/database.md +43 -17
  19. package/templates/skills/brain-audit/references/dependencies-licensing.md +27 -12
  20. package/templates/skills/brain-audit/references/design-system.md +40 -17
  21. package/templates/skills/brain-audit/references/devops.md +32 -17
  22. package/templates/skills/brain-audit/references/documentation.md +38 -16
  23. package/templates/skills/brain-audit/references/failure.md +40 -18
  24. package/templates/skills/brain-audit/references/feature-flags.md +31 -15
  25. package/templates/skills/brain-audit/references/flow-integrity.md +42 -10
  26. package/templates/skills/brain-audit/references/frontend.md +40 -12
  27. package/templates/skills/brain-audit/references/functional.md +31 -11
  28. package/templates/skills/brain-audit/references/future.md +28 -7
  29. package/templates/skills/brain-audit/references/goal.md +15 -6
  30. package/templates/skills/brain-audit/references/i18n.md +30 -8
  31. package/templates/skills/brain-audit/references/idempotency.md +46 -24
  32. package/templates/skills/brain-audit/references/infrastructure.md +43 -13
  33. package/templates/skills/brain-audit/references/mobile.md +37 -15
  34. package/templates/skills/brain-audit/references/multi-tenancy.md +41 -12
  35. package/templates/skills/brain-audit/references/numeric.md +33 -16
  36. package/templates/skills/brain-audit/references/observability.md +43 -19
  37. package/templates/skills/brain-audit/references/packaging.md +39 -13
  38. package/templates/skills/brain-audit/references/performance.md +43 -13
  39. package/templates/skills/brain-audit/references/privacy.md +38 -15
  40. package/templates/skills/brain-audit/references/product.md +29 -10
  41. package/templates/skills/brain-audit/references/prompt-spec-gap.md +34 -10
  42. package/templates/skills/brain-audit/references/reachability.md +38 -18
  43. package/templates/skills/brain-audit/references/repo-history.md +23 -16
  44. package/templates/skills/brain-audit/references/runtime.md +48 -10
  45. package/templates/skills/brain-audit/references/scalability.md +37 -10
  46. package/templates/skills/brain-audit/references/security.md +46 -22
  47. package/templates/skills/brain-audit/references/state-model.md +44 -15
  48. package/templates/skills/brain-audit/references/supply-chain.md +42 -13
  49. package/templates/skills/brain-audit/references/temporal.md +37 -14
  50. package/templates/skills/brain-audit/references/testing.md +38 -14
  51. package/templates/skills/brain-audit/references/tooling-baseline.md +34 -18
  52. package/templates/skills/brain-audit/references/type-safety.md +38 -19
  53. package/templates/skills/brain-audit/references/usability.md +78 -0
  54. package/templates/skills/brain-audit/references/versioning-compatibility.md +34 -12
  55. package/templates/skills/brain-audit/references/visual-design.md +38 -12
  56. package/templates/skills/brain-audit/references/web-metadata.md +47 -19
  57. package/templates/skills/brain-record/SKILL.md +297 -0
  58. package/templates/skills/brain-record/assets/build-video.sh +142 -0
  59. package/templates/skills/brain-record/assets/record.mjs +283 -0
  60. package/templates/skills/brain-record/references/pitfalls.md +233 -0
  61. package/templates/skills/brain-worktree/SKILL.md +103 -0
@@ -4,27 +4,29 @@ Does the code still serve the goal it was written for? Codebases drift: the goal
4
4
 
5
5
  ## Stated goal
6
6
 
7
- - [ ] Locate the goal as written — README opening, package description, ADRs, design docs. `search_code` the project name; `search_context` for "purpose" or "why".
8
- - [ ] If two sources state different goals, `search_code` each source's exact goal phrase to confirm both are current — rule out one being superseded by a changelog, deprecation note, or newer doc before calling it a live contradiction. A genuine contradiction is a `Medium` finding on its own. Pick neither; report both.
7
+ - [ ] Locate the goal as written — README opening, package description, ADRs, design docs. `search_code` the project name; `search_context` for "purpose" or "why". Where the README exists, confirm it states why the project exists, not only what it does and how to install it — a README that is entirely "what" and "how" with no "why" leaves the goal to be reconstructed from code, which is the condition the "no source states a goal" check below exists to catch; cross-reference it before scoring that check Medium. The "why" may live in a linked design doc or ADR the README points to rather than restating it — a link that resolves to a real doc satisfies this. (GitHub, Inc., "About READMEs" — https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes; Winters, Manshreck & Wright, eds., *Software Engineering at Google*, ch. 10, 2020 — https://abseil.io/resources/swe-book/html/ch10.html)
8
+ - [ ] If two sources state different goals, `search_code` each source's exact goal phrase to confirm both are current — rule out one being superseded by a changelog, deprecation note, or newer doc before calling it a live contradiction. A genuine contradiction is a `Medium` finding on its own. Pick neither; report both. (Winters, Manshreck & Wright, eds., *Software Engineering at Google*, ch. 10, 2020 — https://abseil.io/resources/swe-book/html/ch10.html)
9
9
  - [ ] If no source states a goal, `search_code` "purpose", "goal", "mission" across the repo root and docs directory to confirm the absence rather than assume it. A project whose purpose exists only in someone's head cannot be onboarded onto.
10
+ - [ ] Where the stated goal makes a scoped, checkable-sounding claim ("fast", "offline-capable", "zero-config", "lightweight"), `search_code` for a corresponding threshold, benchmark, or default (a perf budget, a fallback branch, a counted config surface). A claim with nothing in the repo that could confirm or refute it is a goal this module cannot actually test — name it as untestable rather than silently skipping it. Rule out a claim that is qualitative by design (e.g. "developer-friendly") where the goal source itself frames it as aspirational rather than a measurable constraint — quote the goal source's own framing before calling it untestable. (re:Work (Google), "Set goals with OKRs" — https://rework.withgoogle.com/en/guides/set-goals-with-okrs)
10
11
 
11
12
  ## Goal vs. architecture
12
13
 
13
14
  - [ ] The architecture serves the stated goal. `get_architecture` for the dependency list: a local-first tool with a hard cloud SDK dependency, a "simple" tool with a plugin system, a "fast" tool with a synchronous network call on the hot path — `find_callers` the hot-path function to confirm it is actually on a called-often path before flagging it. Each confirmed mismatch is a goal/structure defect.
14
15
  - [ ] The highest-PageRank symbols from `repo_map` sit on the goal's critical path. If the centre of the call graph is infrastructure rather than the core job, the project may have drifted into building a framework.
15
- - [ ] Constraints implied by the goal are actually enforced. "Offline-capable" ⇒ `search_code` the network-client import and check each call site has a degraded/cached path. "Zero-config" ⇒ `search_code` required config reads and count the keys with no default.
16
+ - [ ] Constraints implied by the goal are actually enforced. "Offline-capable" — owned by `failure.md` (`search_code` for a fallback branch on an optional dependency's failure: cached data, a degraded path); reuse its finding when it ran, and add a goal-specific finding here only where the goal claims something that check didn't cover. "Zero-config" ⇒ `search_code` required config reads and count the keys with no default.
16
17
 
17
18
  ## Goal vs. scope
18
19
 
19
- - [ ] Features that serve no stated goal. `find_callers` each major feature's entry point and check whether its purpose traces back to the stated goal. Not automatically wrong — but each needs a reason, or it is scope that will need maintenance forever.
20
+ - [ ] Features that serve no stated goal. `find_callers` each major feature's entry point and check whether its purpose traces back to the stated goal. Not automatically wrong — but each needs a reason, or it is scope that will need maintenance forever. For a feature already flagged this way, run `impact` on its entry point before recommending removal: a small, self-contained blast radius is a maintenance-cost finding (Low); a blast radius reaching unrelated call paths is a coupling finding as much as a scope finding, and the recommendation changes from "remove" to "isolate first" — name which callers were excluded (e.g. test/mock code) before calling a large blast radius coupling. (Fowler, "Yagni," martinfowler.com bliki — https://martinfowler.com/bliki/Yagni.html)
20
21
  - [ ] Goals with no supporting feature. Read the stated goal's claims one by one and `search_code` each for a corresponding entry point. The stated ambition nothing implements is usually the more expensive direction.
21
22
  - [ ] Abandoned directions: half-built subsystems, feature flags never turned on, TODOs older than the last major refactor. `search_code` for `TODO`/`FIXME` and, where `Repo History` is in the confirmed module set, cross-check the comment's age against recent activity in that file. Cross-check flags with `Reachability`.
22
23
 
23
24
  ## Decision record
24
25
 
25
- - [ ] Significant architectural choices have a recorded why — ADR, design doc, or at minimum a comment. `search_code` the decision's keyword (the technology or pattern name) across `docs/adr`, `docs/`, and the comments near its `find_symbol` location. An unexplained choice cannot be revisited safely because nobody knows what it was trading against.
26
- - [ ] Decisions that were reversed are recorded as reversed, not silently overwritten. `search_code` for an ADR or doc marked superseded; a reversal with no trace at all means the next person re-litigates a settled question.
26
+ - [ ] Significant architectural choices have a recorded why — ADR, design doc, or at minimum a comment. `search_code` the decision's keyword (the technology or pattern name) across `docs/adr`, `docs/`, and the comments near its `find_symbol` location. An unexplained choice cannot be revisited safely because nobody knows what it was trading against. (ADR GitHub Organization, "Architectural Decision Records" — https://adr.github.io/; Nygard, "Documenting Architecture Decisions," Cognitect blog, 2011 — https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions)
27
+ - [ ] Decisions that were reversed are recorded as reversed, not silently overwritten. `search_code` for an ADR or doc marked superseded; a reversal with no trace at all means the next person re-litigates a settled question. (ADR GitHub Organization, "Architectural Decision Records" — https://adr.github.io/; Nygard, "Documenting Architecture Decisions," Cognitect blog, 2011 — https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions)
27
28
  - [ ] Where a decision's rationale has expired (the constraint it optimised for is gone), flag it. Read the ADR/comment's stated constraint and check via `find_symbol`/`find_callers` whether the code that constraint drove is still present unchanged. That is the highest-value finding in this module.
29
+ - [ ] Where a `docs/adr/` (or equivalent) directory exists, `search_code` its most recent entry and compare its subject against `get_architecture`'s current dependency list and `repo_map`'s current top symbols. An ADR directory whose newest entry predates a dependency or architectural centre visible today is a decision-record practice that lapsed, not one that is healthy — record it as a distinct finding from "no ADR directory at all," since the two have different fixes. Check whether `get_architecture`'s dependency list or `repo_map`'s top symbols actually changed since that entry, not just whether time passed, before flagging. Where `Repo History` is in the confirmed module set, cross-check its findings to promote this past `inferred`.
28
30
 
29
31
  ## Out of static reach
30
32
 
@@ -32,6 +34,10 @@ Does the code still serve the goal it was written for? Codebases drift: the goal
32
34
  - Whether an architectural mismatch actually causes pain in practice, versus being theoretically inconsistent.
33
35
  - Team intent behind an undocumented decision, when no comment, ADR, or commit message records it.
34
36
  - Whether a decision's original constraint has genuinely expired, when nothing in the repo dates the constraint itself.
37
+ - Whether a stated goal was understood by its authors as a firm commitment or an aspirational stretch — this module reads what was written, not how it was discussed.
38
+ - Whether the stated goal is genuinely aspirational or simply describes what the code already does — that judgement needs the team's own account, not the repo alone.
39
+ - Whether a recorded decision's stated context was complete and accurate at the time — this module can confirm a record exists, not that it told the whole story.
40
+ - Whether an unused feature's complexity tax has materially slowed real changes — this module measures coupling via `impact`, not historical change velocity.
35
41
 
36
42
  ## Severity guidance
37
43
 
@@ -41,5 +47,8 @@ Does the code still serve the goal it was written for? Codebases drift: the goal
41
47
  | Two sources state contradictory goals, both confirmed current | Medium |
42
48
  | No goal recorded anywhere | Medium |
43
49
  | Decision whose rationale has expired | Medium |
50
+ | Goal claim scoped and checkable-sounding but nothing in the repo can confirm or refute it | Medium |
51
+ | ADR/decision-record practice lapsed while the architecture kept moving | Medium |
44
52
  | Feature serving no stated goal | Low |
45
53
  | Abandoned direction still in the tree | Low |
54
+ | README states what and how but never why the project exists | Low |
@@ -9,6 +9,7 @@ The core of this module is the two-directional key sweep from `reachability.md`,
9
9
  - [ ] **Keys used in code but missing from a locale file.** `search_code` for the translation call (`t(`, `i18n.t(`, `formatMessage(`) and extract the literal key arguments; diff that set against each locale file's keys. Any key present in code and absent from a shipped locale is `High` — the user sees the raw key, or a crash.
10
10
  - [ ] Keys present in locale files that no call site uses. Take each locale's key list and `search_code` it back against the codebase — a key with zero call-site hits is dead translation weight, and translators still pay to maintain it.
11
11
  - [ ] Every locale has the same key set. Read each locale file (`en.json`, `es.json`, …) and diff their key sets directly — a key present in the default locale and absent from another means that locale degrades in production only, and a manual spot-check in the default locale would never catch it.
12
+ - [ ] The key-integrity diffs above (used-but-missing, orphaned, cross-locale parity) normalize both sides before comparing. `search_code` the diffing script or i18n tooling for an explicit `.normalize('NFC')` (or equivalent) call before the key/value comparison; two visually and semantically identical keys or values encoded with different Unicode normalization forms (precomposed vs. combining-mark sequences) compare unequal as raw strings, producing a false "missing key" or false "orphan key" finding that no visual review would ever catch. Refuted when the i18n tooling or JS runtime already normalizes internally (many ICU-backed libraries do), or the locale files are round-tripped through a formatter that canonicalizes encoding on save (Unicode Consortium, UAX #15 Unicode Normalization Forms, current, https://unicode.org/reports/tr15/ — "two equivalent strings will have precisely the same normalized form" only after normalization; without it, canonically equivalent sequences differ at the byte level and fail binary/string comparison).
12
13
  - [ ] Dynamically constructed keys — `t('errors.' + code)` — cannot be statically verified by a direct diff. `search_code` for template-literal or concatenation inside a translation call, then read the type/enum backing the interpolated variable and check each possible resulting key exists in every locale; where the value set is unbounded (raw user input), flag the construction itself as unverifiable rather than guessing.
13
14
  - [ ] Keys are namespaced consistently, and the namespace scheme is one scheme. Read locale files from two or three different feature areas and compare their nesting convention (`feature.section.key` vs a flat key with a prefix) — a second scheme introduced partway through is drift, visible directly in the file structure.
14
15
 
@@ -20,25 +21,27 @@ The core of this module is the two-directional key sweep from `reachability.md`,
20
21
 
21
22
  ## Formatting
22
23
 
23
- - [ ] Dates, times, numbers, currencies, and percentages go through locale-aware formatting rather than manual concatenation. `search_code` for hand-built date strings (`${year}-${month}-${day}`, `.toLocaleDateString()` called with no locale argument) instead of the project's formatting library used with an explicit locale.
24
+ - [ ] Dates, times, numbers, currencies, and percentages go through locale-aware formatting rather than manual concatenation. `search_code` for hand-built date strings (`${year}-${month}-${day}`, `.toLocaleDateString()` called with no locale argument) instead of the project's formatting library used with an explicit locale (Ecma International, ECMA-402, current, https://tc39.es/ecma402/ — `Intl.NumberFormat`/`Intl.DateTimeFormat` standardize locale-aware formatting; plain ECMA-262 `toLocaleString()` behaviour is "largely implementation-defined," the exact gap these APIs close).
24
25
  - [ ] Timezone handling is explicit for anything displayed to a user. `search_code` the date-display paths for a threaded-through timezone (`Intl.DateTimeFormat` with `timeZone`, or an explicit UTC conversion) — a bare `new Date().toString()` rendered to the user takes on the server's timezone, not theirs.
25
- - [ ] Currency carries an explicit currency code, never an assumed one. `search_code` for a hardcoded `$`/`€` prefix concatenated onto a number, versus `Intl.NumberFormat(locale, { style: 'currency', currency })` — the concatenated symbol assumes both the currency and its position, which differ across locales.
26
- - [ ] Sorting uses locale-aware collation where the list is user-visible. `search_code` for `.sort(` on user-visible string arrays and check whether the comparator uses `localeCompare` — a default `.sort()` on strings orders by UTF-16 code unit, wrong for accented and non-Latin scripts.
27
- - [ ] The runtime formatting non-English locales actually has that locale's data installed, not just the code path to request it. `search_code` the deployment config, `Dockerfile`, or `package.json` for `full-icu`/`--with-intl=full-icu`, or confirm the runtime version bundles full ICU by default — a Node process built against `small-icu` silently formats every locale as `en-US` instead of throwing, so `Intl.NumberFormat('de-DE', ...)` can be correct on a developer's machine and silently wrong in a minimal production container with no error to catch it.
26
+ - [ ] Currency carries an explicit currency code, never an assumed one. `search_code` for a hardcoded `$`/`€` prefix concatenated onto a number, versus `Intl.NumberFormat(locale, { style: 'currency', currency })` — the concatenated symbol assumes both the currency and its position, which differ across locales (Ecma International, ECMA-402, current, https://tc39.es/ecma402/ — `Intl.NumberFormat` standardizes currency-aware formatting).
27
+ - [ ] Sorting uses locale-aware collation where the list is user-visible. `search_code` for `.sort(` on user-visible string arrays and check whether the comparator uses `localeCompare` — a default `.sort()` on strings orders by UTF-16 code unit, wrong for accented and non-Latin scripts (Ecma International, ECMA-402, current, https://tc39.es/ecma402/ — `Intl.Collator` standardizes locale-aware string comparison).
28
+ - [ ] The runtime formatting non-English locales actually has that locale's data installed, not just the code path to request it. `search_code` the deployment config, `Dockerfile`, or `package.json` for `full-icu`/`--with-intl=full-icu`, or confirm the runtime version bundles full ICU by default — a Node process built against `small-icu` silently formats every locale as `en-US` instead of throwing, so `Intl.NumberFormat('de-DE', ...)` can be correct on a developer's machine and silently wrong in a minimal production container with no error to catch it (OpenJS Foundation, Node.js documentation, current, https://nodejs.org/api/intl.html — on `small-icu`, non-English locales "do not throw errors but produce unpredictable results"; `Intl.DateTimeFormat('es', {month:'long'})` can print `"M01"` instead of `"enero"`, silently).
28
29
 
29
30
  ## Grammar
30
31
 
31
- - [ ] Pluralisation uses the framework's plural rules, not `count === 1 ? x : y`. `search_code` for that exact ternary shape gated on a count variable — each hit is provably wrong for any language with more than two plural forms, independent of which languages currently ship. CLDR defines up to six plural categories (`zero`, `one`, `two`, `few`, `many`, `other`); Arabic and Welsh use all six, Russian and Polish use four — a binary ternary collapses all of them to two.
32
+ - [ ] Pluralisation uses the framework's plural rules, not `count === 1 ? x : y`. `search_code` for that exact ternary shape gated on a count variable — each hit is provably wrong for any language with more than two plural forms, independent of which languages currently ship. CLDR defines up to six plural categories (`zero`, `one`, `two`, `few`, `many`, `other`); Arabic and Welsh use all six, Russian and Polish use four — a binary ternary collapses all of them to two (Unicode Consortium/CLDR-TC, current, https://cldr.unicode.org/index/cldr-spec/plural-rules, and MDN Web Docs, Mozilla, current, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules — `Intl.PluralRules` returns one of the six tags; plural rules affect nouns, verbs and pronouns, not just the count word itself).
32
33
  - [ ] No sentences assembled from concatenated fragments — word order differs across languages, so the fragments cannot be reordered. `search_code` for adjacent translation calls joined by string concatenation or interpolated into one template literal.
33
34
  - [ ] Interpolated values are named placeholders, not positional ones, so translators can reorder them. `search_code` translation call sites for a positional arguments array (`t('key', [name, date])`) versus a named object (`t('key', { name, date })`) — positional arguments force every locale to keep the source language's argument order.
34
- - [ ] Gendered or context-dependent strings have the context available to the translator. `search_code` for `select`/`gender` ICU MessageFormat blocks, or their absence around a string known to vary by subject ("He/She updated the profile") — gendered content with no ICU block hardcodes one gender into the key. ICU MessageFormat's `plural`/`select` constructs are the baseline to check for — MessageFormat 2 (the successor spec) reached its stable Final Candidate in 2025, but tooling adoption is still early as of 2026, so its absence by name is not itself a finding.
35
+ - [ ] Gendered or context-dependent strings have the context available to the translator. `search_code` for `select`/`gender` ICU MessageFormat blocks, or their absence around a string known to vary by subject ("He/She updated the profile") — gendered content with no ICU block hardcodes one gender into the key. ICU MessageFormat's `plural`/`select` constructs are the baseline to check for — MessageFormat 2 (the successor spec) reached Final Candidate status in Jan 2025 and Stable status in March 2025 (CLDR 47), but tooling adoption is still early as of 2026, so its absence by name is not itself a finding (Unicode Consortium/CLDR-TC, CLDR 47 release notes, 2025, https://cldr.unicode.org/index/downloads/cldr-47 — "MessageFormat has advanced from Final Candidate to Stable," released 2025-03-13, with tech-preview implementations already in ICU 76). Where a message nests both constructs, `select` sits on the outside and `plural` nests inside — `search_code` locale files or message-catalog sources for a message combining both and check the nesting order; an inverted order (plural outside, select inside) forces every select branch to duplicate the full plural block, quietly multiplying maintenance surface and drift risk each time a plural form changes. Refuted when only one of the two constructs is present in the message — the check does not apply.
35
36
 
36
37
  ## Layout
37
38
 
38
- - [ ] Text expansion is tolerated — translations commonly run 30–50% longer. `search_code` for a fixed pixel/rem width or `white-space: nowrap` on a container wrapping translated text (a button label, a nav item) — a fixed-width label sized to the English string truncates or overflows once a longer locale renders.
39
+ - [ ] Short UI labels (roughly under 20–30 characters — button text, nav items, badges) need headroom well beyond 30–50%: real-world data puts single words and short labels at 160–300% expansion. The 30–50% figure only becomes realistic once a string passes about 30–50 characters, and a 15–30% figure applies to long, full-sentence passages over roughly 70 characters. `search_code` for a fixed pixel/rem width or `white-space: nowrap` on a container wrapping translated text (a button label, a nav item) — a fixed-width label sized for the English string with only 30–50% headroom will still truncate for many short-label translations (W3C Internationalization WG, current, https://www.w3.org/International/articles/article-text-size — citing IBM localization guidance: strings up to 10 characters expect 200–300% expansion, 11–20 chars expect 180–200%, tapering to ~130% past 70 characters; a worked example shows "views" expanding 2.6–3x across French/Portuguese/German/Italian).
39
40
  - [ ] Right-to-left layout is handled if any supported locale requires it: logical CSS properties, mirrored icons, correct text direction. `search_code` the locale config for an RTL language (`ar`, `he`, `fa`, `ur`); if one is present, `search_code` the stylesheet for physical properties (`margin-left`, `left:`, `text-align: left`) instead of logical ones (`margin-inline-start`, `inset-inline-start`) — physical properties do not flip under `dir="rtl"`.
40
41
  - [ ] Direction is set via the `dir` attribute, not left to CSS alone, and lives at the document root. Where an RTL locale is present, `search_code` the root layout, `_document`, or SSR template for `dir=` bound to the active locale on the `<html>` element — W3C's own i18n guidance treats markup, not a `direction:` stylesheet rule, as the authoritative source, since the Unicode bidi algorithm and assistive technology both key off the attribute. A hardcoded `dir="ltr"` on the root with RTL handled only in CSS is the finding.
41
- - [ ] Opposite-direction fragments embedded inside RTL prose — a username, a product code, a foreign proper noun — are wrapped, not left to automatic direction detection. `search_code` for `<bdi` or an explicit `dir=` span around interpolated values in components that render user-generated or mixed-script content next to translated RTL text; unwrapped interpolation is where individual characters or whole substrings visibly reorder.
42
+ - [ ] The root `<html>` element's `lang` attribute is bound to the resolved active locale, not a literal string. `search_code` the root layout, `_document`, or SSR template for `lang=` and check whether it reads from the same locale-resolution source the rest of the app uses, or is hardcoded (`lang="en"`) regardless of which locale actually rendered; optionally `find_symbol`/`trace_path` from the locale-resolution function to confirm it actually reaches the attribute. Refuted when `lang=` is bound via a templating expression that reads the same resolved-locale value used elsewhere in the app — read the actual binding, not just the presence of a `lang=` token (W3C Web Accessibility Initiative, WCAG 2.2 Understanding, current, https://www.w3.org/WAI/WCAG22/Understanding/language-of-page.html — SC 3.1.1: "the default human language of each web page can be programmatically determined," required for correct screen-reader/TTS pronunciation).
43
+ - [ ] A passage or phrase in a language different from the page's default — a quoted testimonial, a foreign-language excerpt, third-party or user-generated content in a known different language — carries its own `lang=` override, except proper names, technical terms, and vernacular loanwords. `search_code` components that render third-party or user-supplied content alongside translated UI for a `lang=` attribute applied when that content's language is known and differs from the page default. Refuted when the content type is one of the exceptions (proper name, technical term, word of indeterminate language, vernacular loanword) — name the exception before dropping the finding (W3C Web Accessibility Initiative, WCAG 2.2 Understanding, current, https://www.w3.org/WAI/WCAG22/Understanding/language-of-parts.html — SC 3.1.2, language of parts, with its explicit exception list).
44
+ - [ ] Opposite-direction fragments embedded inside RTL prose — a username, a product code, a foreign proper noun — are wrapped, not left to automatic direction detection. `search_code` for `<bdi` or an explicit `dir=` span around interpolated values in components that render user-generated or mixed-script content next to translated RTL text; unwrapped interpolation is where individual characters or whole substrings visibly reorder (W3C Internationalization WG, current, https://www.w3.org/International/articles/inline-bidi-markup/ — the `bdi` element provides "directional isolation" for embedded opposite-direction fragments; without it, neutral characters, numbers, and punctuation at the boundary can attach to the wrong directional run).
42
45
  - [ ] Fonts cover the character sets of every supported locale. `search_code` the `@font-face`/font-family declarations and cross-reference the typeface against the declared locale list — a Latin-only webfont with no fallback stack shipped alongside a CJK or Cyrillic locale is readable from the declaration; whether the glyphs actually render correctly still needs a rendered check.
43
46
  - [ ] Truncation is by grapheme, not by byte or code unit. `search_code` for `.slice(`/`.substring(`/`.substr(` applied to a string headed for display and check whether it precedes a grapheme-aware truncation utility (`Intl.Segmenter`, or a surrogate-pair-aware library) — plain index slicing on a string containing emoji or combining characters splits a visible character in half.
44
47
 
@@ -55,6 +58,21 @@ The core of this module is the two-directional key sweep from `reachability.md`,
55
58
  - Actual rendered text expansion and truncation at real container widths.
56
59
  - Whether RTL mirroring (icons, directional imagery) is visually correct, beyond which CSS property class was used.
57
60
  - Translation quality and tone consistency across a locale.
61
+ - Whether a translated string contains a confusable substitution for a security-sensitive label — this module reads string content, not character-skeleton equivalence.
62
+ - Translator context and process quality — no source-level or bundle artefact records what a translator was shown.
63
+ - Whether the resulting bidi run actually displays correctly for a given real string — this module confirms the wrapper is present in source, not the rendered visual order. (Where `browser.md` ran, a screenshot can partially close this per the existing RTL-mirroring observed row below.)
64
+ - Runtime conformance of a locale library to the CLDR plural rules or MessageFormat 2 spec it claims to implement — this module checks for presence and usage, not spec conformance.
65
+
66
+ ## What browser observation closes
67
+
68
+ Applies only when `browser.md` ran; findings here are `observed` and cite the bundle path with a line or step number.
69
+
70
+ | Artefact | Gap it closes | Observed instance earns |
71
+ |---|---|---|
72
+ | `steps.md` | Rendered text expansion or truncation at real container widths, confirmed by a screenshot per step | Medium |
73
+ | `steps.md` | RTL mirroring of icons and directional imagery, confirmed visually correct or not per step | Medium |
74
+ | `steps.md` / `read_page` output — `document.documentElement.lang` captured per step, compared against the locale switcher's active state | `<html>` `lang` value does not match the locale actually selected during a language-switch flow. Refuted if the mismatch is a transient hydration flash that corrects within the same step's final captured state, not the persisted state | High |
75
+ | `steps.md` / `read_page` output | Raw translation key or untranslated fallback string rendered on screen during a non-default-locale flow (e.g. `errors.notFound`, or default-locale text where the walked locale was not default). Refuted if the locale file itself declares the string as an intentionally untranslated brand/product name rather than a missing translation | High |
58
76
 
59
77
  ## Severity guidance
60
78
 
@@ -73,3 +91,7 @@ The core of this module is the two-directional key sweep from `reachability.md`,
73
91
  | Positional instead of named placeholders | Low |
74
92
  | Layout that breaks on text expansion | Low |
75
93
  | Unused keys in locale files | Low |
94
+ | `<html lang>` hardcoded rather than bound to the resolved locale | High |
95
+ | Key-integrity diff run without Unicode normalization, risking false missing/orphan findings | Medium |
96
+ | Embedded foreign-language passage with no `lang=` override | Medium |
97
+ | Nested ICU `select`/`plural` construct in the wrong order | Low |
@@ -7,31 +7,35 @@ Is repetition safe? Gate: retries, webhooks, queues, or externally-triggered wri
7
7
  ## Reachable retry surface
8
8
 
9
9
  - [ ] Every write reachable from a retryable entry point — `trace_path` from each retry helper, queue consumer, or webhook route to the write(s) it performs. A retry wrapper that only retries a read is not a finding here; one that retries a write is the starting point for everything below.
10
- - [ ] For each such write: does an idempotency key exist on the request, and where does it come from? A client-generated key survives a client-side retry (the client resends the same key); a server-generated key does not — the server assigns a new one on retry and the write happens again. `find_symbol` the key generation to see which side owns it. There is no ratified standard to check this against — `draft-ietf-httpapi-idempotency-key-header` expired 2026-04-18 with no successor draft — so judge it against the convention Stripe and AWS both implement (client-generated), not a spec.
11
- - [ ] The key is enforced by a uniqueness constraint (DB unique index, `INSERT ... ON CONFLICT`, a dedupe table with a unique key) rather than only a read-then-write existence check. A "look up by key, if not found insert" without a constraint is itself a race — cross-reference `concurrency.md` for the read-modify-write pattern, but report the missing-constraint instance here since the *mechanism* is this module's concern.
12
- - [ ] A key reused with a *different* request body is rejected, not silently replayed or silently reprocessed — `search_code` the key-lookup site for a stored-payload comparison (a hash or field-by-field check) before treating the request as a duplicate. Stripe and AWS both make this a hard error (AWS EC2's `IdempotentParameterMismatch`); a handler that only keys on the identifier and ignores the body lets a retried-with-different-arguments call silently do the wrong thing.
13
- - [ ] A duplicate key with the *same* payload replays the original stored response rather than recomputing a fresh one — read the key-hit branch for a stored-response return versus falling through to re-execute business logic. Recomputing breaks the caller's assumption that a retry is a no-op if downstream state moved between the two attempts (a price, an inventory count).
14
- - [ ] The idempotency key's scope — is it unique per operation type and per actor, or global? A key that is unique only by value (not scoped to the endpoint or the account) lets one caller's retry key collide with an unrelated operation from another caller, silently short-circuiting a legitimate second write as a "duplicate."
10
+ - [ ] For each such write: does an idempotency key exist on the request, and where does it come from? A client-generated key survives a client-side retry (the client resends the same key); a server-generated key does not — the server assigns a new one on retry and the write happens again. `find_symbol` the key generation to see which side owns it. There is no ratified standard to check this against — `draft-ietf-httpapi-idempotency-key-header` expired 2026-04-18 with no successor draft (IETF HTTPAPI Working Group, official datatracker record, 2025-2026, https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/) — so judge it against the convention Stripe and AWS both implement (client-generated, not derived) (Stripe, official API reference, current, https://docs.stripe.com/api/idempotent_requests; AWS, official EC2 developer guide, current, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html; AWS Builders' Library, official vendor engineering guide, current, https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/), not a spec.
11
+ - [ ] The idempotency key is a caller-supplied unique identifier, not a value the server derives by hashing or otherwise computing from the request body — `find_symbol` the key-generation site and `Read` it. A derived key silently collapses two distinct, intentionally identical requests (e.g., two separate $10 charges to the same card, minutes apart) into one — the write that should have happened a second time never does, and nothing reports an error. AWS's own preferred approach is "a unique caller-provided client request identifier," not a token derived from the request's own parameters (AWS Builders' Library, official vendor engineering guide, current, https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/); Stripe similarly suggests V4 UUIDs, not content-derived hashes (Stripe, official API reference, current, https://docs.stripe.com/api/idempotent_requests). Refuted if the endpoint's documented contract is itself content-based dedup (e.g., an upload-dedup endpoint where identical content should collapse by design) — confirm the endpoint's intended semantics before flagging.
12
+ - [ ] The key is enforced by a uniqueness constraint (DB unique index, `INSERT ... ON CONFLICT`, a dedupe table with a unique key) rather than only a read-then-write existence check — `find_symbol` the write path and `Read` it to confirm which of these it uses (AWS Builders' Library, official vendor engineering guide, current, https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/). A "look up by key, if not found insert" without a constraint is itself a race — cross-reference `concurrency.md` for the read-modify-write pattern, but report the missing-constraint instance here since the *mechanism* is this module's concern.
13
+ - [ ] A key reused with a *different* request body is rejected, not silently replayed or silently reprocessed — `search_code` the key-lookup site for a stored-payload comparison (a hash or field-by-field check) before treating the request as a duplicate. Stripe and AWS both make this a hard error: Stripe "compares incoming parameters to those of the original request and errors if they're not the same" (Stripe, official API reference, current, https://docs.stripe.com/api/idempotent_requests), and AWS EC2's client-token retry with different parameters "fails with an `IdempotentParameterMismatch` error" (AWS, official EC2 developer guide, current, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html); a handler that only keys on the identifier and ignores the body lets a retried-with-different-arguments call silently do the wrong thing.
14
+ - [ ] A duplicate key with the *same* payload replays the original stored response rather than recomputing a fresh one — `find_symbol` the key-lookup handler and `Read` the key-hit branch for a stored-response return versus falling through to re-execute business logic. Stripe saves the status code and body of the first request and replays it on a retry with the same key, "including `500` errors" (Stripe, official API reference, current, https://docs.stripe.com/api/idempotent_requests); AWS's own guidance is that a matching retry should get "the same meaning as the first response" (AWS Builders' Library, official vendor engineering guide, current, https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/). Recomputing breaks the caller's assumption that a retry is a no-op if downstream state moved between the two attempts (a price, an inventory count).
15
+ - [ ] The idempotency key's scope — is it unique per operation type and per actor, or global? `find_symbol` the key-generation/lookup site and `Read` what it scopes the key to. A key that is unique only by value (not scoped to the endpoint or the account) lets one caller's retry key collide with an unrelated operation from another caller, silently short-circuiting a legitimate second write as a "duplicate."
15
16
 
16
17
  ## Webhooks
17
18
 
18
- - [ ] Signature verification present on every webhook route before the payload is trusted — `search_code` the webhook handler for a signature/HMAC check (Stripe's `Stripe-Signature`, HMAC-SHA256 over `timestamp.payload`; GitHub's `X-Hub-Signature-256`; or the cross-vendor Standard Webhooks spec — `webhook-signature`/`svix-signature`, HMAC-SHA256 over `msg_id.timestamp.payload`, now adopted by 40+ providers including OpenAI, Anthropic, and Twilio). Its absence means anyone who finds the URL can trigger the write, not just a genuine retry.
19
- - [ ] The comparison is constant-time, not `==`/`===`/string equality — `search_code` for the signature-compare line and confirm it calls a constant-time primitive (`crypto.timingSafeEqual` in Node, `hmac.compare_digest` in Python, `hash_equals` in PHP, `Rack::Utils.secure_compare` in Ruby). GitHub's and Stripe's own docs both call out plain `==` explicitly: it short-circuits on the first mismatched byte and leaks the correct prefix through response timing.
20
- - [ ] The signature is computed over the raw request body, not a re-serialised copy — `search_code` for a body-parsing middleware (Express's `express.json()` mounted globally is the canonical case) that runs before the webhook route and reparses the payload. Re-serialising JSON changes key order, whitespace, and number formatting, which changes the bytes the HMAC covers and breaks verification — the raw body must be captured before any parsing, scoped to the webhook route specifically.
21
- - [ ] A replay window — is a signed-but-stale payload (timestamp far in the past) still accepted? Stripe's default tolerance is 5 minutes, and its own docs warn against setting tolerance to 0 (that disables the check entirely). Without a window, a captured valid payload can be replayed indefinitely.
22
- - [ ] The provider's event ID is stored and checked before processing, not just the payload's business data — `find_callees` from the handler to confirm a lookup against previously-seen event IDs happens before the side-effecting write, not after.
23
- - [ ] Fields inside the payload (an `event_type`, a `customer_id`) are not used to route or act on the request before the signature is verified — verification must gate every use of the body, not just the parts a developer remembered to protect.
24
- - [ ] Out-of-order delivery: a handler that assumes events arrive in the order they were sent (e.g. `payment.created` before `payment.refunded`) — most providers guarantee at-least-once, not ordered, delivery. `search_code` for sequencing assumptions (a state transition that would break if the "later" event arrived first).
25
- - [ ] Duplicate webhook deliveries from provider-side retries (the provider itself retries on a non-2xx or a timeout) versus the handler's own idempotency check — confirm the handler returns success only after the write is durably committed, not before, or the provider will interpret a slow success as a failure and retry a request that already landed.
19
+ - [ ] Signature verification present on every webhook route before the payload is trusted — `search_code` the webhook handler for a signature/HMAC check (Stripe's `Stripe-Signature`, HMAC-SHA256 over `timestamp.payload` (Stripe, official product documentation, current, https://docs.stripe.com/webhooks); GitHub's `X-Hub-Signature-256`, HMAC-SHA256 over the raw payload (GitHub, official product documentation, current, https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries); or the cross-vendor Standard Webhooks spec — the `webhook-signature` header, some implementations also sending the legacy `svix-signature` for compatibility, HMAC-SHA256 over `msg_id.timestamp.payload`, adopted by 40+ providers including OpenAI, Anthropic, and Twilio (Standard Webhooks project, official spec repository, current, https://github.com/standard-webhooks/standard-webhooks)). Rule out a signature-check middleware mounted ahead of this route before reporting absence from the handler body alone — confirm its behaviour too. Its absence means anyone who finds the URL can trigger the write, not just a genuine retry; that is `High` at `read`. Where the project centralises verification in one shared helper, `find_callers` that helper and confirm this route is absent from its callers promotes the finding to `traced`, and `Critical`. A shipped defect of this exact shape is not hypothetical: `@clerk/backend`'s `verifyWebhook` contained inverted logic that "rejected requests with valid signatures and allowed those with invalid or no signatures to be processed," CVSS 7.5 (CVE-2025-53548, vulnerability-database writeup, 2025, https://www.miggo.io/vulnerability-database/cve/CVE-2025-53548).
20
+ - [ ] Where a signature-verification function exists, `Read` its comparison and every branch: does a mismatched or missing signature actually reject, or does the function's control flow let the request through on any path other than an explicit match? A verification call that exists and is invoked is not evidence it protects anything if its logic is inverted — `@clerk/backend`'s `verifyWebhook` shipped with exactly this defect, rejecting valid signatures and accepting invalid or missing ones (CVE-2025-53548, vulnerability-database writeup, 2025, https://www.miggo.io/vulnerability-database/cve/CVE-2025-53548), fixed by replacing the manual implementation with the `standardwebhooks` library. `High` at `read`; `find_callers` confirming every webhook route's happy path only proceeds after a passing return from this function promotes it to `traced`, and `Critical`. Refuted if the apparently-inverted branch is unreachable dead code or gated behind a test-only flag absent from the production build — confirm via `find_callers` that a production route actually exercises the suspect branch.
21
+ - [ ] `search_code` for an IP-allowlist check (middleware or edge/firewall rule scoped to the webhook route) alongside the signature check. A route relying on signature verification alone has no defense-in-depth if the signing secret ever leaks — a log line, a misconfigured error response, a compromised CI secret store. Stripe's own guidance is to "use both of these protections: IP allowlisting... Signature verification" (Stripe, official product documentation, current, https://docs.stripe.com/webhooks). Refuted if the provider does not publish a stable IP range to allowlist against, or the deployment sits behind infrastructure (a managed gateway, a provider-specific webhook proxy) enforcing this at a layer the repository doesn't show.
22
+ - [ ] The comparison is constant-time, not `==`/`===`/string equality — owned by `security.md` (`search_code` for the signature-compare line and confirm it calls a constant-time primitive: `crypto.timingSafeEqual` in Node, `hmac.compare_digest` in Python, `hash_equals` in PHP, `Rack::Utils.secure_compare` in Ruby — GitHub's own docs warn "never use a plain `==` operator" for exactly this reason (GitHub, official product documentation, current, https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries)); reuse its finding, do not re-report. This module's own concern stops at the presence check above — that a signature check exists at all.
23
+ - [ ] The signature is computed over the raw request body, not a re-serialised copy — `search_code` for a body-parsing middleware (Express's `express.json()` mounted globally is the canonical case) that runs before the webhook route and reparses the payload (Stripe, official product documentation, current, https://docs.stripe.com/webhooks — documents this exact Express-ordering failure mode). Re-serialising JSON changes key order, whitespace, and number formatting, which changes the bytes the HMAC covers and breaks verification — the raw body must be captured before any parsing, scoped to the webhook route specifically.
24
+ - [ ] A replay window — `search_code` the signature-verification function for a timestamp-tolerance check: is a signed-but-stale payload (timestamp far in the past) still accepted? Stripe's default tolerance is 5 minutes, and its own docs warn against setting tolerance to 0 ("using a tolerance value of `0` disables the recency check entirely") (Stripe, official product documentation, current, https://docs.stripe.com/webhooks). Without a window, a captured valid payload can be replayed indefinitely.
25
+ - [ ] The provider's event ID is stored and checked before processing, not just the payload's business data — `find_callees` from the handler to confirm a lookup against previously-seen event IDs happens before the side-effecting write, not after. Stripe itself recommends this over trusting delivery order: "track event IDs to identify duplicate deliveries instead" (Stripe, official product documentation, current, https://docs.stripe.com/webhooks).
26
+ - [ ] Fields inside the payload (an `event_type`, a `customer_id`) are not used to route or act on the request before the signature is verified — `trace_path` from the body-parsing step to the first place a payload field drives control flow, and confirm signature verification sits before it. Verification must gate every use of the body, not just the parts a developer remembered to protect.
27
+ - [ ] Out-of-order delivery: a handler that assumes events arrive in the order they were sent (e.g. `payment.created` before `payment.refunded`) — most providers guarantee at-least-once, not ordered, delivery; Stripe's own docs state "we don't guarantee the delivery of events in the order that they're generated" (Stripe, official product documentation, current, https://docs.stripe.com/webhooks). `search_code` for sequencing assumptions (a state transition that would break if the "later" event arrived first).
28
+ - [ ] Duplicate webhook deliveries from provider-side retries (the provider itself retries on a non-2xx or a timeout — Stripe's automatic retries run "for up to three days with an exponential back off" (Stripe, official product documentation, current, https://docs.stripe.com/webhooks)) versus the handler's own idempotency check — `find_symbol` the handler and `Read` its return path relative to the write: confirm it returns success only after the write is durably committed, not before, or the provider will interpret a slow success as a failure and retry a request that already landed.
26
29
 
27
30
  ## Queue and retry semantics
28
31
 
29
- - [ ] At-least-once delivery acknowledged in the consumer's code (idempotency key, or the write itself is naturally idempotent — e.g. a `SET`, not an `INCREMENT`) versus silently assumed to be exactly-once. `search_code` the consumer's ack/commit point relative to where the write happens, concretely: Kafka's `enable.auto.commit` defaults to `true` on a 5-second interval and commits the offset once `poll()` returns — before the handler body has run — so a crash mid-processing is silent loss unless the commit is manual and placed after the write; SQS deletes the message explicitly, and a delete issued before processing has the same effect, while a delete issued after processing but with too short a visibility timeout (SQS's default is 30 seconds) causes duplicate redelivery instead of loss; RabbitMQ's manual ack before processing is discarded on crash, ack after is safe by default (auto-requeue on channel/connection close) provided the write itself is idempotent. An ack after a failed write, or a write before the ack, both reopen the redelivery case.
32
+ - [ ] At-least-once delivery acknowledged in the consumer's code (idempotency key, or the write itself is naturally idempotent — e.g. a `SET`, not an `INCREMENT`) versus silently assumed to be exactly-once. `search_code` the consumer's ack/commit point relative to where the write happens, concretely: Kafka's `enable.auto.commit` defaults to `true` on a 5-second interval (`auto.commit.interval.ms` default 5000) and commits the offset periodically in the background (Apache Kafka project, official source repository, current, https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java) — before the handler body has necessarily run — so a crash mid-processing is silent loss unless the commit is manual and placed after the write; SQS deletes the message explicitly, and a delete issued before processing has the same effect, while a delete issued after processing but with too short a visibility timeout (SQS's default is 30 seconds, and even within the timeout SQS "doesn't guarantee that a message won't be delivered more than once") causes duplicate redelivery instead of loss (AWS, official SQS developer guide, current, https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html); RabbitMQ's manual ack before processing is discarded on crash, ack after is safe by default (auto-requeue on channel/connection close, with consumers expected to "handle redeliveries and otherwise be implemented with idempotence in mind") provided the write itself is idempotent (RabbitMQ, official product documentation, current, https://www.rabbitmq.com/docs/confirms). An ack after a failed write, or a write before the ack, both reopen the redelivery case.
33
+ - [ ] The consumer's acknowledgement mode is explicit manual ack (RabbitMQ `auto_ack=False` / `basic.ack`; Kafka `enable.auto.commit=false` with a manual commit issued after the write; SQS an explicit `DeleteMessage` after the write) — not a framework or client-library default that acknowledges on receipt. `search_code` the consumer setup for the ack-mode flag. Auto-ack removes the redelivery safety net every other check in this section assumes exists: a crash mid-processing becomes silent loss instead of a duplicate the idempotency key would have absorbed — RabbitMQ's own docs contrast manual mode, which "requires client acknowledgement," against "automatic mode, where messages are considered delivered immediately upon sending" (RabbitMQ, official product documentation, current, https://www.rabbitmq.com/docs/confirms). Refuted if the handler performs no side effect that outlives the process — a pure read or a stateless transform re-derivable from source — so loss-on-crash has no observable consequence.
30
34
  - [ ] Consumer-side dedupe is implemented as an inbox / idempotent-consumer table (a `processed_message(id)` record inserted in the same transaction as the handling), not just an in-memory guard — `search_code` for a processed-messages/seen-ids table and confirm the insert and the business write share a transaction. An in-memory-only guard resets on every deploy and duplicates on every restart.
31
- - [ ] Retries that are unbounded (no max attempt count) or unjittered (fixed-interval retry against a struggling downstream, amplifying the load that caused the failure in the first place). Named jitter strategies exist for a reason — Full Jitter (`random(0, min(cap, base*2^attempt))`) is the primary-source recommendation over Equal Jitter or no jitter at all, since it does the least total work against a recovering backend for comparable completion time (AWS Architecture Blog, "Exponential Backoff and Jitter").
32
- - [ ] A retry wrapper applied to an operation that is not idempotent by construction — `find_callers` on the retry helper and check each wrapped call against the checks above; wrapping a bare `INSERT` with no key is a retry mechanism actively making things worse.
35
+ - [ ] Retries are bounded and backed off — owned by `failure.md` and `scalability.md` (`search_code` the retry/backoff config for a max-attempt count and a jitter strategy; jittered exponential backoff — AWS's own comparison names Full Jitter, `random(0, min(cap, base*2^attempt))`, and Equal Jitter as both giving "a substantial decrease in client work and server load" over no jitter at all, without crowning either the winner — is the primary-source recommendation over un-jittered backoff, with the specific variant an implementation detail (AWS Architecture Blog, official vendor engineering blog, current, https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/)); reuse their finding, do not re-report. This module's own angle — whether an unbounded retry replays a non-idempotent write — is the next check.
36
+ - [ ] A retry wrapper applied to an operation that is not idempotent by construction — `find_callers` on the retry helper and check each wrapped call against the checks above (AWS Builders' Library, official vendor engineering guide, current, https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/); wrapping a bare `INSERT` with no key is a retry mechanism actively making things worse.
33
37
  - [ ] Retry-on-timeout specifically: a timeout means the first attempt's outcome is unknown, not that it failed. `search_code` for a catch-and-retry around a timeout error with no idempotency key — this is the mechanism behind duplicate charges and duplicate emails, because the first attempt may have already succeeded server-side.
34
- - [ ] A poison message (one that will never succeed, e.g. malformed payload) has a dead-letter path rather than being retried indefinitely — `find_callees` from the consumer's error handler to confirm a max-attempts-then-park path exists, distinct from a message that fails only transiently.
38
+ - [ ] A poison message (one that will never succeed, e.g. malformed payload) has a dead-letter path rather than being retried indefinitely — `find_callees` from the consumer's error handler to confirm a max-attempts-then-park path exists, distinct from a message that fails only transiently (AWS recommends a Dead-Letter Queue for messages that repeatedly fail: AWS, official SQS developer guide, current, https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html). Cross-reference `scalability.md`, which owns the dead-letter-destination/drain check more broadly; report the consumer-side poison-message instance here since it is this module's retry-safety concern.
35
39
 
36
40
  ## Client-side half
37
41
 
@@ -40,22 +44,38 @@ Is repetition safe? Gate: retries, webhooks, queues, or externally-triggered wri
40
44
  ## Compensation and cleanup
41
45
 
42
46
  - [ ] Multi-step operations that can fail partway (charge then provision, reserve then confirm) have a compensating action for the already-completed steps — `find_callees` from the orchestrating function to see if a rollback/compensate path exists for each step, not just a try/catch that logs and gives up.
43
- - [ ] A partial failure leaves state that is reversible by a human or a retry, rather than requiring manual database surgery — read the error path to confirm which state the record is left in.
44
- - [ ] Dedupe/idempotency-key records are stored but never expired — `search_code` for the dedupe table's write path and check for a corresponding TTL or cleanup job. An unbounded dedupe store is a slow leak, and once it is large enough that lookups degrade, the protection it provides degrades with it.
47
+ - [ ] A partial failure leaves state that is reversible by a human or a retry, rather than requiring manual database surgery — `find_symbol` the operation's error path and `Read` it to confirm which state the record is left in.
48
+ - [ ] Dedupe/idempotency-key records are stored but never expired — `search_code` for the dedupe table's write path and check for a corresponding TTL or cleanup job (Stripe itself prunes keys "after they're at least 24 hours old": Stripe, official API reference, current, https://docs.stripe.com/api/idempotent_requests). An unbounded dedupe store is a slow leak, and once it is large enough that lookups degrade, the protection it provides degrades with it.
49
+ - [ ] The dedupe/idempotency-key TTL is compared against the longest realistic retry delay this system can produce (a queued job's backoff ceiling, a client's offline-then-resume window) — `search_code` both the TTL/cleanup job and the retry/backoff config. A key pruned before a legitimate late retry arrives does not fail loudly: the same key is treated as a brand-new request and the write happens again — exactly the outcome idempotency exists to prevent. Stripe's own keys are pruned "after they're at least 24 hours old," and "we generate a new request if a key is reused after the original is pruned" (Stripe, official API reference, current, https://docs.stripe.com/api/idempotent_requests). Refuted if the retry/backoff config has a hard max-attempts or max-elapsed-time ceiling below the TTL, so no legitimate retry can arrive after expiry — confirm the numeric relationship before flagging.
50
+
51
+ ## What browser observation closes
52
+
53
+ Applies only when `browser.md` ran; findings here are `observed` and cite the bundle path with a line or step number. This module's server-side ground — key generation and constraint enforcement, webhook signature logic, queue-consumer ack timing — is server-to-server or in-process and produces nothing a browser tool observes; the client-submit-guard check below is the only slice of this module the bundle reaches, matching the module's own "Client-side half" section.
54
+
55
+ | Artefact | Gap it closes | Observed instance earns |
56
+ |---|---|---|
57
+ | `network.jsonl` (two request lines: same method + URL + body shape, close timestamps), `screenshots/` | A flow's primary submit action, clicked twice in quick succession, fires two outbound POST/PUT requests for the same operation with no differentiating idempotency-key/request-id header (or the identical key on both). Refuted if the second request carries a distinct client-generated idempotency-key header the server is expected to dedupe on, or if `screenshots/` shows the control was disabled/hidden before the second click fired. | Medium |
45
58
 
46
59
  ## Out of static reach
47
60
 
48
- - Actual delivery ordering and duplication behaviour of the specific queue/webhook provider in production.
61
+ - Actual delivery ordering and duplication behaviour of the specific queue/webhook provider in production — closed by `runtime.md` when execution is enabled, to the extent the project declares integration tests exercising webhook/queue delivery.
49
62
  - Whether a race window is wide enough to matter at real traffic volumes.
50
63
  - Whether a compensating action is triggered promptly enough in practice, versus existing in code but rarely exercised.
51
64
  - Idempotency-key storage capacity under sustained load.
65
+ - Whether the configured provider truly retries deliveries as documented — this module reads the receiving code, not the sending service's runtime behavior.
66
+ - Whether key-generation entropy is sufficient at real traffic volume — this module confirms the algorithm exists, not that it never collides.
67
+ - Whether a retry has landed after key expiry in production — this module compares two configured values, not observed occurrences.
68
+ - Whether the provider's published IP range is current and complete — this module checks for the control's presence, not the freshness of the range it's configured with.
52
69
 
53
70
  ## Severity guidance
54
71
 
55
72
  | Situation | Severity |
56
73
  |---|---|
57
- | Retryable write with no idempotency key and no unique constraint | Critical |
58
- | Webhook route with no signature verification | Critical |
74
+ | Retryable write with no idempotency key and no unique constraint, the write traced from the retryable entry point via `trace_path` (traced) | Critical |
75
+ | Webhook route with no signature verification, confirmed via `find_callers` on the shared verification helper (traced) | Critical |
76
+ | Signature verification exists but its accept/reject logic is inverted, confirmed via `find_callers` that every route's happy path depends on a passing return (traced) | Critical |
77
+ | Webhook route with no signature verification, established only by reading the handler body | High |
78
+ | Signature verification exists but its accept/reject logic is inverted, established only by reading the branch logic | High |
59
79
  | Retry-on-timeout wrapping a non-idempotent write (duplicate charge shape) | High |
60
80
  | Idempotency key server-generated instead of client-supplied on a client-retried path | High |
61
81
  | Idempotency enforced only by read-then-write check, no DB constraint | High |
@@ -64,13 +84,15 @@ Is repetition safe? Gate: retries, webhooks, queues, or externally-triggered wri
64
84
  | Consumer dedupe implemented only as an in-memory guard, not a durable inbox record | High |
65
85
  | Signature verified over a re-serialised body instead of the raw bytes | High |
66
86
  | Payload fields trusted or routed on before signature verification | High |
87
+ | Consumer acknowledgement mode is auto-ack instead of explicit manual ack after the write | High |
67
88
  | Webhook handler with no replay-window check | Medium |
68
89
  | Consumer assumes ordered delivery from an at-least-once queue | Medium |
69
- | Unbounded or unjittered retry against a downstream dependency | Medium |
70
90
  | Idempotency key not scoped per operation/actor, allowing cross-operation collision | Medium |
71
91
  | Handler acknowledges before the write is durably committed | Medium |
72
92
  | Poison message retried indefinitely with no dead-letter path | Medium |
73
93
  | Submit action with no client-side dedupe guard | Medium |
74
94
  | Duplicate key + same payload recomputes a fresh response instead of replaying the stored one | Medium |
75
- | Signature compared with non-constant-time equality | Medium |
95
+ | Idempotency key derived from request content instead of caller-supplied | Medium |
96
+ | Dedupe/idempotency-key TTL shorter than the system's longest realistic retry delay | Medium |
76
97
  | Dedupe/idempotency records stored with no expiry | Low |
98
+ | No IP allowlist as defense-in-depth alongside webhook signature verification | Low |
@@ -7,44 +7,64 @@ Runtime environment and its definition. Gate: CI/CD, a Dockerfile, or IaC was de
7
7
  ## Declared vs. actual
8
8
 
9
9
  - [ ] `search_code` for `.tf`, `Pulumi.*`, `*.bicep`, or a CloudFormation template, and cross-reference the resources they declare against the cloud SDK usage `get_architecture` reports for the application. A resource the app clearly talks to but no IaC declares is the candidate — **rule-out**: it may live in a separate, un-indexed infrastructure repo, so when no IaC directory exists in this repo at all, report the signal as `undetermined`, not as a confirmed hand-created resource.
10
- - [ ] State is remote and locked, not local. `search_code` the Terraform `backend` block or the Pulumi state/backend config for a remote target (S3, GCS, Terraform Cloud) with locking (DynamoDB table, native lock) rather than a local `.tfstate`.
11
- - [ ] Drift detection exists. `search_code` CI workflows for a scheduled `terraform plan` / `pulumi preview` job distinct from the apply-on-merge job, or a TACOS platform config that runs it for you — `atlantis.yaml`, a Spacelift/env0 stack definition, or an HCP Terraform workspace with drift detection enabled. A plan that only ever runs right before an apply never catches drift that accumulates between deploys.
12
- - [ ] Every environment comes from the same definition with different inputs. Read the IaC directory structure: one module parameterised by `*.tfvars`/env-specific variables is the intended shape; separate copy-pasted per-environment directories (`envs/staging/main.tf`, `envs/prod/main.tf` diverging beyond their variables) is the finding — diff them.
10
+ - [ ] State is remote and locked, not local. `search_code` the Terraform `backend` block or the Pulumi state/backend config for a remote target (S3, GCS, Terraform Cloud) with locking (DynamoDB table, native lock) rather than a local `.tfstate`. Terraform locks state "for all operations that could write state" when the backend supports it, preventing concurrent corruption (HashiCorp, official Terraform documentation, current, https://developer.hashicorp.com/terraform/language/state/locking); local state also "limits the ability to collaborate" and "risks losing workspace state if the local state file is lost" (HashiCorp, official Terraform documentation, current, https://developer.hashicorp.com/terraform/language/state).
11
+ - [ ] Drift detection exists. `search_code` CI workflows for a scheduled `terraform plan` / `pulumi preview` job distinct from the apply-on-merge job, or a TACOS platform config that runs it for you — `atlantis.yaml`, a Spacelift/env0 stack definition, or an HCP Terraform workspace with drift detection enabled. A plan that only ever runs right before an apply never catches drift that accumulates between deploys. By default Terraform only compares state to real infrastructure when `plan`/`apply` runs, and `-refresh-only` surfaces drift without auto-modifying state (HashiCorp, official Terraform tutorial, current, https://developer.hashicorp.com/terraform/tutorials/state/resource-drift) — which is why a scheduled job, not just the pre-apply plan, is what actually catches drift accumulating between deploys.
12
+ - [ ] Infrastructure-affecting changes (Terraform/Pulumi apply, network/router config, global feature flags) go through a staged or canary rollout distinct from one global apply step. `search_code` CI workflows and IaC modules for a percentage-based or per-region/per-cluster apply sequence, or an explicit approval gate between `plan` and a global `apply`; a CI job that targets every region or the entire fleet in one step with no staged subset and no gate is the finding. Refuted if the project's actual blast radius is inherently small (single service, single region/cluster), so a "global" apply is by construction also the entire staged subset — confirm via the IaC inventory (`get_architecture`/`search_code` for deployment targets) before flagging a single-target project.
13
+ - [ ] Every environment comes from the same definition with different inputs. Read the IaC directory structure: one module parameterised by `*.tfvars`/env-specific variables is the intended shape; separate copy-pasted per-environment directories (`envs/staging/main.tf`, `envs/prod/main.tf` diverging beyond their variables) is the finding — diff them. The same "config varies, code doesn't" principle applies one layer down, to the environment's own definition (Adam Wiggins et al., The Twelve-Factor App, current, https://12factor.net/config).
13
14
 
14
15
  ## Configuration
15
16
 
16
- - [ ] Every environment variable the application reads is declared in the deployment definition. Reuse `reachability.md`'s used-but-never-declared probe directly: `search_code` for `process.env.` / `os.environ` / the language's equivalent, then check each name against the deployment manifest's env list — this is where that check pays off most, because the failure mode is a variable that is `undefined` only in production.
17
+ - [ ] Every environment variable the application reads is declared in the deployment definition. Reuse `reachability.md`'s used-but-never-declared probe directly: `search_code` for `process.env.` / `os.environ` / the language's equivalent, then check each name against the deployment manifest's env list — this is where that check pays off most, because the failure mode is a variable that is `undefined` only in production. Twelve-Factor's own config guidance is the reason this matters: config "varies substantially across deploys, code does not," and belongs outside the artefact entirely (Adam Wiggins et al., The Twelve-Factor App, current, https://12factor.net/config).
17
18
  - [ ] Required config with no value fails at startup, not at first use. `find_symbol` the config-loading module and read it: a schema-validated load that throws before the server binds its port is the standard; a lazy read that returns `undefined` and gets used three requests later is the finding.
18
19
  - [ ] Defaults in the definition are safe for production. Read the deployment definition's default values for anything security-relevant — `debug: true`, a wildcard CORS origin, a verbose log level — a convenient development default is `High` if nothing overrides it in the production environment file.
19
- - [ ] Nothing environment-specific is compiled into the artefact. `search_code` the build step for values injected at build time (webpack `DefinePlugin`, a baked-in API base URL, an embedded feature flag) rather than read at runtime — these force a rebuild per environment and silently defeat "one artefact, many environments".
20
+ - [ ] Nothing environment-specific is compiled into the artefact. `search_code` the build step for values injected at build time (webpack `DefinePlugin`, a baked-in API base URL, an embedded feature flag) rather than read at runtime — these force a rebuild per environment and silently defeat "one artefact, many environments". The twelve-factor litmus test is that "the codebase could be made open source at any moment, without compromising any credentials" (Adam Wiggins et al., The Twelve-Factor App, current, https://12factor.net/config), which a build-time-baked value already fails.
20
21
 
21
22
  ## Resource limits
22
23
 
23
- - [ ] CPU and memory limits are set. `search_code` Kubernetes manifests or compose files for `resources.limits` / `mem_limit`; absence is the finding — cross-reference `cost.md` where a limit is present but sits far above observed use.
24
+ - [ ] CPU and memory limits are set. `search_code` Kubernetes manifests or compose files for `resources.limits` / `mem_limit`; absence is the finding — cross-reference `cost.md` where a limit is present but sits far above observed use. CPU limits are hard-throttled by the kernel; memory limits are enforced reactively — "a container that over allocates memory may not be immediately killed" but "may get killed" once the kernel detects pressure (Kubernetes project, official documentation, current, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/).
24
25
  - [ ] Disk is bounded and monitored wherever logs or uploads land. `search_code` volume mounts for a log or upload directory and check for a size cap or rotation config (`logrotate`, a max-size setting) alongside it.
25
26
  - [ ] Connection and file-descriptor limits accommodate the configured pool sizes. Read the application's DB/connection pool size setting and compare it against the container's declared `ulimit` or fd limit where one is set — a pool ceiling above the fd ceiling only fails under load, never in development.
26
27
  - [ ] Autoscaling bounds exist at both ends, and the scale-up signal is the resource that actually saturates. `search_code` the autoscaler config (HPA, ASG launch config) for `min`/`max` replicas and the triggering metric; cross-reference `performance.md` for whether that metric is the one that actually saturates first.
27
28
 
29
+ ## Health checks and disruption budgets
30
+
31
+ - [ ] Kubernetes Deployments/StatefulSets declare both a readiness and a liveness probe. `search_code` manifests/Helm charts/Kustomize overlays for `livenessProbe:`/`readinessProbe:` keys per workload; a Deployment or StatefulSet with neither means a hung process keeps receiving traffic indefinitely and is never automatically restarted. Liveness-probe failure triggers a kill-and-restart; readiness-probe failure only removes the pod from Service endpoints — the two protect against different failure modes and a workload needs both (Kubernetes project, official documentation, current, https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). Refuted if the workload is a Job/CronJob or a batch/one-shot container with no long-running traffic to gate — rule out by `kind` before flagging; a sidecar container intentionally has no probe of its own because the pod's readiness is already governed by the main container's probe.
32
+ - [ ] Every Deployment/StatefulSet with `replicas` > 1 has a matching PodDisruptionBudget. `search_code` for `kind: PodDisruptionBudget` and cross-reference its selector against multi-replica workloads; a multi-replica workload with no matching PDB can be evicted below serving capacity, or below quorum for a clustered dependency, during a routine node drain or cluster upgrade. A PDB "limit[s] the number of concurrent disruptions" during voluntary disruptions — its own worked example is a Consul/ZooKeeper/etcd-style clustered dependency losing quorum without one, though it "does not truly guarantee" availability against every cause (Kubernetes project, official documentation, current, https://kubernetes.io/docs/tasks/run-application/configure-pdb/). Refuted if the workload runs on fully-managed serverless compute (Fargate profile, managed node groups with no direct drain exposure) with no node-drain concept to protect against — confirm the compute model before flagging.
33
+
28
34
  ## Network and access
29
35
 
30
- - [ ] Nothing is publicly reachable that does not need to be. `search_code` IaC or compose files for datastore ports (`5432:5432`, `6379:6379`, `27017:27017`) bound to a public interface rather than `127.0.0.1:` or a private subnet — a datastore port with no interface prefix in a compose file defaults to all interfaces.
36
+ - [ ] Nothing is publicly reachable that does not need to be. `search_code` IaC or compose files for datastore ports (`5432:5432`, `6379:6379`, `27017:27017`) bound to a public interface rather than `127.0.0.1:` or a private subnet — a datastore port with no interface prefix in a compose file defaults to all interfaces. Rule out a compose file scoped to local development only (no corresponding production deploy target in the same file) before treating an open port binding as a production exposure.
31
37
  - [ ] Ingress rules are specific rather than open ranges. `search_code` the IaC for `0.0.0.0/0`.
32
38
  - [ ] Service-to-service access is least-privilege. Read the IAM role or policy document attached to each service in IaC — a wildcard `*` action or `*` resource on a role that only needs to read one bucket is the finding.
33
39
  - [ ] Credentials are workload identities where available, rather than long-lived static keys. `search_code` the deployment definition for static key literals or key references (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`) versus an instance-profile or workload-identity binding — presence of the former where the platform offers the latter is the finding.
40
+ - [ ] Containers run as a non-root user. `search_code` Dockerfiles for a `USER` directive and Kubernetes manifests for `securityContext.runAsNonRoot`/`runAsUser`; an image and pod spec with neither runs as root by default. Docker's own build guidance: "If a service can run without privileges, use `USER` to change to a non-root user" (Docker, Inc., official Docker documentation, current, https://docs.docker.com/build/building/best-practices/). Refuted if the base image already runs as a fixed non-root user by its own convention (e.g. official `node`/`nginx-unprivileged` images) with no `USER` line needed in this repo's Dockerfile because it's inherited — check the base image's own definition/docs before flagging, since `search_code` on this repo alone cannot see an inherited `USER`.
34
41
 
35
42
  ## Durability
36
43
 
37
- - [ ] Backups exist for every stateful resource the inventory names. `search_code` IaC or the managed-service config for a backup/snapshot-schedule attribute on each one — a resource with no such attribute has no backup, full stop.
38
- - [ ] Restore time and acceptable data loss are stated somewhere findable — a runbook, a README, an ADR. **Whether a restore has actually been performed and succeeded is not establishable from source**; report the runbook's existence (or absence) as the static half of this check and push the "actually tested" half to Out of static reach.
39
- - [ ] Deletion protection on resources whose loss would be unrecoverable. `search_code` IaC for `deletion_protection` / `prevent_destroy` on the datastore and storage resources the inventory lists.
44
+ - [ ] Backups exist for every stateful resource the inventory names. `search_code` IaC or the managed-service config for a backup/snapshot-schedule attribute on each one — a resource with no such attribute has no backup, full stop. Rule out a managed offering whose provider enables automated backups by default outside any IaC-declared attribute; where the resource is a managed service with no attribute either way, report `undetermined` rather than a confirmed gap. A backup strategy must cover both data and "infrastructure, configuration, and application code," ideally via IaC — without it, restoring a workload is complex and can exceed the stated RTO (Amazon Web Services, official AWS whitepaper, current, https://docs.aws.amazon.com/whitepapers/latest/disaster-recovery-workloads-on-aws/disaster-recovery-options-in-the-cloud.html).
45
+ - [ ] Restore time and acceptable data loss are stated somewhere findable — a runbook, a README, an ADR. `search_code` the repo for a runbook, README, or ADR naming a restore-time objective or acceptable data loss. **Whether a restore has actually been performed and succeeded is not establishable from source**; report the runbook's existence (or absence) as the static half of this check and push the "actually tested" half to Out of static reach. AWS's own DR guidance requires the strategy to include testing the backup (Amazon Web Services, official AWS whitepaper, current, https://docs.aws.amazon.com/whitepapers/latest/disaster-recovery-workloads-on-aws/disaster-recovery-options-in-the-cloud.html); GitHub's own 2018 incident shows the cost when neither is exercised in advance — a 43-second network partition triggered cross-region primary promotion the application tier couldn't support, and manual binary-log reconciliation "continued beyond the incident's official conclusion" (GitHub Engineering, official post-incident analysis, 2018, https://github.blog/news-insights/company-news/oct21-post-incident-analysis/).
46
+ - [ ] Deletion protection on resources whose loss would be unrecoverable. `search_code` IaC for `deletion_protection` / `prevent_destroy` on the datastore and storage resources the inventory lists. S3 object versioning and delete markers are named as mitigations against exactly this kind of unrecoverable loss (Amazon Web Services, official AWS whitepaper, current, https://docs.aws.amazon.com/whitepapers/latest/disaster-recovery-workloads-on-aws/disaster-recovery-options-in-the-cloud.html).
40
47
  - [ ] Stateful data is not on ephemeral storage. Read the container or pod spec for the path the application writes state to — mounted on `emptyDir` or no volume at all is the finding; a persistent volume claim or managed volume is the pass.
41
48
 
49
+ ## Single points of failure
50
+
51
+ - [ ] A single shared control-plane dependency (service discovery, secrets, or scheduling backend — Consul, etcd, ZooKeeper, Vault) is not relied on by multiple independently-critical services with no isolation. `impact` the shared dependency's client/SDK symbol to see how many distinct critical services transitively depend on it, then `find_callers` to confirm they resolve to one shared cluster/instance rather than isolated per-tier instances. If the same dependency also backs the telemetry/monitoring path, name that as a circular-monitoring risk explicitly. A single Consul cluster shared by Nomad, Vault, and service discovery for many critical workloads caused a 73-hour outage when it degraded under real production churn — and telemetry itself depended on the same cluster, "severely hampering diagnosis" (Roblox Engineering, official incident postmortem, 2022, https://about.roblox.com/newsroom/2022/01/roblox-return-to-service-10-28-10-31-2021/). `High` at `traced`; escalate to `Critical` when the traced fan-in shows the telemetry/monitoring path itself depends on the same shared instance — diagnosis becomes blind exactly when it's needed. Refuted if the fan-in traces to genuinely distinct cluster instances or addresses per tier (e.g. a dedicated Consul cluster for the auth tier, separate from the general-workload cluster) rather than one shared instance — confirm via the addresses/config each caller resolves, not just that they call the same client library.
52
+
42
53
  ## Operability
43
54
 
44
55
  - [ ] Someone can reach logs, metrics, and a shell for a running instance without a bespoke procedure. Cross-reference `observability.md`; `search_code` for a centralised logging/metrics sink configured in the deployment definition versus container-stdout-only, which is unreachable once the container recycles.
45
56
  - [ ] Restart, scale, and redeploy are single documented commands. Read the deployment docs or `Makefile`/scripts directory for these — their absence, when the app clearly does deploy somehow, is itself the finding: the knowledge exists only in one person's shell history.
46
57
  - [ ] The definition names an owner. `search_code` IaC or manifest metadata (tags, labels, annotations) for an owner or team field — treat this as a soft signal: missing metadata implies but does not prove the resource is unowned, since ownership may be tracked outside the repo.
47
58
 
59
+ ## What browser observation closes
60
+
61
+ Applies only when `browser.md` ran; findings here are `observed` and cite the bundle path with a line or step number. The infrastructure this module audits is declared in IaC, not rendered by a browser — but a live request's response headers are one of the few places that declared topology (edge/CDN, TLS termination) becomes externally observable at all, which is what the two rows below reach.
62
+
63
+ | Artefact | Gap it closes | Observed instance earns |
64
+ |---|---|---|
65
+ | `network.jsonl` (response headers on the primary document request: `server`, `via`, `cf-ray`, `x-amz-cf-id`, `x-vercel-id`, `cache-control`/`age`) cross-referenced against CDN/load-balancer/WAF resources found via `search_code` in IaC | Edge/CDN, TLS termination, and cache layer actually in front of the app. Refuted if a header names a provider not in IaC but is a legitimate additional hop in front of a declared one (e.g. Cloudflare in front of a declared CloudFront origin) — confirm no double-declaration exists first; the reverse (IaC declares a CDN, headers show none) may mean the browser hit an origin/staging URL rather than the fronted production one — record which URL was actually observed. | Medium |
66
+ | `network.jsonl` (connection/security details on the primary document request, where the capturing tool includes them), else record as not producible with the filled tool rather than silently omitted | TLS certificate identity/expiry actually served, cross-checked against an IaC-declared cert resource. Refuted if the observed cert is issued by a managed provider (ACM, Let's Encrypt via cert-manager) that legitimately rotates without a matching literal in IaC — check for the issuer/controller resource, not a static cert reference. | Low |
67
+
48
68
  ## Out of static reach
49
69
 
50
70
  - Whether a backup restore actually succeeds — only executing one proves it; the runbook's existence is the ceiling of what source can show.
@@ -53,19 +73,29 @@ Runtime environment and its definition. Gate: CI/CD, a Dockerfile, or IaC was de
53
73
  - Real network reachability from the public internet — a port scan or external probe would confirm it, IaC only states intent.
54
74
  - Hand-created resources that exist entirely outside any indexed repo — invisible to `search_code` by definition; only a live account inventory would surface them.
55
75
  - Actual on-call ownership and response readiness — an owner tag is a label, not a guarantee someone answers a page.
76
+ - Full CIS Docker Benchmark conformance — the scored checklist is not freely published and several of its items require inspecting a running daemon/container, not source.
77
+ - Whether a shared control-plane dependency will actually hold under production load and churn — config review sees the topology, not the load it hasn't been tested against.
78
+ - Whether CPU/memory requests and limits are sized correctly for real usage — only observed utilization data proves right-sizing; source shows only that a number is set.
79
+ - Whether a network/routing config change will propagate safely — only a live, staged rollout proves it; source shows only whether a staged path exists at all.
56
80
 
57
81
  ## Severity guidance
58
82
 
59
83
  | Situation | Severity |
60
84
  |---|---|
61
- | Datastore or admin port publicly reachable | Critical |
62
- | Long-lived static credentials in the definition | Critical |
85
+ | Datastore or admin port publicly reachable | High |
86
+ | Long-lived static credentials in the definition | High |
63
87
  | No backup for a stateful resource | High |
64
- | Backup exists but restore never tested | High |
88
+ | No runbook or stated restore procedure found | Medium |
65
89
  | Stateful data on ephemeral storage | High |
66
90
  | Ingress open to `0.0.0.0/0` beyond a public entry point | High |
67
91
  | Application env var not declared in the deployment | High |
92
+ | Kubernetes Deployment/StatefulSet with neither a liveness nor a readiness probe declared | High |
93
+ | Shared control-plane dependency traced (`impact`/`find_callers`) as relied on by multiple independently-critical services with no isolation | High |
94
+ | Shared control-plane dependency traced as above, and the same dependency also backs the telemetry/monitoring path | Critical |
68
95
  | No resource limits set | Medium |
69
96
  | Manually created resources absent from IaC | Medium |
70
97
  | Local or unlocked state file | Medium |
98
+ | Multi-replica Deployment/StatefulSet with no matching PodDisruptionBudget | Medium |
99
+ | Container runs as root (no `USER` directive, no `runAsNonRoot`) | Medium |
100
+ | Infrastructure-affecting change applies through one global step with no staged/canary path or approval gate | Medium |
71
101
  | No drift detection | Low |