Repository navigation
Description
Problem
The schema/runtime precision tranche in #280 removes another central weak-contract cluster, but the remaining non-CLI residue is still concentrated in a utility/runtime band that sits under multiple surfaces:
polylogue/schemas/privacy.pypolylogue/schemas/audit_models.pypolylogue/schemas/redaction_report.pypolylogue/scenarios/runtime.pypolylogue/pipeline/prepare.pypolylogue/lib/query_sorting.pypolylogue/lib/query_plan.pypolylogue/lib/outcomes.py
These files are not blocked on missing annotations. They are blocked on semantically weak utility contracts: Any-typed query/runtime helpers, payload reports that still serialize through broad dicts, and runtime wrappers that hide the real shape of their inputs and outputs.
Outcome
Run a non-CLI utility/runtime precision tranche that replaces the remaining weak helper and report contracts here with explicit typed helpers, narrower payload models, and cleaner sort/prepare/runtime interfaces.
Acceptance Criteria
privacy.py,audit_models.py, andredaction_report.pyexpose typed payload/report surfaces instead ofdict[str, Any]style serialization.scenarios/runtime.pyandpipeline/prepare.pystop using their current broadAnyruntime arguments where a stable typed protocol or narrower input contract is possible.lib/query_sorting.py,lib/query_plan.py, andlib/outcomes.pyreduce their remainingAny-typed sort/result helpers in favor of explicit generic or typed result contracts.- Adjacent tests are updated where those contracts are exercised so the renewed helpers are proven rather than just annotated.
ruff check,mypy, and targeted pytest slices pass for the touched tranche before PR.
Notes
This tranche should stay away from the active CLI/query-surface work and keep the scope on reusable substrate/runtime utilities only.
Activity
test: type core verification and semantic contracts
test: type mcp and ui surface contracts
refactor: tighten privacy audit and runtime contracts (#283)
refactor: remove dynamic seam Any typing (#284)
refactor: promote schema relation and core test contracts (#285)
test: type core verification and semantic contracts (#286)
test: type strategy and infra contracts (#287)
test: type mcp and ui surface contracts (#288)
test: type cli command contracts (#289)
test: type storage contracts (#290)
test: type pipeline contracts (#291)
40 remaining items
test: type storage contracts (#290)
test: type pipeline contracts (#291)
test: type source parser contracts (#292)
test: type integration workflow contracts (#293)
test: type remaining test contracts (#294)
refactor: remove stale typing suppressions (#295)
refactor: split ingest pipeline runtimes (#297)
Sinity commentedon Apr 22, 2026
Starting #281 on
feature/refactor/privacy-audit-runtime-contracts.Initial boundary:
Planned verification before PR: targeted
ruff check,mypy, focused pytest slices for the touched files, and a fulldevtools verifyif the tranche crosses enough shared substrate to justify it.Sinity commentedon Apr 22, 2026
Implementation checkpoint for #281 on
feature/refactor/privacy-audit-runtime-contracts:Commits so far:
1b56e028refactor(schema): type privacy and audit report contractsac7fabadrefactor(runtime): narrow execution and query contractsWhat changed:
SchemaPrivacyConfigprotocol and routed schema generation/privacy guard helpers through it instead of duplicating partial privacy protocols.PrepareRepositoryprotocol for prepare persistence.Focused verification so far:
ruff checkover touched files -> passedmypyover touched files and adjacent tests -> passedpytest -q tests/unit/core/test_audit.py tests/unit/core/test_redaction_report.py tests/unit/core/test_schema_privacy.py tests/unit/core/test_privacy_config.py tests/unit/core/test_schema_generation.py tests/unit/scenarios/test_runtime.py tests/unit/lib/test_outcomes.py tests/unit/core/test_query_fields.py tests/unit/pipeline/test_prepare_records.py-> 221 passedSinity commentedon Apr 22, 2026
Verification update for #281:
Full local baseline now passes:
devtools verify-> all checks passedOne issue surfaced during the first full run and is fixed in the branch:
ConversationFilter._sql_pushdown_params()still advertiseddict[str, object]after the query plan contract narrowed toSqlPushdownParams. I folded that adjacent call-site fix into the runtime/query commit before rerunning the full baseline.Current commits:
1b56e028refactor(schema): type privacy and audit report contractsf3acafacrefactor(runtime): narrow execution and query contractsSinity commentedon Apr 22, 2026
PR opened for #281:
refactor: renew privacy audit runtime contracts (#369)1b56e028refactor(schema): type privacy and audit report contractsf3acafacrefactor(runtime): narrow execution and query contractsVerification in PR body includes the focused ruff/mypy/pytest slices, full
devtools verify, and pre-push quick verification.refactor: renew privacy audit runtime contracts (#369)
Sinity commentedon Apr 22, 2026
Closeout for #281:
b54a0516ae11b8e3e0c92e00093e7162f6e677b1Verification:
ruff check-> passedmypy-> passeddevtools verify-> all checks passedRemote completed checks were green before merge; the long Python matrix/CodeQL jobs were still in progress and accepted under the current CI-quota constraint after full local verification.
refactor: renew privacy audit runtime contracts (#369)