← Back to Pull requests

feat(assess): migrate run_assess onto the core contract (#363) #366

Closed
unknown closed this pull request without merging on Nov 22, 2026 15:13 UTC
View on GitHub
unknown unknown commented on Nov 22, 2026 14:30 UTC
Author

Second step of #363 (stacked on #364 — base is feat/headless-core-contract; rebase to master once #364 merges). Migrates the first real consumer, assess, onto the core contract.

What changes

  • run_assess is decoupled from the console and from SystemExit. It now raises typed core errors — ConnectError when the source Odoo is unreachable, NothingToDoError when nothing can be assessed — instead of printing an error panel and calling raise SystemExit(1) from inside the library. A programmatic caller (a server, a UI, a test) gets a typed exception it can handle, not a process exit.

  • It takes an optional RunReporter (default NullReporter), and drives it through connecting → discovering models → assessing, with per-model progress. The console-free core never has to check for None.

  • The CLI owns presentation. internal/reporter.py adds ConsoleReporter, a RunReporter that writes progress to stderr so stdout stays the clean report (the same discipline a stdio line-protocol consumer will need). assess_cmd passes it, and wraps the call: except FluvoError → _show_error_panel(...) + raise SystemExit(exc.exit_code). stdout is unchanged; errors still show the same panel and exit 1.
  • Return type is unchanged (list[dict]), so existing programmatic callers are unaffected.

    Design note

    A read-only capability is request/response, so the heavy parts of the contract (RunResult envelope, CancelToken) aren't load-bearing here — the win for assess is typed errors instead of a library SystemExit, plus the reporter seam. The full RunResult/CancelToken story lands with the import-engine migration, where long-running, mutating, cancellable work actually needs it. compare is the next read-only consumer (PR 3).

    Checks


  • tests/test_assess.py: the two SystemExit error-path tests now assert the typed errors; added a reporter-phases test and a CLI-maps-error-to-exit-1 test (CliRunner).

  • ruff, pydoclint, mypy (whole-tree) clean. Full suite green. Synthetic values only.
  • Diff: 258 lines (+193 / -65) across 3 files Reviewer: bosd Review duration: 42m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.62) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 258 lines diff across 3 files
    0.62
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    57%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.332
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #366"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.4% (MEDIUM) · Higher = larger blast radius
    62.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.0% · Lower = rushed or shallow review
    58.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.2% · Safe to merge
    26.2%
    Repository