Chapter 61: Infrastructure Score (pmat infra-score)

The Infrastructure Score evaluates CI/CD pipeline quality across GitHub Actions workflows, scoring projects on a 0-100 scale (with 10 bonus points for provable contracts). This command was introduced in PMAT v3.8.0 and reflects the Toyota Production System principle that build infrastructure is the foundation of software quality.

Scoring Categories

CategoryPointsWhat It Measures
Workflow Architecture25Matrix strategy, concurrency groups, gate jobs, branch protection
Build Reliability25CI success rate, no continue-on-error, deterministic builds, caching, pinned actions
Quality Pipeline20Test jobs, lint jobs, coverage reporting, security audit, format checks
Deployment & Release15Release workflows, cross-platform, release automation, registry publishing, semver
Supply Chain Security15Branch protection, no hardcoded secrets, dependency review, SLSA provenance, signed commits
Provable Contracts (bonus)10pv lint, contract score, proof level, contracts directory

Hard cutoff: Projects scoring below 90 receive an auto-fail status.

Quick Start

# Score the current project
pmat infra-score

# JSON output for CI/CD integration
pmat infra-score --format json

# Show only failures and recommendations
pmat infra-score --failures-only

# Score a different project
pmat infra-score --path /path/to/repo

Sample Output

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Infra Score v1.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Summary
  Score: 93.0/100.0
  Grade: A
  Status: PASS

Categories
  ✓ Workflow Architecture: 25.0/25.0 (100.0%)
  ⚠ Build Reliability: 20.0/25.0 (80.0%)
  ✓ Quality Pipeline: 20.0/20.0 (100.0%)
  ✓ Deployment & Release: 15.0/15.0 (100.0%)
  ⚠ Supply Chain Security: 13.0/15.0 (86.7%)

Findings
  ✗ [BR-01]: 0/10 runs succeeded (0%) — need >=90%
  ℹ [SC-05]: No signed commits configuration found.

Recommendations
  BR-01: 0/10 runs succeeded (0%) — need >=90% (+5 pts, ~30 minutes)
  SC-05: No signed commits configuration found (+2 pts, ~5 minutes)

Check Reference

Workflow Architecture (WA)

CheckPointsDescription
WA-015Matrix build strategy (matrix: in workflows)
WA-025Minimum 2 workflow files for separation of concerns
WA-035Reusable workflows (uses: ./.github/workflows/)
WA-043Concurrency groups with cancel-in-progress
WA-053Gate job with if: always() for required status checks
WA-062Branch protection (PR triggers on main/master)
WA-072Required status check patterns

Build Reliability (BR)

CheckPointsDescription
BR-015CI success rate >= 90% (checks last 10 GitHub Actions runs)
BR-025No continue-on-error: true on test/lint jobs
BR-035Deterministic builds (--locked, CARGO_INCREMENTAL=0)
BR-043Build caching (actions/cache, sccache)
BR-053Pinned action versions (SHA or specific version tags)
BR-062No || true escape hatches in test/lint steps
BR-072timeout-minutes configured on jobs

Quality Pipeline (QP)

CheckPointsDescription
QP-015Test job (cargo test, pytest, etc.)
QP-025Lint job (cargo clippy, eslint, etc.)
QP-034Coverage reporting (cargo llvm-cov, codecov)
QP-043Security audit (cargo audit, npm audit)
QP-053Format check (cargo fmt --check, prettier)

Deployment & Release (DR)

CheckPointsDescription
DR-015Release/nightly workflow with schedule trigger
DR-023Cross-platform builds (>= 2 OS targets)
DR-033Automated release (action-gh-release, cargo publish)
DR-042Registry publishing (Cargo.toml with version)
DR-052Semantic versioning (x.y.z pattern, workspace-inherited OK)

Supply Chain Security (SC)

CheckPointsDescription
SC-013Branch protection (PR trigger on main branches)
SC-023No hardcoded secrets (detects API keys, tokens)
SC-033Dependency review tool (dependabot, renovate)
SC-042SLSA provenance or attestation
SC-052Signed commits configuration
HD-012No dangerous context interpolation in run: blocks

Provable Contracts Bonus (PV)

CheckPointsDescription
PV-013pv lint contracts/ passes
PV-023Contract score >= 0.5
PV-032Proof level L2+
PV-042contracts/ directory exists

Sovereign CI Credit

Projects using the sovereign-ci.yml reusable workflow automatically receive implied credit for checks that the shared workflow guarantees (deterministic builds, caching, pinned actions, test/lint/coverage/format, SLSA provenance).

CI/CD Integration

# .github/workflows/quality.yml
- name: Check infra score
  run: |
    pmat infra-score --format json -o infra-report.json
    score=$(jq '.score' infra-report.json)
    if (( $(echo "$score < 90" | bc -l) )); then
      echo "::error::Infra score $score < 90"
      exit 1
    fi

Cross-Repo Analysis

Use pmat stack status to check infra scores across the entire sovereign AI stack:

# Check all batuta stack repos
for repo in aprender trueno trueno-graph trueno-db; do
  echo "$repo: $(cd ~/src/$repo && pmat infra-score --format json | jq -r '.grade')"
done