Skip to content

refactor(core): move outcome grammar out of lib - #664

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/core-outcomes-clean
May 1, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/core-outcomes-clean

Conversation

@Sinity

@Sinity Sinity commented May 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Move shared outcome status/report types from polylogue.lib.outcomes to polylogue.core.outcomes.

Problem

OutcomeStatus, OutcomeCheck, and OutcomeReport are cross-cutting result grammar used by readiness, maintenance, proof, schema audits, devtools, CLI rendering, and verification scenarios. Keeping them under lib made a central contract look like miscellaneous helper code.

Solution

Rename polylogue/lib/outcomes.py to polylogue/core/outcomes.py, update proof/readiness/schema/showcase/devtools/test imports, refresh topology, and keep no old-path shim.

Verification

  • devtools build-topology-projection && devtools verify-topology — realized=697 declared=697 blocking=False
  • ruff check polylogue/ tests/ devtools/ — all checks passed
  • mypy polylogue/ — no issues found in 697 source files
  • pytest -q tests/unit/lib/test_outcomes.py tests/unit/core/test_health_core.py tests/unit/cli/test_check_rendering_plain_runtime.py tests/unit/cli/test_deterministic_output.py tests/unit/proof/test_models.py tests/unit/proof/test_catalog.py tests/unit/proof/test_evidence_runners.py tests/unit/devtools/test_semantic_axis_evidence.py — 93 passed
  • devtools render-all --check — sync OK
  • pre-push devtools verify --quick — all checks passed

Ref #635

Summary by CodeRabbit

Release Notes

  • Refactor

    • Reorganized internal module dependencies and outcome-related functionality across multiple subsystems for improved code structure.
    • Updated topology configuration and ownership mappings to support the new organizational layout.
    • Adjusted internal dependency paths to enhance consistency and maintainability throughout the codebase.
  • Documentation

    • Updated generated topology reports to reflect the reorganized module structure.

Copilot AI review requested due to automatic review settings May 1, 2026 20:31
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 38

Affected Domains

  • architecture_discipline — 4 claim(s), maturity growing
  • benchmark_coverage — 0 claim(s), maturity seed
  • cli_surface — 0 claim(s), maturity established
  • distribution — 0 claim(s), maturity seed
  • docs_media — 0 claim(s), maturity seed
  • migration_safety — 0 claim(s), maturity nascent
  • mutation_coverage — 0 claim(s), maturity growing
  • operational_resilience — 14 claim(s), maturity seed
  • performance — 0 claim(s), maturity nascent
  • pipeline_correctness — 0 claim(s), maturity growing
  • provider_coverage — 0 claim(s), maturity growing
  • scenario_coverage — 0 claim(s), maturity nascent
  • schema_correctness — 1 claim(s), maturity growing
  • security_privacy — 0 claim(s), maturity nascent
  • site_publication — 0 claim(s), maturity seed
  • spec_accuracy — 0 claim(s), maturity seed
  • spec_completeness — 3 claim(s), maturity seed
  • storage_correctness — 0 claim(s), maturity established
  • surface_parity — 1 claim(s), maturity nascent
  • test_quality — 1 claim(s), maturity growing
  • unclassified — 18 claim(s), maturity seed

Required Gates

  • devtools verify-manifests — structural manifest changed
  • devtools affected-obligations --path devtools/build_topology_projection.py — refresh structural obligation routing
  • devtools verify-topology — topology projection changed
  • devtools affected-obligations --path docs/plans/topology-target.yaml — refresh structural obligation routing
  • devtools affected-obligations --path docs/topology-status.md — refresh structural obligation routing
  • pytest tests/unit/proof — proof kernel or catalog changed
  • pytest tests/unit/devtools/test_render_verification_catalog.py — catalog renderer changed
  • devtools render-verification-catalog --check — verification catalog must stay current
  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit
  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • distribution: dev_install: Not verified in CI; devshell is canonical environment [owner: distribution; next: Add package/build or cross-artifact CI gate], distribution: No scenario for install/package verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], install_parity: No cross-artifact equivalence verification (wheel vs sdist vs Nix) [owner: distribution; next: Add package/build or cross-artifact CI gate], macos: No macOS CI runner [owner: distribution; next: Add package/build or cross-artifact CI gate], sdist: Not built or tested in CI [owner: distribution; next: Add package/build or cross-artifact CI gate], wheel: Not built or tested in CI [owner: distribution; next: Add package/build or cross-artifact CI gate], windows: No Windows CI runner [owner: distribution; next: Add package/build or cross-artifact CI gate]
  • docs_media: docs_media: No scenario for documentation freshness verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], docs_media: README examples and media are not yet generated from executable scenario projections. [owner: docs-media; next: Add executable scenario projection or media integrity gate], docs_media: Screenshots and VHS media have no committed nonblank/readability verification. [owner: docs-media; next: Add executable scenario projection or media integrity gate]
  • migration_safety: migration_safety: No scenario for migration safety verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject]
  • performance: performance: No scenario family exercising memory or throughput budgets [owner: scenario-coverage; next: Add scenario family or generated projection for this subject]
  • security_privacy: dependency_audit: No dependency vulnerability scanning in CI [owner: security-privacy; next: Add dedicated security/privacy gate for this area], file_permissions: Crawl-source file permissions not verified [owner: security-privacy; next: Add dedicated security/privacy gate for this area], secrets_detection: No automated secrets scanning in CI [owner: security-privacy; next: Add dedicated security/privacy gate for this area], security_privacy: Security verification uses unit tests, not scenario specs [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], xss_prevention: No dedicated XSS test file; relies on snapshot rendering [owner: security-privacy; next: Add dedicated security/privacy gate for this area]
  • site_publication: site_publication: Static-site publication has no visual or hyperlink integrity gate. [owner: docs-media; next: Add executable scenario projection or media integrity gate]
  • storage_correctness: storage_correctness: No dedicated scenario family for storage-layer verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject]
  • test_quality: direct_coverage: Coverage per-module not tracked (only aggregate fail_under) [owner: test-quality; next: Add measurable quality gate for this dimension], flakiness: No systematic flakiness tracking, CI retry, or quarantine [owner: test-quality; next: Add measurable quality gate for this dimension], fuzz: Atheris fuzz targets not run in CI [owner: test-quality; next: Add measurable quality gate for this dimension], mock_depth: Mock depth not measured or enforced [owner: test-quality; next: Add measurable quality gate for this dimension]

Oracle / Cost

  • oracle mix: {"construction_sanity": 524, "drift_check": 5, "manual_review": 1, "proof": 37, "smoke": 12}
  • cost tier: {"static": 563, "unit": 16}
  • stale evidence: 579
  • manual review cells: 1

@Sinity
Sinity merged commit ee04ccb into master May 1, 2026
14 of 15 checks passed
@Sinity
Sinity deleted the feature/refactor/core-outcomes-clean branch May 1, 2026 20:32
@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 969fc72c-8700-4e7b-98ea-9e6d3177a38b

📥 Commits

Reviewing files that changed from the base of the PR and between f3894e4 and eb40777.

📒 Files selected for processing (38)
  • devtools/build_topology_projection.py
  • devtools/semantic_axis_evidence.py
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/core/outcomes.py
  • polylogue/maintenance/targets.py
  • polylogue/proof/catalog.py
  • polylogue/proof/models.py
  • polylogue/proof/rendering.py
  • polylogue/proof/runners.py
  • polylogue/readiness/__init__.py
  • polylogue/schemas/audit/checks.py
  • polylogue/schemas/audit/models.py
  • polylogue/schemas/audit/workflow.py
  • polylogue/showcase/invariants.py
  • polylogue/showcase/qa_markdown.py
  • polylogue/showcase/qa_runner_models.py
  • polylogue/showcase/report_common.py
  • tests/unit/archive/test_query_miss_diagnostics.py
  • tests/unit/cli/test_check_rendering_plain_runtime.py
  • tests/unit/cli/test_deterministic_output.py
  • tests/unit/cli/test_schema_helper_runtime.py
  • tests/unit/core/test_audit.py
  • tests/unit/devtools/test_schema_lab_commands.py
  • tests/unit/devtools/test_semantic_axis_evidence.py
  • tests/unit/lib/test_outcomes.py
  • tests/unit/proof/test_catalog.py
  • tests/unit/proof/test_evidence_runners.py
  • tests/unit/proof/test_generated_scenario_obligations.py
  • tests/unit/proof/test_models.py
  • tests/unit/proof/test_schema_provider_obligations.py
  • tests/unit/proof/test_structural_error_evidence.py
  • tests/unit/proof/test_trace_evidence.py
  • tests/unit/showcase/test_invariants_runtime.py
  • tests/unit/showcase/test_operator_reporting_runtime.py
  • tests/unit/showcase/test_qa_runner.py
  • tests/unit/showcase/test_qa_workflow_runtime.py
  • tests/unit/showcase/test_report.py

📝 Walkthrough

Walkthrough

This PR relocates outcome types (OutcomeStatus, OutcomeCheck, OutcomeReport) from polylogue.lib.outcomes to polylogue.core.outcomes. Build topology configuration, import statements across 30+ source and test files, and documentation metrics are updated to reflect the new module location.

Changes

Cohort / File(s) Summary
Build & Topology Configuration
devtools/build_topology_projection.py, docs/plans/topology-target.yaml, docs/topology-status.md
Updates build topology rules and documentation: removes outcomes.py from lib-root primitives, maps it to core-primitive, and adjusts target/status metrics (core primitives: 7→8, aggregated primitives: 23→22).
Core Outcome Type Consumers
polylogue/maintenance/targets.py, polylogue/proof/catalog.py, polylogue/proof/models.py, polylogue/proof/rendering.py, polylogue/proof/runners.py
Update OutcomeStatus/OutcomeCheck imports from polylogue.lib.outcomes to polylogue.core.outcomes; no logic changes.
Readiness & Schemas
polylogue/readiness/__init__.py, polylogue/schemas/audit/checks.py, polylogue/schemas/audit/models.py, polylogue/schemas/audit/workflow.py
Redirect outcome type imports to polylogue.core.outcomes; readiness re-exports and audit check construction remain functionally unchanged.
Showcase & Reporting
polylogue/showcase/invariants.py, polylogue/showcase/qa_markdown.py, polylogue/showcase/qa_runner_models.py, polylogue/showcase/report_common.py
Switch OutcomeStatus source from polylogue.lib.outcomes to polylogue.core.outcomes; invariant and QA result logic unchanged.
Unit Tests
tests/unit/archive/test_query_miss_diagnostics.py, tests/unit/cli/test_*.py, tests/unit/core/test_audit.py, tests/unit/devtools/test_*.py, tests/unit/lib/test_outcomes.py, tests/unit/proof/test_*.py, tests/unit/showcase/test_*.py
Update test imports of OutcomeStatus/OutcomeCheck to source from polylogue.core.outcomes; all assertions and test logic remain unchanged.
Semantic & Import Metadata
devtools/semantic_axis_evidence.py
Adjusts OutcomeStatus import source for consistency with the overall outcome type relocation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

type:refactor, area:cli, area:schema, area:qa, tool:claude

Poem

🐰 From lib's old ground to core's new nest,
Outcomes migrate to pass their test.
Import paths shift, yet logic stays—
A tidy move for cleaner days! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/core-outcomes-clean

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the shared “outcome” result grammar (status/check/report types) into the core primitives layer so cross-cutting verification/readiness/reporting code depends on polylogue.core instead of polylogue.lib.

Changes:

  • Added polylogue.core.outcomes with OutcomeStatus, OutcomeCheck, OutcomeCounts, and OutcomeReport.
  • Updated runtime and test imports across showcase/proof/schemas/readiness/devtools/CLI to use polylogue.core.outcomes.
  • Updated topology plan + generated topology status to reflect the move.

Reviewed changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/showcase/test_report.py Update imports to polylogue.core.outcomes.
tests/unit/showcase/test_qa_workflow_runtime.py Update imports to polylogue.core.outcomes.
tests/unit/showcase/test_qa_runner.py Update imports to polylogue.core.outcomes.
tests/unit/showcase/test_operator_reporting_runtime.py Update imports to polylogue.core.outcomes.
tests/unit/showcase/test_invariants_runtime.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_trace_evidence.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_structural_error_evidence.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_schema_provider_obligations.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_models.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_generated_scenario_obligations.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_evidence_runners.py Update imports to polylogue.core.outcomes.
tests/unit/proof/test_catalog.py Update imports to polylogue.core.outcomes.
tests/unit/lib/test_outcomes.py Point outcomes tests at polylogue.core.outcomes.
tests/unit/devtools/test_semantic_axis_evidence.py Update imports to polylogue.core.outcomes.
tests/unit/devtools/test_schema_lab_commands.py Update imports to polylogue.core.outcomes.
tests/unit/core/test_audit.py Update imports to polylogue.core.outcomes.
tests/unit/cli/test_schema_helper_runtime.py Update imports to polylogue.core.outcomes.
tests/unit/cli/test_deterministic_output.py Update imports to polylogue.core.outcomes.
tests/unit/cli/test_check_rendering_plain_runtime.py Update imports to polylogue.core.outcomes.
tests/unit/archive/test_query_miss_diagnostics.py Update imports to polylogue.core.outcomes.
polylogue/showcase/report_common.py Update imports to polylogue.core.outcomes.
polylogue/showcase/qa_runner_models.py Update imports to polylogue.core.outcomes.
polylogue/showcase/qa_markdown.py Update imports to polylogue.core.outcomes.
polylogue/showcase/invariants.py Update imports to polylogue.core.outcomes.
polylogue/schemas/audit/workflow.py Update imports to polylogue.core.outcomes.
polylogue/schemas/audit/models.py Update imports to polylogue.core.outcomes.
polylogue/schemas/audit/checks.py Update imports to polylogue.core.outcomes.
polylogue/readiness/init.py Update imports/re-exports to source outcomes from core.
polylogue/proof/runners.py Update imports to polylogue.core.outcomes.
polylogue/proof/rendering.py Update imports to polylogue.core.outcomes.
polylogue/proof/models.py Update imports to polylogue.core.outcomes.
polylogue/proof/catalog.py Update imports to polylogue.core.outcomes.
polylogue/maintenance/targets.py Update imports to polylogue.core.outcomes.
polylogue/core/outcomes.py New canonical implementation of shared outcome grammar under core.
docs/topology-status.md Update generated counts for core-primitive / primitives after the move.
docs/plans/topology-target.yaml Declare polylogue/core/outcomes.py under core-primitive and remove polylogue/lib/outcomes.py.
devtools/semantic_axis_evidence.py Update imports to polylogue.core.outcomes.
devtools/build_topology_projection.py Remove outcomes.py from LIB_ROOT_PRIMITIVES list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Move shared outcome status/report types from `polylogue.lib.outcomes` to
`polylogue.core.outcomes`.

## Problem

`OutcomeStatus`, `OutcomeCheck`, and `OutcomeReport` are cross-cutting
result grammar used by readiness, maintenance, proof, schema audits,
devtools, CLI rendering, and verification scenarios. Keeping them under
`lib` made a central contract look like miscellaneous helper code.

## Solution

Rename `polylogue/lib/outcomes.py` to `polylogue/core/outcomes.py`,
update proof/readiness/schema/showcase/devtools/test imports, refresh
topology, and keep no old-path shim.

## Verification

- `devtools build-topology-projection && devtools verify-topology` —
realized=697 declared=697 blocking=False
- `ruff check polylogue/ tests/ devtools/` — all checks passed
- `mypy polylogue/` — no issues found in 697 source files
- `pytest -q tests/unit/lib/test_outcomes.py
tests/unit/core/test_health_core.py
tests/unit/cli/test_check_rendering_plain_runtime.py
tests/unit/cli/test_deterministic_output.py
tests/unit/proof/test_models.py tests/unit/proof/test_catalog.py
tests/unit/proof/test_evidence_runners.py
tests/unit/devtools/test_semantic_axis_evidence.py` — 93 passed
- `devtools render-all --check` — sync OK
- pre-push `devtools verify --quick` — all checks passed

Ref #635
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.

2 participants