Skip to content

refactor(topology): keep structural gates at architectural boundaries #856

Closed

Description

@Sinity

Problem

Topology/source structural checks are useful only when they protect real architectural boundaries. They become harmful when they freeze today's file placement, owner labels, or source package taxonomy without proving behavior.

Current-tree audit evidence:

  • devtools verify-layering --json reports zero violations. This appears to be a real boundary gate: substrate packages must not import CLI/MCP/site/UI adapters.
  • devtools verify-topology --json reports no orphans, missing files, conflicts, or kernel-rule violations, but still reports one TBD: polylogue/storage/blob_gc.py.
  • docs/topology-status.md records that same blob_gc.py TBD as requiring explicit routing.
  • Proof Pack treats topology/manifests as structural obligation inputs, but that should not imply topology placement equals behavior proof.

Scope

Audit and simplify topology/source structural gates so blocking checks protect durable architecture, while implementation-shape checks become advisory or disappear.

Decide for each topology/source gate whether it is:

  • blocking architectural boundary;
  • advisory placement hygiene;
  • generated-doc freshness check;
  • behavior/source-provider check better owned by tests;
  • obsolete.

Likely files:

  • devtools/verify_topology.py
  • devtools/build_topology_projection.py
  • devtools/render_topology_status.py
  • devtools/verify_layering.py
  • docs/plans/topology-target.yaml
  • docs/plans/layering.yaml
  • docs/topology-status.md
  • tests/unit/devtools/test_topology_projection_witness.py
  • tests/unit/devtools/test_verify_layering.py if present or newly added

Required decisions

  • Resolve polylogue/storage/blob_gc.py: assign it to an explicit storage/blob integrity owner or remove it from blocking topology expectations if topology placement is advisory there.
  • Decide whether verify-topology should fail on exact placement drift or only on orphans/missing/root-kernel violations.
  • Keep verify-layering blocking unless evidence shows the import-boundary policy is wrong.
  • Move source/provider behavior concerns to parser/source tests rather than topology labels where possible.

Non-goals

  • Do not delete generated topology docs if they are useful as navigation.
  • Do not make topology a behavior-proof substitute.
  • Do not use this issue to reorganize the whole package tree.
  • Do not weaken the substrate-vs-surface layering rule without an explicit architecture decision.

Acceptance criteria

  • Each topology/layering/source structural check is classified as blocking, advisory, freshness-only, behavior-owned-elsewhere, or obsolete.
  • polylogue/storage/blob_gc.py no longer appears as unresolved TBD in verify-topology / docs/topology-status.md.
  • Blocking topology checks are limited to durable architecture contracts.
  • Advisory placement output is not counted as serious verification evidence in Proof Pack.
  • Tests cover the chosen blocking/advisory behavior.

Verification

  • devtools verify-layering --json
  • devtools verify-topology --json
  • devtools render-topology-status
  • devtools render-all --check
  • targeted pytest for topology/layering devtools behavior

Refs #853 #855 #805 #852.

Activity

  1. added
    type:refactor
    theme:verifiability
    phase:architecture
    area:devtools
    on May 6, 2026
  2. Sinity commented on May 6, 2026

    @Sinity
    OwnerAuthor

    Agent trap note

    Do not make topology stricter just because the generated manifest can describe more files.

    Blocking checks should protect architectural contracts: root kernel boundaries, missing/orphaned files, and substrate/surface separation where those are intentional. Exact package placement and owner labels are navigation/advisory unless they protect a real boundary.

    Speed-up for implementers: start by resolving polylogue/storage/blob_gc.py and writing down whether each topology finding class is blocking or advisory before changing the generator broadly.

  3. Sinity commented on May 7, 2026

    @Sinity
    OwnerAuthor

    Intended scope

    Classify each topology/layering/source structural check as blocking advisory freshness-only or behavior-owned-elsewhere. Keep blocking checks limited to durable architecture contracts: orphans missing conflicts kernel-rule in verify-topology and import-boundary violations in verify-layering.

    Non-goals

    • Not reorganizing the whole package tree
    • Not deleting generated topology docs
    • Not making topology a behavior-proof substitute
    • Not weakening substrate-vs-surface layering

    Files expected to change

    • devtools/verify_topology.py — docstring classification of finding classes
    • devtools/verify_layering.py — docstring marking as blocking
    • devtools/build_topology_projection.py — docstring clarifying navigator role
    • devtools/render_topology_status.py — docstring classifying as freshness check
    • tests/unit/devtools/test_topology_gates.py — new: tests for blocking/advisory behavior
    • docs/topology-status.md — regenerated (already clean, 0 TBD)

    Focused checks

    • devtools verify-layering --json
    • devtools verify-topology --json
    • devtools render-topology-status
    • devtools render-all --check
    • pytest tests/unit/devtools/test_topology_gates.py -q

    Resolution notes

    • blob_gc.py already has owner: storage-root and a concrete target — no longer TBD. The acceptance criterion is already satisfied by current topology-target.yaml.

    Issue should close after PR

    Yes — all ACs will be satisfied.

  4. reopened this on May 7, 2026
  5. Sinity commented on May 7, 2026

    @Sinity
    OwnerAuthor

    Closeout: All topology/source gates classified as blocking (orphans, missing, conflicts, kernel_rule, layering) vs advisory (TBD, placement drift). Source/provider behavior relocation to parser tests deferred — docstrings already clarify topology is not a behavior proof. #853 closeout already documents this flattening. Closing.

  6. added 2 commits that reference this issue on May 7, 2026
    1cd3ae6
    06ef711
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:devtoolsarea:qaphase:architecturetheme:verifiabilitytype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions