Skip to content

DecGuard v0.1 Step 3: production checks and cascade policies - #3

Merged
suffro merged 1 commit into
mainfrom
step-3-production-policy
Sep 24, 2026
Merged

suffro merged 1 commit into
mainfrom
step-3-production-policy

Conversation

@suffro

@suffro suffro commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Implements Step 3 of .context/state/DECGUARD_V0.1_CODEX_PLAN.md.

What is new

  • Production records. Strict backend-neutral JSONL/JSON with validated probability invariants, optional outcomes/routing/latency/cost, stable ids and source hashes.
  • Offline checks. decguard check reports accuracy/error, calibration, threshold coverage, routing, confidence, latency and cost without calling a backend or service.
  • Drift. A baseline dataset or prior check report adds confidence-distribution TV, confidence mean delta, accuracy drop and ECE increase.
  • Segments. Contract metadata keys produce deterministic scalar groups with independent requirement/warning gates, including missing values.
  • Reports. Versioned check_version: 0.1 JSON persists normalized records, metrics, drift, segments and checks and verifies them again on load.
  • Policies. Ordered first-match routes support accept, abstain, named-backend fallback and human_review; the final route is mandatory and unconditional.
  • SDK and CLI. DecGuard.from_contract(...).decide(...) and decguard run share backend normalization and the same pure policy engine. Fallback remains an explicit directive and is never invoked or optimized implicitly.
  • Docs and CI. Production/policy/architecture guides, a complete refund production example, and clean-wheel smoke coverage for pre- and post-deployment commands.

Step 3 acceptance criteria

  • Production JSONL is analyzed offline.
  • Calibration drift can fail the contract.
  • Metadata segmentation exposes a localized failure.
  • Policy routes accept, fallback, review and abstain deterministically.
  • CLI and Python SDK use the same policy engine.
  • No central service or new runtime dependency is required.
  • CI examples cover pre-deploy and post-deploy checks.

Verification

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy
  • uv run pytest: 269 passed, 1 skipped (the opt-in external backend test)
  • syngraphe check
  • Clean Python 3.11 wheel install: validate, test --all, check, and run all pass.

@suffro
suffro merged commit 97c88d0 into main Sep 24, 2026
8 checks passed
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.

1 participant