Skip to content

refactor: tighten schema and lib semantic boundary precision #251

Closed

Description

@Sinity

Ref #250

Outcome

Renew the next substrate tranche around polylogue/schemas/ and polylogue/lib/, focusing on semantic precision rather than just strict-type acceptance.

Problem or opportunity

After the completed renewal program, the highest remaining weak-contract density is in schemas and lib. These modules are type-checked, but many runtime paths still move meaning through broad Any/object containers, repeated cast(...) use, and dict-shaped payload conventions that obscure the actual contract.

Expected scope

Likely modules include:

  • polylogue/schemas/field_stats_*
  • polylogue/schemas/relational_*
  • polylogue/schemas/schema_*
  • polylogue/lib/* modules that still center broad payload coercion or runtime result-shape adaptation
  • adjacent helpers that need to adopt the new contract shape

Constraints and invariants

  • Establish the contract shape in local anchor rewrites first.
  • Use workers only for narrow propagation after the anchor lands.
  • Prefer deleting duplicated coercion glue over layering more helpers on top.
  • Keep test fallout targeted to proof of the new contracts.

Acceptance criteria

  • Broad schema/lib payload flow is replaced with stronger aliases, explicit records, or narrowing helpers where appropriate.
  • Remaining cast pressure in the touched schema/lib slice is materially reduced.
  • The tranche lands as a coherent PR with devtools verify green.

Verification plan

Run devtools verify before merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:schematype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions