Repository navigation
refactor: renew privacy audit runtime contracts (#369) - #369
Conversation
Problem: #281 identified the privacy, schema audit, and redaction report layer as a remaining weak-contract band where machine payloads were assembled as broad inline dictionaries and privacy config protocols were duplicated across generation helpers. What changed: add a shared SchemaPrivacyConfig protocol, route generation privacy helpers through it, and give outcome, audit, redaction decision, field, and summary payloads typed to_json surfaces. The report JSON output now delegates to those typed payload objects instead of ad hoc nested dict assembly. Verification: ruff check on touched files; mypy on touched schema/outcome files and tests; pytest -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/lib/test_outcomes.py. Ref #281
Problem: #281 also called out reusable runtime/query helpers whose public contracts were broader than their actual behavior, including untyped runner dispatch, storage pushdown params, sorting/finalization inputs, and prepare persistence dependencies. What changed: add typed runner invocation and generic runner dispatch, make synthetic benchmark runners consume that typed path, define SQL pushdown value contracts, introduce a minimal query sort protocol and result window, and narrow prepare persistence to a PrepareRepository protocol instead of a concrete repository class. Verification: ruff check on touched files; mypy on touched runtime/query/prepare files and tests; pytest -q tests/unit/scenarios/test_runtime.py tests/unit/core/test_query_fields.py tests/unit/pipeline/test_prepare_records.py. Ref #281
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 49 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (25)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
## Summary Renew the non-CLI privacy, audit, runtime, query, and prepare helper contracts named in #281. Closes #281 ## Problem The remaining utility/runtime precision tranche was no longer mostly missing annotations; it was still broad at semantic boundaries. Privacy config behavior was described through duplicate partial protocols, schema audit and redaction JSON payloads were assembled as inline dictionaries, runner dispatch returned opaque objects even when the authored execution was runner-backed, SQL pushdown params were exposed as `dict[str, object]`, query sorting consumed the full query plan instead of the actual sort/window surface, and prepare persistence depended on the concrete repository class. ## Solution - Added a shared `SchemaPrivacyConfig` protocol and routed schema generation privacy helpers through it. - Added typed payload surfaces for `OutcomeCounts`, `AuditSummary`, audit check JSON, redaction decisions, field reports, and schema redaction summaries. - Added typed runner invocation and generic `dispatch_runner_execution`, and moved synthetic benchmark dispatch to the typed runner path. - Added explicit SQL pushdown value/params contracts and updated query plan/filter call sites. - Added a minimal query sort protocol plus `ResultWindow` for finalization. - Added `PrepareRepository` as the persistence protocol needed by record preparation. - Extended focused tests for audit/redaction payloads, outcome counts, runner dispatch, and query pushdown contracts. ## Verification - `ruff check polylogue/schemas/privacy_config.py polylogue/schemas/privacy.py polylogue/schemas/generation_support.py polylogue/schemas/generation_schema_builder.py polylogue/schemas/generation_workflow.py polylogue/schemas/generation_provider_bundle.py polylogue/schemas/generation_provider_bundle_packages.py polylogue/schemas/generation_redaction.py polylogue/schemas/generation_field_annotations.py polylogue/schemas/redaction_report.py polylogue/schemas/audit_models.py polylogue/lib/outcomes.py polylogue/lib/query_sorting.py polylogue/lib/query_fields.py polylogue/lib/query_plan.py polylogue/scenarios/runtime.py polylogue/scenarios/__init__.py devtools/benchmark_campaigns.py polylogue/pipeline/prepare.py tests/unit/core/test_audit.py tests/unit/core/test_redaction_report.py tests/unit/scenarios/test_runtime.py tests/unit/lib/test_outcomes.py tests/unit/core/test_query_fields.py` -> all checks passed - `mypy polylogue/schemas/privacy.py polylogue/schemas/privacy_config.py polylogue/schemas/audit_models.py polylogue/schemas/redaction_report.py polylogue/schemas/generation_support.py polylogue/schemas/generation_schema_builder.py polylogue/schemas/generation_workflow.py polylogue/schemas/generation_provider_bundle.py polylogue/schemas/generation_provider_bundle_packages.py polylogue/schemas/generation_redaction.py polylogue/schemas/generation_field_annotations.py polylogue/scenarios/runtime.py polylogue/scenarios/__init__.py devtools/benchmark_campaigns.py polylogue/pipeline/prepare.py polylogue/lib/query_sorting.py polylogue/lib/query_fields.py polylogue/lib/query_plan.py polylogue/lib/outcomes.py tests/unit/core/test_audit.py tests/unit/core/test_redaction_report.py tests/unit/scenarios/test_runtime.py tests/unit/lib/test_outcomes.py tests/unit/core/test_query_fields.py` -> success - `pytest -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 passed - `devtools verify` -> all checks passed - `git push -u origin feature/refactor/privacy-audit-runtime-contracts` -> pre-push quick verification passed
Summary
Renew the non-CLI privacy, audit, runtime, query, and prepare helper contracts named in #281.
Closes #281
Problem
The remaining utility/runtime precision tranche was no longer mostly missing annotations; it was still broad at semantic boundaries. Privacy config behavior was described through duplicate partial protocols, schema audit and redaction JSON payloads were assembled as inline dictionaries, runner dispatch returned opaque objects even when the authored execution was runner-backed, SQL pushdown params were exposed as
dict[str, object], query sorting consumed the full query plan instead of the actual sort/window surface, and prepare persistence depended on the concrete repository class.Solution
SchemaPrivacyConfigprotocol and routed schema generation privacy helpers through it.OutcomeCounts,AuditSummary, audit check JSON, redaction decisions, field reports, and schema redaction summaries.dispatch_runner_execution, and moved synthetic benchmark dispatch to the typed runner path.ResultWindowfor finalization.PrepareRepositoryas the persistence protocol needed by record preparation.Verification
ruff check polylogue/schemas/privacy_config.py polylogue/schemas/privacy.py polylogue/schemas/generation_support.py polylogue/schemas/generation_schema_builder.py polylogue/schemas/generation_workflow.py polylogue/schemas/generation_provider_bundle.py polylogue/schemas/generation_provider_bundle_packages.py polylogue/schemas/generation_redaction.py polylogue/schemas/generation_field_annotations.py polylogue/schemas/redaction_report.py polylogue/schemas/audit_models.py polylogue/lib/outcomes.py polylogue/lib/query_sorting.py polylogue/lib/query_fields.py polylogue/lib/query_plan.py polylogue/scenarios/runtime.py polylogue/scenarios/__init__.py devtools/benchmark_campaigns.py polylogue/pipeline/prepare.py tests/unit/core/test_audit.py tests/unit/core/test_redaction_report.py tests/unit/scenarios/test_runtime.py tests/unit/lib/test_outcomes.py tests/unit/core/test_query_fields.py-> all checks passedmypy polylogue/schemas/privacy.py polylogue/schemas/privacy_config.py polylogue/schemas/audit_models.py polylogue/schemas/redaction_report.py polylogue/schemas/generation_support.py polylogue/schemas/generation_schema_builder.py polylogue/schemas/generation_workflow.py polylogue/schemas/generation_provider_bundle.py polylogue/schemas/generation_provider_bundle_packages.py polylogue/schemas/generation_redaction.py polylogue/schemas/generation_field_annotations.py polylogue/scenarios/runtime.py polylogue/scenarios/__init__.py devtools/benchmark_campaigns.py polylogue/pipeline/prepare.py polylogue/lib/query_sorting.py polylogue/lib/query_fields.py polylogue/lib/query_plan.py polylogue/lib/outcomes.py tests/unit/core/test_audit.py tests/unit/core/test_redaction_report.py tests/unit/scenarios/test_runtime.py tests/unit/lib/test_outcomes.py tests/unit/core/test_query_fields.py-> successpytest -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 passeddevtools verify-> all checks passedgit push -u origin feature/refactor/privacy-audit-runtime-contracts-> pre-push quick verification passed