Skip to content

vcl-ut #25 P5a: trusted Rust/SPARK-grade String->Statement parser#26

Merged
hyperpolymath merged 3 commits into
mainfrom
reinforce/vclut-25-phase5a-rust-parser
May 19, 2026
Merged

vcl-ut #25 P5a: trusted Rust/SPARK-grade String->Statement parser#26
hyperpolymath merged 3 commits into
mainfrom
reinforce/vclut-25-phase5a-rust-parser

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

P5a — trusted Rust/SPARK-grade String -> Statement parser

First slice of the boundary-reinforcement workstream (#25). The
verified corpus certifies an already-built Statement; nothing
turned a query string into the certified AST. This adds the trust
anchor that will: parse text → (P5b) marshal across the C-ABI → (P5c)
hand to the proof-gated Idris2 certifier → (P5d) return a signed
attestation.

What this PR adds

  • New workspace crate src/interface/parse (vcltotal-parse) — a
    total, panic-free recursive-descent parser for the VCL-total
    relational core.
  • SPARK-grade posture, statically enforced + CI-gated:
    #![forbid(unsafe_code)],
    #![deny(clippy::{unwrap_used, expect_used, panic, indexing_slicing, arithmetic_side_effects, unreachable, todo, unimplemented, exit})].
    The only arithmetic is cursor saturating_add; every failure is a
    typed ParseError.
  • proptest panic-free invariant — 4096 cases × 3 strategies
    (arbitrary UTF-8, arbitrary bytes, token-salad). A green run is
    machine evidence of totality.
  • Faithful AST mirror of src/core/Grammar.idrast.rs is 1:1
    with the Idris constructors so the P5b marshaller is a structural
    map. Expr VqlType slots deliberately omitted: the parser
    establishes syntax only; type resolution + the L0–L10 decision
    remain the certifier's job (kept honest about what parsing proves).
  • .github/workflows/parse-gate.yml — hard gate (cargo clippy --all-targets -D warnings over the SPARK lint set + tests/proptest).
  • PROOF-NEEDS.md — corrects the ReScript-bridge nit: it is a
    standalone frontend, not on the verified path; the trusted
    parser is this crate. Reconciles with VERIFICATION-STANCE.adoc's
    precise "no string→Statement parser exists" (= none whose output
    is the certified Idris2 Statement).

Scope / honesty

Covered: SELECT/FROM/WHERE/GROUP BY/HAVING/ORDER BY/LIMIT/OFFSET +
full expression grammar (literals, params, *, fields, aggregates,
comparisons, AND/OR/NOT, parens, scalar sub-queries). The VCL-total
extension clauses (PROOF / EFFECTS / AT VERSION / CONSUME|USAGE /
EPISTEMIC) and modal expressions are fail-closed: a typed
"not yet supported" error, never a silently-wrong AST. Full grammar
coverage iterates per the #25 roadmap.

requested_level is a documented, conservative P5a policy (max
feature-implied level), explicitly not a proven fact; authoritative
reconciliation with the ReScript bridge / certifier is a later #25
iteration. OCTADHEXAD accepted pending that reconciliation.

Verification (local, CI-faithful)

  • cargo clippy -p vcltotal-parse --all-targets -- -D warnings → exit 0
  • cargo test -p vcltotal-parse → 11/11 (6 lib + 5 integration incl.
    proptest)
  • cargo fmt -p vcltotal-parse -- --check → clean

Does not touch the Idris corpus or PR #24. Refs
#25, hyperpolymath/standards#124.

🤖 Generated with Claude Code

hyperpolymath and others added 2 commits May 19, 2026 14:51
First slice of the boundary-reinforcement workstream (#25). Adds a new
workspace crate `src/interface/parse` (`vcltotal-parse`): a TOTAL,
panic-free parser for the VCL-total relational core, the trust anchor
that will feed the Idris2 certifier across the C-ABI (P5b/P5c).

SPARK-grade posture (enforced statically, gated in CI):
  - #![forbid(unsafe_code)]
  - #![deny(clippy::{unwrap_used, expect_used, panic, indexing_slicing,
    arithmetic_side_effects, unreachable, todo, unimplemented, exit})]
    => no UB, no panics, no unchecked arithmetic; the only arithmetic
    is cursor saturating_add; every failure is a typed ParseError.
  - proptest panic-free invariant (4096 cases x 3 strategies incl.
    arbitrary bytes) = runtime witness of totality.

