Skip to content

Refactor policy doctor registration into focused modules #106295

Closed

Description

@steipete

Summary

extensions/policy/src/doctor/register.ts has grown to roughly 5,600 lines and mixes registration, evaluation orchestration, shape validation, policy evidence checks, scoped policy handling, and artifact I/O.

Scope

Split the module into focused policy-doctor components while preserving the existing register.ts public surface and runtime behavior.

Acceptance criteria

  • register.ts remains the stable registration/export facade.
  • Policy evaluation order, findings, repairs, and cache behavior remain unchanged.
  • The Policy extension test suite and changed extension gates pass.
  • The refactor introduces no config, protocol, storage, or user-visible behavior change.

This refactor was explicitly requested by a maintainer.

Activity

  1. added
    maintainer
    on Jul 13, 2026
  2. self-assigned this
    on Jul 13, 2026
  3. clawsweeper commented on Jul 13, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 13, 2026, 7:48 AM ET / 11:48 UTC.

    Summary
    This is an active, explicitly sponsored cleanup with a linked open implementation PR. Current main still contains the oversized policy-doctor module, so the issue should remain open until the linked PR is reviewed and either merged or closed.

    Reproducibility: not applicable. This issue requests a behavior-preserving internal refactor rather than reporting a reproducible product failure.

    Root-cause cluster
    Relationship: canonical
    Canonical: #106295
    Summary: This issue is the canonical tracking item, and its linked open PR is the direct implementation candidate rather than a duplicate or completed fix.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Include the exact command, prompt, or workflow that triggered it.
    • Add expected vs actual behavior.

    Next step
    The issue already has a directly linked open fix PR, so a separate ClawSweeper repair job would duplicate active work.

    Review details

    Best possible solution:

    Land a behavior-equivalent module extraction that keeps register.ts as the sole stable registration/export facade, then let the linked PR close the issue after focused policy tests and extension gates confirm unchanged behavior.

    Do we have a high-confidence way to reproduce the issue?

    Not applicable; this issue requests a behavior-preserving internal refactor rather than reporting a reproducible product failure.

    Is this the best way to solve the issue?

    Yes. Keeping the existing facade while extracting cohesive internals is the narrowest maintainable solution, provided the linked PR proves evaluation order, repairs, cache behavior, and exports remain unchanged.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The linked PR is a large mechanical split, so evaluation ordering, repair behavior, cache semantics, exports, and import-cycle behavior still require careful PR review before merge.

    Codex review notes: model internal, reasoning high; reviewed against 497662f0fc8b.

    Label changes

    Label changes:

    • add P3: This is a low-risk, non-user-visible maintainability refactor with no reported runtime regression.
    • add issue-rating: 🌊 off-meta tidepool: Current issue advisory state selects this label.

    Label justifications:

    • P3: This is a low-risk, non-user-visible maintainability refactor with no reported runtime regression.
    Evidence reviewed

    What I checked:

    • Current implementation: At the reviewed main SHA, policy-doctor registration, evaluation, validation, evidence checks, scoped handling, and helper logic remain concentrated in the same large module. (extensions/policy/src/doctor/register.ts:63, 497662f0fc8b)
    • Open implementation candidate: The linked pull request is open, uses closing syntax for this issue, retains the registration facade, and proposes the requested module extraction with behavior-equivalence validation. (2b6e45896ea7)
    • Existing validation surface: The policy extension has dedicated doctor tests, and the linked PR reports the focused policy suite plus extension type, lint, and import-cycle gates as passing. (extensions/policy/src/doctor/register.test.ts, 497662f0fc8b)
    • Protected maintainer routing: The issue carries the protected maintainer label, is assigned, and states that the refactor was explicitly requested; repository policy therefore requires keeping it open for explicit maintainer handling.
    • Release comparison: The latest release predates this newly filed refactor and does not establish that the requested split has shipped; current main also retains the monolithic module. (extensions/policy/src/doctor/register.ts:63, e085fa1a3ffd)

    Likely related people:

    • steipete: They filed and are assigned to the issue and authored the linked implementation branch containing the focused policy-doctor module split. (role: assigned refactor owner and recent area contributor; confidence: high; commits: 2b6e45896ea7; files: extensions/policy/src/doctor/register.ts, extensions/policy/src/doctor)
    • giodl73-repo: Repository CODEOWNERS routes the policy extension to this person, making them a strong reviewer for behavior-preservation and module-boundary decisions. (role: policy extension code owner; confidence: high; files: extensions/policy/)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. locked as resolved and limited conversation to collaborators on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

maintainer

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions