← Back to Pull requests

:sparkles: Add experimental OSPS Baseline conformance mode #5449

Closed
unknown closed this pull request without merging on Nov 09, 2026 08:06 UTC
View on GitHub
unknown unknown commented on Nov 09, 2026 05:26 UTC
Author

What kind of change does this PR introduce?

Feature (experimental): an amendment to the osps-baseline-conformance OpenSpec change, and its first deliverable.

  • PR title follows the guidelines defined in our pull request documentation
  • What is the current behavior?

    The merged osps-baseline-conformance change (#4952) sets the direction for OSPS Baseline conformance but has no specs, design, or tasks, and Scorecard can't report results against OSPS Baseline requirements. The implementation plan in #4994 grew too large to finish.

    What is the new behavior (if this is a feature change)?

    An experimental conformance mode evaluates OSPS-AC-03.01 and OSPS-AC-03.02 (primary-branch protection) from existing branch-protection probes:

    scorecard --repo=github.com/ossf/scorecard \
      --catalog=osps-baseline --profile=maturity-1 --format=gemara
    

  • --catalog=osps-baseline[@<release>] and --profile=maturity-N select the catalog and applicability group; --format is json (conformance JSON) or gemara (a Gemara v1.6.0 Evaluation Log).

  • Each requirement gets PASS, FAIL, UNKNOWN, NOT_APPLICABLE, or NEEDS_REVIEW, with the probe findings used as evidence. Unmapped requirements are listed as not evaluated.

  • Conformance mode runs only the probes its mappings name and computes no check scores. Runs without --catalog are unchanged.

  • The code is in internal/conformance/. The main go.mod gains no dependencies; cue is added to the tools module to validate the Gemara fixture in CI (make validate-gemara).

  • --help labels the options experimental, every run warns on standard error, and conformance JSON sets "experimental": true. User docs are in docs/conformance.md.
  • ##### Try it

    Build this branch and set a GitHub token, as for any Scorecard run:

    gh pr checkout 5449 --repo ossf/scorecard
    go build -o scorecard .
    export GITHUB_AUTH_TOKEN=<token>
    

    Conformance JSON:

    ./scorecard --repo=github.com/<owner>/<repo> \
      --catalog=osps-baseline --profile=maturity-1 --format=json
    

    Gemara Evaluation Log, written to a file:

    ./scorecard --repo=github.com/<owner>/<repo> \
      --catalog=osps-baseline --profile=maturity-1 --format=gemara -o log.json
    

  • --catalog takes osps-baseline or osps-baseline@v2026.08.28; without a version, the output records the release used.

  • --profile is required: maturity-1, maturity-2, or maturity-3.

  • --format is required and must be json or gemara. The package-manager options work as usual. --checks, --probes, --policy, --repos, --org, --local, and a --commit other than HEAD are rejected: both mapped requirements need branch protection settings, which Scorecard reads only for the current state of a hosted repository.

  • Standard error always starts with WARNING: conformance mode (--catalog) is experimental. Its options and output may change or be removed in a future release.

  • With classic branch protection, whether the rule applies to administrators is visible only to a token with admin access to the repository; without it, OSPS-AC-03.01 can be UNKNOWN. Repository rulesets are visible to any token.

  • Classic branch protection can let specific users, teams, or apps bypass required pull requests. Scorecard doesn't collect that list yet, so an OSPS-AC-03.01 PASS says in its explanation that it wasn't checked.
  • For ossf/scorecard at maturity-1, the JSON output (trimmed) is:

    {
      "catalog": { "id": "osps-baseline", "version": "v2026.08.28" },
      "profile": "maturity-1",
      "results": [
        {
          "requirement": "OSPS-AC-03.01",
          "result": "NEEDS_REVIEW",
          "explanation": "The default branch \"main\" requires pull requests, but administrators can bypass the rule. The requirement does not say whether an administrator exception is allowed.",
          "evidence": [
            { "probe": "branchesAreProtected", "outcome": "True", "message": "branch 'main' is protected" },
            { "probe": "requiresPRsToChangeCode", "outcome": "True", "message": "PRs are required in order to make changes on branch 'main'" },
            { "probe": "branchProtectionAppliesToAdmins", "outcome": "False", "message": "'branch protection settings apply to administrators' is disabled on branch 'main'" }
          ]
        },
        {
          "requirement": "OSPS-AC-03.02",
          "result": "PASS",
          "explanation": "The default branch \"main\" cannot be deleted.",
          "evidence": [
            { "probe": "blocksDeleteOnBranches", "outcome": "True", "message": "'allow deletion' disabled on branch 'main'" }
          ]
        }
      ],
      "notEvaluated": ["OSPS-AC-01.01", "OSPS-AC-02.01", "OSPS-BR-01.01", "..."],
      "experimental": true
    }
    

    The other 23 maturity-1 requirements are in notEvaluated: no result is claimed for them. To check a Gemara log against the schema:

    git clone --depth 1 --branch v1.6.0 https://github.com/gemaraproj/gemara
    cd gemara && cue vet -c -d '#EvaluationLog' . /path/to/log.json
    

    docs/conformance.md covers the options, results, and both formats.

    ##### OpenSpec

    On the OpenSpec side, proposal.md opens with a table of the earlier statements this amendment supersedes (v6 framing, single combined run, framework abstraction, data-file mappings, Phase 1 scope), and design.md answers each review comment on #4994.

  • Tests for the changes have been added (for bug fixes/features)
  • Which issue(s) this PR fixes

    NONE. Supersedes #4994.

    Special notes for your reviewer

    Feedback matters most on:

  • Execution mode instead of a combined run. Conformance mode computes no check scores, deferring the proposal's single-run constraint. See "Conformance is an execution mode" in design.md.

  • NEEDS_REVIEW for administrator bypass. OSPS-AC-03.01 gives NEEDS_REVIEW when pull requests are required but administrators can bypass the rule, because the requirement doesn't say whether that exception is allowed. ossf/scorecard itself gets this result today.

  • Probe names as a dependency. Mappings name probes, and a test fails if a mapped probe isn't registered. tasks.md asks whether probe names should become a versioned interface.

  • One package per catalog release. internal/conformance/ospsbaseline/v20260828 holds that release's requirement IDs and applicability, which must not change after it ships; evaluation fixes go in ospsbaseline.
  • Checked outside CI:

  • A live run against ossf/scorecard, with a token that can read its branch protection settings, gave NEEDS_REVIEW for OSPS-AC-03.01 and PASS for OSPS-AC-03.02. The Gemara log validated with cue vet -c -d '#EvaluationLog' against Gemara v1.6.0.

  • A live run against a fork with no branch protection or rulesets gave FAIL for OSPS-AC-03.01 and UNKNOWN for OSPS-AC-03.02.

  • Native --format=json output for ossf/scorecard (Branch-Protection, Code-Review, and Maintained, with details) is identical between this branch and its base, apart from the documentation URL, which comes from build metadata.
  • Does this PR introduce a user-facing change?

    ``release-note
    Add an experimental conformance mode:
    --catalog=osps-baseline --profile=maturity-N evaluates OSPS Baseline requirements OSPS-AC-03.01 and OSPS-AC-03.02 and writes conformance JSON (--format=json) or a Gemara Evaluation Log (--format=gemara).
    ``

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: justaugustus Review duration: 160m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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%
    56%
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5449"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 22.5% · Safe to merge
    22.5%
    Repository