sourcecode 5.2.0__py3-none-any.whl → 5.3.0__py3-none-any.whl

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.
sourcecode/waivers.py ADDED
@@ -0,0 +1,384 @@
1
+ """waivers.py — adjudication that survives the next run (F-BI).
2
+
3
+ A team gates on a finding family, reviews the list once, and decides that three
4
+ of the rows are not defects *here*: `/auth/login` is public on purpose, the
5
+ commented-out block is documentation, the handler is reached by a framework this
6
+ model does not read. Today that judgement lives in a chat thread and the next
7
+ run reproduces the list in full — so the gate stays red, and a gate that is
8
+ always red trains a team to ignore it. Field evaluation #24 measured the cost of
9
+ that with 0 of 9 `high` findings correct on a greenfield module.
10
+
11
+ This is **not** the `verify` baseline. A baseline records accepted *debt*: the
12
+ finding is real, and you are not fixing it today. A waiver says *this was never a
13
+ defect here*, which is a different claim, made by a different person, with a
14
+ different review. Keeping them apart is what lets a team adopt a family that has
15
+ any false-positive rate at all — and precision fixes reduce the need for waivers
16
+ without ever removing it.
17
+
18
+ The rules this module holds to, all of them the same rule:
19
+
20
+ * **Nothing disappears.** A waived finding leaves `findings` and appears in
21
+ `waived[]` with its reason, and both counts are published. A number that goes
22
+ down because somebody wrote a file, with no way to see what left, is exactly
23
+ the confident falsehood this product exists not to produce.
24
+ * **A waiver names one finding, exactly.** Keyed on the stable `finding_id` or
25
+ `defect_id`, never a glob and never a rule family — waiving `DEAD-001` in one
26
+ line would silence the family, and a silenced family is indistinguishable from
27
+ a family that found nothing.
28
+ * **A reason is required.** A waiver with no reason is not adjudication; it is a
29
+ deletion with better manners.
30
+ * **A waiver can expire, and an expired one does not apply.** It is published as
31
+ expired rather than dropped, because "this was reviewed in March and the
32
+ review lapsed" is the fact a reader needs.
33
+ * **A waiver that matches nothing is reported, never ignored.** It usually means
34
+ the finding it named was fixed — or that the id was mistyped, which would
35
+ otherwise be a silent no-op.
36
+ * **A malformed file is an error, never an empty waiver set.** Reading "no
37
+ waivers" out of a broken file would apply a gate the repository did not
38
+ declare.
39
+
40
+ File (first one found wins, and the rest are ignored):
41
+
42
+ .ask/waivers.yml
43
+ .ask/waivers.yaml
44
+ .ask/waivers.json
45
+
46
+ schema_version: waivers-v1
47
+ waivers:
48
+ - finding_id: SEC-001-3f2a9c1b4d5e
49
+ reason: /auth/login is public by design — the login endpoint itself
50
+ by: security-review-2026-08
51
+ expires: 2027-01-01
52
+ - defect_id: dead-code-9a8b7c6d5e4f
53
+ reason: Javadoc sample, not commented-out control flow
54
+ """
55
+ from __future__ import annotations
56
+
57
+ import json
58
+ from dataclasses import dataclass
59
+ from datetime import date, datetime, timezone
60
+ from pathlib import Path
61
+ from typing import Any, Iterable, Optional
62
+
63
+ WAIVERS_SCHEMA = "waivers-v1"
64
+
65
+ #: Precedence order, and the same shape `verify_rules` uses for contracts: YAML
66
+ #: is the documented home because a waiver is reviewed by a human and JSON has
67
+ #: no comments to review in.
68
+ WAIVER_FILES = (
69
+ ".ask/waivers.yml",
70
+ ".ask/waivers.yaml",
71
+ ".ask/waivers.json",
72
+ )
73
+
74
+ _KNOWN_FIELDS = frozenset({"finding_id", "defect_id", "reason", "by", "expires", "note"})
75
+
76
+
77
+ class WaiversError(ValueError):
78
+ """The waivers file exists and is malformed.
79
+
80
+ Raised rather than swallowed: a broken file that read as "no waivers" would
81
+ hold a gate red on rows the repository adjudicated, and a broken file that
82
+ read as "waive everything" would do the opposite. Both are worse than
83
+ stopping.
84
+ """
85
+
86
+
87
+ @dataclass(frozen=True)
88
+ class Waiver:
89
+ """One adjudicated finding, and who said so."""
90
+
91
+ target_id: str
92
+ target_field: str # finding_id | defect_id
93
+ reason: str
94
+ by: str = ""
95
+ expires: Optional[str] = None
96
+ source: str = ""
97
+ line: Optional[int] = None
98
+
99
+ def expired_on(self, today: date) -> bool:
100
+ if not self.expires:
101
+ return False
102
+ try:
103
+ return date.fromisoformat(self.expires) < today
104
+ except ValueError: # validated at load; unreachable through load_waivers
105
+ return False
106
+
107
+ def to_dict(self) -> dict:
108
+ out: dict = {
109
+ self.target_field: self.target_id,
110
+ "reason": self.reason,
111
+ "declared_in": self.source,
112
+ }
113
+ if self.line is not None:
114
+ out["line"] = self.line
115
+ if self.by:
116
+ out["by"] = self.by
117
+ if self.expires:
118
+ out["expires"] = self.expires
119
+ return out
120
+
121
+
122
+ @dataclass
123
+ class WaiverOutcome:
124
+ """What the waivers did to one finding population, in full."""
125
+
126
+ kept: list
127
+ waived: list[dict]
128
+ applied: list[Waiver]
129
+ expired: list[Waiver]
130
+ unmatched: list[Waiver]
131
+ source: str = ""
132
+ declared: int = 0
133
+
134
+ def to_block(self) -> dict:
135
+ """The published block. Present whenever a waivers file exists, so the
136
+ absence of adjudication is as visible as its presence."""
137
+ return {
138
+ "schema_version": WAIVERS_SCHEMA,
139
+ "declared_in": self.source,
140
+ "declared": self.declared,
141
+ "applied": len(self.applied),
142
+ "waived_findings": len(self.waived),
143
+ "expired": [w.to_dict() for w in self.expired],
144
+ "unmatched": [w.to_dict() for w in self.unmatched],
145
+ "basis": (
146
+ "A waiver states that a finding is not a defect in this "
147
+ "repository; it does not make the finding disappear. Every waived "
148
+ "row is published under `waived` with the reason and the file that "
149
+ "declared it, and `summary.total_findings` counts what is left. "
150
+ "An expired waiver does not apply and is listed above; a waiver "
151
+ "that matched nothing is listed too, because it usually means the "
152
+ "finding was fixed — or that its id is wrong."
153
+ ),
154
+ }
155
+
156
+
157
+ def waivers_path(root: Path) -> Optional[Path]:
158
+ """The declared waivers file, or None. First match in precedence order."""
159
+ base = Path(root)
160
+ for candidate in WAIVER_FILES:
161
+ path = base / candidate
162
+ if path.is_file():
163
+ return path
164
+ return None
165
+
166
+
167
+ def _parse_yaml_ish(text: str, source: str) -> list[dict]:
168
+ """Waiver entries from the YAML subset this file needs, without a dependency.
169
+
170
+ Deliberately narrow: a list of `- key: value` blocks under `waivers:`. A
171
+ construction outside that subset raises rather than being silently skipped —
172
+ a waiver nobody can see is the failure mode of the whole feature.
173
+ """
174
+ entries: list[dict] = []
175
+ current: Optional[dict] = None
176
+ in_list = False
177
+ for index, raw in enumerate(text.splitlines(), start=1):
178
+ line = raw.split("#", 1)[0].rstrip() if not raw.strip().startswith("#") else ""
179
+ if not line.strip():
180
+ continue
181
+ stripped = line.strip()
182
+ indent = len(line) - len(line.lstrip())
183
+ if indent == 0:
184
+ key = stripped.split(":", 1)[0].strip()
185
+ if key == "waivers":
186
+ in_list = True
187
+ current = None
188
+ continue
189
+ if key in ("schema_version", "version"):
190
+ in_list = False
191
+ continue
192
+ raise WaiversError(
193
+ f"{source}:{index}: unknown top-level key {key!r} — this file "
194
+ "declares `schema_version` and `waivers`"
195
+ )
196
+ if not in_list:
197
+ raise WaiversError(
198
+ f"{source}:{index}: entry outside the `waivers:` list"
199
+ )
200
+ if stripped.startswith("- "):
201
+ current = {"__line__": index}
202
+ entries.append(current)
203
+ stripped = stripped[2:].strip()
204
+ if not stripped:
205
+ continue
206
+ if current is None:
207
+ raise WaiversError(
208
+ f"{source}:{index}: `{stripped}` is not inside a `- ` list item"
209
+ )
210
+ if ":" not in stripped:
211
+ raise WaiversError(f"{source}:{index}: expected `key: value`, got {stripped!r}")
212
+ key, _, value = stripped.partition(":")
213
+ current[key.strip()] = _unquote(value.strip())
214
+ return entries
215
+
216
+
217
+ def _unquote(value: str) -> str:
218
+ if len(value) >= 2 and value[0] == value[-1] and value[0] in ("'", '"'):
219
+ return value[1:-1]
220
+ return value
221
+
222
+
223
+ def _entries_from_json(text: str, source: str) -> list[dict]:
224
+ try:
225
+ data = json.loads(text)
226
+ except json.JSONDecodeError as exc:
227
+ raise WaiversError(f"{source}: invalid JSON ({exc})") from exc
228
+ if isinstance(data, list):
229
+ raw = data
230
+ elif isinstance(data, dict):
231
+ raw = data.get("waivers", [])
232
+ else:
233
+ raise WaiversError(f"{source}: expected an object or a list of waivers")
234
+ if not isinstance(raw, list):
235
+ raise WaiversError(f"{source}: `waivers` must be a list")
236
+ return [dict(entry) for entry in raw if isinstance(entry, dict)]
237
+
238
+
239
+ def load_waivers(root: Path) -> tuple[list[Waiver], str]:
240
+ """Every waiver this repository declares, and the file that declared them.
241
+
242
+ Returns `([], "")` when no file exists — the ordinary case, and the only one
243
+ in which an empty result means "nothing was adjudicated".
244
+ """
245
+ path = waivers_path(root)
246
+ if path is None:
247
+ return [], ""
248
+ try:
249
+ rel = path.relative_to(Path(root)).as_posix()
250
+ except ValueError:
251
+ rel = path.as_posix()
252
+ try:
253
+ text = path.read_text(encoding="utf-8", errors="ignore")
254
+ except OSError as exc:
255
+ raise WaiversError(f"{rel}: cannot be read ({exc})") from exc
256
+
257
+ entries = (
258
+ _entries_from_json(text, rel) if path.suffix == ".json"
259
+ else _parse_yaml_ish(text, rel)
260
+ )
261
+
262
+ waivers: list[Waiver] = []
263
+ for entry in entries:
264
+ line = entry.pop("__line__", None)
265
+ where = f"{rel}:{line}" if line else rel
266
+ unknown = set(entry) - _KNOWN_FIELDS
267
+ if unknown:
268
+ raise WaiversError(f"{where}: unknown field(s) {sorted(unknown)}")
269
+ target_field = (
270
+ "finding_id" if entry.get("finding_id")
271
+ else "defect_id" if entry.get("defect_id")
272
+ else ""
273
+ )
274
+ if not target_field:
275
+ raise WaiversError(
276
+ f"{where}: a waiver names one finding — give `finding_id` or "
277
+ "`defect_id`. Waiving a rule family would silence it, and a "
278
+ "silenced family cannot be told apart from one that found nothing"
279
+ )
280
+ if entry.get("finding_id") and entry.get("defect_id"):
281
+ raise WaiversError(
282
+ f"{where}: give `finding_id` or `defect_id`, not both — a waiver "
283
+ "that names two things adjudicates neither"
284
+ )
285
+ reason = str(entry.get("reason") or "").strip()
286
+ if not reason:
287
+ raise WaiversError(
288
+ f"{where}: `reason` is required. A waiver without one is not "
289
+ "adjudication, it is a deletion"
290
+ )
291
+ expires = str(entry.get("expires") or "").strip() or None
292
+ if expires:
293
+ try:
294
+ date.fromisoformat(expires)
295
+ except ValueError as exc:
296
+ raise WaiversError(
297
+ f"{where}: `expires` must be an ISO date (YYYY-MM-DD), got "
298
+ f"{expires!r}"
299
+ ) from exc
300
+ waivers.append(Waiver(
301
+ target_id=str(entry[target_field]).strip(),
302
+ target_field=target_field,
303
+ reason=reason,
304
+ by=str(entry.get("by") or "").strip(),
305
+ expires=expires,
306
+ source=rel,
307
+ line=line,
308
+ ))
309
+ return waivers, rel
310
+
311
+
312
+ def apply_waivers(
313
+ findings: Iterable[Any],
314
+ root: Optional[Path],
315
+ *,
316
+ today: Optional[date] = None,
317
+ ) -> WaiverOutcome:
318
+ """Split *findings* into what stands and what the repository adjudicated.
319
+
320
+ Never raises on the ordinary path: a repository with no waivers file gets its
321
+ findings back untouched and a block that says nothing was declared. A
322
+ malformed file raises `WaiversError`, because guessing at it decides a gate.
323
+ """
324
+ items = list(findings)
325
+ if root is None:
326
+ return WaiverOutcome(kept=items, waived=[], applied=[], expired=[], unmatched=[])
327
+ declared, source = load_waivers(Path(root))
328
+ if not declared:
329
+ return WaiverOutcome(
330
+ kept=items, waived=[], applied=[], expired=[], unmatched=[], source=source,
331
+ )
332
+
333
+ day = today or datetime.now(timezone.utc).date()
334
+ live = [w for w in declared if not w.expired_on(day)]
335
+ expired = [w for w in declared if w.expired_on(day)]
336
+ by_finding = {w.target_id: w for w in live if w.target_field == "finding_id"}
337
+ by_defect = {w.target_id: w for w in live if w.target_field == "defect_id"}
338
+
339
+ kept: list[Any] = []
340
+ waived: list[dict] = []
341
+ matched: set[str] = set()
342
+ for finding in items:
343
+ waiver = by_finding.get(getattr(finding, "id", "")) or by_defect.get(
344
+ getattr(finding, "defect_id", "") or ""
345
+ )
346
+ if waiver is None:
347
+ kept.append(finding)
348
+ continue
349
+ matched.add(waiver.target_id)
350
+ row = finding.to_dict() if hasattr(finding, "to_dict") else dict(finding)
351
+ row["waived"] = waiver.to_dict()
352
+ waived.append(row)
353
+
354
+ return WaiverOutcome(
355
+ kept=kept,
356
+ waived=waived,
357
+ applied=[w for w in live if w.target_id in matched],
358
+ expired=expired,
359
+ unmatched=[w for w in live if w.target_id not in matched],
360
+ source=source,
361
+ declared=len(declared),
362
+ )
363
+
364
+
365
+ def apply_to_result(result: Any, root: Optional[Path], *, today: Optional[date] = None) -> Any:
366
+ """Adjudicate a `SpringAuditResult` in place, and re-finalize it.
367
+
368
+ Applied where the **whole** population exists — after the scopes are merged,
369
+ never inside one auditor — because a waiver that names a security finding is
370
+ not "unmatched" when the transaction scope fails to find it, and publishing
371
+ it as unmatched would send a team looking for an id that is doing its job.
372
+
373
+ Re-finalized rather than patched: `summary`, `defects` and the confidence
374
+ level are derived from the finding population, and a population that changed
375
+ must not keep numbers derived from the one before it.
376
+ """
377
+ findings = list(getattr(result, "findings", []) or [])
378
+ outcome = apply_waivers(findings, root, today=today)
379
+ if not outcome.source:
380
+ return result # no waivers file: nothing declared, nothing to publish
381
+ result.findings = outcome.kept
382
+ result.waived = outcome.waived
383
+ result.waivers = outcome.to_block()
384
+ return result.finalize()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 5.2.0
3
+ Version: 5.3.0
4
4
  Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
