Every workflow returns a workflow result
Status: accepted (2026-11-02)
Each workflow's run() returns a workflow result with one shared surface: summary() (a DataFrame), tables() (named DataFrames), plot(), assumptions() and to_dict() (the JSON-safe form, for reports and agents; the CLI's run --json writes its own, smaller object, not this dict). The shared parts live in a WorkflowResult base class, so to_dict() and the notebook display are written once. A report author, whether an analyst in a notebook or an agent writing a .qmd, marimo or Streamlit page, learns one shape for all eight workflows. The package does not write reports; it stays format-neutral.
Workflows that are single flat modules (lifetime loss, segmentation, simulation) keep their module layout and their existing functions. They gain a run() that composes those functions and returns the result. The 2026 Phase 3 decision to leave them flat was about module fragmentation, not about the return type.
Considered options
- Protocol only (structural typing). Rejected:
to_dict()and the HTML display would be reimplemented per workflow. - Richer return types on the existing functions (a
DataFramesubclass, a dict). Rejected: breaks callers that use them as plain values, andforecast_lifetime_lossis a float by design. - A report generator in the package. Rejected: ties the package to output formats that analysts and agents already choose for themselves.
Consequences
ReadinessRunResult.summarywas a field holding the scoring dict; it is now.report, and.summary()is a method like the others.- A contract test runs every result type; a workflow added without a conforming result fails it.
to_dict()caps non-summary tables (200 rows by default) and flags truncation; full tables come fromtables().