feat(core): B1.2 — sectioned-output hook (one file, many sections) - #66
Merged
Conversation
The OSS/MIT enabling piece for the Pro workbook. A single output can now carry several
sections (one file with many sections — e.g. an XLSX workbook with a worksheet per
section), each with its own filters/columns, all projected in one source pass. The Pro
ClosedXML writer + XlsxWorkbook(...) API (B1.3) implement the new Core contract.
- New Core contracts (in Core, not the frozen Abstractions, like the artifact store):
IReportSectionedWriter, ISectionedWriterFactory, SectionedWriterContext, ReportSection.
- Builder: ToSections(SectionedOutputSpec, s => s.Section("name", v => v.Where(...).Column(...)))
via a SectionBuilder<T> reusing the B1.1 OutputView<T>. CompiledReport gains
SectionedOutputs (spec + per-section name/schema).
- Pipeline: TypedBatchReader also projects each section (single pass); ProjectedBatch
carries per-sectioned-output, per-section rows; WrittenCount counts a source row once
across outputs and sections. The runner creates one IReportSectionedWriter per sectioned
output, writes each section per batch, finalizes one file, uploads/retains it (unified
with regular outputs via an IFinishedFile interface).
- Additive: reports without sectioned outputs are byte-identical (all existing tests green).
Tests: 55 green Core (+1) — a fake sectioned writer proves single-read, per-section
projection with different columns into one file. Jobs (16) and AspNetCore (10) unaffected.
PLAN B1.2 done; B1.3 is the commercial NeoReports.Xlsx.Pro package.
- Refactor TypedBatchReader projection into small helpers (S3776 cognitive complexity). - Explicit types where not apparent (IDE0008); Path.Join and a .Where filter in the runner (CodeQL cs/path-combine + missed-Where, both on the new sectioned code path). - Hoist an expected array in the test (CA1861). No behavior change; 55 green Core.
…urn types Clears the re-scan findings on the B1.2 refactor: use raw.Count(Distribute) instead of a foreach+if (S3267 / CodeQL use-Where), and return the concrete array types from the Freeze helpers (CA1859). No behavior change; 55 green.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The OSS/MIT enabling piece for the Pro workbook. A single output can now carry several sections — one file with many sections (e.g. an XLSX workbook with a worksheet per section) — each with its own filters/columns, all projected in one source pass. The commercial ClosedXML writer +
XlsxWorkbook(...)API land in B1.3 on top of this.This complements B1.1 (many outputs → many files) with the other axis (one output → many sections in one file).
API
Changes (additive — default path byte-identical)
Abstractions, like the artifact store):IReportSectionedWriter,ISectionedWriterFactory,SectionedWriterContext,ReportSection.ToSections(...)via aSectionBuilder<T>reusing B1.1'sOutputView<T>.CompiledReportgainsSectionedOutputs(spec + per-section name/schema).TypedBatchReaderalso projects each section in the single pass;ProjectedBatchcarries per-sectioned-output → per-section rows;WrittenCountcounts a source row once across outputs and sections. The runner creates oneIReportSectionedWriterper sectioned output, writes each section per batch, finalizes one file, and uploads/retains it (unified with regular outputs via a smallIFinishedFile).Tests
55 green Core (+1): a fake sectioned writer proves single read, per-section projection with different columns into one file, plus correct
RecordsWritten. Jobs (16) and AspNetCore (10) unaffected — reports without sectioned outputs are byte-identical.Next
B1.3 —
NeoReports.Xlsx.Pro(commercial): a ClosedXMLIReportSectionedWriter(one worksheet per section) + fluentXlsxWorkbook(...)+ the PolyForm Small Business LICENSE (I'll fetch the canonical text) + metadata, excluded from the OSS NuGet release.