refactor(P2): extract ingestion-summary renderer into reporting.ConsoleRenderer#248
Merged
Merged
Conversation
…onsoleRenderer Structural refactor phase P2 (backend#796) — pull presentation out of the ingestion logic. The summary box (success rate, per-channel counts, status banner) was ~114 lines of print + ANSI + emoji living inside the 1,196-line BaseIngestor god class. - New tracebloc_ingestor/reporting.py with ConsoleRenderer.render_summary — the single home for that presentation. The body moved VERBATIM, so the customer-facing output is byte-for-byte identical. - BaseIngestor._log_summary becomes a thin delegate (kept as a method so the existing callers/tests that reference BaseIngestor._log_summary keep working). base.py: -119/+10 lines. - Drops the now-unused BLUE import from base.py. - IngestionSummary stays the pure data object the renderer consumes; the renderer type-hints it via TYPE_CHECKING to avoid a runtime import cycle. Payoff: the presentation is now unit-testable without a DB or a full ingest — tests/test_reporting.py (8 cases, reporting.py 100% covered) locks the output contract, including #234's "dropped records count toward the failure total / disqualify the success banner" behavior. Behaviour-preserving: full unit suite 1026 passed (97.3% coverage); the characterization harness goldens (#247: DB cells / DEST_PATH manifest / backend payloads) are unaffected — they don't assert the summary box — and the CI e2e job re-confirms against real MySQL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
👋 Heads-up — Code review queue is at 14 / 8 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
This was referenced Jun 15, 2026
divyasinghds
approved these changes
Jun 15, 2026
4 tasks
divyasinghds
added a commit
that referenced
this pull request
Jun 15, 2026
Release bundles the fixes merged to develop since 0.3.9 (#230–#254): - Ingestion accounting: dropped records fail the run; JSON read-layer fails fast (#230, #234, #235) - Coercion: single source of truth for NA policy + int64 range (#236, #237) - Security: block path traversal via manifest filename/mask_id (#239) - UX papercuts: delimiter hint, NUL truncation, table-name message, Config numeric coercion (#238) - Schema/DB: real MySQL column types, CHAR(N) mapping, drop instance_segmentation from enum, empty-CSV fast fail (#240, #241, #249, #250) - DataValidator: accept single-dict / filter non-dict JSON (#232, #233) - Single-label classification caught at preflight + friendly backend reason, with the full bugbot-hardened LabelDiversityValidator (#251, #252) - CLI: schema descriptions surfaced in validation errors (#254) - Reporting: ConsoleRenderer extraction; packaging split (#248, #246) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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.
Summary
Structural refactor — phase P2 (epic backend#796): pull human-facing presentation out of the ingestion logic. This is the first structural phase, now unblocked since #242–#245 merged.
The ingestion-summary box (success rate, per-channel counts, status banner) was ~114 lines of
print+ ANSI + emoji living inside the 1,196-lineBaseIngestorgod class.Changes
tracebloc_ingestor/reporting.pywithConsoleRenderer.render_summary— the single home for that presentation. The body moved verbatim, so the customer-facing output is byte-for-byte identical.BaseIngestor._log_summarybecomes a thin delegate (kept as a method so existing callers/tests that referenceBaseIngestor._log_summarykeep working). Net:base.py−119 / +10.BLUEimport frombase.py.IngestionSummarystays the pure data object the renderer consumes; the renderer type-hints it viaTYPE_CHECKINGto avoid a runtime import cycle.Payoff
The presentation is now unit-testable without a DB or a full ingest —
tests/test_reporting.py(8 cases,reporting.py100% covered) locks the output contract, including #234's behavior that dropped records count toward the failure total and disqualify the success banner.Behaviour preservation (the gate)
Scope note
This is P2 step 1 — the largest single presentation block. The remainder of P2 (strip ANSI from raised exception messages;
print→ logging in validators) is a focused follow-up, kept separate so each PR is small and reviewable. No conflict with any open work.🤖 Generated with Claude Code