Skip to content

feat(foreman): reconcile library for sliced-workload interface drift#1034

Merged
Defilan merged 1 commit into
defilantech:mainfrom
Defilan:feat/slicer-reconcile
Jul 10, 2026
Merged

feat(foreman): reconcile library for sliced-workload interface drift#1034
Defilan merged 1 commit into
defilantech:mainfrom
Defilan:feat/slicer-reconcile

Conversation

@Defilan

@Defilan Defilan commented Jul 10, 2026

Copy link
Copy Markdown
Member

What

First task of the Sliced Workloads epic (#1033): the pkg/foreman/slicer reconcile library, a Go port of the validated slicer experiment core.

  • PinnedCheck — deterministic, authoritative. Verifies each pinned shared_identifier appears as a whole token (not a substring) in every slice that defines or references it; absence yields a pinned-missing Drift.
  • LLMSweep — advisory. Asks an injected ModelCaller to flag unpinned drift, emitting llm-flagged Drifts. Degrades open: any transport error, or an empty / NONE / unparseable / non-list completion, yields no drifts and never fails, so a model outage never blocks reconciliation.
  • Reconcile — composes the two; Clean is true only when neither produced a drift.

Why

The slicer decomposes an issue into disjoint-file slices; the union builds clean but is blind to semantic interface drift between slices (a dashboard querying a metric an exporter never emits). Validated live on #700 and #1001, where a green build hid broken integrations that this check caught. This is the foundational, self-contained piece; it has no controller wiring yet.

How

Pure library. The model transport is injected via the ModelCaller interface, so the library never constructs a client or makes a network call; Foreman's model client is wired in a follow-up task. Whole-token matching is a manual boundary scan (Go's RE2 has no lookbehind), faithful to the experiment's non-identifier-char lookaround.

Testing

go test ./pkg/foreman/slicer/ — 9 test functions covering the experiment's suite, including the whole-token regression (a pin rocm_smi_gpu_temp must not be satisfied by the different metric rocm_smi_gpu_temperature or a _degC suffix) and the degrade-open paths (error / NONE / malformed). Build, vet, gofmt, golangci-lint all clean.

Checklist

  • Tests added
  • go test / go vet / gofmt / golangci-lint clean on the package
  • Pure library, no behavior change to existing code
  • DCO sign-off

Part of #1033


Assisted-by: Claude Code (Opus 4.8), porting a design and test suite the author validated live; reviewed and verified by the author.

Go port of the validated slicer reconcile core: PinnedCheck (deterministic,
whole-token presence, authoritative) + LLMSweep (injected ModelCaller,
degrades open on outage/malformed/NONE, advisory) + Reconcile composing them.
Drift shape {Identifier, Slice, File, Kind} with kinds pinned-missing /
llm-flagged. Pure library with no controller wiring; the model client is
injected via the ModelCaller interface (wired in a follow-up). Ports the
experiment's test suite including the whole-token regression (a pin like
rocm_smi_gpu_temp must not be satisfied by rocm_smi_gpu_temperature).

Part of defilantech#1033

Signed-off-by: Christopher Maher <chris@mahercode.io>
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.40506% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/foreman/slicer/reconcile.go 92.40% 3 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@Defilan Defilan merged commit b14f687 into defilantech:main Jul 10, 2026
24 checks passed
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