Skip to content

feat(pivot): PR-K.1 — sever patterns lib + replay runner from k8sevents#211

Merged
trilamsr merged 1 commit into
mainfrom
pr-k-1-sever-patterns-k8sevents
May 31, 2026
Merged

feat(pivot): PR-K.1 — sever patterns lib + replay runner from k8sevents#211
trilamsr merged 1 commit into
mainfrom
pr-k-1-sever-patterns-k8sevents

Conversation

@trilamsr

@trilamsr trilamsr commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

RFC-0013 §migration PR-K.1 (line 252): sever internal/synthesis/patterns/ and the replay runner from components/receivers/k8sevents by introducing local model types in a new internal/synthesis/patterns/model.go. No deletions.

This is the hard gate for PR-I.2 (patterndetectorprocessor + rankjoinprocessor extraction into module/). PR-I.2 cannot ship while the pattern library drags an in-tree receiver package into its compile graph — the module's go.mod boundary would be broken on first build.

Root cause

The detector code in internal/synthesis/patterns/pod_evicted.go (and its tests + the replay runner) imported Record, NodeRecord, ObjectRef, Hint, HintPodEvicted, HintNodePressure, NodePressureKind, PressureDisk, PressureMemory, PressurePID, PressureNotReady, EventTypeWarning from components/receivers/k8sevents. That coupling is wrong-direction: the pattern library is the v0.3 moat and travels with the project regardless of which receivers ship in the active build — its input types belong next to the detectors.

Mechanics

  • new internal/synthesis/patterns/model.go (158 LOC): local Record, NodeRecord, ObjectRef structs with the same JSON tags as the k8sevents equivalents (so fixture corpora round-trip unchanged); Hint + NodePressureKind named types; only the four Hint* constants the pattern library switches on (HintPodEvicted, HintNodePressure, HintNodeUnhealthy, HintScheduleFailure); all four Pressure* constants; EventTypeNormal / EventTypeWarning.
  • modified pod_evicted.go: drop the k8sevents import; signatures + switch arms reference the local types; doc-comment header points at model.go instead of "M10's exported Record".
  • modified pod_evicted_test.go + pod_evicted_bench_test.go: swap k8sevents.* references for patterns.*.
  • modified pressure_from_note_test.go: same swap for NodePressureKind + Pressure* constants (this test is in-package patterns, not patterns_test).
  • modified internal/synthesis/replay/runner.go: Fixture.Events / Fixture.NodeConditions retyped to []patterns.Record / []patterns.NodeRecord; import swap.
  • modified internal/synthesis/replay/pod_evicted/_real_world/README.md: contract-pointer updated from components/receivers/k8sevents/record.go to internal/synthesis/patterns/model.go.

Out of scope (deferred to PR-K.2 / PR-K.3 per RFC §migration L253-254)

  • Deleting components/receivers/{clockreceiver,kernelevents,k8sevents,containerstdout} — those packages still ship and still emit these wire shapes.
  • Migrating the ~86 remaining test fixtures that reference the in-tree receivers.
  • Chart-default flip + values-key deprecation cycle.

Test plan

  • go build ./... — clean
  • go vet ./internal/synthesis/... — clean
  • make lint0 issues
  • go test -race -count=1 ./internal/synthesis/... — pass (patterns + replay)
  • go test -bench=BenchmarkPodEvictedDetector -benchtime=1x -run=^$ ./internal/synthesis/patterns/ — pass (~2.2 ms/op for 1024-event window)
  • bash scripts/doc-check.sh — clean (comment-noise diff gate vs origin/main included)
  • grep -r 'components/receivers/k8sevents' internal/synthesis/ — zero hits
  • CI: full make verify + race-coverage + build-OCB
NONE

Introduce a local model for the pattern library so detectors no longer
import components/receivers/k8sevents for their record types. Per
RFC-0013 §migration (line 252), this is the hard gate for PR-I.2's
patterndetectorprocessor + rankjoinprocessor — those processors
cannot ship into module/ while patterns/ still drags an in-tree
receiver into its compile graph.

Mechanics:
- new internal/synthesis/patterns/model.go: local Record, NodeRecord,
  ObjectRef, Hint, NodePressureKind types with the same JSON tags as
  the k8sevents equivalents, so fixture corpora unmarshal unchanged
- new HintPodEvicted / HintNodePressure / HintNodeUnhealthy /
  HintScheduleFailure constants (only the values patterns switch on)
- new PressureMemory / PressureDisk / PressurePID / PressureNotReady
- new EventTypeNormal / EventTypeWarning
- pod_evicted.go drops the k8sevents import; switches signatures and
  switch arms to the local types (doc comment updated)
- pod_evicted_test.go + pod_evicted_bench_test.go + replay/runner.go
  swap their k8sevents.* references for patterns.*
- pressure_from_note_test.go uses the local NodePressureKind constants
- replay/pod_evicted/_real_world/README.md updates the contract
  pointer from components/receivers/k8sevents/record.go to
  internal/synthesis/patterns/model.go

No deletions in this PR (k8sevents still ships, k8sevents emitters
still produce these wire shapes). PR-K.2 will delete the in-tree
k8sevents receiver after the chart-default flip lands.

Verification:
- go build ./... — clean
- go vet ./internal/synthesis/... — clean
- go test -race -count=1 ./internal/synthesis/... — pass
- go test -bench=BenchmarkPodEvictedDetector -benchtime=1x — pass
- grep -r components/receivers/k8sevents internal/synthesis/ — zero hits

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Signed-off-by: Tri Lam <tri@maydow.com>
@trilamsr trilamsr merged commit 7a9ff71 into main May 31, 2026
18 of 19 checks passed
@trilamsr trilamsr deleted the pr-k-1-sever-patterns-k8sevents branch May 31, 2026 09:14
trilamsr added a commit that referenced this pull request May 31, 2026
## Summary

RFC-0013 §migration PR-K.2: delete the four in-tree receivers
(`clockreceiver`, `kernelevents`, `k8sevents`, `containerstdout`)
plus the `xidgen` failure-injector (whose sole consumer was
`kernelevents`'s wire shape per RFC §migration L253). PR-K.1
(#211) just severed `internal/synthesis/patterns/` + `replay` from
`k8sevents`, unblocking the source-tree cut. PR-J (#195) shipped
the four upstream-OTel recipes that replace the in-tree receivers
in the bundled Helm-chart pipeline; this PR retires the
behind-the-curtain code.

Chart cleanup (values keys, DaemonSet template refs, `NOTES.txt`
deprecation warnings) intentionally stays in PR-K.3 so operators
get one minor of deprecation telemetry before the values shape
breaks.

> **Branch state note:** PR-F.2 (#215,
`internal/{componentstatus,pipeline,pipelinebuilder,config,consumer,fanout,runtime/lifecycle}`
deletion) and PR-I.1a (#214, `module/` Go submodule scaffold +
`go.work`) both landed on main mid-flight and have been merged into this
branch. The `_test.go` placeholder-name migration originally scoped here
(RFC §migration's "~86 fixture refs" line) is now moot — PR-F.2 deleted
every `internal/*` file that held those refs, so the migration target
evaporated. `make ci` + `make verify` + `make build` re-run green
against the merged tree.

```release-notes
[CHANGE] In-tree receivers clockreceiver/kernelevents/k8sevents/containerstdout deleted in favor of PR-J upstream-OTel recipes. xidgen failure-injector deleted alongside kernelevents (sole consumer).
```

## What lands

### Deletions — receivers (4)

| Path | Files | LOC | Replacement (PR-J recipe) |
|---|---|---|---|
| `components/receivers/clockreceiver/` | 10 | ~1.4k |
`hostmetricsreceiver` (loadscraper @ 1s) — PR-E landed in #180. RFC-0013
§migration originally named `telemetrygeneratorreceiver` but that
receiver does not exist in opentelemetry-collector-contrib (contrib
#41687 + #43657 both closed `not_planned`). |
| `components/receivers/kernelevents/` | 49 | ~13.2k |
[`journaldreceiver` + `filelogreceiver` (kmsg) + OTTL Xid
transform](../blob/main/docs/integrations/journald-kernel.md).
Customer-stable `kernelevents.xid` + `gpu.id` attributes preserved via
the OTTL transform per RFC-0013 §3. |
| `components/receivers/k8sevents/` | 37 | ~6.8k | [`k8sobjectsreceiver`
(watch mode on `events`) + OTTL `k8s.event.hint`
transform](../blob/main/docs/integrations/k8sobjects-events.md).
11-entry hint enum preserved via the OTTL transform per RFC-0013 §3. The
typed `internal/synthesis/patterns/Record` + `NodeRecord` (severed in
PR-K.1) keeps M19's pod-evicted detector pinned. |
| `components/receivers/containerstdout/` | 56 | ~6.4k |
[`filelogreceiver` + container stanza + `file_storage`
extension](../blob/main/docs/integrations/filelog-container.md).
Per-rank attribution + dataloader-timing extraction move to OTTL
transforms in the bundled recipe per RFC-0013 §3. |

### Deletions — supporting infra

| Path | Why |
|---|---|
| `tools/failure-inject/xidgen/` (2 files, 281 LOC) | Sole consumer was
the kernelevents wire shape per RFC-0013 §migration L253. Operators
inject NVRM Xid via real `/dev/kmsg` (`sudo tee`) or `systemd-cat`
against the journald recipe. |
| `install/kubernetes/tracecore/ci/containerstdout-on-values.yaml` (41
LOC) | Chart-render fixture for the deleted receiver. Remaining chart
fixtures (`all-receivers-off-values.yaml`,
`one-receiver-on-values.yaml`, `pyspy-on-values.yaml`) untouched; their
`clockreceiver: enabled: false` / `kernelevents: enabled: false` rows
survive to PR-K.3's chart cleanup. |
| `.github/ISSUE_TEMPLATE/component-bug-kernelevents.yml` |
Receiver-specific bug template; no surviving receiver. |

### failure-inject CLI surface

`failure-inject xid --code=N [--format=…] [--count=N]` removed.
`failure-inject {pod-evict,nccl-hang,cpu-steal}` unchanged.
`tools/failure-inject/testdata/golden.sha256` drops the two `xid`
golden rows. `.github/workflows/chaos.yml` drops the two
two-run-determinism steps that exercised the xid byte-determinism
contract; pod-evict's determinism + the golden-SHA replay loop
survive.

### Tooling shed

- `Makefile`: retire `test-extras-sustained` body (was kernelevents-
  only; now `@true` — target retained so downstream automation has
  a stable name; future sustained-load suites slot back in).
  Retire `test-extras-fuzz-kmsg` / `test-extras-fuzz-journald`;
  `test-extras-fuzz` loop drops to nccl-fr only. Drop the
  kernelevents row from `test-extras-race`. Empty the `bench-check`
  for-loop (k8sevents was the only baseline; PR-F.2 already
  rewrote the comment block to reflect this — the merge keeps
  both edits aligned).
- `go.mod`: sheds
`k8s.io/{api,apimachinery,client-go,klog/v2,kube-openapi,utils}`,
  `sigs.k8s.io/{json,randfill,structured-merge-diff/v6,yaml}`,
  `gopkg.in/{evanphx/json-patch.v4,inf.v0}` — the dep cluster
  k8sevents dragged in. `go.uber.org/goleak` also dropped post-
  merge (was held only by PR-F.2's-deleted
  `internal/pipeline/chaos_test.go`).

### Doc + comment sweep

Comment-only references to deleted receivers in
`components/exporters/{otlphttp,stdoutexporter}/`,
`components/receivers/{nccl_fr,pyspy}/`,
`internal/synthesis/patterns/{doc,model,verdict}.go` rewired to
surviving references (or to upstream recipe pointers).
`docs/README.md` per-component-docs table drops five dead links
(caught by `doc-check.sh`'s rotten-link gate — that is in fact
how I caught the last drift). `bench/install/README.md`
tick-alias note + schema-v2-rename note updated.
`tools/failure-inject/README.md` xid section removed; status
banner rewritten.

CHANGELOG (new PR-K.2 entry under Unreleased + wave-4 paragraph
re-balanced), MILESTONES (M1 + M9 + M10 + M15 status lines flipped
from "DELETED at v0.2.0" → "DELETED in PR-K.2" with file pointers
to the integration recipes), `docs/migration/v0.1-to-v0.2.md`
(PR-K.1 + PR-K.2 checkboxes flipped, PR-F.2 + PR-I.1a status
block updated post-merge), AGENTS.md (queued-for-deletion
paragraph updated to current reality) all swept.

### What evaporated mid-flight

Originally this PR was also going to migrate a handful of
`_test.go` files that held placeholder-name string references
to `clockreceiver` (in `internal/pipeline/saferun_test.go`,
`internal/config/fuzz_test.go`,
`internal/pipelinebuilder/fuzz_test.go`).
PR-F.2 (#215) deleted those files outright while this branch
was being drafted, so the migration target disappeared. No
follow-up needed.

## Net LOC delta

```
192 files changed, 120 insertions(+), 28,927 deletions(-)
```

## What is intentionally NOT in this PR

- **Helm-chart `receivers.clockreceiver` / `receivers.kernelevents`
  / `receivers.containerstdout` toggles + DaemonSet template refs
  + `containerstdout-rbac.yaml` template** — stays for PR-K.3 so
  operators see `NOTES.txt` deprecation warnings before the values
  shape breaks. The toggles are already inert post-PR-A2 (enabling
  any of them in `values.yaml` crashes the OCB binary at boot
  because the factories are not registered) — keeping them as
  no-ops for one minor preserves operator UX.
- **`internal/{componentstatus,pipeline,…}/` deletion** — already
  done in PR-F.2 (#215) before this branch landed; merged in.
- **Chart `values.yaml` `# clockreceiver — in-tree heartbeat
  retired by RFC-0013 PR-A2` style retire-banners** — stays for
  PR-K.3 alongside the actual values-keys cleanup.
- **`tools/failure-inject/ncclhang/`** — KEPT. Used by
  `pkg/nccl/fr_parser/synthesize_test.go` +
  `bench/overhead/nccl_fr_bench_test.go`; this is the canonical
  example of a failure-injector that survives the v0.2.0 cut.

## Root cause

The four receivers + xidgen survived only because PR-K.1's pattern-
library severance from `k8sevents` was still in flight. With #211
merged at the start of this session, the deletion is unblocked.
There is no workaround being applied here — this PR is the
root-cause deletion of the in-tree receivers themselves, which
RFC-0013 §migration set as the v0.2.0 deletion target.

## Test plan

- [x] `make ci` green post-merge (verify + license + nccl-fr-rce-gate +
      register-lint + actionlint + zizmor + coverage-check +
      ci-fuzz-nccl-fr + govulncheck + doc-check + no-autoupdate-check +
      build).
- [x] `make verify` green post-merge.
- [x] `make build` green post-merge (OCB compile against
      `builder-config.yaml` with `GOWORK=off` per the PR-I.1a
      isolation guard yields `./_build/tracecore`).
- [x] `go test ./...` green across the post-merge tree.
- [x] Hard pre-flight: zero external Go importers for any
      deletion target (`clockreceiver`, `kernelevents`, `k8sevents`,
      `containerstdout`, `xidgen`) — re-verified after the merge.
- [ ] CI: `chart-render` job validates the surviving chart fixtures
      (`all-receivers-off-values.yaml`, `one-receiver-on-values.yaml`,
`pyspy-on-values.yaml`); the deleted `containerstdout-on-values.yaml`
      drop-out should not regress conftest coverage of the
      containerstdout-allowlist / operational-invariant rules
      because the template guard still fires when
      `containerstdout.enabled=true` is set in any future values
      file. PR-K.3 will reassess once the chart-side keys go.
- [ ] CI: `install (kind)` job continues to render the bench
      tracecore-values.yaml against the OCB binary
      (hostmetricsreceiver heartbeat surface).
- [ ] CI: `harness-determinism (amd64/arm64)` job no longer runs
      the xid byte-determinism steps; pod-evict + golden-SHA loop
      survive. Expected: 2 fewer steps per matrix arm.

## Gates that should fail this PR if I missed something

- `doc-check`'s "dead markdown link" gate would catch any
  surviving link into the deleted dirs (caught the
  `docs/README.md` regressions on the first run; fixed and
  re-verified).
- `go vet ./...` would catch a stale import; ran clean.
- `golangci-lint run ./...` would catch unused imports or dead
  code introduced by the sweep; 0 issues reported.
- `go mod tidy -diff` would catch a missing dep prune; ran clean
  after the post-merge prune of `go.uber.org/goleak`.

Refs RFC-0013 §migration PR-K.2.

Signed-off-by: Tri Lam <tri@maydow.com>
Co-authored-by: Tri Lam <tri@maydow.com>
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