Working TODO list for ChunkFlow. Design decisions and their reasons live in CONVENTIONS.md, released changes in CHANGELOG.md; this file only tracks what is left to do. Items that were removed rather than done are kept struck through with the reason, so the question is not reopened by accident.
- Safety net: CI (gofmt, vet, golangci-lint, race tests on 1.27.x and stable, govulncheck), a
benchstat job on pull requests, protected
master,Makefile+ pre-commit hook,goleakin every concurrent test, 100% statement coverage, runnableExample*for every public operation. - One stream type,
New(ctx)withSeq,Seq2(key/value asEntry),SeqErr,Chan;Option/StepOption;WithParallelordered by default withWithUnordered();WithOnError. - Error model: errors as elements, terminals stop at the first fatal one,
Suppressmarks a tolerated error,ErrSuppressed,ErrPanic,ErrEmpty.First/Lastreturn(T, error). - Operators:
Map,Filter,Tap,Take,Skip,TakeWhile,SkipWhile,Compact,Chunk,ChunkTimeout,Zip,Through,Transform; top-levelFlatten,Concat,Merge; terminalsCollect,ForEach,Reduce,ReduceBy,Count,Drain,All,Any,First,Last,Seq. - Sub-packages:
policy(CircuitBreaker, written on the public seam),step(Decorate,Decorate3,Middleware,Retrywith an injectedBackoff,Timeout,Tolerate),seq. - Measured:
BENCHMARK.md,make bench; the README's performance claims come from it. - Decided against, with the reason recorded in CONVENTIONS.md or here:
— a global "seen" set belongs to the user's store;DistinctExampleStream_Chunk_deduplication.— replaced byWithLoggerWithOnError; the library has nothing to say on its own.—GroupBy,CountByReduceBycovers both;CountBymeans two different things across libraries.—FindFilter(p).First(), shown inExampleStream_First_find.—Pair/tupleZiptakes a callback that names the fields; a generic pair nests badly.stock backoffs (— pacing is a solved problem elsewhere;Constant,Exponential)stepdeclares thecenkalti/backoffmethod set and takes no dependency.direct implementations of— a quarter of a 12 ns/element gap for four duplicated operators (BENCHMARK.md).Map/Filter/Collect— its comparer blows up on generic methods (5-line repro, 21 GB before OOM); see the parking lot for the replacement.apidiffin CI
The core API freeze. After this tag a breaking change is a minor bump with a migration note in CHANGELOG.md until v1; additions are minors too.
- README rewritten around real use (
BatchEventSaver, runnable asExample_batchEventSaver),ChunkTimeoutin the changelog - the last breaking change before the freeze:
Seq2means any two-value iterator (asEntry), the fallible constructor isSeqErr - tag
v0.1.0, thengo mod download github.com/shults/chunkflow@v0.1.0so pkg.go.dev indexes it
Ideas without a decision. They enter only with a concrete use case.
- public API check in CI without
apidiff: the std-library pattern, anapi.txtlisting every exported identifier with its type per package, generated by a smallgo/typesprogram and committed; CI fails when the generated listing differs from the committed one, so a change to the API has to be deliberate in the same PR. Removed lines are breaking, added ones are a minor. Zero dependencies, seconds in CI. Also: report theapidiffbug upstream with the repro - more policies in
policy, e.g.Tolerate(func(error) bool)on a stream, an in-stream error observer, a breaker with a time window. Each is additive and enters with a use case step: a third callback shape (func(ctx, T) errorforTapCtx/ForEachCtx) is ten more lines when needed; whether the package stays in this module or becomes its own is open, it imports onlySuppressandErrSuppressedfrom the root- pool optimisations the benchmarks pointed at, none taken:
policy.CircuitBreakerformats a message per tolerated error (~430 ns vs ~125 ns for a bareSuppress), a lazy error type would remove most of it; the ordered pool allocates a ticket and a channel per element, a ring buffer of sizekwould allocate once per stage (~20%); the remaining ~500 ns/element is channel operations and wake-ups, which only batching (double buffering between feeder and workers) amortises, at the price of a window in batches and an idle-flush. All of it speeds up the workload that should not use a pool; wait for someone measuring the pool as a bottleneck WithReadAhead(m):options.readAheadexists (default 2, window2n); aStepOptiontaking a multiplier, never an absolute size, for plenty of memory and high latency variance per call- an opt-in context-free, error-free stream type for pure in-memory work, if the ~2.7× overhead
over
memStream(bench_test.go) ever matters to someone - fuzz tests for the
Chunk+Flattenround trip