Skip to content

refactor(vis): split run, publish, cache and config modules - #28

Closed
prisis wants to merge 21 commits into
mainfrom
refactor/vis-split-v2
Closed

prisis wants to merge 21 commits into
mainfrom
refactor/vis-split-v2

Conversation

@prisis

@prisis prisis commented Oct 17, 2026

Copy link
Copy Markdown
Member

Summary

Behaviour-preserving split of oversized vis modules, plus fixes from review. This replaces the earlier branch refactor/vis-split-large-files (PR #25), which has diverged on origin.

  • run/handler.ts: execute is an orchestrator over phase modules in handler-parts/ (file now about 67 lines). Mode functions are merged into run-modes.ts, and handler-parts files share one run- prefix.
  • release/core/orchestrator/publish.ts: publishContext split into publish stages (file about 318 lines).
  • util/catalog.ts: 18-line re-export; implementation in util/catalog/engine.ts.
  • commands/cache/handler.ts: 1657 → 760 lines; why/maintenance moved to sibling modules.
  • config/types.ts: scoped-task type cycle broken; still over 1000 lines (see below).

Fixes, which change behaviour:

  • Services booted before a setup failure are now torn down (run cleanup is armed earlier, and dry runs now also tear down).
  • Publish preflight reports remote-detection errors as failures instead of rejecting.

Duplicate helpers are consolidated: liveness checks, shell quoting, nested-field setter, and visOptions.

Not done

  • config/types.ts stays above 1000 lines. Splitting VisConfig changes the generated schema and breaks check:schemas-drift.
  • RunContext is still a mutable bag. The phases share state that cleanup reads later, so typed returns would change side-effect ordering.
  • applyContext, buildContext, prepareRunRuntime, runPostPublish and runPersistentTasks are large functions carried over unchanged.

Testing

  • lint:types and check:schemas-drift pass.
  • Full suite: 73 failing tests, the same set as the base branch except two timing-sensitive perf tests (one newly failing under load, one newly passing). The perf test passes when run alone.
  • Three secrets test files fail with a missing native binding. These are environmental and not confirmed on the base commit.

Needs manual check before merge

  • Ctrl+C during run setup: signal cleanup now starts earlier. Service cleanup runs, but Node may not exit. No test covers this.

🤖 Generated with Claude Code

prisis and others added 21 commits October 17, 2026 01:52
Move the publish wave into publish-wave, publish-loop, publish-tags and
publish-post modules. publishContext keeps its signature and orchestrates
the phases in the same order, with the same awaits and lock handling.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Move workspace load, project selection, target filtering and task build
out of execute into handler-parts modules. Shared state lives on a
RunContext that each phase reads and updates in place.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Move task graph build, preflight checks, service attach and injection, and
dry-run plan printing into handler-parts modules. Phase order and the
points where execution can stop early are unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Move hook and runner-option setup, cleanup signal wiring, the interactive
loop, and the static and watch modes into handler-parts modules. The
interactive loop stays one function because its retry state is written
from inside a promise callback.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
execute keeps its signature and default export. It now calls the phase
functions in the original order and runs the same try/finally teardown.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Destructure currentOs from the run context at the top of the interactive
loop, so the retry branch passes the same expression as before.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The retry branch moved from handler.ts into handler-parts/run-modes.ts. The source-string assertions now read both files.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Cleanup was armed after prepareRunRuntime, so a failure in the remote
cache attestation check or a run:before hook left services booted by
this run running. Arm cleanup as soon as services are attached and
keep the rest of the run inside the try/finally.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The retry budget test now imports createRetryBudget from its owning
module, so the handler no longer re-exports it. The handler doc comment
uses a TARGET placeholder: the jsdoc escaping rule rewrites a bare
angle-bracket placeholder into an entity, which rendered literally.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Remote provider and repo detection in the release-PR check and the
push-rule check could reject, so publishContext threw instead of
returning a result. Record those errors as a _preflight failure and
stop, so the caller gets the same result shape as other refusals.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
PublishWaveModules and PublishWaveBase are only used inside publish-wave,
so they no longer need to be exported.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The push-rule preflight and the tag phase each derived the release and
floating tags from the plan on their own. planPublishTags now owns that
decision; both callers use it, so the preflight checks the tags the run
creates. Tag names, floating-tag conditions and creation order are
unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
isPidAlive now lives in util/process-alive and the service registry and
release state share it. Persistent tasks keep their group-then-pid check
on top of it. The shell quote primitives move to util/shell-quote; the
run shell keeps its Windows bare-word rule over the shared quoting, and
the two shellQuote signatures are now named for what they do. getVisOptions
moves to task/target-options so both run modules import one copy.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
ScopedTasksMatch moves into types-parts/project next to the project types
it refers to, so the part no longer imports from types.ts. types.ts still
re-exports it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Name the project types the discovered-ecosystem map holds, and use a
top-level type import for the pre-mode file type.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
setNestedField was copied into util/catalog and deps/workspace-protocol.
Both copies behave the same, so they now import one helper.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The three run mode functions now sit in run-modes.ts; run-static.ts is
gone. Handler-parts files all carry the run- prefix (seven of twelve
already did), so executor, output, parse, persistent-tasks and shell
are renamed to match. Imports are updated to the new paths.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
util/catalog.ts is now only the public re-export list. The implementation
moves to util/catalog/engine.ts, next to the existing catalog helper
modules, with import paths adjusted. No importer path changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The cache maintenance commands (clean, prune and their eviction helpers)
move to cache/maintenance.ts, and the why report to cache/why.ts. Shared
entry and output helpers move to cache/shared.ts. handler.ts keeps list,
hash, size and verify, and re-exports the moved names so existing imports
still resolve. index.ts loads each moved entry from its new module.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Moving ScopedTasksMatch left the customTypes row doc detached from its
interface. Restore that doc and put the moved interface above it. The
regenerated schema changes only the ScopedTasksMatch description, which
now reads as plain text instead of an unresolved {@link}.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Cleanup was armed after finalizeServiceGraph, which ran outside the
try. Arm it straight after the services boot and move the finalize step
inside the try/finally, so a throw there also tears services down.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@github-actions github-actions Bot added size:XXL Size of the change, tests and generated files excluded. package: vis vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. and removed size:XXL Size of the change, tests and generated files excluded. labels Oct 17, 2026
@prisis

prisis commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Superseded: the refactor is already in main via #25. The two fixes from this branch are rebased onto main in #30.

@prisis prisis closed this Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vis vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant