@alexgreensh/token-optimizer 5.13.75 → 5.13.76

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 (84) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/hooks/module_runner.py +1 -1
  4. package/hooks/posttooluse_runner.py +7 -9
  5. package/hooks/run.py +5 -1
  6. package/hooks/stop_runner.py +15 -56
  7. package/hooks/userpromptsubmit_runner.py +29 -4
  8. package/package.json +1 -1
  9. package/skills/token-optimizer/assets/dashboard.html +30 -14
  10. package/skills/token-optimizer/assets/savings_story.js +103 -27
  11. package/skills/token-optimizer/references/agent-prompts.md +2 -0
  12. package/skills/token-optimizer/references/implementation-playbook.md +1 -0
  13. package/skills/token-optimizer/scripts/_measure/__init__.py +1 -1
  14. package/skills/token-optimizer/scripts/_measure/apply_safe.py +512 -0
  15. package/skills/token-optimizer/scripts/_measure/audit.py +9 -20
  16. package/skills/token-optimizer/scripts/_measure/autocompact_advice.py +455 -0
  17. package/skills/token-optimizer/scripts/_measure/cache_policy.py +82 -127
  18. package/skills/token-optimizer/scripts/_measure/cli.py +10 -24
  19. package/skills/token-optimizer/scripts/_measure/cold_guard.py +777 -0
  20. package/skills/token-optimizer/scripts/_measure/continuity.py +45 -4
  21. package/skills/token-optimizer/scripts/_measure/counted_closes.py +398 -0
  22. package/skills/token-optimizer/scripts/_measure/counted_headline.py +112 -0
  23. package/skills/token-optimizer/scripts/_measure/dashboard.py +14 -6
  24. package/skills/token-optimizer/scripts/_measure/feature_health.py +6 -0
  25. package/skills/token-optimizer/scripts/_measure/keepwarm_auto.py +452 -0
  26. package/skills/token-optimizer/scripts/_measure/keepwarm_economics.py +8 -4
  27. package/skills/token-optimizer/scripts/_measure/keepwarm_safety.py +548 -24
  28. package/skills/token-optimizer/scripts/_measure/limit_units.py +463 -0
  29. package/skills/token-optimizer/scripts/_measure/local_adapt.py +192 -0
  30. package/skills/token-optimizer/scripts/_measure/mod_action_booking.py +71 -14
  31. package/skills/token-optimizer/scripts/_measure/next_actions.py +420 -0
  32. package/skills/token-optimizer/scripts/_measure/poc_commands.py +44 -0
  33. package/skills/token-optimizer/scripts/_measure/prefix_cost.py +215 -0
  34. package/skills/token-optimizer/scripts/_measure/pt_resume_cues.py +46 -0
  35. package/skills/token-optimizer/scripts/_measure/quality_archive.py +7 -10
  36. package/skills/token-optimizer/scripts/_measure/savings.py +75 -81
  37. package/skills/token-optimizer/scripts/_measure/savings_headline.py +17 -21
  38. package/skills/token-optimizer/scripts/_measure/savings_story.py +8 -1
  39. package/skills/token-optimizer/scripts/_measure/session_store_spool.py +119 -78
  40. package/skills/token-optimizer/scripts/_measure/status_bar_refresh.py +38 -3
  41. package/skills/token-optimizer/scripts/_measure/structural_ledger.py +1 -1
  42. package/skills/token-optimizer/scripts/_measure/subscription_audits.py +725 -0
  43. package/skills/token-optimizer/scripts/_measure/transcript_backfill.py +1 -1
  44. package/skills/token-optimizer/scripts/_measure/transcript_stream.py +8 -2
  45. package/skills/token-optimizer/scripts/antigravity_install.py +3 -0
  46. package/skills/token-optimizer/scripts/archive_result.py +16 -28
  47. package/skills/token-optimizer/scripts/archive_verify.py +1 -1
  48. package/skills/token-optimizer/scripts/bash_compress.py +156 -176
  49. package/skills/token-optimizer/scripts/bash_compress_hook.py +218 -174
  50. package/skills/token-optimizer/scripts/bash_search_results.py +189 -9
  51. package/skills/token-optimizer/scripts/bash_whitelist.py +6 -1
  52. package/skills/token-optimizer/scripts/benchmark.py +11 -13
  53. package/skills/token-optimizer/scripts/big_noncode_read.py +998 -0
  54. package/skills/token-optimizer/scripts/build_output_compress.py +103 -8
  55. package/skills/token-optimizer/scripts/builtin_tool_compress.py +716 -0
  56. package/skills/token-optimizer/scripts/cloud_kit.py +1 -1
  57. package/skills/token-optimizer/scripts/codex_doctor.py +1 -1
  58. package/skills/token-optimizer/scripts/command_compress_extra.py +955 -0
  59. package/skills/token-optimizer/scripts/compact_markers.py +129 -0
  60. package/skills/token-optimizer/scripts/copilot_install.py +3 -0
  61. package/skills/token-optimizer/scripts/cursor_install.py +7 -0
  62. package/skills/token-optimizer/scripts/devin_source.py +5 -5
  63. package/skills/token-optimizer/scripts/emit_safety_gate.py +518 -0
  64. package/skills/token-optimizer/scripts/fixtures/b2_more_commands.json +142 -0
  65. package/skills/token-optimizer/scripts/fixtures/b5_more_savings.json +26 -0
  66. package/skills/token-optimizer/scripts/fixtures/builtin_tools.json +103 -0
  67. package/skills/token-optimizer/scripts/fixtures/c7_review_ratchet.json +52 -0
  68. package/skills/token-optimizer/scripts/fixtures/large_output_policy.json +55 -0
  69. package/skills/token-optimizer/scripts/go_cargo_test_compress.py +493 -0
  70. package/skills/token-optimizer/scripts/grok_install.py +3 -0
  71. package/skills/token-optimizer/scripts/hermes_doctor.py +4 -1
  72. package/skills/token-optimizer/scripts/hermes_install.py +10 -1
  73. package/skills/token-optimizer/scripts/hook_fastpath.py +94 -0
  74. package/skills/token-optimizer/scripts/hook_runtime.py +6 -2
  75. package/skills/token-optimizer/scripts/large_output_policy.py +431 -0
  76. package/skills/token-optimizer/scripts/measure.py +10 -12
  77. package/skills/token-optimizer/scripts/pipe_file_compress.py +900 -0
  78. package/skills/token-optimizer/scripts/pipeline_analyzer.py +15 -1
  79. package/skills/token-optimizer/scripts/post_run_classify.py +2 -2
  80. package/skills/token-optimizer/scripts/preserved_reinject.py +20 -3
  81. package/skills/token-optimizer/scripts/process_identity.py +66 -0
  82. package/skills/token-optimizer/scripts/read_cache.py +51 -60
  83. package/skills/token-optimizer/scripts/statusline.js +21 -3
  84. package/skills/token-optimizer/scripts/visibility_rule.py +536 -0
