Skip to content

docs(adr): close Phase 1 — three ADRs + Phase 2 execution plan - #218

Merged
zzylol merged 1 commit into
mainfrom
docs/adrs-and-phase-2-plan
May 2, 2026
Merged

zzylol merged 1 commit into
mainfrom
docs/adrs-and-phase-2-plan

Conversation

@zzylol

@zzylol zzylol commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes Phase 1 of the edge-framework migration (see `docs/design-asap-edge-framework.md` §9). Phase 1's exit criterion is "doc reviewed + ADRs opened"; the design doc has been through three iterations already (#213, #216, #217) so this PR adds the three ADRs and the Phase 2 execution plan.

What's in the PR

`docs/adr/adr-0001-retire-sketch-core.md` (Accepted, retrospective)

Records what shipped in asap_sketchlib#36 + ASAPQuery-backend#73 + ASAPQuery#309: sketch-core retired into `asap_sketchlib`'s existing `src/sketches/` layout; ImplMode dispatch removed; dsrs / clap / ctor / asap-cli deps dropped; renames (`HllDelta` → `HllSketchDelta`, `HeapItem` → `CmsHeapItem`, `CountMinDelta` → `CountMinSketchDelta`).

`docs/adr/adr-0002-extract-precompute-runtime.md` (Proposed, gates Phases 2 / 3)

Pins the `asap-precompute-{go,rs}` crate layout, the `Precompute` / `Sketch` / `PrecomputeConfig` API surface, the behavior-preservation contract (b3-delta produces same value at offset −90s), and the performance contract (per-observation p99 within 10%).

`docs/adr/adr-0003-adapter-trait-and-control-channel.md` (Proposed, gates Phases 4 / 5 / 6)

Pins the `Adapter` trait, the `ControlChannel` trait, the hard rule that `ControlChannel` runs in an internal goroutine/task on every adapter (precedent: OTel's `tailsamplingprocessor`), and the Strategy A/B encoding choice with the project-standard well-known field names.

`docs/phase-2-execution-plan.md` (companion to ADR-0002)

File-by-file extraction map for all 5 OTel processors (~3850 LoC across `{ddsketch,kll,hll,countsketch,countminsketch}processor/processor.go` → ~1500 LoC shared `asap-precompute-go` module + 5 × ~50 LoC shims). Identifies two structural patterns:

  • Pattern A (DDSketch / KLL / HLL): nested `resourceWindow → scopeWindow → metricWindow → sketchSeries` hierarchy.
  • Pattern B (CountSketch / CMS): flat `windowSketch` map keyed by partitionKey.

Unifies both under the generic `Precompute[SketchT]` trait. 11-step work breakdown with explicit phase-exit gate (b3-delta value, p99 latency, P8 accuracy reducer, controlchannel smoke).

Stats

```
docs/adr/adr-0001-retire-sketch-core.md 137
docs/adr/adr-0002-extract-precompute-runtime.md 195
docs/adr/adr-0003-adapter-trait-and-control-channel.md 179
docs/phase-2-execution-plan.md 280
---
791 lines
```

Next

Once these land, Phase 1 is done and Phase 2 (Go runtime extract) can start using the execution plan as the work-breakdown spec.

Phase 1 of the edge-framework migration is "lock the design + ADRs"
per docs/design-asap-edge-framework.md §9. Adds:

- adr-0001-retire-sketch-core.md (Accepted, retrospective). Records
  what shipped in asap_sketchlib#36 + ASAPQuery-backend#73 +
  ASAPQuery#309: sketch-core retired, ImplMode dispatch removed,
  dsrs/clap/ctor/asap-cli deps dropped, well-known-name renames
  (HllDelta → HllSketchDelta, HeapItem → CmsHeapItem, CountMinDelta
  → CountMinSketchDelta).

- adr-0002-extract-precompute-runtime.md (Proposed, gates Phases
  2 / 3). Pins the asap-precompute-{go,rs} crate layout, the
  Precompute / Sketch / PrecomputeConfig trait surface, the
  behavior-preservation contract (b3-delta produces same value),
  and the performance contract (p99 within 10%).

- adr-0003-adapter-trait-and-control-channel.md (Proposed, gates
  Phases 4 / 5 / 6). Pins the Adapter trait, the ControlChannel
  trait, the hard rule that ControlChannel runs in an internal
  goroutine/task on every adapter (precedent: tailsamplingprocessor),
  and the Strategy A/B encoding choice with the project-standard
  well-known field names.

- phase-2-execution-plan.md (companion to ADR-0002). File-by-file
  function-level extraction map for all 5 OTel processors
  (~3850 LoC → ~1500 LoC shared module + 5 × ~50 LoC shims).
  Identifies two structural patterns (DDSketch/KLL/HLL nested
  windows vs CountSketch/CMS flat partitioned windows) and
  unifies them under the generic Precompute trait. 11-step work
  breakdown with phase-exit criterion.

Once these ADRs land, Phase 1 is done and Phase 2 (Go runtime
extract) can start.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 811a59a into main May 2, 2026
@zzylol
zzylol deleted the docs/adrs-and-phase-2-plan branch May 2, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant