Skip to content

Add retained, bounded metrics for kani-smoke (#847) - #908

Draft
leynos wants to merge 2 commits into
mainfrom
issue-847-add-retained-bounded-metrics-for-kani-smoke
Draft

leynos wants to merge 2 commits into
mainfrom
issue-847-add-retained-bounded-metrics-for-kani-smoke

Conversation

@leynos

@leynos leynos commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Record each Kani workflow attempt with fixed decision, outcome, proof duration and cache result labels. An unconditional finalizer writes release-admission JSONL; the workflow uploads it under an attempt-specific artifact name with 30-day retention. Documentation covers bounded vocabularies, cache semantics, operator aggregation, and cancellation and timeout limits.

Closes #847

Validation

  • make typecheck-python
  • make markdownlint
  • make nixie
  • make check-fmt
  • make test-workflow-contracts — 1,246 passed, 3 skipped; 27 follow-on script tests passed.
  • make lint
  • make doc-coverage — 98.87% aggregate.
  • make test — 3,919 nextest passed, 6 skipped; doctests passed.
  • coderabbit review --agent — final review completed with no findings.

Summary by Sourcery

Add retained, bounded observability for every Kani smoke workflow attempt.

New Features:

  • Record bounded Kani smoke attempt, cache, outcome, and proof-duration metrics as retained JSONL artifacts.

Bug Fixes:

  • Preserve Kani decision and failure observability across scope errors, proof failures, cancellations, and incomplete timing marks.

Enhancements:

  • Add fixed decision and outcome vocabularies with documented cache semantics, timing behavior, aggregation guidance, and delivery limits.

CI:

  • Wire unconditional Kani metrics finalization and attempt-specific 30-day artifact upload into the CI workflow.

Documentation:

  • Document the Kani smoke metrics contract, bounded labels, cache interpretation, timing limitations, artifact retrieval, and aggregation.

Tests:

  • Add workflow contract, unit, acceptance, property, duration, and wiring coverage for Kani metrics and retained artifact delivery.

Chores:

  • Extend Kani proof scope tracking to include the metrics helper.

References

@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR adds an attempt-level observability pipeline for kani-smoke: scope decisions, proof and mutation outcomes, cache results, and proof duration are normalized into a bounded JSONL contract, finalized and uploaded even after ordinary failures, with 30-day attempt-specific retention and extensive workflow-contract coverage.

Sequence diagram for Kani smoke metrics finalization

sequenceDiagram
    participant Scope as Scope step
    participant Workflow as kani-smoke workflow
    participant Metrics as kani_smoke_metrics.py
    participant Artifact as Retained artifact

    Scope->>Metrics: write_decision_record()
    Workflow->>Metrics: mark_start()
    Workflow->>Workflow: make kani-ir
    Workflow->>Metrics: mark_end()
    Workflow->>Metrics: finalize()
    Metrics->>Metrics: classify_outcome()
    Metrics->>Metrics: classify_cache()
    Metrics->>Metrics: metrics_records()
    Metrics-->>Workflow: metrics.jsonl
    Workflow->>Artifact: upload metrics.jsonl
    Note over Workflow,Artifact: always(), retention 30 days
Loading

File-Level Changes

Change Details Files
Adds bounded, retained metrics emission to the kani-smoke workflow without changing its proof-selection contract.
  • Records fixed scope-decision categories separately from GitHub outputs, including invalid-scope handling.
  • Classifies every attempt into bounded event, decision, outcome, and cache labels.
  • Adds an unconditional finalizer that emits atomic JSONL run/cache counters and optional proof duration.
  • Uploads one attempt-specific artifact with 30-day retention and visible failure on missing output.
.github/workflows/ci.yml
scripts/kani_proof_scope.py
scripts/kani_smoke_metrics.py
Defines and documents the metrics schema, operational semantics, and delivery limitations.
  • Documents exact metric names, label keys, vocabularies, outcome precedence, cache semantics, timing fallback behavior, and aggregation examples.
  • Records cancellation, timeout, runner-loss, checkout, and setup limitations for finalization and upload.
docs/adr-039-change-scoped-kani-gate.md
docs/developers-guide.md
Expands workflow contracts and tests to enforce metrics behavior and wiring.
  • Covers decision categories, malformed inputs, bounded labels, outcome precedence, cache classification, duration handling, atomic output, and failure warnings.
  • Verifies step ordering, guards, environment paths, finalizer inputs, pinned dependencies, artifact naming, retention, and upload behavior.
tests/workflow_ci.rs
tests/workflow_contracts/kani_proof_scope_decision_test.py
tests/workflow_contracts/kani_proof_scope_property_test.py
tests/workflow_contracts/kani_proof_scope_test.py
tests/workflow_contracts/kani_smoke_metrics_contract.py
tests/workflow_contracts/kani_smoke_metrics_duration_test.py
tests/workflow_contracts/kani_smoke_metrics_property_test.py
tests/workflow_contracts/kani_smoke_metrics_test.py
tests/workflow_contracts/kani_smoke_metrics_wiring_test.py
tests/workflow_contracts/kani_smoke_scope_wiring_test.py
Treats the metrics helper as a proof-scope input for change detection.
  • Adds the metrics script to the tracked proof-scope paths so changes to observability code trigger Kani proofs.
tools/kani/proof-scope.toml

Assessment against linked issues

Issue Objective Addressed Explanation
#847 Record retained metrics for each Kani workflow attempt, including bounded proof decision and outcome categories, proof duration, and reliable cache hit/miss information across successful, skipped, unreadable-diff, invalid-scope, and proof-failure paths. ✅
#847 Ensure metrics are finalized and retained after normal workflow failures, with an unconditional finalizer, attempt-specific artifact upload, explicit 30-day retention, and documented cancellation, timeout, and delivery limitations. ✅
#847 Keep metric labels bounded and free of paths, IDs, URLs, and free-form errors, while adding behavioral tests and workflow-contract coverage for emission, failure handling, duration, delivery, retention, wiring, and label cardinality. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

leynos added 2 commits October 12, 2026 17:34
Keep fixed scope decisions outside `GITHUB_OUTPUT` so invalid scopes
still fail without changing the public output contract. Finalize bounded
run, cache, and proof-duration records into a retained per-attempt
artifact, with tests and operator guidance for classification, delivery,
and limitations.
Record how the local-reference inventory covers the metrics helper and require future Kani workflow helpers to remain explicitly reachable.
@leynos
leynos force-pushed the issue-847-add-retained-bounded-metrics-for-kani-smoke branch from 70b8b0b to ec0afc1 Compare October 12, 2026 16:17

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add retained, bounded metrics for kani-smoke

1 participant