Skip to content

chore(examples,scripts): drop single-implementation factories and hand-rolled stdlib equivalents - #657

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
chore/ponytail-examples-scripts
Sep 6, 2026
Merged

ScriptedAlchemy merged 1 commit into
mainfrom
chore/ponytail-examples-scripts

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

Behavior-preserving simplification of examples/* and scripts/*. No publishable package changes (skip-changeset).

  1. audiobook-curator operations — done. src/operations/{audible,discovery,evidence,media-mutation,output}.ts no longer define an XOperations interface, a defaultXOperations object, and an xOperations(operations) factory; every one of the 30 route call sites passed the default and no test substituted an implementation. Each module now exports one frozen xOperations registry whose entries are the plain { handler, id, inputSchema, resultSchema } definitions; pass-through handlers reference the domain function directly (handler: searchAudible). Call sites read audibleOperations.audibleSearch. defineCliCommand/CliCommandDefinition (an Object.freeze identity) are gone; src/cli-command.ts keeps only CliCommandContext, and the README sentence describing it is updated.
  2. rsc-agent-runtime durable tree — done. New src/dev/durable-tree.ts owns digestBytes, isSafeSegment, assertInside, fsyncPath, writeFileDurably, and copyTree(src, dst, onFile); generation-materializer.ts (copyCheckpointTree) and environment-checkpoint-store.ts (stageTree) import it instead of carrying byte-identical walkers. freezeJson moved next to canonicalJson in canonical-json.ts, and definition-entry.ts writes canonicalJson(...) instead of its own canonicalize + JSON.stringify (same bytes — the materializer already required the executable's output to equal canonicalJson). Not touched: serialize-inspection.ts, rsbuild-runtime-session.ts, rsbuild.config.ts. Two unreachable-in-practice error strings are unified ("<path>" must be a regular directory. and "<path>" escaped its root "<root>".); no test pinned the old wording. docs/architecture/rsc-runtime-workbench.md is generated and was already stale on main for unrelated reasons (CI does not enforce it), so it is left alone rather than regenerating unrelated drift into this PR.
  3. foundation.ts sha256File — done. await pipeline(createReadStream(path), hash).
  4. slow.tsx sleep — done. setTimeout(ms, 'elapsed', { signal }) from node:timers/promises, resolving 'aborted' on rejection; same values as before, including an already-aborted signal.
  5. argv → util.parseArgs — partial. Done for classify-docs-only.mjs and rsc-runtime-topology.mjs (same flag names and defaults; the topology script's rejection of a repeated --root/--output/--check is relaxed to last-wins, which is parseArgs' behavior). Skipped for host-cli-pins.mjs and check-declaration-imports.mjs: packages/agent-bundle/tests/{host-cli-pins,check-declaration-imports}.test.ts (avoid-list) pin the hand-rolled error text (--prefix requires a directory operand for a missing/empty/dash-leading operand; Unknown argument: --bogus), which parseArgs does not produce — translating its ERR_PARSE_ARGS_* errors costs more code than the loops it would replace.
  6. measure-hook-cold-start.mjs — done. run is spawnSync(cmd, args, { input, encoding: 'utf8' }); measureOnce is synchronous. measure-preflight-cold-start.mjs untouched.
  7. import.meta.dirname — done in host-cli-pins, local-ci, record-claude-hooks-schema-fixtures, sync-license-files (unused fileURLToPath/dirname imports dropped). run-packed-native-smoke.mjs uses spawnSync(...).status.
  8. request-render.ts — done. FlightRenderOptions.maximumStderrBytes/terminationGraceMs had no caller (invocation-worker.ts passes only maximumFlightBytes + signal); the bounds are now the module constants.

Validation

  • pnpm build && pnpm typecheck && pnpm lint && pnpm test:unit — green (4237 unit tests).
  • examples/audiobook-curator: pnpm validate && pnpm build && pnpm typecheck && pnpm test && pnpm test:routes — green (build includes the Claude host validation + package declaration emit).
  • examples/rsc-agent-runtime: pnpm typecheck; rstest tests/generation-materializer.test.ts tests/environment-checkpoint-store.test.ts tests/state-and-definition.test.ts — green.
  • examples/host-test: pnpm typecheck && pnpm test — green.
  • Script smoke runs with the CI/package.json invocations: classify-docs-only.mjs --listing-errorlisting-error; --changed-files-count 2 --listing <tsv>docs-only; count mismatch → truncated-listing; --bogus → exit 1. rsc-runtime-topology.mjs --root . --output … --check runs (reports the pre-existing staleness); missing --output / absolute --output → usage, exit 1. host-cli-pins.mjs print prints the pins. sync-license-files.mjs is a no-op on a synced tree. run-packed-native-smoke.mjs with no host → usage, exit 2. measure-hook-cold-start.mjs --checkhook cold-start ok: median 42.88ms (baseline 39.74ms).

Deslop

Deslop: Claude Fable 5.1, 3 edits (dropped inferred Promise<…> return annotations on the operation handlers; run in the cold-start script returns the spawnSync result instead of re-shaping it; removed the interface-era comment block from cli-command.ts).

Self-review

Reviewer: gpt-5.6-sol-medium (generalPurpose; TraceDecay daemon was down so change-risk-reviewer could not run). Scope: all 53 files vs origin/main, every workflow and package.json script invocation of the touched scripts, production importers of the new durable-tree.ts, fsync/rename ordering, and the stdlib swap semantics (sleep abort path, sha256File digest, parseArgs defaults, spawnSync status). No merge risks found; nothing to fix or dismiss.

@changeset-bot

changeset-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5824c8b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy ScriptedAlchemy added the skip-changeset PR changes a publishable package but ships no observable change; changeset not required label Sep 6, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@657
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@657
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@657
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@657

commit: 5824c8b

@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review September 6, 2026 00:36
@ScriptedAlchemy
ScriptedAlchemy enabled auto-merge (squash) September 6, 2026 00:36
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@ScriptedAlchemy
ScriptedAlchemy merged commit 71963b4 into main Sep 6, 2026
15 of 16 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the chore/ponytail-examples-scripts branch September 14, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changeset PR changes a publishable package but ships no observable change; changeset not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant