foretop-ebb 0.1.0__tar.gz

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. foretop_ebb-0.1.0/LICENSE +202 -0
  2. foretop_ebb-0.1.0/PKG-INFO +175 -0
  3. foretop_ebb-0.1.0/README.md +160 -0
  4. foretop_ebb-0.1.0/pyproject.toml +74 -0
  5. foretop_ebb-0.1.0/pyproject.toml.orig +78 -0
  6. foretop_ebb-0.1.0/src/ebb/__init__.py +1 -0
  7. foretop_ebb-0.1.0/src/ebb/__main__.py +4 -0
  8. foretop_ebb-0.1.0/src/ebb/brand.py +5 -0
  9. foretop_ebb-0.1.0/src/ebb/build_findings.py +118 -0
  10. foretop_ebb-0.1.0/src/ebb/canonicalize.py +60 -0
  11. foretop_ebb-0.1.0/src/ebb/cli.py +176 -0
  12. foretop_ebb-0.1.0/src/ebb/detect/__init__.py +0 -0
  13. foretop_ebb-0.1.0/src/ebb/detect/base.py +29 -0
  14. foretop_ebb-0.1.0/src/ebb/detect/dockerfile.py +8 -0
  15. foretop_ebb-0.1.0/src/ebb/detect/json_format.py +8 -0
  16. foretop_ebb-0.1.0/src/ebb/detect/notebook.py +25 -0
  17. foretop_ebb-0.1.0/src/ebb/detect/patterns.py +51 -0
  18. foretop_ebb-0.1.0/src/ebb/detect/python.py +8 -0
  19. foretop_ebb-0.1.0/src/ebb/detect/registry.py +25 -0
  20. foretop_ebb-0.1.0/src/ebb/detect/scan_text.py +46 -0
  21. foretop_ebb-0.1.0/src/ebb/detect/terraform.py +8 -0
  22. foretop_ebb-0.1.0/src/ebb/detect/toml.py +8 -0
  23. foretop_ebb-0.1.0/src/ebb/detect/typescript.py +8 -0
  24. foretop_ebb-0.1.0/src/ebb/detect/yaml.py +8 -0
  25. foretop_ebb-0.1.0/src/ebb/finding.py +34 -0
  26. foretop_ebb-0.1.0/src/ebb/owner.py +52 -0
  27. foretop_ebb-0.1.0/src/ebb/registries/retirements/anthropic.yaml +101 -0
  28. foretop_ebb-0.1.0/src/ebb/registries/retirements/bedrock.yaml +81 -0
  29. foretop_ebb-0.1.0/src/ebb/registries/retirements/cohere.yaml +33 -0
  30. foretop_ebb-0.1.0/src/ebb/registries/retirements/google.yaml +408 -0
  31. foretop_ebb-0.1.0/src/ebb/registries/retirements/openai.yaml +107 -0
  32. foretop_ebb-0.1.0/src/ebb/registry/__init__.py +0 -0
  33. foretop_ebb-0.1.0/src/ebb/registry/loader.py +74 -0
  34. foretop_ebb-0.1.0/src/ebb/registry/models.py +47 -0
  35. foretop_ebb-0.1.0/src/ebb/registry/resolve.py +36 -0
  36. foretop_ebb-0.1.0/src/ebb/render/__init__.py +0 -0
  37. foretop_ebb-0.1.0/src/ebb/render/annotations.py +50 -0
  38. foretop_ebb-0.1.0/src/ebb/render/json_renderer.py +7 -0
  39. foretop_ebb-0.1.0/src/ebb/render/markdown.py +41 -0
  40. foretop_ebb-0.1.0/src/ebb/render/sarif.py +11 -0
  41. foretop_ebb-0.1.0/src/ebb/render/terminal.py +31 -0
  42. foretop_ebb-0.1.0/src/ebb/triage.py +166 -0
  43. foretop_ebb-0.1.0/src/ebb/triage_role.py +415 -0
  44. foretop_ebb-0.1.0/src/ebb/verdict.py +48 -0
  45. foretop_ebb-0.1.0/src/ebb/walk.py +38 -0
  46. foretop_ebb-0.1.0/src/keel/__init__.py +1 -0
  47. foretop_ebb-0.1.0/src/keel/collect/__init__.py +0 -0
  48. foretop_ebb-0.1.0/src/keel/collect/walk.py +95 -0
  49. foretop_ebb-0.1.0/src/keel/finding.py +105 -0
  50. foretop_ebb-0.1.0/src/keel/gate.py +152 -0
  51. foretop_ebb-0.1.0/src/keel/git_ref.py +45 -0
  52. foretop_ebb-0.1.0/src/keel/owner.py +58 -0
  53. foretop_ebb-0.1.0/src/keel/render/__init__.py +0 -0
  54. foretop_ebb-0.1.0/src/keel/render/annotations.py +62 -0
  55. foretop_ebb-0.1.0/src/keel/render/markdown.py +40 -0
  56. foretop_ebb-0.1.0/src/keel/render/sarif.py +85 -0
  57. foretop_ebb-0.1.0/src/keel/render/terminal.py +38 -0
  58. foretop_ebb-0.1.0/src/keel/render/triage_json.py +15 -0
  59. foretop_ebb-0.1.0/src/keel/report.py +98 -0
  60. foretop_ebb-0.1.0/src/keel/run.py +67 -0
  61. foretop_ebb-0.1.0/src/keel/triage.py +167 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 the foretop authors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: foretop-ebb
3
+ Version: 0.1.0
4
+ Summary: Tells an engineering team which repos, jobs, prompts and owners break when an AI provider retires a model — before the deadline becomes an outage.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Dist: typer>=0.15
8
+ Requires-Dist: rich>=13.9
9
+ Requires-Dist: pathspec>=0.12
10
+ Requires-Dist: pydantic>=2.9
11
+ Requires-Dist: pyyaml>=6.0
12
+ Requires-Dist: httpx>=0.28
13
+ Requires-Python: >=3.12
14
+ Description-Content-Type: text/markdown
15
+
16
+ # ebb
17
+
18
+ > Tells an engineering team which repos, jobs, prompts and owners break when an AI provider
19
+ > retires a model — before the deadline becomes an outage.
20
+
21
+ A provider announces a retirement date. Somewhere in your repos, Airflow DAGs, Terraform
22
+ variables and prompt templates there's a hardcoded model string nobody remembers. `ebb` finds
23
+ every one of them, joins it to the provider's real retirement date, and tells you who owns it.
24
+
25
+ ## Install and run
26
+
27
+ ```
28
+ uvx foretop-ebb scan .
29
+ ```
30
+
31
+ No config, no account, no network call beyond installing the package — detection is entirely
32
+ local and deterministic, matched against a versioned registry bundled in the package. Add
33
+ `--format sarif` for GitHub Code Scanning, `--format markdown` for a PR comment, or
34
+ `--fail-on critical` to make CI fail when something's actually urgent (see below for exit
35
+ codes). `ebb scan --help` lists everything.
36
+
37
+ ## Use it as a GitHub Action
38
+
39
+ ```yaml
40
+ - uses: foretop-dev/ebb@main
41
+ with:
42
+ fail-on: critical # info | low | medium | high | critical; empty string = report-only
43
+ ```
44
+
45
+ Annotates the pull request inline and upserts one summary comment (finds its own previous
46
+ comment by an HTML marker and edits it — never posts a second one on repeat pushes). Needs
47
+ `permissions: pull-requests: write` in the calling workflow.
48
+
49
+ ## License
50
+
51
+ Apache-2.0. This file tracks build status below; the source-of-truth product spec lives in the
52
+ private monorepo this is mirrored from (see `scripts/sync-mirror.sh` there).
53
+
54
+ ## Status
55
+
56
+ **Slice 1** (Session 3): a Typer CLI that walks a repository and detects model-identifier-shaped
57
+ strings in Python, TypeScript, YAML, TOML, JSON, Terraform, Dockerfiles and Jupyter notebooks.
58
+ Deterministic pattern matching only.
59
+
60
+ ```
61
+ uv run --package foretop-ebb ebb scan <path>
62
+ ```
63
+
64
+ Detectors are pure functions `(path, content) -> list[RawMatch]`, registered in a table in
65
+ `src/ebb/detect/registry.py`. Adding a language means one new detector file plus one new fixture
66
+ under `tests/fixtures/` — nothing else changes.
67
+
68
+ **Registry (Session 4):** `src/ebb/registry/` loads `src/ebb/registries/retirements/*.yaml` —
69
+ real retirement data for OpenAI, Anthropic and Google, sourced from each provider's live
70
+ deprecations
71
+ page, never invented. `RegistryEntry` requires `source_url` and `verified_at`; a record missing
72
+ either fails the whole load (`RegistryLoadError`) rather than silently dropping it. Loading warns
73
+ (`StaleRegistryEntryWarning`) on any entry verified more than 90 days ago. `resolve(raw_text,
74
+ registry)` is an exact-match lookup against `canonical_id` and curated `aliases` only — no
75
+ prefix or fuzzy matching, so an uncurated floating alias (`claude-3-opus-latest`) resolves to
76
+ `Unknown`, never to whatever entry happens to share a prefix. `registry.version` is a
77
+ content-derived hash, stamped onto every `Finding.rule_version` (Session 6).
78
+
79
+ **Canonicalisation (Session 5):** `src/ebb/canonicalize.py` — pure, isolated, no registry lookup,
80
+ no I/O. Collapses AWS Bedrock cross-Region inference profile IDs and vendor-prefixed model IDs
81
+ (`us.anthropic.claude-3-haiku-20240307-v1:0` — the literal example from AWS's own docs) and GCP
82
+ Vertex AI publisher-model resource paths (`publishers/{vendor}/models/{id}`, optionally
83
+ `projects/.../locations/...`-prefixed) plus their respective `-v{N}:{M}` / `@{N}` version
84
+ suffixes, down to the bare dated-snapshot id a provider's own API would use directly. Property-
85
+ tested with Hypothesis for idempotency and round-tripping, per the plan's explicit requirement.
86
+ Deliberately does **not** strip `-latest` / `-preview` suffixes — some of those are curated as
87
+ their own whole registry entries (`chatgpt-4o-latest`), and stripping would silently break their
88
+ resolution; an uncurated floating alias stays exactly as unresolvable after canonicalisation as
89
+ before, which is correct (see Session 4's `resolve()` tests).
90
+
91
+ **Owner attribution (Session 5):** `src/ebb/owner.py` — CODEOWNERS first (reusing `pathspec`'s
92
+ gitignore matching, since GitHub documents CODEOWNERS pattern syntax as the same rules; last
93
+ matching rule in the file wins, per GitHub's own precedence), `git blame` on the specific line as
94
+ fallback. Returns `None` rather than raising when neither source has an answer — a file with no
95
+ declared owner and no git history is a legitimate, common outcome.
96
+
97
+ **Findings, verdicts and renderers (Session 6):** the whole pipeline is wired together for the
98
+ first time — `src/ebb/build_findings.py` runs walk → detect → `canonicalize()` → `resolve()` →
99
+ `find_owner()` → verdict/severity/confidence (`src/ebb/verdict.py`) → a `Finding`
100
+ (`src/ebb/finding.py`, the SUITE_ARCHITECTURE.md §3 model: `evidence` can never be empty,
101
+ enforced by a Pydantic validator, and `unknown` is a first-class `Verdict`, not a fallback).
102
+ Identity is `sha256(canonical_id | file_path | symbol)[:16]` — deliberately excludes the line
103
+ number; `symbol` is a lightweight, language-agnostic "nearest assignment target" heuristic
104
+ (`detect/scan_text.nearest_symbol`), not full per-language AST scoping, which was out of scope
105
+ for this session.
106
+
107
+ Verdict logic: `unknown` for anything `resolve()` couldn't verify; for a verified entry, no
108
+ shutdown date on record is `clear`, a shutdown date already passed is `break` (critical severity
109
+ — it's failing now, not eventually), a future one is `drift` (severity scales with days
110
+ remaining: ≤30d high, ≤90d medium, else low).
111
+
112
+ ```
113
+ uv run --package foretop-ebb ebb scan <path> [--format table|markdown|json|sarif] [--fail-on SEVERITY]
114
+ ```
115
+
116
+ Four renderers (`src/ebb/render/`): terminal (Rich, colour-capable — `--format table`, the
117
+ default), Markdown (for PR comments), JSON, and SARIF 2.1.0. The SARIF renderer is validated in
118
+ tests against the real schema fetched from OASIS's own repo (committed at
119
+ `tests/fixtures/sarif-schema-2.1.0.json`), not written from memory. `--fail-on SEVERITY` makes
120
+ exit code 1 when any finding meets or exceeds that severity; exit codes are an API (specs/ebb.md
121
+ §6) — 0 clean, 1 threshold met, 2 internal error (bad `--format`/`--fail-on`, registry failed to
122
+ load) — and these are never conflated.
123
+
124
+ `--registry-dir` overrides where registry YAML is loaded from; the default is the copy bundled
125
+ inside the `foretop-ebb` distribution itself (`src/ebb/registries/retirements/`, resolved via
126
+ `importlib.resources` — see Session 8 below), so it works identically whether ebb is running
127
+ from an editable monorepo checkout or a `pip`/`uvx`-installed wheel.
128
+
129
+ Known gap (detection is not the issue — Session 7's golden corpus scores every detector at
130
+ 1.000 precision/recall): `canonicalize()` only strips AWS Bedrock and GCP Vertex AI wrapper
131
+ syntax, not a generic OpenAI-style dated-snapshot suffix. `gpt-4-turbo-2024-04-09` is detected
132
+ correctly as a whole match, but `canonicalize()` passes it through unchanged, and the registry
133
+ has no `gpt-4-turbo-2024-04-09` entry or alias — only bare `gpt-4-turbo` — so it resolves
134
+ `unknown` instead of joining to the real tracked entry. Not fixed here deliberately: generic
135
+ snapshot-suffix stripping has the same failure mode `canonicalize()` already refuses for
136
+ `-latest`/`-preview` (some dated suffixes are themselves curated as distinct whole entries,
137
+ and blind-stripping would break their resolution) — it needs the same care as that decision,
138
+ not a quick patch bolted onto Session 8's actual scope.
139
+
140
+ **Session 10 (the extraction session):** `packages/keel` now exists. `src/ebb/walk.py`'s
141
+ gitignore-aware file walker (`is_binary`/`iter_files`/the gitignore matching) turned out to be
142
+ byte-identical to the copy telltale had made of it in Session 9, so it moved to
143
+ `keel.collect.walk` — the first and, for now, only thing in `keel`. `src/ebb/walk.py` now
144
+ imports it and keeps only `scan_repo`, ebb's own detector-dispatch logic. This is deliberately
145
+ the *only* extraction so far (SUITE_ARCHITECTURE.md §8's "premature platformisation" warning);
146
+ `packages/keel/README.md` has the full identical-vs-similar reasoning, including a real
147
+ packaging gap it left behind: `apps/ebb`'s public mirror (Session 8, `foretop-dev/ebb`) isn't
148
+ yet updated to vendor or depend on `keel`, so it must not be re-synced and republished until
149
+ that's resolved.
150
+
151
+ **The accuracy floor (Session 7):** `tests/golden/` holds 30 hand-labelled repository fixtures,
152
+ 3–5 per detector, covering all 8 detectors (`python`, `typescript`, `yaml`, `json`, `toml`,
153
+ `terraform`, `dockerfile`, `notebook`). Ground truth lives in `tests/golden_manifest.yaml` — kept
154
+ *outside* `tests/golden/` on purpose: a ground-truth file with model-id strings in it living
155
+ *inside* the scanned tree would itself get scanned and picked up as a spurious match. Labels
156
+ reflect real, current OpenAI/Anthropic/Google model-id shapes, not what the detector already
157
+ happened to catch — the entire point is that a gap between the two is a real bug, not a fixture
158
+ mistake.
159
+
160
+ `tests/unit/test_golden_corpus.py` (`make accuracy` to run it directly) scores every detector
161
+ **independently** — precision and recall are never pooled into one aggregate, because an average
162
+ across 8 detectors can hide one that's badly broken. The floor is precision ≥ 0.95 and recall ≥
163
+ 0.85 per detector; a second test asserts every detector has at least one pure-decoy fixture (zero
164
+ expected matches), so a detector that's simply never tempted can't pass on a technicality.
165
+
166
+ First run against the corpus failed 6 of 8 detectors on real gaps: `patterns.py` had no o3/o4
167
+ family at all (only `o1`), no `gpt-5` family, and `gpt-4.1` silently matched as the shorter,
168
+ wrong `gpt-4` (alternation tries branches in order — with bare `4` before `4\.\d+`, "gpt-4.1"
169
+ matched only "gpt-4" and quietly dropped the `.1` that makes it a different model). Fixed in
170
+ `patterns.py` by adding the missing families and reordering the OpenAI alternation so the
171
+ longer, more specific branch is tried first — not by loosening the 0.95/0.85 floor, which never
172
+ moved. Also extended the OpenAI and Gemini date/qualifier suffixes to cover the bare-4-digit
173
+ snapshot convention (`gpt-4-0125-preview`) and `-preview`/`-exp` qualifiers
174
+ (`gemini-3-pro-preview`), both real, both previously truncating to a shorter, wrong match rather
175
+ than the full one. All 8 detectors now score 1.000 precision / 1.000 recall against the corpus.
@@ -0,0 +1,160 @@
1
+ # ebb
2
+
3
+ > Tells an engineering team which repos, jobs, prompts and owners break when an AI provider
4
+ > retires a model — before the deadline becomes an outage.
5
+
6
+ A provider announces a retirement date. Somewhere in your repos, Airflow DAGs, Terraform
7
+ variables and prompt templates there's a hardcoded model string nobody remembers. `ebb` finds
8
+ every one of them, joins it to the provider's real retirement date, and tells you who owns it.
9
+
10
+ ## Install and run
11
+
12
+ ```
13
+ uvx foretop-ebb scan .
14
+ ```
15
+
16
+ No config, no account, no network call beyond installing the package — detection is entirely
17
+ local and deterministic, matched against a versioned registry bundled in the package. Add
18
+ `--format sarif` for GitHub Code Scanning, `--format markdown` for a PR comment, or
19
+ `--fail-on critical` to make CI fail when something's actually urgent (see below for exit
20
+ codes). `ebb scan --help` lists everything.
21
+
22
+ ## Use it as a GitHub Action
23
+
24
+ ```yaml
25
+ - uses: foretop-dev/ebb@main
26
+ with:
27
+ fail-on: critical # info | low | medium | high | critical; empty string = report-only
28
+ ```
29
+
30
+ Annotates the pull request inline and upserts one summary comment (finds its own previous
31
+ comment by an HTML marker and edits it — never posts a second one on repeat pushes). Needs
32
+ `permissions: pull-requests: write` in the calling workflow.
33
+
34
+ ## License
35
+
36
+ Apache-2.0. This file tracks build status below; the source-of-truth product spec lives in the
37
+ private monorepo this is mirrored from (see `scripts/sync-mirror.sh` there).
38
+
39
+ ## Status
40
+
41
+ **Slice 1** (Session 3): a Typer CLI that walks a repository and detects model-identifier-shaped
42
+ strings in Python, TypeScript, YAML, TOML, JSON, Terraform, Dockerfiles and Jupyter notebooks.
43
+ Deterministic pattern matching only.
44
+
45
+ ```
46
+ uv run --package foretop-ebb ebb scan <path>
47
+ ```
48
+
49
+ Detectors are pure functions `(path, content) -> list[RawMatch]`, registered in a table in
50
+ `src/ebb/detect/registry.py`. Adding a language means one new detector file plus one new fixture
51
+ under `tests/fixtures/` — nothing else changes.
52
+
53
+ **Registry (Session 4):** `src/ebb/registry/` loads `src/ebb/registries/retirements/*.yaml` —
54
+ real retirement data for OpenAI, Anthropic and Google, sourced from each provider's live
55
+ deprecations
56
+ page, never invented. `RegistryEntry` requires `source_url` and `verified_at`; a record missing
57
+ either fails the whole load (`RegistryLoadError`) rather than silently dropping it. Loading warns
58
+ (`StaleRegistryEntryWarning`) on any entry verified more than 90 days ago. `resolve(raw_text,
59
+ registry)` is an exact-match lookup against `canonical_id` and curated `aliases` only — no
60
+ prefix or fuzzy matching, so an uncurated floating alias (`claude-3-opus-latest`) resolves to
61
+ `Unknown`, never to whatever entry happens to share a prefix. `registry.version` is a
62
+ content-derived hash, stamped onto every `Finding.rule_version` (Session 6).
63
+
64
+ **Canonicalisation (Session 5):** `src/ebb/canonicalize.py` — pure, isolated, no registry lookup,
65
+ no I/O. Collapses AWS Bedrock cross-Region inference profile IDs and vendor-prefixed model IDs
66
+ (`us.anthropic.claude-3-haiku-20240307-v1:0` — the literal example from AWS's own docs) and GCP
67
+ Vertex AI publisher-model resource paths (`publishers/{vendor}/models/{id}`, optionally
68
+ `projects/.../locations/...`-prefixed) plus their respective `-v{N}:{M}` / `@{N}` version
69
+ suffixes, down to the bare dated-snapshot id a provider's own API would use directly. Property-
70
+ tested with Hypothesis for idempotency and round-tripping, per the plan's explicit requirement.
71
+ Deliberately does **not** strip `-latest` / `-preview` suffixes — some of those are curated as
72
+ their own whole registry entries (`chatgpt-4o-latest`), and stripping would silently break their
73
+ resolution; an uncurated floating alias stays exactly as unresolvable after canonicalisation as
74
+ before, which is correct (see Session 4's `resolve()` tests).
75
+
76
+ **Owner attribution (Session 5):** `src/ebb/owner.py` — CODEOWNERS first (reusing `pathspec`'s
77
+ gitignore matching, since GitHub documents CODEOWNERS pattern syntax as the same rules; last
78
+ matching rule in the file wins, per GitHub's own precedence), `git blame` on the specific line as
79
+ fallback. Returns `None` rather than raising when neither source has an answer — a file with no
80
+ declared owner and no git history is a legitimate, common outcome.
81
+
82
+ **Findings, verdicts and renderers (Session 6):** the whole pipeline is wired together for the
83
+ first time — `src/ebb/build_findings.py` runs walk → detect → `canonicalize()` → `resolve()` →
84
+ `find_owner()` → verdict/severity/confidence (`src/ebb/verdict.py`) → a `Finding`
85
+ (`src/ebb/finding.py`, the SUITE_ARCHITECTURE.md §3 model: `evidence` can never be empty,
86
+ enforced by a Pydantic validator, and `unknown` is a first-class `Verdict`, not a fallback).
87
+ Identity is `sha256(canonical_id | file_path | symbol)[:16]` — deliberately excludes the line
88
+ number; `symbol` is a lightweight, language-agnostic "nearest assignment target" heuristic
89
+ (`detect/scan_text.nearest_symbol`), not full per-language AST scoping, which was out of scope
90
+ for this session.
91
+
92
+ Verdict logic: `unknown` for anything `resolve()` couldn't verify; for a verified entry, no
93
+ shutdown date on record is `clear`, a shutdown date already passed is `break` (critical severity
94
+ — it's failing now, not eventually), a future one is `drift` (severity scales with days
95
+ remaining: ≤30d high, ≤90d medium, else low).
96
+
97
+ ```
98
+ uv run --package foretop-ebb ebb scan <path> [--format table|markdown|json|sarif] [--fail-on SEVERITY]
99
+ ```
100
+
101
+ Four renderers (`src/ebb/render/`): terminal (Rich, colour-capable — `--format table`, the
102
+ default), Markdown (for PR comments), JSON, and SARIF 2.1.0. The SARIF renderer is validated in
103
+ tests against the real schema fetched from OASIS's own repo (committed at
104
+ `tests/fixtures/sarif-schema-2.1.0.json`), not written from memory. `--fail-on SEVERITY` makes
105
+ exit code 1 when any finding meets or exceeds that severity; exit codes are an API (specs/ebb.md
106
+ §6) — 0 clean, 1 threshold met, 2 internal error (bad `--format`/`--fail-on`, registry failed to
107
+ load) — and these are never conflated.
108
+
109
+ `--registry-dir` overrides where registry YAML is loaded from; the default is the copy bundled
110
+ inside the `foretop-ebb` distribution itself (`src/ebb/registries/retirements/`, resolved via
111
+ `importlib.resources` — see Session 8 below), so it works identically whether ebb is running
112
+ from an editable monorepo checkout or a `pip`/`uvx`-installed wheel.
113
+
114
+ Known gap (detection is not the issue — Session 7's golden corpus scores every detector at
115
+ 1.000 precision/recall): `canonicalize()` only strips AWS Bedrock and GCP Vertex AI wrapper
116
+ syntax, not a generic OpenAI-style dated-snapshot suffix. `gpt-4-turbo-2024-04-09` is detected
117
+ correctly as a whole match, but `canonicalize()` passes it through unchanged, and the registry
118
+ has no `gpt-4-turbo-2024-04-09` entry or alias — only bare `gpt-4-turbo` — so it resolves
119
+ `unknown` instead of joining to the real tracked entry. Not fixed here deliberately: generic
120
+ snapshot-suffix stripping has the same failure mode `canonicalize()` already refuses for
121
+ `-latest`/`-preview` (some dated suffixes are themselves curated as distinct whole entries,
122
+ and blind-stripping would break their resolution) — it needs the same care as that decision,
123
+ not a quick patch bolted onto Session 8's actual scope.
124
+
125
+ **Session 10 (the extraction session):** `packages/keel` now exists. `src/ebb/walk.py`'s
126
+ gitignore-aware file walker (`is_binary`/`iter_files`/the gitignore matching) turned out to be
127
+ byte-identical to the copy telltale had made of it in Session 9, so it moved to
128
+ `keel.collect.walk` — the first and, for now, only thing in `keel`. `src/ebb/walk.py` now
129
+ imports it and keeps only `scan_repo`, ebb's own detector-dispatch logic. This is deliberately
130
+ the *only* extraction so far (SUITE_ARCHITECTURE.md §8's "premature platformisation" warning);
131
+ `packages/keel/README.md` has the full identical-vs-similar reasoning, including a real
132
+ packaging gap it left behind: `apps/ebb`'s public mirror (Session 8, `foretop-dev/ebb`) isn't
133
+ yet updated to vendor or depend on `keel`, so it must not be re-synced and republished until
134
+ that's resolved.
135
+
136
+ **The accuracy floor (Session 7):** `tests/golden/` holds 30 hand-labelled repository fixtures,
137
+ 3–5 per detector, covering all 8 detectors (`python`, `typescript`, `yaml`, `json`, `toml`,
138
+ `terraform`, `dockerfile`, `notebook`). Ground truth lives in `tests/golden_manifest.yaml` — kept
139
+ *outside* `tests/golden/` on purpose: a ground-truth file with model-id strings in it living
140
+ *inside* the scanned tree would itself get scanned and picked up as a spurious match. Labels
141
+ reflect real, current OpenAI/Anthropic/Google model-id shapes, not what the detector already
142
+ happened to catch — the entire point is that a gap between the two is a real bug, not a fixture
143
+ mistake.
144
+
145
+ `tests/unit/test_golden_corpus.py` (`make accuracy` to run it directly) scores every detector
146
+ **independently** — precision and recall are never pooled into one aggregate, because an average
147
+ across 8 detectors can hide one that's badly broken. The floor is precision ≥ 0.95 and recall ≥
148
+ 0.85 per detector; a second test asserts every detector has at least one pure-decoy fixture (zero
149
+ expected matches), so a detector that's simply never tempted can't pass on a technicality.
150
+
151
+ First run against the corpus failed 6 of 8 detectors on real gaps: `patterns.py` had no o3/o4
152
+ family at all (only `o1`), no `gpt-5` family, and `gpt-4.1` silently matched as the shorter,
153
+ wrong `gpt-4` (alternation tries branches in order — with bare `4` before `4\.\d+`, "gpt-4.1"
154
+ matched only "gpt-4" and quietly dropped the `.1` that makes it a different model). Fixed in
155
+ `patterns.py` by adding the missing families and reordering the OpenAI alternation so the
156
+ longer, more specific branch is tried first — not by loosening the 0.95/0.85 floor, which never
157
+ moved. Also extended the OpenAI and Gemini date/qualifier suffixes to cover the bare-4-digit
158
+ snapshot convention (`gpt-4-0125-preview`) and `-preview`/`-exp` qualifiers
159
+ (`gemini-3-pro-preview`), both real, both previously truncating to a shorter, wrong match rather
160
+ than the full one. All 8 detectors now score 1.000 precision / 1.000 recall against the corpus.
@@ -0,0 +1,74 @@
1
+ [project]
2
+ name = "foretop-ebb"
3
+ version = "0.1.0"
4
+ description = "Tells an engineering team which repos, jobs, prompts and owners break when an AI provider retires a model — before the deadline becomes an outage."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ dependencies = [
10
+ "typer>=0.15",
11
+ "rich>=13.9",
12
+ "pathspec>=0.12",
13
+ "pydantic>=2.9",
14
+ "pyyaml>=6.0",
15
+ "httpx>=0.28",
16
+ ]
17
+
18
+ [project.scripts]
19
+ ebb = "ebb.__main__:app"
20
+ foretop-ebb = "ebb.__main__:app"
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "pytest>=8.3",
25
+ "types-pyyaml>=6.0",
26
+ "hypothesis>=6.115",
27
+ "jsonschema>=4.23",
28
+ "mypy>=2.3.0",
29
+ "ruff>=0.16.2",
30
+ ]
31
+
32
+ [tool.uv.build-backend]
33
+ module-name = [
34
+ "ebb",
35
+ "keel",
36
+ ]
37
+
38
+ [tool.ruff]
39
+ line-length = 100
40
+ target-version = "py312"
41
+ extend-exclude = [
42
+ "tests/fixtures",
43
+ "tests/golden",
44
+ ]
45
+
46
+ [tool.ruff.lint]
47
+ select = [
48
+ "E",
49
+ "F",
50
+ "I",
51
+ "N",
52
+ "UP",
53
+ "B",
54
+ "A",
55
+ "C4",
56
+ "SIM",
57
+ "TCH",
58
+ "RUF",
59
+ ]
60
+
61
+ [tool.ruff.lint.isort]
62
+ known-first-party = ["ebb"]
63
+ known-third-party = ["keel"]
64
+
65
+ [tool.mypy]
66
+ strict = true
67
+ python_version = "3.12"
68
+
69
+ [tool.pytest.ini_options]
70
+ addopts = "-ra"
71
+
72
+ [build-system]
73
+ requires = ["uv_build>=0.11.32,<0.12.0"]
74
+ build-backend = "uv_build"