feat(pipeline): plain-English per-step result summaries

Replaces the raw-JSON summary column in the Results table with the mockup's
plain-English phrasing: "312 duplicates removed across 147 groups
(18,442 → 18,130 rows)", "1,204 cells cleaned in name & city", etc.
(correct singular/plural via a small _n helper).

Adds step_phrase() and step_status() to pipeline_modules.py. step_status
derives the status pill (✓ ok / ⚠ ok · N skipped / ✗ error / ⏭ skipped) and,
for warn/error steps (e.g. format_standardize unparseable cells, column_map
coercion failures / missing required targets), an inline detail callout
rendered directly below the results table — surfacing non-fatal issues in
context without a dedicated always-empty column.

Extends tests/gui/test_pipeline_builder.py with phrasing + status assertions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 18:21:17 +00:00
parent 837f4b88b5
commit 00d3f28865
3 changed files with 187 additions and 8 deletions

View File

@@ -89,3 +89,32 @@ def test_run_produces_results_with_friendly_names():
res = at.session_state["pipeline_result"]
assert res.initial_rows == 3 and res.final_rows == 2 # the two Jane rows merge
assert all(sr.error is None for sr in res.step_results)
def test_step_phrase_is_plain_english_not_json():
from src.gui.components.pipeline_modules import step_phrase, step_status
# dedup phrasing mirrors the design mockup wording exactly.
phrase = step_phrase("dedup", {
"input_rows": 18442, "output_rows": 18130,
"duplicates_removed": 312, "groups": 147,
})
assert phrase == "312 duplicates removed across 147 groups (18,442 → 18,130 rows)"
# text_clean lists affected columns in prose, with thousands separators.
assert step_phrase("text_clean", {
"cells_changed": 1204, "columns_processed": ["name", "city"],
}) == "1,204 cells cleaned in name & city"
# singular nouns pluralize correctly
assert step_phrase("missing", {"rows_dropped": 1, "columns_dropped": ["x"]}) == \
"1 row dropped, 1 column dropped"
# unparseable cells downgrade the pill to warn with an inline detail
label, level, detail = step_status(
"format_standardize", {"cells_changed": 100, "cells_unparseable": 141},
)
assert level == "warn" and "141 skipped" in label and detail
# a clean step is "ok" with no detail
assert step_status("text_clean", {"cells_changed": 5})[1] == "ok"