Skip to content

S0334-shared-scripts-consolidation: the canonical shared scripts, published from @cosyte/process - #109

Merged
NSchatz merged 6 commits into
mainfrom
sdd/S0334-shared-scripts-consolidation-config
Sep 19, 2026
Merged

NSchatz merged 6 commits into
mainfrom
sdd/S0334-shared-scripts-consolidation-config

Conversation

@NSchatz

@NSchatz NSchatz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Spec: pipeline/active/S0334-shared-scripts-consolidation/spec.md. The item is repos: [config]: the hl7 adoption slice left by conductor ruling (pipeline/active/S0334-shared-scripts-consolidation/conductor-ruling-split-the-hl7-slice-off-the-refuted-scripts.md), because it can only be built against a published @cosyte/process version this PR has not shipped yet. The config child's criteria are folded into the spec as AC-C1 through AC-C11.

config becomes the one place the estate's small shared scripts live. Two entry points join the existing cosyte-process bin, and the canonical trigger surface of the two security-workflow callers is published from the same package as data.

What this adds

  • cosyte-process sync-version (AC-C1, AC-C3, AC-C4): writes package.json's version into the exported VERSION constant in src/index.ts. Five numbered conditions, named by every refusal and documented in the README: a usable manifest version, exactly one declaration of the form export const VERSION: string = "<value>"; anchored at column 0 anywhere in the file, a literal splice (a version carrying $& or $1 is written character for character), an idempotent run that does not touch an already-synced file, and an exit vocabulary closed at 0 and 1.
  • cosyte-process pack-docs [outputdir] (AC-C5, AC-C6): builds docs-content.tar.gz and source.tar.gz into an output directory defaulting to dist-artifacts, with the member sets the contract names. Every required input is checked and both archives are built before the output directory is created, so a refused run leaves nothing half-built. The archives are written with node:zlib and a small ustar writer, so no tar binary has to be on PATH; the tests read them back with the system tar rather than with the writer that produced them.
  • The canonical security-workflow trigger surface as data, plus a grader (AC-C8): SECURITY_WORKFLOW_SURFACES, gradeWorkflowText, gradeWorkflowFile, gradeSecurityWorkflows. A pass means every element was found and equal; that the file exists is not one of the elements, and scorecard.yml carrying no pull_request trigger is an element in the same way as codeql.yml carrying one.
  • This repository's own canonical caller texts under scripts/parser-template/.github/workflows/ are graded against that data (AC-C9), so the scaffold every parser copies cannot drift away from what consumers grade against.
  • Every failure of either entry point is a refusal (AC-C10, AC-5): the path, the entry point, what was reported in structural terms and the action available, on stderr, exit 1, stdout empty, and no content of any file it read.

What this does not change

Neither entry point is a verb (AC-C7, AC-6): cosyte-process check grades the same five scripts, any present reserved variants and the override file, and the override file's accepted top-level keys stay build, test, lint, typecheck, format. An override naming sync-version or pack-docs is refused exactly as any other unknown key is, by every verb. No new dependency, no new workflow, and no file deleted: neither .github/workflows/ nor scripts/parser-template/ is touched by this diff, so no element of the canonical security-scanning trigger surface moves.

Gates

Green locally on 4f9cc2d against main at 0d55911:

  • pnpm test: root 37 files / 1023 passed; @cosyte/process 12 files / 225 passed; @cosyte/script-utils 17; @cosyte/test-utils 195.
  • pnpm drift: 1 matching, 0 with drift, 23 skipped, of 24 repo(s), identical to the same command run on origin/main.
  • pnpm drift:validate, pnpm check:no-emdash, pnpm format:check, pnpm typecheck, pnpm lint, pnpm build, node scripts/readme-check.mjs, node scripts/changeset-guard.mjs: all green.

…ocess bin

The canonical version sync, published from @cosyte/process so a repo executes
it instead of carrying a copy. Five numbered conditions: the manifest version,
exactly one column-0 VERSION declaration, a literal splice rather than a
replacement pattern, an idempotent run that writes nothing, and an exit
vocabulary closed at 0 and 1.

Adds the entry-point surface the bin dispatches ahead of the verbs, plus the
ustar writer, the YAML subset and the trigger-surface data the next two tasks
consume.
Two tarballs into an output directory named by the first positional argument,
default dist-artifacts, with the member sets the contract names. It fails fast:
every required input is checked before the output directory is created, so a
refused run leaves no half-built artifact set for a release job to pick up.

The archives are read back in the tests with the system tar, not with the
writer that produced them.
…face, as data plus a grader

A workflow only runs from the repository's own .github/workflows directory, so
what consolidates is the definition of what those files must say: the canonical
trigger surface is published from @cosyte/process, and a caller text is graded
against it element by element. A file that exists, parses and has lost its
schedule is reported, never passed; scorecard's absence of a pull_request
trigger is an element like any other.

Also grades this repository's own canonical caller texts under
scripts/parser-template against that same data, so the scaffold every parser
copies cannot drift away from what consumers grade against, and proves the five
numbered version-sync conditions are each named by a test.
… the trigger surface

The README documents them where the five verbs are: the invocations, the five
numbered conditions a sync-version refusal names, what pack-docs checks before
it writes anything, and the trigger surface with its grader, whose example the
snippet harness executes against this repository's own sources.

The changeset is a patch rather than a minor while 0.1.0 is pending: the
release plan is carried to that line by exactly one minor changeset, and a
concurrent item queues the weaker type, which resolves to the same version.
Comment thread packages/process/src/pack-docs.ts Fixed
Comment thread packages/process/test/sync-version.test.ts Fixed
…one descriptor

CodeQL's js/file-system-race on the first run of this branch, twice: a file
described by path and then read by path is two files as far as the filesystem
is concerned, so the archive could carry one file's bytes under another's
metadata. Both the packer and the idempotence test now take a descriptor and
read the metadata and the bytes through it.
…fusal

Impl gate ordinal 1, findings F2 (blocking), F3 and F4 (advisory).

runEntryPoint converted only its own two error types and rethrew everything
else, so an ordinary I/O failure left the bin as an unhandled exception naming
neither the entry point nor an action available. Every failure now carries the
contracted shape: the path, the entry point, what the system reported in
structural terms, the action available, exit 1, stdout empty. The thrown error's
own message is described rather than restated, because an arbitrary message can
carry the bytes of a file the entry point read.

pack-docs builds both archives before it creates the output directory, so a
member the tarball format cannot carry refuses with the tree exactly as it was
found rather than with docs-content.tar.gz already sitting where a release job
would pick it up. That member is this command's own refusal now, naming the
member and the action.

The version declaration's value runs to the first quote, which is the form the
contract quotes as the floor. A wider value matched a declaration line carrying
a trailing comment that ends in the same two characters, and spliced the
manifest version over the comment: source text deleted where a refusal was owed.

Each of the five added tests was run red against the unfixed sources first.
@NSchatz
NSchatz merged commit 6f224a5 into main Sep 19, 2026
8 checks passed
@NSchatz
NSchatz deleted the sdd/S0334-shared-scripts-consolidation-config branch September 19, 2026 13:52
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.

2 participants