Commit b0dea8d
authored
release: 0.7.0 — thin-client refactor (#34)
BREAKING CHANGES
----------------
SDK is now a thin client. All enforcement decisions arrive from the
backend via /api/v1/gate and /api/v1/execute. Local policy
enforcement, its dataclass, and its hardcoded thresholds are removed.
Removed:
* class Policy, Policy.default_local(), Policy.strict_local(),
Policy.from_dict() (was at nullrun.runtime.Policy)
* NullRunRuntime.policy property
* NullRunRuntime(policy=...) constructor kwarg
* NullRunStatus.active_policy, .fallback_policy,
.fallback_reason, .last_policy_fetch,
.last_policy_fetch_age_seconds fields
* Transport.fetch_policy() method
* Transport.clear_policy_cache() method
* FallbackMode.CACHED enum value
* Local loop/rate detectors: LoopTracker, RateTracker,
LocalDecision classes
* NullRunRuntime._local_check(), _loop_tracker, _rate_tracker
instance attrs
* _local_loop_threshold, _local_rate_limit (hardcoded 6/1000)
* CachedDecision, PolicyCache transport classes
* NULLRUN_FALLBACK_MODE env var
* NULLRUN_POLICY_FAIL_OPEN env var (backend is authoritative)
* NullRunRuntime._fetch_policy() method
* WS on_policy_invalidated callback
Migration: if you need to display policy values in a UI, fetch them
directly via GET /api/v1/orgs/{org_id}/policies. The SDK no longer
mirrors them.
Audit: Drift D-01 from 2026-06-26 SDK↔backend audit
(PolicyResponse lacked fields SDK expected; local defaults silently
widened limits).
Transport finalizer behavior change
-----------------------------------
Transport._atexit_flush_safe is now a no-op that emits a single
DEBUG log line. It does NOT persist buffered events to the WAL
anymore — by the time weakref.finalize fires, self._buffer /
self._lock / self._client are already gone. Crash-safety now lives
exclusively in stop() and the context-manager pattern. Callers who
relied on the implicit on-exit WAL flush MUST switch to:
with nullrun.Transport(api_url=..., api_key=...) as t:
...
or call t.stop() explicitly before process exit.
Tests
-----
* tests/test_signal_safety.py::TestAtexitViaWeakref rewritten to
pin the new no-op-finalizer contract (was written against an
intended but-unimplemented WAL-persist finalizer).
* tests/test_deprecation_warnings.py removed (NULLRUN_FALLBACK_MODE
env var is gone; deprecation warning is moot).
* tests/test_no_local_policy.py added (pins absence of
NullRunRuntime._local_check and the local Policy dataclass).
* Various test updates reflecting runtime/transport refactors
(-1883 / +1432 in tests/, mostly deletions of policy- and
fallback-mode-specific cases).
Other
-----
* pyproject.toml: version bumped 0.6.1 -> 0.7.0 (was inconsistent
with __version__.py before this commit).
* CHANGELOG.md: full 0.7.0 entry covering BREAKING CHANGES, the
transport-finalizer contract change, and migration guidance.
Verification (local on Windows / Python 3.14.2):
pytest 913 passed, 13 skipped (0:08:50)
ruff check clean on src/ and tests/
mypy src/ clean on 26 source files1 parent 54cc6fa commit b0dea8d
68 files changed
Lines changed: 1432 additions & 1883 deletions
File tree
- src/nullrun
- observability
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
10 | 78 | | |
11 | 79 | | |
12 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
258 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
259 | 274 | | |
260 | 275 | | |
261 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
111 | 122 | | |
112 | 123 | | |
113 | 124 | | |
114 | | - | |
| 125 | + | |
115 | 126 | | |
116 | 127 | | |
117 | 128 | | |
| |||
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
172 | | - | |
173 | | - | |
| 176 | + | |
| 177 | + | |
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
| |||
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | 186 | | |
193 | 187 | | |
194 | 188 | | |
| |||
0 commit comments