Skip to content

refactor(artifacts): move catalog declarations out of package root #599

Closed

Description

@Sinity

Scope

Concrete source-organization issue for splitting the runtime artifact catalog out of polylogue/artifacts/__init__.py and making artifact/proof/catalog ownership easier to audit.

Problem

polylogue/artifacts/__init__.py is a 1,072-line package-root module that defines artifact descriptors, operations, readiness surfaces, and graph-adjacent catalog data. This makes the package root load-bearing and makes it harder to tell which declarations are runtime artifacts, proof subjects, operation specs, or docs/rendering support.

Concrete split target (from comment thread)

The module already has clear internal sections. A natural split:

artifacts/
  __init__.py       # re-exports only, ~30 lines (intentional public API)
  descriptors.py    # artifact enum, artifact kinds, metadata
  operations.py     # operation specs, stage sequences
  readiness.py      # readiness checks, health surfaces
  catalog.py        # catalog data, graph-adjacent declarations
  graph.py          # (existing, keep)

Before starting

Check the public API surface that must stay stable:

rg "from polylogue\.artifacts import|from polylogue\.artifacts\." \
   polylogue/ devtools/ tests/ --no-heading | sort -u

Acceptance criteria

  • Move runtime artifact catalog declarations out of the package root into explicit modules (descriptors, operations, readiness, catalog).
  • Package root exports only intentional public API; no internal compatibility shims.
  • Update proof subject, operation, scenario, and docs/rendering consumers to import from the new ownership modules.
  • Add package-root budget/layering check so catalog declarations do not regrow in __init__.py.
  • Generated docs/proof surfaces are regenerated from the new owners, not from compatibility re-exports.
  • Topology/file-budget checks prevent a new package-root catalog from forming again.

Relationship to other issues

Ref #578
Ref #594
Ref #634
Ref #635

Activity

  1. added
    type:refactor
    area:core
    on May 1, 2026
  2. changed the title [-]refactor(artifacts): split runtime artifact catalog out of package root[/-] [+]refactor(artifacts): move catalog declarations out of package root[/+] on May 1, 2026
  3. Sinity commented on May 1, 2026

    @Sinity
    OwnerAuthor

    Source-layout guard: moving declarations out of polylogue/artifacts/__init__.py should also remove package-root side effects.

    Suggested acceptance additions:

    • package root exports only intentional public API and cheap symbols;
    • runtime artifact descriptors, operation specs, proof/catalog adapters, and docs/rendering support live in separate ownership modules;
    • imports are updated so consumers import from the owner module unless they are deliberately using public API;
    • topology/file-budget checks prevent a new package-root catalog from forming again;
    • generated docs/proof surfaces are regenerated from the new owners, not from compatibility re-exports.

    This is narrower than #634, but it should establish the pattern for future package-root cleanup.

  4. Sinity commented on May 1, 2026

    @Sinity
    OwnerAuthor

    Implementation anchors and acceptance additions from the 2026-05-01 follow-up audit.

    Code anchors:

    • polylogue/artifacts/__init__.py: 1,072 lines.
    • polylogue/artifacts/__init__.py:11-60: core artifact models/enums.
    • polylogue/artifacts/__init__.py:63+: huge runtime artifact catalog.
    • polylogue/artifacts/__init__.py:900-1053: artifact path declarations.
    • polylogue/artifacts/__init__.py:1056-1072: builders and exports.
    • docs/plans/topology-target.yaml:143-146: topology already records this package-root growth.

    Acceptance additions:

    • Split into models.py, runtime_nodes.py or catalog.py, runtime_paths.py, and registry.py; keep polylogue.artifacts as a deliberate re-export boundary only.
    • Add package-root budget/layering check so catalog declarations do not regrow in __init__.py.
    • Update proof subject, operation, scenario, docs/rendering imports to point to ownership modules.

    This can land before #634 as a low-risk structural slice.

  5. Sinity commented on May 1, 2026

    @Sinity
    OwnerAuthor

    Artifact layout integration from 2026-05-01 bundle

    This issue remains a concrete source-organization slice under the package-boundary decision in #634/#635.

    Clarifications from the integrated bundle:

    • package-root re-exports should be intentional public API only, not internal compatibility shims;
    • move catalog declarations to owner modules and update consumers directly;
    • use no old import aliases unless a public API exception is explicitly chosen;
    • topology/file-budget checks should prevent __init__.py from becoming a catalog bin again.

    This is not superseded by the already-merged lib cleanup PRs. It is still a good low-risk structural slice before or alongside the larger storage/sqlite, proof, and devtools splits.

    Ref #634
    Ref #635

  6. Sinity commented on May 2, 2026

    @Sinity
    OwnerAuthor

    Current state

    polylogue/artifacts/__init__.py is now 1072 lines with one sibling module graph.py (112 lines). It defines artifact descriptors, operations, readiness surfaces, and graph-adjacent catalog data — all in the package root.

    Concrete split suggestion

    The module already has clear internal sections. A natural split:

    artifacts/
      __init__.py       # re-exports only, ~30 lines
      descriptors.py    # artifact enum, artifact kinds, metadata
      operations.py     # operation specs, stage sequences
      readiness.py      # readiness checks, health surfaces
      catalog.py        # catalog data, graph-adjacent declarations
      graph.py          # (existing, keep)
    

    The key invariant: polylogue.artifacts imports must stay stable for external consumers. Check who imports from polylogue.artifacts before deciding which symbols remain re-exported at package level.

    Check before starting

    rg "from polylogue\.artifacts import|from polylogue\.artifacts\." polylogue/ devtools/ tests/ --no-heading | sort -u

    This will show the public API surface that must stay stable through the split.

  7. Sinity commented on May 3, 2026

    @Sinity
    OwnerAuthor

    Closed by #752. Verify: wc -l polylogue/artifacts/__init__.py → 21 lines (was 1072).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corearea:docstool:codextype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions