Skip to content

refactor(global): the packages read the files they ship through one port - #292

Open
rami-hatoum wants to merge 2 commits into
mainfrom
refactor/the-packages-read-what-they-ship-through-one-port
Open

rami-hatoum wants to merge 2 commits into
mainfrom
refactor/the-packages-read-what-they-ship-through-one-port

Conversation

@rami-hatoum

Copy link
Copy Markdown
Contributor

What this changes

Several packages ship files beside their code and read them from disk where they need them, each in its own way: the provider entries and their OpenAPI documents, the sandbox lib the program check compiles against, the engine's WebAssembly, the guides, recipes and terminology the server serves to agents, and the landing page's typefaces. A package should compute where its files are and never how they are read: how is one decision, taken once, by the server that composes the packages.

  • ShippedFiles, in @on.auto/operations, reads text, bytes or the names in a folder at a URL a package computes from its own location. Its one implementation on disk lives behind a subpath entry of its own, as the ledger keeps its sqlite3 entry, so the main entry loads no file system; a fake over a map is in the testing entry, and the same tests run on both.
  • The server composes the reader once and hands it to the packages that read. The worker pool receives the files its workers need as a value read before the pool is made, since a thread cannot be handed a reader; the provider documents reach tool-servers as texts with their sizes, read once; the typefaces are read once at start, and a missing one fails the start.
  • Documents the operator gives by path, the configuration file, the caches, the SQLite files and the server's own files are not shipped files and read as before.

Splits the lint limits asked for: the server's start sequence, the pool's program job and its checks, and the shared test helpers each have a module of their own; the server's options types live in a leaf module.

Tests

  • The port's tests run on the disk reader and on the fake alike; an entry test shows neither the main nor the testing entry reaches the disk reader.
  • A worker starts with its module's files before any reservation; a check worker starts with its own; an evaluation asked before any reservation answers.
  • Each shipped document's text and byte count match the file on disk; a document over the bound is refused by its stored size.
  • A missing typeface fails the start.
  • pnpm check passes on each commit.

rami-hatoum and others added 2 commits October 23, 2026 00:23
…ShippedFiles port

A package computes where its files are and never how they are read. ShippedFiles reads the
text or the bytes of a file, or the names of the files in a folder, at a URL the package
computes from its own import.meta.url. shippedFilesOnDisk is the one reader and the one
module of the port that imports node:fs, behind an entry of its own,
@on.auto/operations/shipped-files-on-disk, so the main and testing entries reach no file
system for it. shippedFilesInMemory is a fake over a map for unit tests, held to the same
tests as the reader on disk.

The testing entry also gives measuredEnvironment, the coverage folder a test hands a worker
or a process, and modulesReachedFrom, the files and packages an entry reaches through the
imports that load at run time, which the test of the package's entries walks with.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…hippedFiles port

A package computes where its files are and never how they are read. The server composes the
reader once, shippedFilesOnDisk in src/server-options/composed-options.ts, as
ServerOptions.shippedFiles, and hands it to each package that reads, as a dependency of the
function or factory that reads. What a package read it hands on as content, never as a path.

- workflow-engine: a pool is handed the files its workers start with as a value, keyed by
  worker module, which handedWorkersOf and handedFilesOf read through the reader before the
  pool is made; programPool stays synchronous, and every worker starts with its files, an
  evaluation worker asked before any reserve among them. freshInstance, machineSandboxOf,
  filterSandboxOf and sandboxAnswers take the reader.
- definitions: handedWorkersWithChecks answers the files of a pool that checks saves, the
  kept lib for the check worker in place of the sandbox, and the check worker makes its
  checker of them with serveJobsWith and sandboxLibFrom.
- providers: readProviders(shippedFiles) reads the entries and the documents beside them and
  hands on each document as its text and the bytes it takes, measured once from the bytes read;
  the documents:translate command reads the manifests through the reader on disk, and a file
  given to it itself.
- tool-servers and connections: a connection of a provider reads its document from those the
  providers handed on, a place of documents of the kind shipped, and its bound compares the
  bytes they measured; a document the operator names by its path is read as before.
- api: readPageStyle reads the typefaces through the reader; the server reads the style once,
  at its start beside the providers' entries, so a typeface that cannot be read stops it.
- server: the settings are read against the providers it ships, and the guides and recipes
  through the reader; what a server is started with and answers moves to src/server-options,
  which the start and the composition import, so no module imports the start for it.
- workflow-host: the reactions name the sandbox their filters are matched in, and the tests of
  the views fold on testFoldPoolOf, with the measured pool settings of definitions.
- ledger: the test of the entries walks its imports with modulesReachedFrom of the testing
  entry of operations, as the portability test of the engine does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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