Faithful AST mirror of src/core/Grammar.idr (ast.rs is 1:1 with the
Idris constructors so the P5b marshaller is a structural map). Expr
VqlType slots deliberately omitted — the parser establishes syntax
only; type resolution + the L0-L10 decision stay the certifier's job.

Coverage (first slice): SELECT/FROM/WHERE/GROUP BY/HAVING/ORDER BY/
LIMIT/OFFSET, full expression grammar (literals, params, *, fields,
aggregates, comparisons, AND/OR/NOT, parens, scalar subqueries).
The VCL-total extension clauses (PROOF/EFFECTS/AT VERSION/CONSUME|
USAGE/EPISTEMIC) and modal expressions are FAIL-CLOSED: a typed
"not yet supported" error, never a silently-wrong AST. Full grammar
coverage iterates per the #25 roadmap.

requested_level: a documented, conservative P5a policy (max
feature-implied level), explicitly NOT a proven fact; authoritative
reconciliation with the ReScript bridge is a later #25 iteration.

Also:
  - .github/workflows/parse-gate.yml: hard CI gate (clippy -D warnings
    over the SPARK lint set + tests/proptest).
  - root Cargo.toml: add the workspace member.
  - PROOF-NEEDS.md: correct the ReScript-bridge nit (it is a
    standalone frontend, NOT on the verified path; the trusted parser
    is this crate). Reconciles with VERIFICATION-STANCE.adoc.

Verified locally: cargo clippy -p vcltotal-parse --all-targets
-D warnings (exit 0), cargo test -p vcltotal-parse (11/11),
cargo fmt --check (clean).

Refs #25, hyperpolymath/standards#124.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 21 issues detected

Severity Count
🔴 Critical 4
🟠 High 7
🟡 Medium 10

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action idris-community/setup-idris@v1 needs attention",
    "type": "unpinned_action",
    "file": "proof-corpus.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/upload-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/download-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "codeql.yml lists `language: javascript-typescript` but the repo has no source files in any CodeQL-scannable language. The analyze job will exit 'no source files' on every run. Switch the matrix to `actions` (which scans workflow files — every repo has those).",
    "type": "codeql_language_matrix_mismatch",
    "file": "codeql.yml",
    "action": "switch_codeql_matrix_to_actions",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "assert_smaller bypasses termination checker (1 occurrences, CWE-704)",
    "type": "assert_smaller",
    "file": "/home/runner/work/vcl-ut/vcl-ut/src/core/Checker.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/vcl-ut/vcl-ut/src/core/Decide.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (2 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/vcl-ut/vcl-ut/src/core/Composition.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

…ion)

CI revealed the parent virtual workspace cannot load in a standalone
checkout: the pre-existing src/interface member path-deps on an
out-of-repo sibling (echidna-core = ../../../echidna/...), which only
resolves on the estate layout. Any whole-workspace cargo op (incl. the
prior parse-gate, and the repos other Rust jobs) fails fast in CI.

Decouple the trusted boundary parser: it is now its own [workspace]
root with its own Cargo.lock; parse-gate runs via --manifest-path
--locked, never traversing the broken parent. Remove it from the root
members. P5a code unchanged; verified standalone: clippy --locked -D
warnings clean, 11/11 tests, fmt clean. Root Cargo.lock reverted to
main (the earlier change is moot now parse is not a member).

The parent-workspace external-path-dep breakage is pre-existing and
out of #25 scope; reported separately.

Refs #25.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 21 issues detected

Severity Count
🔴 Critical 4
🟠 High 7
🟡 Medium 10

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action idris-community/setup-idris@v1 needs attention",
    "type": "unpinned_action",
    "file": "proof-corpus.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/upload-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/download-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "codeql.yml lists `language: javascript-typescript` but the repo has no source files in any CodeQL-scannable language. The analyze job will exit 'no source files' on every run. Switch the matrix to `actions` (which scans workflow files — every repo has those).",
    "type": "codeql_language_matrix_mismatch",
    "file": "codeql.yml",
    "action": "switch_codeql_matrix_to_actions",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "assert_smaller bypasses termination checker (1 occurrences, CWE-704)",
    "type": "assert_smaller",
    "file": "/home/runner/work/vcl-ut/vcl-ut/src/core/Checker.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/vcl-ut/vcl-ut/src/core/Decide.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (2 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/vcl-ut/vcl-ut/src/core/Composition.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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