Skip to content

refactor(verification): replace ceremonial proof layers with executable evidence #853

Closed

Description

@Sinity

Summary

Audit, strengthen, and simplify Polylogue's verification-lab/proof/scenario machinery so serious verification claims are backed by executable evidence, runtime observations, or explicit architectural boundary checks.

This is not an anti-verification cleanup. The intent behind the current machinery is real and should be preserved: Polylogue should have automated ways to verify as many important aspects of the system as viable. The issue is that vacuous, self-attesting, or implementation-locking abstractions can obscure reality and make future agents trust evidence that did not actually test anything.

This is a focused refinement from the broader backlog pass in #852. It does not replace #806 or #807; it sharpens them by removing or demoting the parts of the verification setup that can look rigorous without proving behavior.

Audit evidence

The current verification surface is large and partly useful, but it mixes real mechanisms with ceremonial metadata:

  • polylogue/proof/models.py defaults new claims to oracle="construction_sanity", assertion_source="proof_catalog", observation_source="repo_static_analysis", independence_level="independent", and severity="serious". That lets serious/independent-looking claims exist without an explicit oracle choice.
  • polylogue/proof/catalog.py has many default claims and runner bindings. The catalog quality checks are valuable, but much of the assurance is metadata completeness rather than independent behavior checks.
  • polylogue/proof/catalog.py stamps runner trust metadata from static catalog values such as code_revision="catalog-reviewed" and a fixed review timestamp. That is authored metadata, not a run artifact or freshness signal.
  • Generated scenario evidence in polylogue/proof/runners.py validates scenario/projection metadata, but does not necessarily execute the scenario behavior it represents.
  • polylogue/showcase/invariants.py contains a clean_stderr invariant that currently returns success unconditionally because Click runner output merges stderr into stdout.
  • AssertionSpec in polylogue/scenarios/assertions.py defaults to exit-code-only success. Validation lane builders in devtools/validation_lane_base.py use default assertions by default, so a lane can pass while checking only process shape.
  • docs/plans/test-quality-coverage.yaml still records gaps for fuzzing, flakiness tracking, and mock-depth measurement, and some manifest references appear stale after recent cleanup.
  • devtools verify-layering appears to protect a real architectural boundary when it prevents substrate packages from importing CLI/MCP/site/UI adapters.
  • devtools verify-topology / docs/plans/topology-target.yaml are more suspect: they can usefully catch orphaned files and root-kernel drift, but they can also freeze exact module placement, owner labels, and source package shape in a way that constrains implementation rather than protecting behavior.

Judgment framework

Classify each verification surface before keeping, strengthening, or deleting it:

Keep and strengthen when it verifies reality

A verification surface is real if it can fail for a meaningful system regression and points to a concrete fix. Good examples:

  • parser crashlessness, null handling, schema drift, and provider fixture replay;
  • idempotent archive writes and content-hash honesty;
  • FTS/search parity and query contract behavior;
  • daemon cursor, retry, parse-failure, and status behavior;
  • API/CLI/MCP/web-reader contract parity;
  • security/privacy boundaries;
  • executable scenario or lab checks with meaningful assertions;
  • observability signals that expose ingest lag, failure counts, degraded status, cursor health, and repairability.

Strip or demote when it is vacuous

Remove or demote checks that cannot fail except by metadata churn, or that only prove that a catalog entry describes itself. Metadata completeness can be useful, but it must be labeled as metadata/spec completeness rather than behavior proof.

Re-scope when it locks implementation shape

Structural checks should protect stable architectural contracts, not freeze arbitrary file/module organization. In particular, audit source/topology checks for whether they protect one of these real boundaries:

  • substrate packages must not import surfaces;
  • source acquisition/parsing must not depend on CLI/MCP/site/UI adapters;
  • provider detection/parsing behavior stays covered as providers evolve;
  • generated docs/manifests do not reference missing files;
  • root package files remain a small explicit kernel if that is still an intentional architecture rule.

If a topology/source check only enforces today's file placement or naming taxonomy without protecting one of those boundaries, make it advisory, delete it, or replace it with behavior/import-contract tests.

Scope

Classify and prune proof claims

  • Classify each proof claim as one of:
    • executable behavior check;
    • runtime/observability evidence;
    • structural architectural-boundary check;
    • metadata/spec completeness check;
    • manual review assertion.
  • Serious correctness claims must name an explicit oracle, observation source, independence level, assurance domain, and executable or runtime evidence mechanism.
  • Remove or demote metadata-only claims that cannot be made valuable.
  • Make Proof Pack output distinguish executable/runtime evidence from metadata/spec completeness so PR agents do not treat both as equivalent.

Replace self-attesting trust metadata

  • Stop treating fixed catalog review timestamps or catalog-reviewed revisions as evidence freshness.
  • Derive trust/freshness metadata from actual command runs, git revisions, committed witness artifacts, daemon/status observations, or explicitly mark it as authored metadata.
  • Ensure devtools proof-pack --check or an equivalent gate fails on serious claims that lack real evidence routing.

Strengthen scenario and lane assertions

  • Delete or repair the vacuous clean_stderr invariant.
  • Require validation lanes to declare non-default assertions when they claim semantic coverage; otherwise label them as smoke/process lanes.
  • Pair generated scenario/projection claims with executable scenario runners where possible, or demote them to spec completeness.
  • Add invariants for archive-visible behavior where harnesses currently check only exit code, JSON validity, or nonempty output.