@@ -0,0 +1,518 @@
1
+ #!/usr/bin/env python3
2
+ """Final pre-emit safety verifier shared by all Token Optimizer compressors.
3
+
4
+ Stdlib-only. Called right before emitting any compressed replacement:
5
+ (a) Confirms every critical line in raw output (traceback, non-zero exit,
6
+ failing test, panic/fatal, error/exception) is visible verbatim.
7
+ (b) Confirms every omitted line is covered by an accurate declared count
8
+ and place.
9
+ (c) Confirms a working runnable ``measure.py expand <key>`` pointer exists
10
+ whenever any non-empty content is hidden (unless ``require_expand=False``
11
+ for a pre-pointer inner compressor that is re-verified with
12
+ ``require_expand=True`` after attaching the archive pointer).
13
+
14
+ Fail-closed to original: if any check fails or the verifier raises, callers
15
+ emit NOTHING and return the original output untouched.
16
+
17
+ Definitions of critical lines and undeclared hiding mirror
18
+ ``scripts/replay_v2_metrics.py`` without importing from ``scripts/`` at runtime.
19
+ """
20
+ from __future__ import annotations
21
+
22
+ import re
23
+
24
+ VISIBLE_OK = "VISIBLE_OK"
25
+ RECOVERABLE_DECLARED = "RECOVERABLE_DECLARED"
26
+ UNDECLARED_HIDDEN = "UNDECLARED_HIDDEN"
27
+ CRITICAL_HIDDEN = "CRITICAL_HIDDEN"
28
+ QUALITY_CLASSES = (VISIBLE_OK, RECOVERABLE_DECLARED, UNDECLARED_HIDDEN, CRITICAL_HIDDEN)
29
+
30
+ _ANSI_RE = re.compile(r"\x1b\[[0-9;]*[A-Za-z]")
31
+ _CD_PREFIX_RE = re.compile(r"^(?:cd\s+\S+\s*(?:&&|;)\s*)+")
32
+ _SEARCH_MATCH_LINE_RE = re.compile(r"^(?:[A-Za-z]:)?[\w./@+-]+\.[A-Za-z0-9]{1,10}:\d+[:\-]")
33
+ _PLAIN_PATH_LINE_RE = re.compile(r"^(?:[A-Za-z]:)?[\w./@+-]+/[\w./@+-]+\.[A-Za-z0-9]{1,10}$")
34
+ _SEARCH_TOOL_DIAG_RE = re.compile(r"^(?:grep|rg|egrep|fgrep|git|find|ag):\s+", re.I)
35
+ _EXPAND_CMD_RE = re.compile(
36
+ r'measure\.py["\']?\s+(?:--runtime\s+\S+\s+)?expand\s+([a-zA-Z0-9_-]{8,})'
37
+ )
38
+
39
+ _CRIT_TRACEBACK_RE = re.compile(
40
+ r'traceback \(most recent call last\)|^\s*file ".+", line \d+|'
41
+ r"^\s*at\s+\S+\s+\([^)]+:\d+:\d+\)|^goroutine \d+ \[",
42
+ re.I,
43
+ )
44
+ _CRIT_EXIT_RE = re.compile(
45
+ r"\b(?:exit(?:ed with)?|return(?:ed)?)\s+(?:code|status)\s+[1-9]\d*\b|"
46
+ r"^error:\s*exit code\s+[1-9]\d*\b",
47
+ re.I,
48
+ )
49
+ _CRIT_FAIL_TEST_RE = re.compile(
50
+ r"^FAILED\b|^\s*FAIL(?:\s+[\w./-]+|:)|^--- FAIL:|"
51
+ r"\b[1-9]\d*\s+failed\b|\bAssertionError\b|[✗✕✖]\s+"
52
+ )
53
+ _CRIT_PANIC_RE = re.compile(
54
+ r"\b(?:fatal|panic|panicked|segfault|segmentation fault|core dumped|out of memory)\b",
55
+ re.I,
56
+ )
57
+ _CRIT_ERROR_RE = re.compile(
58
+ r"(?:[A-Za-z_][A-Za-z0-9_]*(?:Error|Exception)\b|\b(?:error|errors|exception|failed|failure|failures)\b)",
59
+ re.I,
60
+ )
61
+ _CRIT_NON_ERROR_FAILURE_RE = re.compile(
62
+ r"(?:"
63
+ r"(?i:\bcommand\s+not\s+found\b)|"
64
+ r"(?i:\bno\s+such\s+file\s+or\s+directory\b)|"
65
+ r"^CONFLICT\b|(?i:\bmerge\s+conflict\b)|"
66
+ r"\[rejected\]|"
67
+ r"^\s*Killed(?:\s|$|:)|\bKilled:\s*\d+|"
68
+ r"(?i:\bexceeded\s+its\s+progress\s+deadline\b)|"
69
+ r"(?i:\bno\s+space\s+left\s+on\s+device\b)|"
70
+ r"(?i:\baddress\s+already\s+in\s+use\b)|"
71
+ r"(?i:\bread-only\s+file\s+system\b)|"
72
+ r"(?i:\bcannot\s+(?:access|open|create|remove)\b)|"
73
+ r"(?i:\b(?:could|unable)\s+to\s+resolve\b)"
74
+ r")"
75
+ )
76
+ _BENIGN_ZERO_ERR_RE = re.compile(
77
+ r"\b(?:0|no|zero|without)\s+(?:errors?|failures?|failed)\b|"
78
+ r"\b(?:error_count|errors|failures|failed)\s*[:=]\s*0\b",
79
+ re.I,
80
+ )
81
+
82
+ _DECL_COUNT_PATTERNS: tuple[re.Pattern[str], ...] = (
83
+ re.compile(
84
+ r"\b(\d[\d,]*)\s+(?:more\s+)?(?:[\w/-]+\s+){0,3}"
85
+ r"(?:matches?|lines?|files?|rows?|records?|items?|entries|results?|notes?|chars?)\s+"
86
+ r"(?:omitted|hidden|skipped|elided|truncated|collapsed|archived)\b",
87
+ re.I,
88
+ ),
89
+ re.compile(
90
+ r"\b(\d[\d,]*)\s+more\s+(?:[\w/-]+\s+){0,2}"
91
+ r"(?:matches?|lines?|files?|rows?|records?|items?|entries|results?|notes?|chars?)\b",
92
+ re.I,
93
+ ),
94
+ re.compile(
95
+ r"\b(?:omitted|hidden|skipped|elided|collapsed|archived)\s+(\d[\d,]*)\s+"
96
+ r"(?:[\w/-]+\s+){0,2}"
97
+ r"(?:matches?|lines?|files?|rows?|records?|items?|entries|results?|notes?|chars?)\b",
98
+ re.I,
99
+ ),
100
+ re.compile(r"\bshowing\s+(\d[\d,]*)\s+of\s+(\d[\d,]*)\b", re.I),
101
+ re.compile(r"\+(\d[\d,]*)\s+more\b", re.I),
102
+ re.compile(
103
+ r"\b(\d[\d,]*)\s+of\s+(\d[\d,]*)\s+(?:lines?|matches?|rows?|records?|files?)\b",
104
+ re.I,
105
+ ),
106
+ re.compile(
107
+ r"\[lines\s+\d+-\d+\s+hidden:\s*(\d[\d,]*)\s+lines\s+matching\b",
108
+ re.I,
109
+ ),
110
+ )
111
+ _DECL_PLACE_RE = re.compile(
112
+ r"\b(?:in\s+[\w./@+-]+|lines?\s+\d+(?:\s*[-–]\s*\d+)?|rows?\s+\d+(?:\s*[-–]\s*\d+)?|"
113
+ r"records?\s+\d+(?:\s*[-–]\s*\d+)?|middle|tail|head|after\s+line|remaining|section|"
114
+ r"more\s+files?\s+with\s+matches|omitted\s+from|non-file\s+lines?|folder\(s\)|"
115
+ r"between\s+head|capped)\b",
116
+ re.I,
117
+ )
118
+ _SINGLE_LINE_OMIT_RE = re.compile(
119
+ r"\b(\d[\d,]*)\s+(?:more\s+lines?|(?:middle\s+)?lines?\s+(?:omitted|hidden|elided|collapsed|archived))\b",
120
+ re.I,
121
+ )
122
+ _SEARCH_CMDS = frozenset({"grep", "rg", "egrep", "fgrep", "ag", "find", "ls", "fd"})
123
+
124
+
125
+ def has_valid_expand_command(text: str) -> bool:
126
+ """Return True iff ``text`` contains a runnable ``measure.py expand <key>`` command."""
127
+ return bool(_EXPAND_CMD_RE.search(text or ""))
128
+
129
+
130
+ def _is_search_context(feature: str, tool_name: str, command: str, comp_clean: str) -> bool:
131
+ if tool_name in ("Grep", "Glob") or feature in (
132
+ "builtin_grep",
133
+ "builtin_glob",
134
+ "bash_search_noise_fold",
135
+ "cmd_git_ls",
136
+ ):
137
+ return True
138
+ if comp_clean.startswith(("[Search results:", "[Grep ", "Grep files", "Glob files")):
139
+ return True
140
+ if tool_name == "Bash" and command:
141
+ words = _CD_PREFIX_RE.sub("", command.strip()).split()
142
+ if words and (
143
+ words[0] in _SEARCH_CMDS
144
+ or (words[0] == "git" and len(words) > 1 and words[1] in ("grep", "ls-files"))
145
+ ):
146
+ return True
147
+ return False
148
+
149
+
150
+ _TOKEN_RE = re.compile(r"[^\s,;:'\"()\[\]{}]+")
151
+ _LINENO_TOKEN_RE = re.compile(r"(?:^|[:\s])(\d+):|:(\d+)\b")
152
+
153
+
154
+ def _build_comp_index(comp_clean: str, feature: str) -> dict:
155
+ """Pre-index compressed text in O(M) so per-raw-line checks are O(1)."""
156
+ lines_set: set[str] = set()
157
+ prefix80_set: set[str] = set()
158
+ tokens_set: set[str] = set()
159
+ lineno_lines: dict[str, list[str]] = {}
160
+ for raw_ln in comp_clean.splitlines():
161
+ s = raw_ln.strip()
162
+ if not s:
163
+ continue
164
+ lines_set.add(s)
165
+ if len(s) > 80:
166
+ prefix80_set.add(s[:80])
167
+ for tok in _TOKEN_RE.findall(s):
168
+ tokens_set.add(tok)
169
+ if "/" in tok:
170
+ tokens_set.add(tok.rsplit("/", 1)[-1])
171
+ if ":" in tok:
172
+ head = tok.split(":", 1)[0]
173
+ if head:
174
+ tokens_set.add(head)
175
+ if "/" in head:
176
+ tokens_set.add(head.rsplit("/", 1)[-1])
177
+ s_low = s.lower()
178
+ for m in _LINENO_TOKEN_RE.finditer(s):
179
+ lno = m.group(1) or m.group(2)
180
+ if lno:
181
+ lst = lineno_lines.get(lno)
182
+ if lst is None:
183
+ lineno_lines[lno] = [s_low]
184
+ elif len(lst) < 8:
185
+ lst.append(s_low)
186
+ return {
187
+ "lines": lines_set,
188
+ "prefix80": prefix80_set,
189
+ "tokens": tokens_set,
190
+ "lineno_lines": lineno_lines,
191
+ "feature": feature,
192
+ }
193
+
194
+
195
+ def _line_is_visible(
196
+ line: str,
197
+ comp_clean: str,
198
+ comp_low: str,
199
+ *,
200
+ is_search: bool = False,
201
+ feature: str = "",
202
+ comp_index: dict | None = None,
203
+ ) -> bool:
204
+ if comp_index is not None:
205
+ if line in comp_index["lines"]:
206
+ return True
207
+ if len(line) > 80 and line[:80] in comp_index["prefix80"]:
208
+ return True
209
+ tokens = comp_index["tokens"]
210
+ if _SEARCH_MATCH_LINE_RE.match(line):
211
+ parts = line.split(":", 2)
212
+ if len(parts) == 3:
213
+ fname, lineno, body = parts[0], parts[1], parts[2].strip()
214
+ base = fname.rsplit("/", 1)[-1]
215
+ if (fname in tokens or base in tokens) and lineno in comp_index["lineno_lines"]:
216
+ if not body:
217
+ return True
218
+ body_key = body[:40].lower()
219
+ if any(body_key in cand for cand in comp_index["lineno_lines"][lineno]):
220
+ return True
221
+ if (
222
+ _PLAIN_PATH_LINE_RE.match(line)
223
+ or (is_search and "/" in line and " " not in line)
224
+ or feature == "cmd_git_ls"
225
+ ) and line.rsplit("/", 1)[-1] in tokens:
226
+ return True
227
+ if feature == "cmd_git_diff_stat" and "|" in line:
228
+ left, right = line.split("|", 1)
229
+ fname = left.strip().rsplit("/", 1)[-1]
230
+ nums = re.findall(r"\d+", right)
231
+ if fname and fname in tokens and (not nums or nums[0] in tokens):
232
+ return True
233
+ return False
234
+
235
+ if line in comp_clean or (len(line) > 80 and line[:80] in comp_clean):
236
+ return True
237
+ if _SEARCH_MATCH_LINE_RE.match(line):
238
+ parts = line.split(":", 2)
239
+ if len(parts) == 3:
240
+ fname, lineno, body = parts[0], parts[1], parts[2].strip()
241
+ base = fname.rsplit("/", 1)[-1]
242
+ if (fname in comp_clean or base in comp_clean) and (
243
+ f"{lineno}:" in comp_clean or f":{lineno}" in comp_clean
244
+ ):
245
+ if not body or body[:40].lower() in comp_low:
246
+ return True
247
+ if (
248
+ _PLAIN_PATH_LINE_RE.match(line) or (is_search and "/" in line and " " not in line)
249
+ ) and line.rsplit("/", 1)[-1] in comp_clean:
250
+ return True
251
+ if feature == "cmd_git_diff_stat" and "|" in line:
252
+ left, right = line.split("|", 1)
253
+ fname = left.strip().rsplit("/", 1)[-1]
254
+ nums = re.findall(r"\d+", right)
255
+ if fname and fname in comp_clean and (not nums or nums[0] in comp_clean):
256
+ return True
257
+ return False
258
+
259
+
260
+ _CRIT_SEARCH_STRICT_RE = re.compile(
261
+ r'traceback \(most recent call last\)|^\s*file ".+", line \d+|'
262
+ r"^\s*at\s+\S+\s+\([^)]+:\d+:\d+\)|^goroutine \d+ \[|"
263
+ r"\b(?:exit(?:ed with)?|return(?:ed)?)\s+(?:code|status)\s+[1-9]\d*\b|"
264
+ r"^error:\s*exit code\s+[1-9]\d*\b|"
265
+ r"\b(?:fatal|panic|panicked|segfault|segmentation fault|core dumped|out of memory)\b",
266
+ re.I,
267
+ )
268
+
269
+
270
+ def _critical_reasons_for_line(
271
+ line: str,
272
+ is_search: bool,
273
+ is_gh_list: bool,
274
+ *,
275
+ has_search_strict: bool = True,
276
+ ) -> list[str]:
277
+ if is_gh_list and "\t" in line and (
278
+ "completed\tsuccess" in line.lower() or "\tsuccess\t" in line.lower()
279
+ ):
280
+ return []
281
+ if is_search:
282
+ if _PLAIN_PATH_LINE_RE.match(line):
283
+ return []
284
+ if _SEARCH_MATCH_LINE_RE.match(line):
285
+ # Search hits for ordinary source words like "error" may compress,
286
+ # but hits containing hard failure signals (FATAL/panic, Traceback,
287
+ # non-zero exit code) must stay visible verbatim.
288
+ if not has_search_strict or not _CRIT_SEARCH_STRICT_RE.search(line):
289
+ return []
290
+ strict_reasons: list[str] = []
291
+ if _CRIT_TRACEBACK_RE.search(line):
292
+ strict_reasons.append("hidden_traceback")
293
+ if _CRIT_EXIT_RE.search(line):
294
+ strict_reasons.append("hidden_exit_code")
295
+ if _CRIT_PANIC_RE.search(line):
296
+ strict_reasons.append("hidden_panic_fatal")
297
+ return strict_reasons
298
+ if not (
299
+ _SEARCH_TOOL_DIAG_RE.match(line)
300
+ or (has_search_strict and _CRIT_SEARCH_STRICT_RE.search(line))
301
+ or _CRIT_NON_ERROR_FAILURE_RE.search(line)
302
+ ):
303
+ return []
304
+ reasons: list[str] = []
305
+ if _CRIT_TRACEBACK_RE.search(line):
306
+ reasons.append("hidden_traceback")
307
+ if _CRIT_EXIT_RE.search(line):
308
+ reasons.append("hidden_exit_code")
309
+ if _CRIT_FAIL_TEST_RE.search(line):
310
+ reasons.append("hidden_failing_test")
311
+ if _CRIT_PANIC_RE.search(line):
312
+ reasons.append("hidden_panic_fatal")
313
+ if not reasons and _CRIT_NON_ERROR_FAILURE_RE.search(line):
314
+ reasons.append("hidden_error")
315
+ if not reasons and _CRIT_ERROR_RE.search(line) and not _BENIGN_ZERO_ERR_RE.search(line):
316
+ reasons.append("hidden_error")
317
+ return reasons
318
+
319
+
320
+ def _check_declaration(
321
+ comp_clean: str,
322
+ hidden_nonempty: int,
323
+ hidden_raw_lines: int,
324
+ *,
325
+ require_expand: bool = True,
326
+ ) -> list[str]:
327
+ reasons: list[str] = []
328
+ if require_expand and not has_valid_expand_command(comp_clean):
329
+ reasons.append("missing_expand_cmd")
330
+ declared_counts: list[int] = []
331
+ for rx in _DECL_COUNT_PATTERNS:
332
+ for m in rx.finditer(comp_clean):
333
+ if m.lastindex and m.lastindex >= 2:
334
+ declared_counts.append(
335
+ max(0, int(m.group(2).replace(",", "")) - int(m.group(1).replace(",", "")))
336
+ )
337
+ else:
338
+ declared_counts.append(int(m.group(1).replace(",", "")))
339
+ if not declared_counts:
340
+ reasons.append("missing_hidden_count")
341
+ elif all(c == 0 for c in declared_counts) and hidden_nonempty > 0:
342
+ reasons.append("inaccurate_hidden_count")
343
+ else:
344
+ single = _SINGLE_LINE_OMIT_RE.findall(comp_clean)
345
+ has_breakdown = any(
346
+ k in comp_clean.lower() for k in ("more matches", "more files", "folded noisy", "[git log:")
347
+ )
348
+ if len(single) == 1 and not has_breakdown and len(declared_counts) == 1:
349
+ claimed = int(single[0].replace(",", ""))
350
+ tol = max(3, int(0.15 * max(hidden_nonempty, hidden_raw_lines)))
351
+ if abs(claimed - hidden_raw_lines) > tol and abs(claimed - hidden_nonempty) > tol:
352
+ reasons.append("inaccurate_hidden_count")
353
+ if not _DECL_PLACE_RE.search(comp_clean):
354
+ reasons.append("missing_hidden_place")
355
+ return reasons
356
+
357
+
358
+ def classify_output(
359
+ original: str,
360
+ compressed: str,
361
+ feature: str = "",
362
+ *,
363
+ tool_name: str = "",
364
+ command: str = "",
365
+ exit_code: int | None = None,
366
+ require_expand: bool = True,
367
+ budget=None,
368
+ ) -> tuple[str, list[str]]:
369
+ """Classify ``compressed`` against ``original`` using replay v2 rules."""
370
+ if not original or not compressed:
371
+ return VISIBLE_OK, []
372
+ if feature in ("rerun_dedupe", "crossturn_dedup") and any(
373
+ s in compressed
374
+ for s in (
375
+ "identical to previous run",
376
+ "identical to your previous",
377
+ "same as previous run",
378
+ "same as your previous",
379
+ )
380
+ ):
381
+ return VISIBLE_OK, []
382
+ if (
383
+ feature == "bash_reread_unchanged"
384
+ and "is unchanged since your earlier full read in this session" in compressed
385
+ ):
386
+ return VISIBLE_OK, []
387
+
388
+ comp_clean = _ANSI_RE.sub("", compressed) if "\x1b" in compressed else compressed
389
+ comp_low = comp_clean.lower()
390
+ comp_index = _build_comp_index(comp_clean, feature)
391
+ is_search = _is_search_context(feature, tool_name, command, comp_clean)
392
+ is_gh_list = feature == "cmd_gh_list" or (
393
+ tool_name == "Bash" and (command or "").strip().startswith("gh ")
394
+ )
395
+ has_ansi = "\x1b" in original
396
+ has_search_strict = bool(_CRIT_SEARCH_STRICT_RE.search(original)) if is_search else True
397
+
398
+ crit_reasons: set[str] = set()
399
+ hidden_nonempty = 0
400
+ orig_lines = original.splitlines()
401
+ for _idx, raw_line in enumerate(orig_lines):
402
+ if budget is not None:
403
+ budget.check(_idx, stride=64)
404
+ line = (_ANSI_RE.sub("", raw_line) if has_ansi else raw_line).strip()
405
+ if not line or _line_is_visible(
406
+ line, comp_clean, comp_low, is_search=is_search, feature=feature, comp_index=comp_index
407
+ ):
408
+ continue
409
+ hidden_nonempty += 1
410
+ creasons = _critical_reasons_for_line(
411
+ line, is_search, is_gh_list, has_search_strict=has_search_strict
412
+ )
413
+ if creasons:
414
+ # Substring fallback only for the rare critical line not matching whole-line index.
415
+ if line in comp_clean or (len(line) > 80 and line[:80] in comp_clean):
416
+ continue
417
+ core = line.split(": ", 1)[-1][:60].strip()
418
+ if not (core and len(core) >= 12 and core.lower() in comp_low):
419
+ crit_reasons.update(creasons)
420
+
421
+ if exit_code not in (None, 0) and hidden_nonempty > 0:
422
+ if f"exit code {exit_code}" not in comp_low and f"exit status {exit_code}" not in comp_low:
423
+ crit_reasons.add("hidden_exit_code")
424
+ if crit_reasons:
425
+ return CRITICAL_HIDDEN, sorted(crit_reasons)
426
+ if hidden_nonempty == 0:
427
+ return VISIBLE_OK, []
428
+ hidden_raw = max(hidden_nonempty, len(orig_lines) - len(comp_clean.splitlines()))
429
+ decl = _check_declaration(
430
+ comp_clean, hidden_nonempty, hidden_raw, require_expand=require_expand
431
+ )
432
+ return (UNDECLARED_HIDDEN, sorted(set(decl))) if decl else (RECOVERABLE_DECLARED, [])
433
+
434
+
435
+ def verify_before_emit(
436
+ original: str,
437
+ compressed: str,
438
+ *,
439
+ feature: str = "",
440
+ tool_name: str = "",
441
+ command: str = "",
442
+ exit_code: int | None = None,
443
+ require_expand: bool = True,
444
+ ) -> tuple[bool, list[str]]:
445
+ """Return ``(ok, reasons)``. Fail-closed to ``(False, ["verifier_exception"])``."""
446
+ try:
447
+ if not isinstance(original, str) or not isinstance(compressed, str):
448
+ return False, ["invalid_input_type"]
449
+ if not original or not compressed or compressed == original:
450
+ return True, []
451
+ status, reasons = classify_output(
452
+ original,
453
+ compressed,
454
+ feature,
455
+ tool_name=tool_name,
456
+ command=command,
457
+ exit_code=exit_code,
458
+ require_expand=require_expand,
459
+ )
460
+ return status in (VISIBLE_OK, RECOVERABLE_DECLARED), reasons
461
+ except Exception:
462
+ return False, ["verifier_exception"]
463
+
464
+
465
+ def gate_or_raw(
466
+ original: str,
467
+ compressed: str,
468
+ *,
469
+ feature: str = "",
470
+ tool_name: str = "",
471
+ command: str = "",
472
+ exit_code: int | None = None,
473
+ require_expand: bool = True,
474
+ ) -> str:
475
+ """Return ``compressed`` only if ``verify_before_emit`` passes; else ``original``."""
476
+ try:
477
+ if not compressed or compressed == original:
478
+ return original
479
+ ok, _ = verify_before_emit(
480
+ original,
481
+ compressed,
482
+ feature=feature,
483
+ tool_name=tool_name,
484
+ command=command,
485
+ exit_code=exit_code,
486
+ require_expand=require_expand,
487
+ )
488
+ return compressed if ok else original
489
+ except Exception:
490
+ return original
491
+
492
+
493
+ def gate_or_none(
494
+ original: str,
495
+ compressed: str | None,
496
+ *,
497
+ feature: str = "",
498
+ tool_name: str = "",
499
+ command: str = "",
500
+ exit_code: int | None = None,
501
+ require_expand: bool = True,
502
+ ) -> str | None:
503
+ """Return ``compressed`` only if ``verify_before_emit`` passes; else ``None``."""
504
+ try:
505
+ if not compressed or compressed == original:
506
+ return None
507
+ ok, _ = verify_before_emit(
508
+ original,
509
+ compressed,
510
+ feature=feature,
511
+ tool_name=tool_name,
512
+ command=command,
513
+ exit_code=exit_code,
514
+ require_expand=require_expand,
515
+ )
516
+ return compressed if ok else None
517
+ except Exception:
518
+ return None
@@ -0,0 +1,142 @@
1
+ [
2
+ {
3
+ "name": "git_diff_stat_huge",
4
+ "category": "git_diff_stat",
5
+ "command": "git diff --stat origin/main",
6
+ "raw_output": " src/api/routes_01.py | 42 +++++++++++++++++++++++++++---------------\n src/api/routes_02.py | 18 ++++++++++--------\n src/api/routes_03.py | 6 +++---\n src/api/routes_04.py | 4 ++--\n src/api/routes_05.py | 8 ++++----\n src/api/routes_06.py | 10 +++++-----\n src/api/routes_07.py | 2 +-\n src/api/routes_08.py | 4 ++--\n src/api/routes_09.py | 6 +++---\n src/api/routes_10.py | 8 ++++----\n src/core/engine.py | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n src/core/scheduler.py | 140 ++++++++++++++++++++++++++++++++++++++++++++\n src/core/cache.py | 88 ++++++++++++++++++++++++++++\n src/core/config.py | 12 ++++++------\n src/core/metrics.py | 4 ++--\n src/core/logging.py | 6 +++---\n src/core/types.py | 22 +++++++++++-----------\n src/core/errors.py | 14 +++++++-------\n src/core/utils.py | 8 ++++----\n src/core/validators.py | 10 +++++-----\n tests/test_01.py | 30 +++++++++++++++---------------\n tests/test_02.py | 24 ++++++++++++------------\n tests/test_03.py | 16 ++++++++--------\n tests/test_04.py | 12 ++++++------\n tests/test_05.py | 10 +++++-----\n tests/test_06.py | 8 ++++----\n tests/test_07.py | 6 +++---\n tests/test_08.py | 4 ++--\n tests/test_09.py | 2 +-\n tests/test_10.py | 4 ++--\n docs/guide_01.md | 50 +++++++++++++++++++++++++\n docs/guide_02.md | 45 +++++++++++++++++++++++\n docs/guide_03.md | 35 ++++++++++++++++++\n docs/guide_04.md | 12 ++++++\n docs/guide_05.md | 8 ++++\n docs/guide_06.md | 6 +++\n docs/guide_07.md | 4 ++\n docs/guide_08.md | 4 ++\n docs/guide_09.md | 2 +\n docs/guide_10.md | 2 +\n 40 files changed, 680 insertions(+), 196 deletions(-)\n",
7
+ "must_preserve": [
8
+ "40 files changed, 680 insertions(+), 196 deletions(-)",
9
+ "engine.py",
10
+ "scheduler.py",
11
+ "routes_07.py",
12
+ "test_09.py",
13
+ "guide_10.md",
14
+ "src/api/",
15
+ "src/core/",
16
+ "tests/",
17
+ "docs/"
18
+ ],
19
+ "must_not_contain": [
20
+ "src/api/routes_07.py | 2 +-"
21
+ ],
22
+ "min_compression": 0.30
23
+ },
24
+ {
25
+ "name": "git_grep_many_matches",
26
+ "category": "search_results",
27
+ "command": "git grep -n handle_request",
28
+ "raw_output": "src/server.py:10:def handle_request(req):\nsrc/server.py:22: return handle_request_inner(req)\nsrc/server.py:35: log('handle_request start')\nsrc/server.py:48: log('handle_request mid')\nsrc/server.py:61: log('handle_request end')\nsrc/server.py:74: handle_request_metric(1)\nsrc/server.py:87: handle_request_metric(2)\nsrc/server.py:99: handle_request_metric(3)\nsrc/server.py:112: handle_request_metric(4)\nsrc/server.py:125: handle_request_metric(5)\nsrc/server.py:138: handle_request_metric(6)\nsrc/server.py:151: handle_request_metric(7)\nsrc/server.py:164: handle_request_metric(8)\nsrc/server.py:177: handle_request_metric(9)\nsrc/server.py:190: handle_request_metric(10)\nsrc/router.py:14: dispatch(handle_request)\nsrc/router.py:28: dispatch(handle_request)\nsrc/router.py:42: dispatch(handle_request)\nsrc/router.py:56: dispatch(handle_request)\nsrc/router.py:70: dispatch(handle_request)\nsrc/router.py:84: dispatch(handle_request)\nsrc/router.py:98: dispatch(handle_request)\nsrc/router.py:112: dispatch(handle_request)\nsrc/router.py:126: dispatch(handle_request)\nsrc/router.py:140: dispatch(handle_request)\nsrc/router.py:154: dispatch(handle_request)\nsrc/router.py:168: dispatch(handle_request)\nsrc/router.py:182: dispatch(handle_request)\nsrc/router.py:196: dispatch(handle_request)\nsrc/router.py:210: dispatch(handle_request)\nsrc/router.py:224: dispatch(handle_request)\nsrc/router.py:238: dispatch(handle_request)\n",
29
+ "must_preserve": [
30
+ "src/server.py",
31
+ "src/router.py"
32
+ ],
33
+ "min_compression": 0.25
34
+ },
35
+ {
36
+ "name": "git_ls_files_large",
37
+ "category": "git_ls",
38
+ "command": "git ls-files",
39
+ "raw_output": "README.md\nMakefile\nsrc/core/mod_01.py\nsrc/core/mod_02.py\nsrc/core/mod_03.py\nsrc/core/mod_04.py\nsrc/core/mod_05.py\nsrc/core/mod_06.py\nsrc/core/mod_07.py\nsrc/core/mod_08.py\nsrc/core/mod_09.py\nsrc/core/mod_10.py\nsrc/core/mod_11.py\nsrc/core/mod_12.py\nsrc/core/mod_13.py\nsrc/core/mod_14.py\nsrc/core/mod_15.py\nsrc/api/ep_01.py\nsrc/api/ep_02.py\nsrc/api/ep_03.py\nsrc/api/ep_04.py\nsrc/api/ep_05.py\nsrc/api/ep_06.py\nsrc/api/ep_07.py\nsrc/api/ep_08.py\nsrc/api/ep_09.py\nsrc/api/ep_10.py\nsrc/api/ep_11.py\nsrc/api/ep_12.py\nsrc/api/ep_13.py\nsrc/api/ep_14.py\nsrc/api/ep_15.py\ntests/t_01.py\ntests/t_02.py\ntests/t_03.py\ntests/t_04.py\ntests/t_05.py\ntests/t_06.py\ntests/t_07.py\ntests/t_08.py\ntests/t_09.py\ntests/t_10.py\ntests/t_11.py\ntests/t_12.py\n",
40
+ "must_preserve": [
41
+ "44 paths total",
42
+ "src/core/",
43
+ "src/api/",
44
+ "tests/",
45
+ "README.md",
46
+ "mod_15.py",
47
+ "ep_15.py",
48
+ "t_12.py"
49
+ ],
50
+ "min_compression": 0.25
51
+ },
52
+ {
53
+ "name": "gh_run_view_log_with_error",
54
+ "category": "gh_run_log",
55
+ "command": "gh run view 987654321 --log",
56
+ "raw_output": "test\tSet up job\t2026-11-22T10:00:01Z Current runner version: '2.320.0'\ntest\tSet up job\t2026-11-22T10:00:01Z Operating System: Ubuntu 24.04.1 LTS\ntest\tSet up job\t2026-11-22T10:00:01Z Runner Image: ubuntu-24.04\ntest\tSet up job\t2026-11-22T10:00:01Z GITHUB_TOKEN Permissions: contents: read\ntest\tSet up job\t2026-11-22T10:00:01Z Prepare workflow directory\ntest\tSet up job\t2026-11-22T10:00:02Z Prepare all required actions\ntest\tSet up job\t2026-11-22T10:00:02Z Getting action download info\ntest\tSet up job\t2026-11-22T10:00:03Z Download action repository 'actions/checkout@v4'\ntest\tSet up job\t2026-11-22T10:00:03Z Complete job name: test\ntest\tRun actions/checkout@v4\t2026-11-22T10:00:04Z Syncing repository: org/repo\ntest\tRun actions/checkout@v4\t2026-11-22T10:00:04Z Getting Git version info\ntest\tRun actions/checkout@v4\t2026-11-22T10:00:04Z Temporarily overriding HOME\ntest\tRun actions/checkout@v4\t2026-11-22T10:00:04Z Adding repository directory to the temporary git global config\ntest\tRun actions/checkout@v4\t2026-11-22T10:00:05Z Fetching the repository\ntest\tRun actions/checkout@v4\t2026-11-22T10:00:06Z Checking out the ref\ntest\tRun actions/setup-python@v5\t2026-11-22T10:00:07Z Installed versions\ntest\tRun actions/setup-python@v5\t2026-11-22T10:00:07Z Successfully set up CPython (3.12.7)\ntest\tRun actions/cache@v4\t2026-11-22T10:00:08Z Cache restored from key: pip-linux-abc123\ntest\tRun pytest\t2026-11-22T10:00:09Z ##[group]Run pytest -q\ntest\tRun pytest\t2026-11-22T10:00:09Z shell: /usr/bin/bash -e {0}\ntest\tRun pytest\t2026-11-22T10:00:09Z ##[endgroup]\ntest\tRun pytest\t2026-11-22T10:00:10Z collecting ... collected 120 items\ntest\tRun pytest\t2026-11-22T10:00:24Z def test_window():\ntest\tRun pytest\t2026-11-22T10:00:24Z store = Store(window=3600)\ntest\tRun pytest\t2026-11-22T10:00:25Z > assert store.effective_window() == 30\ntest\tRun pytest\t2026-11-22T10:00:25Z E assert 3600 == 30\ntest\tRun pytest\t2026-11-22T10:00:25Z tests/test_auth.py:88: AssertionError: token expired\ntest\tRun pytest\t2026-11-22T10:00:25Z ##[error]Process completed with exit code 1.\ntest\tPost Run actions/cache@v4\t2026-11-22T10:00:26Z Post Cache\ntest\tPost Run actions/checkout@v4\t2026-11-22T10:00:26Z Post job cleanup.\ntest\tComplete job\t2026-11-22T10:00:27Z Cleaning up orphan processes\n",
57
+ "must_preserve": [
58
+ "> assert store.effective_window() == 30",
59
+ "E assert 3600 == 30",
60
+ "tests/test_auth.py:88: AssertionError: token expired",
61
+ "##[error]Process completed with exit code 1."
62
+ ],
63
+ "must_not_contain": [
64
+ "Temporarily overriding HOME",
65
+ "Cache restored from key"
66
+ ],
67
+ "min_compression": 0.40
68
+ },
69
+ {
70
+ "name": "terraform_plan_verbose",
71
+ "category": "terraform_plan",
72
+ "command": "terraform plan",
73
+ "raw_output": "Acquiring state lock. This may take a few moments...\naws_vpc.main: Refreshing state... [id=vpc-111]\naws_subnet.pub_a: Refreshing state... [id=subnet-111]\naws_subnet.pub_b: Refreshing state... [id=subnet-222]\naws_subnet.priv_a: Refreshing state... [id=subnet-333]\naws_subnet.priv_b: Refreshing state... [id=subnet-444]\naws_security_group.web: Refreshing state... [id=sg-111]\naws_security_group.db: Refreshing state... [id=sg-222]\naws_iam_role.app: Refreshing state... [id=role-111]\naws_iam_policy.app: Refreshing state... [id=pol-111]\naws_s3_bucket.assets: Refreshing state... [id=assets-bucket]\naws_s3_bucket.logs: Refreshing state... [id=logs-bucket]\ndata.aws_ami.ubuntu: Reading...\ndata.aws_ami.ubuntu: Read complete after 1s [id=ami-0123456789]\n\nTerraform used the selected providers to generate the following execution plan.\n\n # aws_instance.web will be created\n + resource \"aws_instance\" \"web\" {\n + ami = \"ami-0123456789\"\n + instance_type = \"t3.medium\"\n + arn = (known after apply)\n + id = (known after apply)\n + private_ip = (known after apply)\n + public_ip = (known after apply)\n + public_dns = (known after apply)\n + private_dns = (known after apply)\n + primary_network_interface_id = (known after apply)\n + root_block_device = (known after apply)\n }\n\n # aws_security_group.web will be updated in-place\n ~ resource \"aws_security_group\" \"web\" {\n id = \"sg-111\"\n ~ description = \"old\" -> \"new\"\n + ingress_cidr = \"0.0.0.0/0\"\n # (8 unchanged attributes hidden)\n }\n\nPlan: 1 to add, 1 to change, 0 to destroy.\n",
74
+ "must_preserve": [
75
+ "# aws_instance.web will be created",
76
+ "# aws_security_group.web will be updated in-place",
77
+ "~ description = \"old\" -> \"new\"",
78
+ "+ ingress_cidr = \"0.0.0.0/0\"",
79
+ "Plan: 1 to add, 1 to change, 0 to destroy."
80
+ ],
81
+ "must_not_contain": [
82
+ "aws_subnet.pub_a: Refreshing state...",
83
+ "unchanged attributes hidden"
84
+ ],
85
+ "min_compression": 0.35
86
+ },
87
+ {
88
+ "name": "kubectl_describe_pod_verbose",
89
+ "category": "k8s",
90
+ "command": "kubectl describe pod api-server-7d9f8b",
91
+ "raw_output": "Name: api-server-7d9f8b\nNamespace: production\nNode: worker-03/10.0.1.23\nStatus: Running\nIP: 10.244.3.19\nControlled By: ReplicaSet/api-server-7d9f8b\nAnnotations:\n kubectl.kubernetes.io/restartedAt: 2026-11-20T12:00:00Z\n prometheus.io/scrape: true\n prometheus.io/port: 9090\n prometheus.io/path: /metrics\n checksum/config: abcdef0123456789\n checksum/extra: 9876543210fedcba\n sidecar.istio.io/status: injected\n meta.helm.sh/release-name: api-server\n meta.helm.sh/release-namespace: production\nContainers:\n api:\n Image: registry.example.com/api:v1.4.2\n State: Waiting\n Reason: CrashLoopBackOff\n Last State: Terminated\n Reason: OOMKilled\n Exit Code: 137\n Ready: False\n Restart Count: 5\n Environment:\n LOG_LEVEL: info\n PORT: 8080\n WORKERS: 4\n REGION: us-east-1\n ENV: production\n METRICS_PORT: 9090\n TRACE_SAMPLE: 0.1\n CACHE_TTL: 300\n DATABASE_URL: <set to the key 'url' in secret 'db-creds'> Optional: false\n DB_POOL_SIZE: 20\n Mounts:\n /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access (ro)\n /etc/config/app.yaml from app-config (ro)\n /etc/config/routes.yaml from app-routes (ro)\n /etc/config/limits.yaml from app-limits (ro)\n /etc/config/flags.yaml from app-flags (ro)\n /tmp/cache from tmp-vol (rw)\n /var/log/app from log-vol (rw)\nConditions:\n Type Status\n Initialized True\n Ready False\n ContainersReady False\nEvents:\n Type Reason Age From Message\n ---- ------ ---- ---- -------\n Warning BackOff 1m kubelet Back-off restarting failed container api\n",
92
+ "must_preserve": [
93
+ "Name: api-server-7d9f8b",
94
+ "CrashLoopBackOff",
95
+ "OOMKilled",
96
+ "Exit Code: 137",
97
+ "DATABASE_URL:",
98
+ "Events:",
99
+ "Back-off restarting failed container api"
100
+ ],
101
+ "must_not_contain": [
102
+ "meta.helm.sh/release-namespace: production",
103
+ "DB_POOL_SIZE: 20"
104
+ ],
105
+ "min_compression": 0.20
106
+ },
107
+ {
108
+ "name": "pip_install_verbose",
109
+ "category": "package_install",
110
+ "command": "pip install -r requirements.txt",
111
+ "raw_output": "Collecting fastapi==0.115.0\n Downloading fastapi-0.115.0-py3-none-any.whl (94 kB)\nCollecting uvicorn==0.32.0\n Using cached uvicorn-0.32.0-py3-none-any.whl (62 kB)\nCollecting pydantic==2.9.2\n Using cached pydantic-2.9.2-py3-none-any.whl (434 kB)\nCollecting starlette==0.38.6\n Using cached starlette-0.38.6-py3-none-any.whl (73 kB)\nCollecting anyio==4.6.0\n Using cached anyio-4.6.0-py3-none-any.whl (90 kB)\nCollecting idna==3.10\n Using cached idna-3.10-py3-none-any.whl (70 kB)\nCollecting sniffio==1.3.1\n Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)\nCollecting click==8.1.7\n Using cached click-8.1.7-py3-none-any.whl (97 kB)\nCollecting h11==0.14.0\n Using cached h11-0.14.0-py3-none-any.whl (58 kB)\nCollecting typing-extensions==4.12.2\n Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)\nRequirement already satisfied: certifi in ./venv/lib/python3.12/site-packages (2024.8.30)\nRequirement already satisfied: charset-normalizer in ./venv/lib/python3.12/site-packages (3.3.2)\nInstalling collected packages: typing-extensions, sniffio, idna, h11, click, anyio, starlette, pydantic, uvicorn, fastapi\nWARNING: Running pip as the 'root' user can result in broken permissions\nSuccessfully installed anyio-4.6.0 click-8.1.7 fastapi-0.115.0 h11-0.14.0 idna-3.10 pydantic-2.9.2 sniffio-1.3.1 starlette-0.38.6 typing-extensions-4.12.2 uvicorn-0.32.0\n",
112
+ "must_preserve": [
113
+ "WARNING: Running pip as the 'root' user",
114
+ "Successfully installed anyio-4.6.0"
115
+ ],
116
+ "must_not_contain": [
117
+ "Using cached sniffio-1.3.1"
118
+ ],
119
+ "min_compression": 0.55
120
+ },
121
+ {
122
+ "name": "mypy_verbose_notes",
123
+ "category": "lint",
124
+ "command": "mypy src/",
125
+ "raw_output": "src/auth.py:42: error: Argument 1 to \"verify\" has incompatible type \"int\"; expected \"str\" [arg-type]\nsrc/auth.py:42: note: Following member(s) of \"int\" have conflicts:\nsrc/auth.py:42: note: Expected:\nsrc/auth.py:42: note: def encode(self, encoding: str = ...) -> bytes\nsrc/auth.py:42: note: Got:\nsrc/auth.py:42: note: <nothing>\nsrc/auth.py:42: note: See https://mypy.readthedocs.io/en/stable/error_codes.html\nsrc/api.py:88: error: No overload variant of \"get\" matches argument types \"int\", \"list[str]\" [call-overload]\nsrc/api.py:88: note: Possible overload variants:\nsrc/api.py:88: note: def get(self, key: str) -> str | None\nsrc/api.py:88: note: def get(self, key: str, default: str) -> str\nsrc/api.py:88: note: def get(self, key: str, default: _T) -> str | _T\nsrc/api.py:88: note: def get(self, key: bytes) -> bytes | None\nsrc/api.py:88: note: def get(self, key: bytes, default: bytes) -> bytes\nsrc/api.py:88: note: def get(self, key: bytes, default: _T) -> bytes | _T\nsrc/api.py:88: note: def get(self, key: int, default: int) -> int\nsrc/api.py:88: note: def get(self, key: int, default: _T) -> int | _T\nsrc/api.py:88: note: def get(self, key: tuple[str, ...]) -> str | None\nsrc/api.py:88: note: def get(self, key: tuple[str, ...], default: _T) -> str | _T\nsrc/api.py:88: note: See https://mypy.readthedocs.io/en/stable/error_codes.html\nsrc/api.py:105: note: Revealed type is \"builtins.dict[builtins.str, builtins.int]\"\nsrc/models.py:19: error: Incompatible return value type (got \"None\", expected \"User\") [return-value]\nsrc/models.py:19: note: See https://mypy.readthedocs.io/en/stable/error_codes.html\nFound 3 errors in 3 files (checked 24 source files)\n",
126
+ "must_preserve": [
127
+ "src/auth.py:42: error:",
128
+ "Expected:",
129
+ "def encode(self, encoding: str = ...) -> bytes",
130
+ "Got:",
131
+ "<nothing>",
132
+ "src/api.py:88: error:",
133
+ "src/models.py:19: error:",
134
+ "Revealed type is",
135
+ "Found 3 errors in 3 files (checked 24 source files)"
136
+ ],
137
+ "must_not_contain": [
138
+ "Possible overload variants:"
139
+ ],
140
+ "min_compression": 0.25
141
+ }
142
+ ]