Skip to content

refactor(P2): extract ingestion-summary renderer into reporting.ConsoleRenderer#248

Merged
divyasinghds merged 1 commit into
developfrom
refactor/extract-console-renderer
Jun 15, 2026
Merged

refactor(P2): extract ingestion-summary renderer into reporting.ConsoleRenderer#248
divyasinghds merged 1 commit into
developfrom
refactor/extract-console-renderer

Conversation

@LukasWodka

Copy link
Copy Markdown
Collaborator

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-line BaseIngestor god class.

Changes

  • 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 existing callers/tests that reference BaseIngestor._log_summary keep working). Net: base.py −119 / +10.
  • 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 ingesttests/test_reporting.py (8 cases, reporting.py 100% 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)

  • Summary code moved verbatim; output identical.
  • Full unit suite: 1026 passed, 1 xfailed, coverage 97.3%.
  • The characterization harness goldens (#247: DB cells / DEST_PATH manifest / backend payloads) are unaffected — they don't assert the summary box. The CI e2e job re-confirms against real MySQL (Docker was unavailable locally this run, so the renderer was instead verified directly via the new unit tests; the data path is untouched).

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

…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>
@LukasWodka

Copy link
Copy Markdown
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.)

@divyasinghds divyasinghds merged commit a29d6c2 into develop Jun 15, 2026
6 checks passed
@divyasinghds divyasinghds deleted the refactor/extract-console-renderer branch June 15, 2026 08:28
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>
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.

2 participants