Repository navigation
Closed
Labels
area:coreCore runtime and shared infrastructurearea:devtoolsDevtools and repo control-plane toolingphase:architectureArchitecture and design spinetype:refactorCode restructuring
Description
Purpose
Structural simplification parent for deleting vacuous abstractions, collapsing duplicated implementations, and reducing maintenance load without mixing in unrelated product or schema migrations.
This issue should produce focused cleanup PRs with measurable deletion/consolidation, not become a catch-all for every bug found by audits.
Current split
- refactor(core): structural simplification — delete vacuous abstractions, collapse parallel implementations #805: structural simplification and deletion/consolidation targets.
- fix(verification): verifiability infrastructure — wire missing bridges, activate dead systems #806: proof/evidence infrastructure activation.
- test(archive): systematic test architecture — catalog-driven invariants across all domains #807: catalog-driven systematic tests.
- chore: repo maintenance — dead dependencies, stale docs, missing test files, CodeQL CI #826: small maintenance leftovers such as unused dependencies and CodeQL.
- chore(schema): inventory universal archive semantics vs provider metadata #840/fix(archive): store context and protocol artifacts semantically, not via projection fallbacks #839/refactor(storage): make conversation writes bundle/hash-honest #841/fix(chatgpt): align parsed message metadata with persisted archive contract #842: archive schema/storage semantic issues.
- refactor(daemon): replace polylogue run with performant convergence #845/fix(daemon): surface raw validation and parse failures in ingest/status #844: daemon convergence and ingest failure visibility.
Valid simplification lanes
- Validation lanes: reduce DSL/registry machinery where simple commands and manifests are clearer.
- Scenario/proof projections: flatten overlapping catalogs and remove NotImplemented/stub inheritance when it adds no signal.
- Sync/async divergence: collapse or prove shared behavior where duplicate paths differ.
- Type-family consolidation: remove bridge-only conversions and permanent information loss at boundaries.
- SQL/output/config duplication: single-source helpers where repeated column lists/format dispatch/env reads cause drift.
- Devtools verify/render control plane: tier gates and wire orphaned checks where they produce useful evidence.
- Dead-code verification: remove only after fresh grep/import/test evidence.
Corrections from later evidence
ArchiveWriteGatewayis not a dead-code target after feat(daemon): replace run ingest with observable convergence (#845) #847; it is part of the write/effects boundary unless new evidence proves otherwise.- Blob GC lease-table decisions belong with fix(storage): clean orphan blobs and wire blob integrity checks #818.
- Schema/tag/live-cursor cleanup claims belong with refactor(storage): reduce FTS bloat and stale schema/read-path drift #817 and must respect later corrections.
Non-goals
- Do not fold all storage/schema work into this issue.
- Do not delete compatibility or generated surfaces without checking current docs, issue comments, and recent PRs.
- Do not replace explicit SQL with a full ORM by default; chore(schema): inventory universal archive semantics vs provider metadata #840 may evaluate a small local descriptor/codegen layer separately.
Acceptance criteria
For each PR against this issue:
- State the specific simplification lane.
- Show before/after duplication, LOC, or behavior-divergence evidence.
- Preserve or improve verification signal.
- Record stale audit claims as satisfied, deferred, or misframed.
- Run focused checks plus
devtools verify --quick; fulldevtools verifybefore publication if shared behavior changes.
Metadata
Metadata
Assignees
Labels
area:coreCore runtime and shared infrastructurearea:devtoolsDevtools and repo control-plane toolingphase:architectureArchitecture and design spinetype:refactorCode restructuring
Activity
Sinity commentedon May 4, 2026
Detailed findings (from agent audit)
Simplification targets (E13-E16)
Sizing & consolidation (E17-E20)
Duplication (P1-P10)
Verification + new categories (D1-D8)
Behavioral divergences
Consolidated LOC savings
Production: sync/async (2,850), verification trinity (7,600), devtools (3,500), storage (2,500), archive (2,000), pipeline (1,787), SQL (1,765), validation lanes (2,000), provider meta (650), coverage manifests (500), output format (375), type hierarchy (400), dead code (813), scenario projections (250), connection mgmt (165), error handling (150), surface unification (170), config (90), import graph (1,140), convention drift (42). Total: ~28,747 LOC.
Test: ceremonial tests (2,750), mock-chain replacement (4,700), snapshot CSS dedup (1,890), parameterization (3,950), property tests (1,250), duplicate tests (880), sleep de-flaking (135), benchmarks removal (438), test infra consolidation (700), trivial test reduction (400). Total: ~17,093 LOC.
Sinity commentedon May 4, 2026
Acceptance Criteria
Simplification
Verification
When closing: comment on this issue or the PR explicitly stating how each criterion was satisfied, deferred, or found misframed.
[-]refactor: structural simplification — delete vacuous abstractions, collapse parallel implementations[/-][+]refactor(core): structural simplification — delete vacuous abstractions, collapse parallel implementations[/+]Sinity commentedon May 4, 2026
Correction: ArchiveWriteGateway is NOT dead code. It's actively used in archive/write_effects.py and archive/write_gateway.py as part of the daemon's write serialization path. Remove from dead-code list.
Sinity commentedon May 5, 2026
Linked focused implementation issue: #837.
This issue already calls out cross-layer type coercion/information loss, including provider events being discarded. #837 turns that slice into an implementation-ready storage/schema fix: provider protocol events become canonical archive rows, compaction counts stop reading
provider_meta, and runtime fallbacks are not used to compensate for missing semantic rows.Sinity commentedon May 6, 2026
Backlog hygiene note: keep this as the structural-cleanup parent
This issue should stay open, but its execution should not absorb every adjacent cleanup.
Current split:
Acceptance-criteria caution: the ArchiveWriteGateway dead-code claim was corrected earlier and should not be treated as a deletion target unless new code evidence proves it unused after daemon convergence work lands.
Sinity commentedon May 6, 2026
Backlog refinement note
#853 is the concrete verification-pruning slice discovered during the project-wide audit. Treat it as the verifiability-specific child of this structural simplification issue.
#805 should continue to own broad simplification and dead-surface removal. #853 owns the narrower question of which proof/scenario/lane abstractions provide real executable evidence, which should be demoted to metadata/spec completeness, and which should be deleted because they only obscure the underlying checks.
Sinity commentedon May 6, 2026
Refinement: standard mechanisms over bespoke abstraction
For verification/proof/scenario simplification, prefer walking back unnecessary abstraction layers while preserving the underlying real checks.
The desired outcome is not fewer checks. It is fewer weird layers between the agent/operator and the thing being checked. When ordinary pytest, mypy, ruff, import-boundary checks, generated-surface checks, committed witnesses, or direct
devtoolscommands provide clear evidence, keep those and delete/flatten custom vocabulary that adds no mechanism.Custom proof/scenario/topology abstractions should survive only when they provide a concrete improvement over standard tooling: affected-check routing, evidence freshness, provenance/witness linkage, cross-surface obligation mapping, or clearer failure diagnosis.
Ref #853.
Sinity commentedon May 6, 2026
Execution supplement
Mass-execution wave: #852 Wave 6, after child evidence from #853/#855/#856/#857 where verification abstractions are involved.
Focused verification:
devtools verify --quick, then fulldevtools verifybefore PR readiness.The goal is fewer unnecessary layers, not fewer real checks.
Sinity commentedon May 7, 2026
Reconnaissance Report for #805
Date: 2026-05-07 | Wave: 6 (depends on #853/#856 findings)
Agent: Codebase exploration complete.
Build this
Simplification (5 acceptance criteria)
Validation lanes: 13 files -> 2 (~300 lines, no DSL compilation, 2 broken lanes fixed)
Current state: 68 lanes across 5 files (721 LOC):
validation_lane_runtime.py(79 LOC),validation_lane_base.py(221 LOC),validation_lane_catalog_composites.py(263 LOC),validation_lane_catalog_contracts.py(362 LOC),validation_lane_catalog_live.py(96 LOC), pluslane_models.py(35 LOC),authored_scenario_catalog.py. The DSL comprisespytest_lane(),devtools_lane(),pipeline_probe_lane(),polylogue_lane(),memory_budget_lane(),composite_lane()— all thin wrappers.Simplify to: One file defining lane entries as plain dataclass instances with shell commands, and one runtime file executing them. The underlying checks (pytest, devtools, polylogue commands) survive untouched.
Scenario projections: projection types deleted, flat CoverageSource replacement
Current state:
scenarios/projections.py(94 LOC),scenarios/sources.py(26 LOC),scenarios/executable.py(74 LOC),scenarios/metadata.py(307 LOC),scenarios/specs.py(47 LOC), plusscenarios/cli_surfaces.py,scenarios/insight_surfaces.py,scenarios/operational_surfaces.py. TheExecutableScenarioclass has 7-level inheritance.Simplify to: Delete projection type hierarchy. Replace with a flat
CoverageSourcethat maps scenario name to shell command + metadata. Keep the actual execution logic inscenarios/runtime.py.Coverage manifests: 7-9 files -> 1, machine-generated measured section
Current state:
proof/coverage_manifests.py(353 LOC),proof/subjects.py(728 LOC),proof/catalog.py(1180 LOC). There are also 7 Pydantic models in the manifest pipeline.Simplify to: One manifest file, generated from actual coverage data rather than maintained by hand. The machine reads what tests actually exist.
Dead code removal (~463 LOC beyond prior ~350)
NOTE:
ArchiveWriteGatewayis NOT dead code — correction in comments. It is actively used inarchive/write_effects.pyandarchive/write_gateway.py.Actual dead code targets from the audit:
polylogue/proof/corpus.py— check if reachablepolylogue/proof/sources/— check if reachable (onlyeffect_compiler.py)polylogue/showcase/files not exercised by any lane or testdevtools/__init__.pyorcommand_catalog.pywhich have no importersSync/async: 10 behavioral divergences fixed, dual implementations collapsed
Current state: 2,850 LOC dual implementations. Key file:
storage/sqlite/async_sqlite_archive.py(256 LOC). The sync implementation isstorage/sqlite/query_store_archive.py(different name convention!). Known divergences: optional_count NULL coercion, optional_rows filtering, missing archive layout validation, missing empty-DB early exit, missing per-connection vec loading.Simplify to: Prefer the async implementation, generate sync wrappers, fix the 10 behavioral divergences.
Verification (2 acceptance criteria)
devtools verify: 3 orphaned scripts wired, tiered gates
Current
devtools/verify.pygates (all blocking): ruff format, ruff check, mypy, render-all, verify-topology, verify-layering, verify-file-budgets, verify-test-ownership, verify-schema-roundtrip, verify-cross-cuts, verify-suppressions, verify-manifests, verify-witness-lifecycle, proof-pack check, pytest.Wire orphans: Check which devtools scripts in
command_catalog.pyare not called from any verify path. Makeverify-cluster-cohesionandrender-topology-statusadvisory (they are already classified advisory in refactor(topology): keep structural gates at architectural boundaries #856). Tier gates as block/warn/info.Type hierarchy: ContentType/ContentBlockType unified, prepare_transform_content.py deleted
Location:
pipeline/materialization_runtime.pyimports/uses it. The file exists solely as a bridge between two parallel type families.Do NOT build this
ArchiveWriteGateway— it is actively used (corrected in comments).devtools verify-test-ownership's zero-uncovered as evidence of simplification success — it is an import map, not behavior coverage.Blob GC leasesif they are active in storage/blob_gc.py (verify first).Files to touch
devtools/validation_lane_catalog_composites.py,devtools/validation_lane_catalog_contracts.py,devtools/validation_lane_catalog_live.pydevtools/validation_lane_base.pydevtools/lane_models.pypolylogue/scenarios/projections.py,polylogue/scenarios/sources.py,polylogue/scenarios/executable.py,polylogue/scenarios/metadata.pypolylogue/proof/coverage_manifests.py,polylogue/proof/subjects.pypolylogue/storage/sqlite/async_sqlite_archive.py,polylogue/storage/sqlite/query_store_archive.pypolylogue/pipeline/materialization_runtime.pyprepare_transform_content.pybridge, unify type familiesdevtools/verify.pyCoordination
Focused tests
Acceptance criteria
CoverageSourcereplacement.ArchiveWriteGatewayNOT touched (actively used).prepare_transform_content.pydeleted.Close when: comment on this issue or the PR explicitly stating how each criterion was satisfied, deferred, or found misframed.
Ambiguities / Stale comments
archive/write_effects.pyandarchive/write_gateway.py. VERIFY before final closeout: check if daemon convergence work (future PRs) will remove its use.storage/blob_gc.pyandtests/unit/storage/test_blob_gc.pyexist. Verify before deletion.refactor(core): collapse validation lane DSL and remove dead code (#805)
15 remaining items
fix(types): zero mypy errors after #805 and #860 waves
fix(devtools): keep authored_scenario_catalog projection extend
refactor(core): delete dead validation_families, audit sync/async (#933)
refactor(devtools): collapse validation lane DSL (#901)
fix(types): targeted type-ignore for #805 simplification leftover
fix(types): one #805 type regression in authored catalog
fix(types): #805 validation_family fixtures and catalog
fix(types): #805 lane DSL leftover in render_quality_reference
fix(types): zero mypy errors after #805 and #860 waves
fix(devtools): keep authored_scenario_catalog projection extend
refactor(core): delete dead validation_families, audit sync/async (#933)
Sinity commentedon May 8, 2026
Reopened during the closed-issue audit.
The last implementation wave only completed a narrow subset of the simplification parent:
VALIDATION_FAMILYremoval and validation-family plumbing cleanup, with the comment itself marking several ACs as partial or out of scope. Remaining lanes such as scenario projection flattening, coverage-manifest consolidation, broader sync/async divergence cleanup, and type-family consolidation still need explicit ownership here or child issues.#944 should not classify this as completed by the baseline reconciliation work.
Sinity commentedon May 8, 2026
Closing: core implementation landed. Remaining edges are incremental.