Skip to content

Plan: Workspace Refactor for Deduplication, Testability, and Maintainability #286

@graysurf

Description

@graysurf

Plan: Workspace Refactor for Deduplication, Testability, and Maintainability

Overview

This plan refactors the workspace in four sprint-gated areas: CI, production crates, test/shared crates, and documentation. The intent is
to remove obsolete code and docs outright, stop carrying compatibility-only paths, extract genuinely reusable helpers, and make the codebase
easier to test and maintain. The rollout stays sequential across sprints, but uses controlled parallelism inside sprints where file overlap
is manageable.

Scope

  • In scope:
    • Consolidate duplicated CI logic and remove unused workflow/script surface.
    • Extract shared runtime helpers into nils-common only where the logic is domain-neutral.
    • Expand and normalize nils-test-support so test cleanup removes local boilerplate instead of recreating it elsewhere.
    • Remove obsolete code, fixtures, reports, plans, and misplaced docs once no live caller/reference remains.
    • Update canonical docs so they describe only the post-refactor architecture and active contributor flows.
  • Out of scope:
    • Adding new end-user features or broad behavior redesigns unrelated to duplication/testability.
    • Preserving historical wrappers, aliases, doc redirects, or compatibility shims solely for legacy reasons.
    • Moving crate-local UX text, warning wording, or exit-code policy into shared crates.

Assumptions

  1. plan-tooling remains available for validation, batch analysis, and PR-splitting checks.
  2. scripts/dev/workspace-shared-crate-audit.sh and scripts/dev/workspace-test-stale-audit.sh remain the authoritative discovery inputs
    for shared-helper and stale-test cleanup work.
  3. No legacy compatibility layer is required unless a currently referenced CI, release, or runtime entrypoint still depends on it.
  4. The workspace coverage gate stays at >= 85.00% total line coverage throughout the refactor.

Success criteria

  • GitHub Actions and local required checks resolve through canonical entrypoints with redundant workflow/script logic removed.
  • Shared runtime logic is centralized where appropriate, with crate-local adapters preserved only for user-visible UX/policy differences.
  • Test harness duplication drops materially because reusable helpers live in nils-test-support, and stale/orphan helper inventory shrinks
    without reintroducing deprecated-path leftovers.
  • Workspace and crate-local docs reflect the refactored boundaries, and obsolete docs/plans/reports are removed instead of being kept for
    legacy compatibility.
  • ./.agents/skills/nils-cli-verify-required-checks/scripts/nils-cli-verify-required-checks.sh and the coverage gate both pass at the
    end of the final sprint.

Task Decomposition

Task Summary Owner Branch Worktree Execution Mode PR Status Notes
S1T1 Inventory canonical CI entrypoints and removal criteria subagent-s1-t1 issue/s1-t1-inventory-canonical-ci-entrypoints-and-removal-c issue-s1-t1 per-sprint #287 done sprint=S1; plan-task:Task 1.1; validate=test -f docs/specs/workspace-ci-entrypoint-inventory-v1.md; pr-grouping=per-sprint; pr-group=s1; shared-pr-anchor=S1T1
S1T2 Extract cross-platform verification entrypoints subagent-s1-t1 issue/s1-t1-inventory-canonical-ci-entrypoints-and-removal-c issue-s1-t1 per-sprint #287 done sprint=S1; plan-task:Task 1.2; deps=Task 1.1; validate=rg -n 'Nils CLI checks/third-party-artifacts-audit/Completion asset audit' .github/workflows/ci.yml; pr-grouping=per-sprint; pr-group=s1; shared-pr-anchor=S1T1
S1T3 Remove obsolete CI/dev helper surface subagent-s1-t1 issue/s1-t1-inventory-canonical-ci-entrypoints-and-removal-c issue-s1-t1 per-sprint #287 done sprint=S1; plan-task:Task 1.3; deps=Task 1.2; validate=rg -n 'scripts/ci//scripts/dev//wrappers/' .github/workflows README.md DEVELOPMENT.md docs .agents crates tests; pr-grouping=per-sprint; pr-group=s1; shared-pr-anchor=S1T1
S1T4 Reorder fail-fast CI gates and coverage boundaries subagent-s1-t1 issue/s1-t1-inventory-canonical-ci-entrypoints-and-removal-c issue-s1-t1 per-sprint #287 done sprint=S1; plan-task:Task 1.4; deps=Task 1.2,Task 1.3; validate=rg -n 'docs-hygiene-audit/test-stale-audit/coverage' .github/workflows/ci.yml; pr-grouping=per-sprint; pr-group=s1; shared-pr-anchor=S1T1
S2T1 Freeze shared-crate boundaries from audit evidence subagent-s2-t1 issue/s2-t1-freeze-shared-crate-boundaries-from-audit-eviden issue-s2-t1 pr-shared #289 done sprint=S2; plan-task:Task 2.1; deps=Task 1.4; validate=test -f docs/specs/workspace-shared-crate-boundary-v1.md; pr-grouping=group; pr-group=s2-auto-g1; shared-pr-anchor=S2T1
S2T2 Extract process, env, and no-color primitives into nils-common subagent-s2-t2 issue/s2-t2-extract-process-env-and-no-color-primitives-into issue-s2-t2 pr-isolated #288 done sprint=S2; plan-task:Task 2.2; deps=Task 2.1; validate=bash scripts/dev/workspace-shared-crate-audit.sh --format tsv; pr-grouping=group; pr-group=s2-auto-g2
S2T3 Consolidate provider auth persistence and filesystem primitives subagent-s2-t1 issue/s2-t1-freeze-shared-crate-boundaries-from-audit-eviden issue-s2-t1 pr-shared #289 done sprint=S2; plan-task:Task 2.3; deps=Task 2.1; validate=bash scripts/dev/workspace-shared-crate-audit.sh --format tsv; pr-grouping=group; pr-group=s2-auto-g1; shared-pr-anchor=S2T1
S2T4 Delete redundant crate-local wrappers and re-document ownership subagent-s2-t1 issue/s2-t1-freeze-shared-crate-boundaries-from-audit-eviden issue-s2-t1 pr-shared #289 done sprint=S2; plan-task:Task 2.4; deps=Task 2.2,Task 2.3; validate=bash scripts/dev/workspace-shared-crate-audit.sh --format tsv; pr-grouping=group; pr-group=s2-auto-g1; shared-pr-anchor=S2T1
S3T1 Freeze stale-test cleanup rules and crate sequencing subagent-s3-t1 issue/s3-t1-freeze-stale-test-cleanup-rules-and-crate-sequen issue-s3-t1 pr-isolated #290 done sprint=S3; plan-task:Task 3.1; deps=Task 2.4; validate=test -f docs/specs/workspace-test-cleanup-lane-matrix-v1.md; pr-grouping=group; pr-group=s3-auto-g1
S3T2 Expand nils-test-support with missing reusable harness primitives subagent-s3-t2 issue/s3-t2-expand-nils-test-support-with-missing-reusable-h issue-s3-t2 pr-shared #291 done sprint=S3; plan-task:Task 3.2; deps=Task 3.1; validate=cargo test -p nils-test-support; pr-grouping=group; pr-group=s3-auto-g2; shared-pr-anchor=S3T2
S3T3 Migrate parallel-safe crates to shared test helpers subagent-s3-t2 issue/s3-t2-expand-nils-test-support-with-missing-reusable-h issue-s3-t2 pr-shared #291 done sprint=S3; plan-task:Task 3.3; deps=Task 3.2; validate=bash scripts/dev/workspace-test-stale-audit.sh --format tsv; pr-grouping=group; pr-group=s3-auto-g2; shared-pr-anchor=S3T2
S3T4 Serialize high-overlap test crates and remove obsolete fixtures subagent-s3-t2 issue/s3-t2-expand-nils-test-support-with-missing-reusable-h issue-s3-t2 pr-shared #291 done sprint=S3; plan-task:Task 3.4; deps=Task 3.2; validate=bash scripts/dev/workspace-test-stale-audit.sh --format tsv; pr-grouping=group; pr-group=s3-auto-g2; shared-pr-anchor=S3T2
S4T1 Classify living docs and build the deletion list subagent-s4-t1 issue/s4-t1-classify-living-docs-and-build-the-deletion-list issue-s4-t1 per-sprint #292 done sprint=S4; plan-task:Task 4.1; deps=Task 3.4; validate=test -f docs/specs/workspace-doc-retention-matrix-v1.md; pr-grouping=per-sprint; pr-group=s4; shared-pr-anchor=S4T1
S4T2 Rewrite canonical docs for the simplified architecture subagent-s4-t1 issue/s4-t1-classify-living-docs-and-build-the-deletion-list issue-s4-t1 per-sprint #292 done sprint=S4; plan-task:Task 4.2; deps=Task 4.1; validate=bash scripts/ci/docs-hygiene-audit.sh --strict; pr-grouping=per-sprint; pr-group=s4; shared-pr-anchor=S4T1
S4T3 Remove obsolete plans, reports, misplaced docs, and compatibility-only text subagent-s4-t1 issue/s4-t1-classify-living-docs-and-build-the-deletion-list issue-s4-t1 per-sprint #292 done sprint=S4; plan-task:Task 4.3; deps=Task 4.2; validate=bash scripts/ci/docs-placement-audit.sh --strict; pr-grouping=per-sprint; pr-group=s4; shared-pr-anchor=S4T1
S4T4 Final dead-surface sweep and baseline lock subagent-s4-t1 issue/s4-t1-classify-living-docs-and-build-the-deletion-list issue-s4-t1 per-sprint #292 done sprint=S4; plan-task:Task 4.4; deps=Task 4.2,Task 4.3; validate=./.agents/skills/nils-cli-verify-required-checks/scripts/nils-cli-verify-required-checks.sh; pr-grouping=per-sprint; pr-group=s4; shared-pr-anchor=S4T1

Consistency Rules

  • Status must be one of: planned, in-progress, blocked, done.
  • Status = in-progress or done requires non-TBD execution metadata (Owner, Branch, Worktree, Execution Mode, PR).
  • Owner must be a subagent identifier (contains subagent) once the task is assigned; main-agent ownership is invalid for implementation tasks.
  • Execution Mode should be one of: per-sprint, pr-isolated, pr-shared (or TBD before assignment).
  • Branch and Worktree uniqueness is enforced only for rows using Execution Mode = pr-isolated.

Risks / Uncertainties

  • Sprint approvals may be recorded before final close; issue stays open until final plan acceptance.
  • Close gate fails if task statuses or PR merge states in the issue body are incomplete.

Evidence

  • Plan source: docs/plans/workspace-refactor-dedup-testability-plan.md
  • Sprint approvals: issue comments (one comment per accepted sprint)
  • Final approval: issue/pull comment URL passed to close-plan

Metadata

Metadata

Assignees

No one assigned

    Labels

    issueIssue workflow trackingplanPlan-driven delivery

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions