Commit e653aba
refactor(spec): move observability seam into the spec layer (leanEthereum#830)
The spec layer's last upward dependency on node was the observability
import in fork_choice.py and state_transition.py. A prior refactor moved
the Interval type and protocol constants into the spec layer but left
this edge, so spec still reached up into node.
Relocate node/observability/ to spec/observability/. The package is
purely the vendor-neutral observer seam: a SpecObserver Protocol, a
no-op default, the observe_* context-manager timers, and set_observer.
Spec emits through it with a no-op default, so spec imports stay
side-effect-free. The concrete Prometheus backend stays in node/metrics
and the startup set_observer wiring stays in the CLI; only the seam moves.
Pure relocation, no behavior change. The test moves to the mirrored
spec path per the test-structure convention.
After this, grep -rn "lean_spec.node" src/lean_spec/spec/ is empty: the
spec layer no longer depends on node in either direction.
Alternative considered: leave the seam in node and inject an observer
into every spec entry point. Rejected as strictly worse churn that
fights the existing module-level singleton design; the seam is itself a
spec-level concern (the spec defines what it observes), so it belongs in
spec with the no-op default.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 30ffb6c commit e653aba
6 files changed
Lines changed: 11 additions & 11 deletions
File tree
- src/lean_spec
- cli
- spec
- forks/lstar
- observability
- tests/lean_spec/spec/observability
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 6 | | |
11 | 7 | | |
12 | 8 | | |
| |||
30 | 26 | | |
31 | 27 | | |
32 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 7 | | |
11 | 8 | | |
12 | 9 | | |
| |||
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
src/lean_spec/node/observability/__init__.py renamed to src/lean_spec/spec/observability/__init__.py
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
File renamed without changes.
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments