Skip to content

feat(cli): explicit validation modes --mode basic|strict|release (#52) - #60

Merged
SollanSystems merged 1 commit into
mainfrom
feat/s2-validation-modes
Jul 13, 2026
Merged

SollanSystems merged 1 commit into
mainfrom
feat/s2-validation-modes

Conversation

@SollanSystems

Copy link
Copy Markdown
Owner

Closes #52. Slice S2 of the Phase 0/1 roadmap run (SPEC criterion 3).

What

  • loop doctor|validate|verify --mode basic|strict|release (default = unchanged auto-detect; basic = the structural fallback made explicit and deterministic even when jsonschema is installed).
  • strict/release require real JSON-Schema validation and fail loud — new ValidationModeError (RuntimeError subclass), CLI exit 2, stderr names jsonschema and the --mode basic escape hatch, no traceback — instead of silently downgrading.
  • releasestrict today with reserved semantics, pinned by a tripwire test so future divergence is a conscious diff.
  • Reports gain requested_mode (auto|basic|strict|release) alongside the untouched internal validation_mode key; VALIDATION_MODES re-exported from the package root (ValidationModeError deliberately not, per the EmitError precedent).
  • CI Quickstart smoke now runs doctor --mode release; new scripts/test_ci_release_mode.py pins the wiring.

Evidence (governed Claudex lane: gpt-5.6-terra worker, deterministic argv gates outside the worker, fresh claude-sonnet-5 review, Fable governance)

  • Scope gate: exactly 8 allowed files; both existing test files purely additive (zero removed lines).
  • Deterministic gates 7/7: extras suite 544 passed / 14 skipped (base 528/14, +16 new tests, zero regressions); pyyaml-only suite 526 passed / 32 skipped (base 513/29) — the jsonschema-absent env genuinely exercises the fail-loud branch; frontmatter + self_eval; release/basic doctor smokes; py_compile; negative probes (strict-without-jsonschema / bogus / valueless --mode → exit 2, stderr-shaped, no stdout, no traceback).
  • Independent review: PASS; reviewer arithmetic cross-check of new-test counts matches gate evidence exactly in both env shapes.
  • One verifier-directed repair (attempt 2/2): a new CLI test was not environment-aware (asserted release exits 0 with jsonschema absent); fixed to assert the fail-loud contract in that env. Codex sessions: 019f5c50-b7ab-71d0-a15c-ccdb0afd94bb (a1), 019f5c5b-d58e-7150-bc04-5be8216b46a6 (a2); receipts cx_s2_modes_a1 (repair_requested), cx_s2_modes_a2 (accepted).

Test plan

  • Full suite, jsonschema present: 544/14
  • Full suite, pyyaml-only: 526/32 (no regressions vs 513/29 baseline)
  • Fail-loud negative probes outside pytest
  • CI runs release mode on all matrix legs (jsonschema installed unconditionally)

https://claude.ai/code/session_01EJ8zA8Cbi4o2amawpj8bZW

loop doctor/validate/verify gain --mode: basic forces the structural
fallback deterministically; strict/release require jsonschema and fail
loud (ValidationModeError -> exit 2, stderr, no traceback) instead of
silently downgrading; release == strict today (reserved, tripwire-tested).
Reports gain requested_mode (auto|basic|strict|release) alongside the
unchanged validation_mode key; VALIDATION_MODES re-exported; CI Quickstart
smoke runs --mode release. 16 new tests honest in both env shapes
(extras 544/14, pyyaml-only 526/32, zero regressions).

Closes #52

Claude-Session: https://claude.ai/code/session_01EJ8zA8Cbi4o2amawpj8bZW
Copilot AI review requested due to automatic review settings July 13, 2026 16:53
@SollanSystems
SollanSystems enabled auto-merge (squash) July 13, 2026 16:53
@SollanSystems
SollanSystems merged commit 866a905 into main Jul 13, 2026
10 checks passed
@SollanSystems
SollanSystems deleted the feat/s2-validation-modes branch July 13, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR makes contract validation strength explicit and deterministic for the CLI “doctor-family” commands by adding --mode basic|strict|release, while keeping the default behavior (auto) unchanged for backward compatibility. It also adds reporting that distinguishes the caller-requested mode from the internally selected validation branch.

Changes:

  • Add public validation modes (basic|strict|release) with “fail loud” behavior for strict/release when jsonschema is unavailable, plus requested_mode in validation reports.
  • Extend the CLI (doctor|validate|verify) to parse --mode, return exit code 2 on mode/availability errors, and avoid tracebacks for these user-facing failures.
  • Update CI quickstart smoke to run doctor --mode release and add tests that pin the CLI/API behavior and CI wiring.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/test_loop_contract_core.py Adds API-level tests for VALIDATION_MODES, requested_mode, and strict/release behavior.
scripts/test_loop_cli.py Adds end-to-end CLI subprocess tests for --mode behavior, exit codes, and stderr/stdout shaping.
scripts/test_ci_release_mode.py Adds a CI workflow “wiring contract” test to pin release-mode usage in the smoke step.
README.md Documents the new requested_mode report field and the --mode semantics.
loop/contract.py Implements mode resolution, introduces ValidationModeError, threads mode through validate_contract/doctor_report, and reports requested_mode.
loop/main.py Parses --mode for doctor/validate/verify, maps mode errors to exit 2, updates help text.
loop/init.py Re-exports VALIDATION_MODES from the package root.
.github/workflows/ci.yml Updates the Quickstart smoke test to run doctor --mode release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Explicit validation modes: loop validate --mode basic|strict|release

2 participants