5
5
  License-File: LICENSE
6
6
  Keywords: agents,ai,codebase,context,developer-tools,llm
@@ -42,7 +42,7 @@ Description-Content-Type: text/markdown
42
42
 
43
43
  **Context · Impact · Migration · Architecture · Review — everything from one structural model.**
44
44
 
45
- ![Version](https://img.shields.io/badge/version-5.2.0-blue)
45
+ ![Version](https://img.shields.io/badge/version-5.3.0-blue)
46
46
  ![Python](https://img.shields.io/badge/python-3.9%2B-green)
47
47
 
48
48
  > **ASK Engine** is the product. The CLI command is **`ask`**. The legacy **`sourcecode`**
@@ -126,7 +126,7 @@ brew tap haroundominique/sourcecode && brew install sourcecode
126
126
  # pip / pipx
127
127
  pipx install sourcecode # or: pip install sourcecode
128
128
 
129
- ask version # ask 5.2.0 — and, on a build that has aged,
129
+ ask version # ask 5.3.0 — and, on a build that has aged,
130
130
  # how many releases have probably shipped since
131
131
  ```
132
132
 
@@ -195,6 +195,29 @@ ask verify /path/to/repo --init --dry-run
195
195
  ask risk /path/to/repo
196
196
  ```
197
197
 
198
+ **And the three that answer questions this repository does not contain the answer to.**
199
+ The profile set is decided by a deployment artefact, the consumers are other repositories,
200
+ and *since when* is a fact about history — each one is a join of things already measured,
201
+ and each one leaves the previous answer untouched when it cannot decide:
202
+
203
+ ```bash
204
+ # The artefact that decides the profile set — Kubernetes manifest, compose file, WebLogic
205
+ # deployment plan, Dockerfile, dotenv, launch script. Every answer is then given under the
206
+ # set it names, with the file:line that decided it. An artefact that decides nothing (a
207
+ # placeholder, two artefacts that disagree) leaves the repository's own verdict as it was.
208
+ ask posture /path/to/repo --profile-from k8s/deployment-prod.yaml
209
+
210
+ # Of the routes a readable rule leaves open: which ones a consumer actually calls (work),
211
+ # and which ones nobody calls (surface to delete instead of guard). Reads TypeScript/JS and
212
+ # Java consumers, only where the verb and the path are written at the call site.
213
+ ask endpoints /path/to/repo --consumer ../web-client --consumer ../partner-api
214
+
215
+ # Since when. Walks the commit series, runs the analyses that already ship on a read-only
216
+ # materialisation of each sampled tree, and publishes where a number MOVED — with the commit
217
+ # it was observed at and the window it could have happened in.
218
+ ask timeline /path/to/repo --since v1.0 --watch posture,data-exposure
219
+ ```
220
+
198
221
  Then the everyday loop:
199
222
 
200
223
  ```bash
@@ -249,7 +272,7 @@ Blast radius from a class or interface — reverse dependencies, through Spring
249
272
 
250
273
  ### 3 · Architecture Intelligence
251
274
  The system map: module graph, dependency views, REST surface, per-class summaries, and a symbol-level IR for downstream tooling.
252
- `ask export` · `ask repo-ir` · `ask endpoints` · `ask explain`
275
+ `ask export` · `ask repo-ir` · `ask endpoints` · `ask explain` · `ask timeline` (*experimental* — the same views over the commit series: when a number moved, and in which window)
253
276
  → [reference](docs/USER_GUIDE.md#core-commands)
254
277
 
255
278
  ### 4 · Migration & Modernization
@@ -280,6 +303,16 @@ parse and publishes the worst. A field audit closed those five hops by hand with
280
303
  the flag existed.
281
304
  `ask posture . --resolve-environments`
282
305
 
306
+ **`--profile-from` closes the loop.** `--resolve-environments` reads what the *repository*
307
+ says; the artefact that actually decides the profile set usually lives outside it. Name it —
308
+ Kubernetes manifest, compose file, WebLogic deployment plan, `Dockerfile`, dotenv, launch
309
+ script — and every answer is given under the set it sets, with the `file:line` that decided
310
+ it. Undecidable-first, so pointing it at the wrong file costs nothing: a placeholder, an entry
311
+ with no value, or two artefacts that disagree decide **nothing** and leave the repository's
312
+ own verdict byte-for-byte as it was. The process environment still outranks the file, and the
313
+ payload says so.
314
+ `ask posture . --profile-from k8s/deployment-prod.yaml`
315
+
283
316
  Unresolved is a first-class outcome: a condition the resolver cannot decide is reported as a
284
317
  hole with the condition named, never folded into active or inactive. **A posture answer that
285
318
  guesses is a confident security falsehood — the worst failure mode this tool has.**
@@ -295,8 +328,12 @@ field case: a defect both `spring-audit` and `impact-chain` called *medium* comp
295
328
  **high (8.06)** once *reachable unauthenticated* and *writes to the database* are in it.
296
329
  The last two factors describe the input path: a query assembled by concatenation, a bounded
297
330
  HTTP-input-to-query-sink path when ASK can prove one, and a route accepting a body with no
298
- declared constraint. General taint remains `NC-001` and is published in the payload's own
299
- `non_coverage` block.
331
+ declared constraint. **The sink family a MyBatis codebase actually uses is covered too**: an
332
+ annotated HTTP input reaching a statement that splices it into the SQL with `${...}` is a
333
+ three-state verdict — `reaches` (with the trace), `does_not_reach` (stated only where the call
334
+ sites were found) or `undecidable` — and only the first moves the factor. The census is
335
+ published beside the rows, so the multiplier is auditable rather than asserted. General taint
336
+ remains `NC-001` and is published in the payload's own `non_coverage` block.
300
337
  `ask risk .` · `ask risk . --min-band high` · `ask risk . --limit 10`
301
338
  → [reference](docs/USER_GUIDE.md)
302
339
 
@@ -322,7 +359,7 @@ experimental: both are true, and they are two different facts.
322
359
  |---|---|---|
323
360
  | **core** | contract stable within a major — safe to gate CI on | `endpoints` · `spring-audit` · `migrate-check` · `impact` · `impact-chain` · `pr-impact` · `verify` |
324
361
  | **supported** | maintained; fields are added, never removed without a major | every command not named in another row |
325
- | **experimental** | shape may change in a minor — do not gate CI on it | `risk` · `enrich` · `audit-report` · `data-exposure` · `migrate-recipe` · `archetype` |
362
+ | **experimental** | shape may change in a minor — do not gate CI on it | `risk` · `enrich` · `audit-report` · `data-exposure` · `migrate-recipe` · `archetype` · `timeline` |
326
363
  | **parked** | kept working, no longer developed | `retrieve` |
327
364
 
328
365
  The same table is printed by `ask --help`, and both are generated from one authority
@@ -338,18 +375,18 @@ from it.
338
375
 
339
376
  | Command | Tier | Answers | Note |
340
377
  |---|---|---|---|
341
- | `posture` | supported | which beans a profile set wires, and how effective endpoint access differs between two sets | the most differentiated capability here |
342
- | `risk` | experimental | what each defect actually costs, once reach, access, write effect and the shape of the input path are in it | `defect_severity × reachability × auth_verdict × write_effect × query_construction × input_constraints`; every factor names its authority; `--table --rule SEC-008 --band high --top-n 20` gives audit triage without `jq` |
378
+ | `posture` | supported | which beans a profile set wires, and how effective endpoint access differs between two sets | the most differentiated capability here. `--resolve-environments` says which set the repository decides; `--profile-from <file>` reads the artefact that actually decides it (Kubernetes manifest, compose file, deployment plan, `Dockerfile`, dotenv) and answers under that set, with the `file:line` — deciding nothing leaves the verdict untouched |
379
+ | `risk` | experimental | what each defect actually costs, once reach, access, write effect and the shape of the input path are in it | `defect_severity × reachability × auth_verdict × write_effect × query_construction × input_constraints`; every factor names its authority; the `query_construction` factor covers MyBatis `${}` splicing with a three-state verdict (`reaches` / `does_not_reach` / `undecidable`) and publishes the census; `--table --rule SEC-008 --band high --top-n 20` gives audit triage without `jq` |
343
380
  | `enrich` | experimental | another scanner's SARIF findings, ranked by what this repository does with them | `--sarif <log>`; same composition as `risk`, with `--table --rule <id> --band high --top-n 20` for triage |
344
381
  | `audit-report` | experimental | human audit bundle over existing `risk` + `posture` evidence, optionally signed | includes `evidence_manifest` claim provenance; `--format markdown`; `--sign-key <file>` signs canonical JSON with HMAC-SHA256 |
345
382
  | `migrate-recipe` | experimental | the migration report as the OpenRewrite recipe that applies it | only recipes a finding named; the manual remainder published beside them; writes nothing without `--write`, and never a runnable command for an empty recipe list |
346
383
  | `data-exposure` | experimental | which routes can carry the data you labelled, and who reaches them | labels declared in `sourcecode.config.json` — never inferred from a name; `signature` and `call_reach` evidence published apart, field-level flow out of scope (NC-008). With nothing declared, `ask data-exposure /path/to/repo` answers `answered: false` and hands back the file, the key and an example to declare — it never reports zero exposed routes |
347
- | `endpoints` | core | every REST endpoint, effective path, security policy, confidence | Spring MVC + JAX-RS (~65 % recall on JAX-RS sub-resource locators). `--compact` answers the exposure census without the rows; `--servlets` lists the servlet-mounted surface as its own population; `--client-usage` says which routes the TS/JS client in this repository actually calls |
384
+ | `endpoints` | core | every REST endpoint, effective path, security policy, confidence | Spring MVC + JAX-RS (~65 % recall on JAX-RS sub-resource locators). `--compact` answers the exposure census without the rows; `--servlets` lists the servlet-mounted surface as its own population; `--client-usage` says which routes the TS/JS client in this repository actually calls; `--consumer <repo>` (repeatable) joins the routes against consumers in **other** repositories — TypeScript/JS and Java — and turns the census into a surface-reduction plan: open and called (fix now), open and called by nobody (delete rather than guard), and calls this server serves no route for |
348
385
  | `spring-audit` | core | transactional anomalies + security configuration/exposure + validation gaps | `--ci`, `-f github-comment`; `--table --rule SEC-008 --top-n 20` for human-scale review. Every run inventories its own rules — `rules_run`, `rules_not_run`, `rules_partially_run`, `rules_run_count`/`rules_total` — so "all of them" is a fact, not an assumption |
349
386
  | `migrate-check` | core | Boot 2→3 readiness + Java LTS/licensing inventory: located blockers, per-dimension score, effort, detected Java 8/11/17/21/25 evidence and explicit licensing-review signals | `--target-jdk 25` sets the target LTS route; `--blast-radius` orders the re-test plan; `--table --rule MIG-001 --band critical --top-n 20` for blocker triage |
350
387
  | `impact` / `impact-chain` | core | blast radius of a change, to the endpoints it reaches | target the **interface**, not the `Impl` |
351
388
  | `pr-impact` | core | the same, scoped to a PR diff | gating command: `--fail-on`, exit codes |
352
- | `verify` | core | does the repo satisfy its declared contracts, **relative to a baseline** | `.ask/contracts.yml`; exit 0/1/2 |
389
+ | `verify` | core | does the repo satisfy its declared contracts, **relative to a baseline** | `.ask/contracts.yml`; exit 0/1/2. `.ask/waivers.yml` adjudicates a finding as *not a defect here* (stable id + required reason, optional expiry) so a reviewed row stops holding the gate red — a baseline records accepted debt, a waiver says it was never a defect |
353
390
  | `verify-edit` | supported | did the working-tree edits change runtime behaviour | semantic diff gate for the edit loop |
354
391
  | `--compact` / `--agent` | — | bounded structural context for an agent | flags of the root command, not commands: not tiered |
355
392
  | `onboard` / `explain` / `cold-start` | supported | orientation in an unfamiliar repo; per-class summary; bootstrap snapshot | |
@@ -360,6 +397,7 @@ from it.
360
397
  | `validation` | supported | request-body validation coverage and gaps | |
361
398
  | `baseline capture\|diff` · `trend` | supported | versioned architectural metrics over time; `ask trend .` reads the series (a repository path or a baselines directory), `ask baseline diff .` compares the tree against its newest point | trend reporting, not gating. Baselines land in `.ask/baselines` **inside the repository** — the history travels with the code, not with a vendor; an audit that must not write passes `--dir`. `capture --auto` is the unattended form (one baseline per commit, never rewrites one, never fails the build) — automate it: [baseline-ci.yml](docs/baseline-ci.yml) |
362
399
  | `retrieve` | parked | typed knowledge queries over the model | |
400
+ | `timeline` | experimental | since when a number moved, and in which commit window | walks the commit series and re-runs the shipped analyses (`posture`, `data-exposure`, `endpoints`, `spring-audit`) on a read-only materialisation of each sampled tree; publishes transitions, not a per-commit dump. A sample that could not be analysed is `null` with a reason, never 0, and a transition under sampling carries the window it could have happened in |
363
401
  | `archetype` | experimental | evidence-based architectural archetype | |
364
402
  | `rename-class` / `chunk-file` | supported | word-boundary Java rename; split a large file for an agent | |
365
403
  | `cache status\|warm\|model\|clear` · `auth` · `telemetry` · `mcp` · `config` · `version` | supported | housekeeping | `cache model [path]` explains what a warm buys per command; `activate` too |
@@ -404,7 +442,7 @@ reading JSON sees the same boundary a buyer reads here.
404
442
 
405
443
  | Not covered | Why | What answers it |
406
444
  |---|---|---|
407
- | **General request-input-to-sink taint analysis.** | `ask risk` includes a bounded slice for annotated HTTP parameters, positional calls in repository Java sources and known query sinks. Anything broader needs value flow through a program, which is a different analysis with a different failure mode: an unsound one produces confident findings that are wrong, and every claim here is meant to be checkable against the line that produced it. | A dataflow scanner (Semgrep, CodeQL) for complete taint. What this product adds on top is reachability and, for the bounded slice, whether an annotated HTTP input reaches a known concatenated query sink. |
445
+ | **General request-input-to-sink taint analysis.** | `ask risk` includes two bounded slices for annotated HTTP parameters and positional calls in repository Java sources: known query sinks, and MyBatis statements that splice a value into their SQL. Anything broader needs value flow through a program, which is a different analysis with a different failure mode: an unsound one produces confident findings that are wrong, and every claim here is meant to be checkable against the line that produced it. | A dataflow scanner (Semgrep, CodeQL) for complete taint. What this product adds on top is reachability and, for the two bounded slices, whether an annotated HTTP input reaches a known concatenated query sink or a spliced SQL statement — the latter with a three-state verdict that says `undecidable` rather than clearing a route it could not follow. |
408
446
  | **Secrets outside Java, Spring configuration and the deployment descriptors — a Helm value, a CI variable file, a shell script.** | The file population this analyzer reads is the Java source, the Spring configuration convention and the descriptors it already parses to resolve an environment. A secret elsewhere is not missed by a weak rule; it is outside the set of files anything here opens. Narrowed by CL-10: a credential stored in `web.xml` or a Spring XML context IS reported (SEC-007), because those files were already being read. | A dedicated secret scanner over the whole tree (gitleaks, trufflehog). |
409
447
  | **Filter-chain order and per-filter URL patterns — the presence of a custom filter is structural only.** | Which filter runs first is decided by bean ordering this analyzer does not resolve. Where two active configurations both match a request, the answer published is `undecided` rather than a guess. | `ask posture --profile <set>` states per endpoint what the readable rules decide and what they leave undecided. |
410
448
  | **Known vulnerabilities in dependencies — no CVE database, no version advisory matching.** | Enriching a vulnerability feed is a different product with a different update cadence; a stale embedded database is worse than no database, because it reads as a clean bill of health. | A dependency scanner (Trivy, OWASP Dependency-Check). `impact-chain` then answers which of its findings anything actually reaches. |
@@ -414,7 +452,7 @@ Two more boundaries worth stating in the same voice:
414
452
  | Not covered | Why | What answers it |
415
453
  |---|---|---|
416
454
  | **Applying a migration — nothing here edits source.** | This is the diagnosis layer: it measures what must change and what each change would reach. Rewriting code is an execution problem with an established executor, and duplicating it would mean maintaining a second, worse one. | OpenRewrite. `migrate-check` publishes the recipe each finding carries (`recipes[]`), which is the input that executor takes. |
417
- | **What the process environment sets at start-up — the profile set, properties and secrets a container is given.** | Nothing in a repository can observe the environment of a process that has not started. A value read from a file here is the default the repository ships, never a guarantee of what runs. | `ask posture --resolve-environments` reads every artefact in the repository that names the profile set, says when none of them decides it, and ranks the admissible sets by what each leaves open. |
455
+ | **What the process environment sets at start-up — the profile set, properties and secrets a container is given.** | Nothing in a repository can observe the environment of a process that has not started. A value read from a file here is the default the repository ships, never a guarantee of what runs. | `ask posture --resolve-environments` reads every artefact in the repository that names the profile set, says when none of them decides it, and ranks the admissible sets by what each leaves open. `--profile-from <file>` goes one step further and reads the deployment artefact itself, which is where that decision is actually written — still a file, so the process environment still outranks it, and the payload says so. |
418
456
 
419
457
 
420
458
  And one about the endpoint surface itself:
@@ -560,7 +598,7 @@ Matching endpoints report `policy: "custom"` and drop out of the `no_security_si
560
598
  | Doc | What it covers |
561
599
  |-----|----------------|
562
600
  | [USER_GUIDE.md](docs/USER_GUIDE.md) | Full command reference, flags, output schema, workflows |
563
- | [contracts.md](docs/contracts.md) | Declare invariants in `.ask/contracts.yml` (or derive them with `ask verify --init`), enforce them in the edit loop and in CI |
601
+ | [contracts.md](docs/contracts.md) | Declare invariants in `.ask/contracts.yml` (or derive them with `ask verify --init`), enforce them in the edit loop and in CI — and adjudicate a finding as *not a defect here* in `.ask/waivers.yml` |
564
602
  | [baseline-ci.yml](docs/baseline-ci.yml) | Capture an architectural baseline per release, so the series exists when you want to read it |
565
603
  | [posture.md](docs/posture.md) | What a profile set actually wires — down to which endpoints its filter chain permits — and what could not be decided |
566
604
  | [migrate-check.md](docs/migrate-check.md) | Migration rule catalogue (MIG-001..043) + Hibernate stratification |