Skip to content

Extract plugin helpers into shared libs (issue-reference + state-path) #782

Open

Description

@jflowers

Context

Approved as follow-up work during the unleash-tier-routing code review (advisories A6/A7 — advisory-only because extraction touches scaffold mirrors and warrants its own spec ceremony):

  • A6 (divisor-architect, structure): uf_unleash_resolve_issue's tools and pure helpers (findIssueReference, parseGhIssuePayload, URL/hash patterns) live inline in the ~4,450-line .opencode/plugins/uf-workflow/index.ts. Precedent: .opencode/lib/branch-classification.ts. Extraction target: .opencode/lib/issue-reference.ts (live + scaffold mirror).
  • A7 (divisor-architect, conventions): the uf-finale route-decision reader (.opencode/plugins/uf-finale/index.ts ~402) hardcodes the .uf/progress/${sanitizeSlug(branch)}/uf.unleash.json path and re-implements completed_steps/positive-integer guards. The writer-reader pair is test-pinned (feat: /uf.unleash should persist demo summary for /uf.finale PR body generation #707 precedent). Extraction target: a shared lib path/state helper used by both writer and reader.

Scope

  • Extract the issue-reference helpers into .opencode/lib/issue-reference.ts with tests unchanged in behavior
  • Extract the shared progress-state path + guard helpers used by uf-workflow (writer) and uf-finale (reader)
  • Keep live/mirror byte-identity (drift tests) and the full suite green

Constraints

  • Goes through its own spec workflow (OpenSpec tactical change); mirror-touching refactor
  • No behavior changes — pure moves with import rewiring

Activity

  1. added
    enhancement
    on Oct 23, 2026
  2. jflowers commented on Oct 23, 2026

    @jflowers
    ContributorAuthor

    Issue Triage: VALID — Enhancement

    Classification

    Field Value
    Verdict VALID (4/4 unanimous)
    Category enhancement
    Objectivity objective

    The Divisor review panel assessed this issue with four successful reviewer runs (architect, guard, sre, testing); a fifth dispatched run (adversary) failed on a transient provider error and did not vote. Applied label: enhancement.

    Evidence verified by the panel

    • findIssueReference and parseGhIssuePayload exist inline in .opencode/plugins/uf-workflow/index.ts (lines 1358, 1381), consumed by uf_unleash_resolve_issue (lines 1482, 1527).
    • .opencode/plugins/uf-finale/index.ts hardcodes the .uf/progress/${routeSlugged}/uf.unleash.json path and re-implements the completed_steps guard (lines 411–425; second reader site at line 443).
    • The cited precedent .opencode/lib/branch-classification.ts exists in both the live tree and the scaffold mirror.
    • The unleash-tier-routing design doc (openspec/changes/unleash-tier-routing/design, Risks/Trade-offs) records this extraction as the deferred follow-up tracked here.
    • One nuance the panel confirmed: sanitizeSlug itself is already shared via lib/uf-workflow-types.js; the duplication is the path template and guard logic, which matches the issue's stated scope.

    Recommendations

    • Route through an OpenSpec tactical change (opsx/<name>): pure moves with import rewiring, no behavior changes, fewer than three stories, single repo.
    • Preserve live/mirror byte-identity for both extracted modules; the drift-detection tests and make plugin-test enforce this.
    • Name the A7 target file during design (A6 already names issue-reference.ts); the panel classifies this as a design-phase decision, not a clarity gap.

    Next steps

    1. Create openspec/changes/<name>/ covering both extractions as one cohesive refactor (same source file, same pattern).
    2. Extend the existing test suites to the new module boundaries (22 table-driven tests already cover uf_unleash_resolve_issue).
    3. Verify with make check (includes plugin-test and drift tests).

    This triage was performed by the Divisor review panel.

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

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions