Skip to content

bin: split the release tooling into a shared release layer - #308

Open
gnidan wants to merge 5 commits into
architect-identificationfrom
release-tooling-split
Open

gnidan wants to merge 5 commits into
architect-identificationfrom
release-tooling-split

Conversation

@gnidan

@gnidan gnidan commented Sep 29, 2026

Copy link
Copy Markdown
Member

Stacked on #305: the base is architect-identification, so this diff shows only the refactor. After #305 merges, this rebases onto main with nothing to resolve, since the two touch disjoint commits.

bin/version.ts had grown to eight concerns in one file: the release vocabulary, workspace reading, git and Lerna plumbing, changelog parsing, the version plan and its guards, the pre-flight checks, the writes, and the report. At the same time bin/ already had a shared model, in the wrong place. Six of the eight scripts imported one from publish-tagged.ts: readWorkspaces alone had five import sites, check-changelog.ts depended on the publisher, and packlist.ts was a library nothing executed. version.ts carried its own copy of the same model.

The nouns are now modules in bin/release/, shared by every script that needs them:

  • policy.ts: the vocabulary (keywords, identifiers, dist-tags, and the release-tag convention: releaseTag, parseReleaseTag, isReleaseTag)
  • git.ts: run, status, tryRun, with no release knowledge
  • workspaces.ts: one Workspace model that keeps dependency kinds apart and derives dependencies exactly as before, plus rewriteManifest and topoSort
  • lerna.ts, changelog.ts, packlist.ts (moved whole), and schema-versions.ts (from format: identify info, resources and program objects with their schema and specification version #305)
  • plan.ts: the moves and the judgements about them
  • apply.ts: the writes, the Publish commit, the tags and the undo advice

No module imports a script, and no script imports another script.

The phases are types. bin/version.ts now reads as surveyRelease (the only read) → decide (pure, returns a Plan that holds the exact bytes to write) → check (pure, returns the errors and findings) → report → applyRelease (the only write). Because the world enters through one reader, the pre-flight findings, the nearest-tag check and the release-tags-at-HEAD exception now have tests from hand-built surveys. They had none before, because they shelled out. applyRelease has its first test too, against a scratch repository, including a failure part-way through tagging.

bin/ is now type-checked: yarn typecheck:bin, with a CI step beside yarn typecheck. The one error it found in the existing code (a narrowing in parseArgs) is fixed in the first commit.

Behavior is unchanged. A dry run of bin/version.ts gives byte-identical output and exit codes against the pre-refactor script for prerelease, patch, minor --all, major --all and a dirty tree. Every commit passes the bin tests and the type-check on its own.

Two things are left as they were, on purpose:

  • A workspace counts as released when any @ethdebug/<name>@… tag exists, as before. publish-tagged.ts still counts only semver-valid tags when it picks a dist-tag, as before. No tag in the repository makes the two differ.
  • The root package.json has no typescript devDependency, so typecheck:bin uses the hoisted tsc. Pinning it would change hoisting, which is out of scope here.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://ethdebug.github.io/format/pr-preview/pr-308/

Built to branch gh-pages at 2026-09-30 18:10 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@gnidan
gnidan force-pushed the architect-identification branch from 7163b01 to a28c85e Compare September 30, 2026 00:49
@gnidan
gnidan force-pushed the release-tooling-split branch from 5158ec7 to 93a22e8 Compare September 30, 2026 00:50
@gnidan
gnidan force-pushed the architect-identification branch from a28c85e to d47013e Compare September 30, 2026 01:20
@gnidan
gnidan force-pushed the release-tooling-split branch from 93a22e8 to ea8b853 Compare September 30, 2026 01:22
@gnidan
gnidan force-pushed the architect-identification branch from d47013e to 471fcd7 Compare September 30, 2026 17:33
@gnidan
gnidan force-pushed the release-tooling-split branch from ea8b853 to b68490d Compare September 30, 2026 17:34
@gnidan
gnidan force-pushed the architect-identification branch from 471fcd7 to 5de84fb Compare September 30, 2026 17:45
@gnidan
gnidan force-pushed the release-tooling-split branch from b68490d to 06e1404 Compare September 30, 2026 17:46
@gnidan
gnidan force-pushed the architect-identification branch from 5de84fb to a6eeb59 Compare September 30, 2026 17:55
@gnidan
gnidan force-pushed the release-tooling-split branch from 06e1404 to f11bdac Compare September 30, 2026 17:55
@gnidan
gnidan force-pushed the architect-identification branch from a6eeb59 to c61187c Compare September 30, 2026 18:06
@gnidan
gnidan force-pushed the release-tooling-split branch from f11bdac to 750261b Compare September 30, 2026 18:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant