Skip to content

refactor(prover): separate outcome evaluation from rendering - #2632

Open
eviehoward wants to merge 1 commit into
NVIDIA:mainfrom
eviehoward:2411-separate-outcome-from-rendering/eviehoward
Open

eviehoward wants to merge 1 commit into
NVIDIA:mainfrom
eviehoward:2411-separate-outcome-from-rendering/eviehoward

Conversation

@eviehoward

Copy link
Copy Markdown
Contributor

Summary

Moves exit-code logic out of the renderers and into prove(), so outcome evaluation happens once in a single place rather than independently in each renderer.

Related Issue

Closes #2411

Changes

  • render_compact and render_report return () instead of i32; all exit-code logic removed from both
  • prove() computes exit code after rendering: i32::from(findings.iter().any(|f| !f.accepted))
  • Call site in prove() drops unused policy_path/credentials_path args from render_compact
  • Both renderer banners gate on active.is_empty() rather than path_count > 0, so terminal output and exit code agree for pathless unaccepted findings
  • Four unit tests added covering: empty findings, all-accepted, unaccepted with paths, pathless unaccepted (the case the old renderers got wrong)

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated - not applicable, no infrastructure, sandbox, or policy changes

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated - not applicable, internal refactor, no behavioral or API change

@copy-pr-bot

copy-pr-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Sep 2, 2026
@eviehoward

Copy link
Copy Markdown
Contributor Author

I'm still keeping an eye on this, AFAIK it's still mergeable- please let me know if anything needs changing or if a rebase is needed 🙂

@github-actions github-actions Bot removed the state:stale Inactive item at risk of automatic closure. label Sep 4, 2026
Comment thread crates/openshell-prover/src/lib.rs Outdated
Signed-off-by: Evie Howard <evhoward@redhat.com>
@eviehoward
eviehoward force-pushed the 2411-separate-outcome-from-rendering/eviehoward branch from 5dc783d to b1dbd85 Compare September 8, 2026 09:57
@eviehoward
eviehoward requested a review from sjenning as a code owner September 8, 2026 09:57
@2000krysztof

Copy link
Copy Markdown
Contributor

Thanks for addressing my concerns @eviehoward LGTM

@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Sep 23, 2026
@eviehoward

Copy link
Copy Markdown
Contributor Author

Commenting to remove stale label- still keeping an eye on this, please lmk if anything needs changing or if a rebase is needed 🙂

@github-actions github-actions Bot removed the state:stale Inactive item at risk of automatic closure. label Sep 30, 2026

@zredlined zredlined left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clear write-up. Looks good to me, with the renderers being presentation-only and pass/fail living in one place, which is what #2411 asked for.

Two non-blocking suggestions:

  1. Consider making outcome public and moving it next to Finding (in finding.rs). The gateway path builds findings through run_all_queries and never goes through prove(), so a shared, public pass/fail helper is more useful than a private one in lib.rs, and it gives the logic a home independent of the CLI entry point.
  2. apply_accepted_risks treats a pathless finding as accepted, while the new outcome treats an unaccepted pathless finding as a failure. They never meet today because the queries only emit findings with at least one path, but it's worth stating that invariant in one place, probably as a doc comment on Finding::paths, so the two don't drift.

One small thing on the compact renderer: the summary now counts findings instead of paths. That reads fine to me and nothing depends on the old string, just flagging it since it is a visible output change.

Once CI runs on the runners, this looks good to merge.

@zredlined

Copy link
Copy Markdown
Collaborator

/ok to test

@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

/ok to test

@zredlined, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@johntmyers johntmyers added the test:e2e Requires end-to-end coverage label Oct 13, 2026
@johntmyers

Copy link
Copy Markdown
Collaborator

/ok to test b1dbd85

@github-actions

Copy link
Copy Markdown

Label test:e2e applied, but pull-request/2632 does not exist yet. A maintainer needs to comment /ok to test b1dbd85de4f71f6b3e44becd9ef07216f4c1d338 to mirror this PR. Once the mirror exists, re-apply the label or re-run Branch E2E Checks from the Actions tab.

@johntmyers johntmyers left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gator-agent

PR Review Status

No blocking findings remain. This focused refactor implements #2411: prove() evaluates the outcome after accepted risks, both renderers only present findings, and the four outcome tests exercise the production helper.

@eviehoward, I checked the helper you added and its call from prove(). @zredlined, I checked your suggestions about helper visibility and pathless findings; those remain optional and do not prevent testing. The compact summary now counts findings, and both banners correctly show REVIEW for an unaccepted pathless finding.

Blocking findings: None.

Carried findings: None.

Gator metadata
  • Validation: Localized prover refactor implementing #2411; no conflicting duplicate found.
  • Docs: No material published-contract change; the minor summary wording correction does not require a docs gate under pragmatic review calibration.
  • Checks: DCO passes. Current-head Branch Checks (including Trivy), Helm Lint, and Branch E2E Checks are queued. Maintainer approval remains outstanding.
  • E2E: test:e2e applied; authorized /ok to test created the matching current-head mirror and queued the E2E workflow with the label present.
  • Head SHA: b1dbd85de4f71f6b3e44becd9ef07216f4c1d338
  • Base SHA: 6e6e6493b3df093540cfcc43b4a1df501470e561
  • Merge base SHA: 6e6e6493b3df093540cfcc43b4a1df501470e561
  • Patch ID: 52ddc8300294de80d95f2a90a07f86ecc4f19757
  • Gator payload: 12
  • Review mode: initial
  • Previous reviewed SHA: none
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:watch-pipeline

@johntmyers johntmyers added the gator:watch-pipeline Gator is monitoring PR CI/CD status label Oct 13, 2026
@johntmyers johntmyers added gator:blocked Gator is blocked by process or repository gates and removed gator:watch-pipeline Gator is monitoring PR CI/CD status labels Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:blocked Gator is blocked by process or repository gates test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(prover): separate outcome evaluation from rendering

4 participants