Skip to content

refactor(asapedgeprocessor): split god-object files into warm/cold/ingest/flush units - #448

Merged
zzylol merged 1 commit into
mainfrom
chore/asapedge-file-reorg
May 26, 2026
Merged

zzylol merged 1 commit into
mainfrom
chore/asapedge-file-reorg

Conversation

@zzylol

@zzylol zzylol commented May 26, 2026

Copy link
Copy Markdown
Contributor

What

Pure file-level reorganization of the asapedgeprocessor package: break up the 667-line god-object processor.go and rename the rest to a consistent warm_* / cold_* / flush_* / ingest convention. No behavior change.

Why

processor.go had grown to own OTel lifecycle, ingest traversal, shard locking, warm sum/sketch flush, cold fragment + intchunk cold-part shipping, accumulation, and shutdown sealing all at once. This splits those concerns into navigable files without changing any logic, as a low-risk first step before any deeper package extraction.

Source changes

Before After
processor.go (667L) processor.go (struct + ctor + lifecycle + forward), ingest.go, flush.go, shard.go, cold_encoder.go
config.go config.go (schema: types/consts/structs), config_validate.go (normalized/valid/eligibility/Validate/familyFor)
coldpart_path.go cold_intchunk_shipper.go, cold_intchunk_accum.go
shipper.go cold_fragment_shipper.go
spool.go cold_spool.go
sum.go / sketch.go warm_sum.go / warm_sketch.go

Renames use git mv to preserve blame; the coldpart_path.go split keeps blame on the accumulator half.

Test files

Renamed the 6 that map 1:1 (sum_pathwarm_sum, sketch_pathwarm_sketch, cold_pathcold_fragment, coldpart_pathcold_intchunk, spoolcold_spool, stagger_pathflush_stagger). The cross-cutting scenario tests (all_families, sample_p_path, tier_path, smooth_flush, cold_density) are left as-is rather than lossily merged.

Verification

  • Pure reorg proof: the set of 106 top-level declarations is byte-identical to main (diff empty).
  • go build ./..., go vet ./..., go test ./... all green — ok in ~1.8s, same as the pre-change baseline.
  • gofmt -l clean across the package.

🤖 Generated with Claude Code

…gest/flush units

Pure file-level reorganization within package asapedgeprocessor. No behavior
change: the set of 106 top-level declarations is identical to main, and
build/vet/test are green (go test ok in ~1.8s, same as before).

Source splits:
- processor.go (667L) -> processor.go (struct+ctor+lifecycle+forward)
  + ingest.go (ConsumeMetrics/consumeMetric/attr decode/shard key)
  + flush.go (flushLoop/flushAll/flushShardWarmCold/flushSum/appendSum)
  + shard.go (shard struct)
  + cold_encoder.go (encoder create/drain + cold-part ship/seal helpers)
- config.go -> config.go (schema: types/consts/structs) + config_validate.go
  (normalized/valid/eligibility/Validate/familyFor)
- coldpart_path.go -> cold_intchunk_shipper.go + cold_intchunk_accum.go

Renames to warm_*/cold_* convention (git mv, blame preserved):
- shipper.go -> cold_fragment_shipper.go, spool.go -> cold_spool.go,
  sum.go -> warm_sum.go, sketch.go -> warm_sketch.go

Test files realigned where the mapping is 1:1 (sum_path->warm_sum,
sketch_path->warm_sketch, cold_path->cold_fragment, coldpart_path->cold_intchunk,
spool->cold_spool, stagger_path->flush_stagger). Scenario tests with no clean
1:1 target (all_families, sample_p_path, tier_path, smooth_flush, cold_density)
are left as-is rather than lossily merged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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