Audit topology, source, and manifest gates

  • Decide which topology checks are blocking, advisory, or obsolete.
  • Keep structural gates that protect ring boundaries or source/surface separation.
  • Demote checks that freeze exact file placement, owner labels, or source package taxonomy without protecting a behavioral or architectural contract.
  • Replace implementation-shape checks with import-boundary checks, behavior tests, generated-doc freshness checks, or source/provider replay tests where that better matches the intent.
  • Refresh stale quality/scenario/topology manifest entries so they describe the live tree after feat(daemon): replace run ingest with observable convergence (#845) #847.

Fold in harness and observability gaps

Non-goals

  • Do not delete useful verification mechanisms just because they are imperfect.
  • Do not preserve vacuous abstractions just because the intent behind them is good.
  • Do not turn this into a broad test-writing campaign; test(archive): systematic test architecture — catalog-driven invariants across all domains #807 owns catalog-driven test architecture.
  • Do not freeze implementation layout unless the check protects a durable architectural boundary.
  • Do not duplicate architecture prose from docs/architecture.md or docs/internals.md.
  • Do not make Proof Pack more jargon-heavy. The output should become plainer about what was actually executed or observed.

Dependencies

Acceptance criteria

  • A claim/surface inventory exists that marks each proof, scenario, validation-lane, topology, source, and manifest gate as executable behavior, runtime evidence, architectural-boundary, metadata/spec, manual-review, advisory, or obsolete.
  • Serious proof claims cannot rely on default oracle/independence/observation metadata.
  • devtools proof-pack --check or an equivalent gate reports/fails serious claims that lack executable or runtime evidence routing.
  • Metadata-only scenario/projection checks are labeled as such in generated reports and are not counted as behavior proof.
  • The vacuous clean_stderr invariant is removed or replaced with a runner that actually captures stderr.
  • Validation lanes that are exit-code-only are visibly labeled as smoke/process lanes, not semantic proof.
  • Topology/source gates are either tied to explicit architectural contracts, made advisory, or removed.
  • Runtime observability signals needed for verification are listed and linked to fix(daemon): surface raw validation and parse failures in ingest/status #844/feat(daemon): add tiered health, backup, alerts, maintenance #830 implementation work.
  • Stale quality/scenario/topology manifest entries are refreshed or moved to explicit follow-up issues.
  • A focused verification command set is recorded for PR agents, distinguishing cheap inner-loop checks from broad gates and distinguishing behavior evidence from structural/advisory checks.

Verification

Expected focused checks for this issue:

  • devtools render-verification-catalog
  • devtools proof-pack --check
  • devtools verify-layering
  • devtools verify-topology after deciding which topology findings should remain blocking
  • devtools render-all --check
  • targeted pytest for proof runners, scenario assertions, validation lanes, topology/layering tools, and Proof Pack rendering
  • devtools verify --lab once the claim/lane changes are coherent

Refs #805, #806, #807, #844, #830, #852.

Activity

  1. added
    type:refactor
    theme:verifiability
    phase:architecture
    theme:evidence-trust
    area:devtools
    on May 6, 2026
  2. Sinity commented on May 6, 2026

    @Sinity
    OwnerAuthor

    Refinement: walk back custom abstractions before deleting real checks

    Interpret this issue as a request to prune the abstraction layer first, not to throw away useful underlying verification.

    Preferred direction:

    • Keep the real checks when they exist: pytest tests, property tests, fuzz targets, generated-surface checks, import-boundary checks, daemon/status assertions, parser replay, schema drift checks, and focused devtools commands.
    • Walk back bespoke proof/catalog/scenario abstractions when they mainly rename or wrap those checks without adding routing, evidence freshness, prioritization, or clearer failure diagnosis.
    • Prefer standard, boring mechanisms where they are enough: pytest, ruff, mypy, GitHub Actions checks, plain JSON reports, committed witnesses, and direct devtools commands.
    • Keep custom abstractions only when they provide an obvious improvement: affected-check selection, cross-surface obligation routing, durable witness/provenance linkage, evidence freshness, or operator-readable impact reports.
    • If a custom layer stays, it should make the underlying command/test more transparent, not less. The report should name the actual command, source files, witness data, and failure mode.

    So the default fix is often:

    1. preserve the underlying behavior check;
    2. delete or flatten the jargon-heavy wrapper;
    3. expose the check through a simpler standard command or CI gate;
    4. keep only the smallest abstraction that materially improves selection, provenance, or diagnosis.

    This especially applies to source/topology/proof surfaces. The question is not whether the intent is valid; it is whether Polylogue needs a bespoke abstraction there, or whether a standard test/import check/manifest freshness check gives the same or better evidence with less conceptual weight.

  3. Sinity commented on May 6, 2026

    @Sinity
    OwnerAuthor

    Execution split

    This issue is now the verification-pruning umbrella. The project audit found three concrete child issues that can run as bounded PRs:

    Keep this umbrella open until those children have either landed or produced a smaller follow-up list. The closeout for #853 should summarize which abstractions were preserved, flattened, demoted, or deleted, and why.

  4. Sinity commented on May 6, 2026

    @Sinity
    OwnerAuthor

    Additional audit evidence from deeper pass

    Three concrete verification-surface findings should feed the #853 closeout matrix:

    These reinforce the pruning rule: preserve checks that fail for real regressions, but label import presence, authored freshness, and baseline catalog context honestly so agents do not over-trust them.

    Refs #855 #807 #806.

  5. Sinity commented on May 7, 2026

    @Sinity
    OwnerAuthor

    Reconnaissance Report for #853

    Date: 2026-05-07 | Wave: 6 (UMBRELLA — closeout only)
    Agent: Codebase exploration complete.


    Status: Children completed

    All three children have been MERGED:

    Build this (closeout summary)

    This issue is now purely a closeout umbrella. The actual implementation work happened in #855/#856/#857. What remains is documentation: categorize every verification surface into one of four buckets and summarize why.

    1. Preservation matrix — what survived and why

    Abstraction Status Reason
    EvidenceTaxonomy (executable_behavior/observability/architectural_static/metadata_spec/manual_review/advisory) Preserved — in models.py lines 59-66, used by proof_pack.py Routes agents to actionable checks, derived from existing oracle/independence fields
    build_proof_pack report (taxonomy-grouped markdown) Preserved — in proof_pack.py Separates run-now gates from static catalog noise; clean-tree distinction prevents false alarm
    build_slop_dashboard (anti-vacuity) Preserved — in proof_pack.py lines 427-518 Identifies claims with missing breakers, runners, subjects, or stale evidence; not blocking but identifies waste
    verify-topology — orphans/missing/conflicts/kernel_rule Preserved as blocking Real structural gaps: missing files, stale manifests, root-kernel violations
    verify-layering (substrate-vs-surface import boundary) Preserved as blocking Durable architectural boundary — substrate packages must not import CLI/MCP/site/UI adapters
    verify-test-ownership (import/ownership map) Preserved as discoverability — NOT as behavior coverage Its output maps imports, not contracts. Zero uncovered does not mean tested. Two orphan tests classified as structural.
    Statement-level proof runners (runners.py) Preserved Real executable checks: CLI help, no-traceback, JSON envelope, semantic queries, schema value closure, error context, trace equivalence
    Showcase invariants (showcase/invariants.py) Preserved json_valid, exit_code, nonempty_output are real checks; clean_stderr was deleted
    devtools verify pipeline Preserved Standard ruff/mypy/pytest checks, plus topology/layering/proof-pack policy gates

    2. Flattened — custom wrappers removed, underlying checks kept

    Abstraction Action
    _check_clean_stderr showcase invariant Deleted — returned success without checking stderr (CliRunner merges stderr into merged output). Deleted from showcase/invariants.py and SHOWCASE_INVARIANTS registry. No underlying check lost.
    Generated scenario evidence_note labeling Added to 3 runner functions — they now explicitly state "metadata/spec completeness: checks that scenario family subject metadata is declared, not that the scenario executes"

    3. Demoted — from blocking to advisory/metadata

    Gate Old status New status
    verify-cluster-cohesion Implicitly blocking (in verify) Advisory — proposed cluster quality, not in default verify
    verify-cross-cuts Implicitly blocking (in verify) Advisory — tag naming consistency, not in default verify
    render-topology-status Not classified Freshness — generated doc, checked via render-all --check
    verify-topology TBD cells Could block with --strict-tbd Advisory by default, blocking only with opt-in flag

    4. Deleted — vacuous abstractions

    Thing Why deleted
    _check_clean_stderr() in showcase/invariants.py Always returned None (pass) without checking stderr
    Scenarios defaulting to exit-code-only without classification Default AssertionSpec() is now SMOKE_PROCESS — visibly not semantic proof

    Remaining gaps (noted for follow-ups, NOT blocking closeout)

    1. Clean-tree routing mismatch: devtools affected-obligations --json reports no affected obligations, while devtools proof-pack --json still reports 533 stable obligations and 32 required gates. refactor(proof): make Proof Pack evidence taxonomy actionable #855 separated baseline catalog context from change-specific gates, but the mismatch in zero-change mode may still be confusing for agents. Follow-up: Add a clean_tree flag (already done in refactor(proof): make Proof Pack evidence taxonomy actionable #855) to distinguish catalog stats from diff obligations.

    2. Witness lifecycle freshness is authored metadata: devtools verify-witness-lifecycle --json bases freshness on authored last_exercised_at, not actual replay/test artifacts. fix(verification): verifiability infrastructure — wire missing bridges, activate dead systems #806 owns either wiring replay evidence or labeling freshness honestly. Tracked in fix(verification): verifiability infrastructure — wire missing bridges, activate dead systems #806 comment.

    3. verify-test-ownership is an import map, not coverage: It reports 806 covered modules for 719 production modules (more covered than exist!) because it marks ancestors/descendants as covered by import reachability. test(archive): systematic test architecture — catalog-driven invariants across all domains #807 owns consuming this as discoverability. Tracked in test(archive): systematic test architecture — catalog-driven invariants across all domains #807 comment.

    4. 527 of 534 obligations are construction_sanity-classified: From the proof catalog: Counter(oracle) = {'construction_sanity': 28 claims}, meaning most claims default to metadata/spec classification. The 17 claims that need explicit oracle= overrides are tracked in fix(verification): verifiability infrastructure — wire missing bridges, activate dead systems #806.

    5. Orphan devtools scripts: The audit found 3 orphaned devtools scripts not wired into devtools verify. Identify and wire them (or delete if truly unused). Tracked in refactor(core): structural simplification — delete vacuous abstractions, collapse parallel implementations #805.

    Do NOT build this in closeout

    Files to touch (closeout documentation only)

    File Change
    docs/verification-catalog.md Update with preservation/flattening/demotion/deletion matrix
    docs/plans/assurance-domains.yaml Update gating classifications to reflect #856 decisions
    CLAUDE.md or equivalent Record the default rule: prefer standard tools (pytest, ruff, mypy) over bespoke abstractions unless the custom layer provides affected-check routing, evidence freshness, provenance/witness linkage, or clearer failure diagnosis

    Coordination

    Focused tests (verification that closeout is coherent)

    # Verify children's changes are all live
    devtools proof-pack --check                  # #855 taxonomy is operational
    devtools verify-topology --json              # #856 blocking/advisory split
    devtools verify-layering --json              # #856 layering still blocking
    devtools run-validation-lanes --lane machine-contract --dry-run  # #857 assertion classification visible
    devtools render-all --check                  # #856 topology status renders
    
    # Catalog coherence after all three PRs
    devtools proof-pack --json | python -c "
    import json,sys
    r=json.load(sys.stdin)
    tx=r.get('taxonomy',{})
    for t,g in tx.items():
        c=g.get('obligation_count',0)
        if c:
            print(f'{t}: {c} ({chr(10)}actionable{chr(10) if g.get(\"actionable\") else \"does not block\"})')
    "
    
    # Full verify gate
    devtools verify --quick
    devtools verify                               # Full verify before closeout
    

    Acceptance criteria (closeout only)

    Close when a comment on this issue summarizes:

    1. Preserved: Which abstractions survived, with explicit rationale (preserved the underlying real check, added routing/freshness/provenance value).
    2. Flattened: Which custom wrappers were removed while keeping the underlying check.
    3. Demoted: Which gates changed from blocking to advisory/metadata and why.
    4. Deleted: Which vacuous abstractions were removed entirely (with or without real check loss).
    5. Follow-ups: Any remaining gaps that should be tracked in other issues (already noted above).

    Ambiguities / Stale comments

    Closeout verdict

    The three children are merged. All implementation work for #853 is complete. This issue is ready for closeout once the preservation/flattening/demotion/deletion summary is written as a final comment.

  6. Sinity commented on May 7, 2026

    @Sinity
    OwnerAuthor

    #853 Closeout — Verification Pruning Implementation Complete

    All three child issues (#855, #856, #857) are merged. This comment closes #853.

    Preserved

    • EvidenceTaxonomy — 6-category classification (executable_behavior, observability, architectural_static, metadata_spec, manual_review, advisory) in polylogue/proof/models.py
    • Taxonomy-grouped proof-pack output — Required Gates section first, actionable/does-not-block labels
    • Topology blocking checks — orphans, missing, conflicts, kernel_rule remain blocking
    • Layering — substrate-vs-surface import boundary remains blocking
    • Showcase invariants — kept as smoke tests, explicitly labeled smoke/process
    • devtools verify pipeline — format/lint/mypy/render/topology/layering/budgets/ownership/roundtrip/cross-cuts/suppressions/manifests/witness-lifecycle/proof-pack

    Flattened

    • _check_clean_stderr() — deleted (always returned success without checking stderr)
    • Generated scenario runners — labeled with evidence_note="metadata/spec completeness" (not semantic proof)

    Demoted

    • verify-cluster-cohesion and verify-cross-cuts — advisory only
    • Topology TBD — advisory by default, warning-only without --strict-tbd
    • construction_sanity (527 of 534 obligations) — classified as metadata_spec, not behavior evidence

    Deleted

    • _check_clean_stderr() function — vacuous invariant, never checked anything meaningful

    Follow-ups

    Refs #855 #856 #857 #806 #807 #805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:devtoolsarea:qaphase:architecturetheme:evidence-trusttheme:verifiabilitytype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions