chore(examples,scripts): drop single-implementation factories and hand-rolled stdlib equivalents - #657
Merged
Conversation
…d-rolled stdlib equivalents
|
commit: |
ScriptedAlchemy
marked this pull request as ready for review
September 6, 2026 00:36
ScriptedAlchemy
enabled auto-merge (squash)
September 6, 2026 00:36
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Behavior-preserving simplification of
examples/*andscripts/*. No publishable package changes (skip-changeset).src/operations/{audible,discovery,evidence,media-mutation,output}.tsno longer define anXOperationsinterface, adefaultXOperationsobject, and anxOperations(operations)factory; every one of the 30 route call sites passed the default and no test substituted an implementation. Each module now exports one frozenxOperationsregistry whose entries are the plain{ handler, id, inputSchema, resultSchema }definitions; pass-through handlers reference the domain function directly (handler: searchAudible). Call sites readaudibleOperations.audibleSearch.defineCliCommand/CliCommandDefinition(anObject.freezeidentity) are gone;src/cli-command.tskeeps onlyCliCommandContext, and the README sentence describing it is updated.src/dev/durable-tree.tsownsdigestBytes,isSafeSegment,assertInside,fsyncPath,writeFileDurably, andcopyTree(src, dst, onFile);generation-materializer.ts(copyCheckpointTree) andenvironment-checkpoint-store.ts(stageTree) import it instead of carrying byte-identical walkers.freezeJsonmoved next tocanonicalJsonincanonical-json.ts, anddefinition-entry.tswritescanonicalJson(...)instead of its owncanonicalize+JSON.stringify(same bytes — the materializer already required the executable's output to equalcanonicalJson). 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.mdis generated and was already stale onmainfor unrelated reasons (CI does not enforce it), so it is left alone rather than regenerating unrelated drift into this PR.foundation.tssha256File— done.await pipeline(createReadStream(path), hash).slow.tsxsleep— done.setTimeout(ms, 'elapsed', { signal })fromnode:timers/promises, resolving'aborted'on rejection; same values as before, including an already-aborted signal.util.parseArgs— partial. Done forclassify-docs-only.mjsandrsc-runtime-topology.mjs(same flag names and defaults; the topology script's rejection of a repeated--root/--output/--checkis relaxed to last-wins, which isparseArgs' behavior). Skipped forhost-cli-pins.mjsandcheck-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 operandfor a missing/empty/dash-leading operand;Unknown argument: --bogus), whichparseArgsdoes not produce — translating itsERR_PARSE_ARGS_*errors costs more code than the loops it would replace.measure-hook-cold-start.mjs— done.runisspawnSync(cmd, args, { input, encoding: 'utf8' });measureOnceis synchronous.measure-preflight-cold-start.mjsuntouched.import.meta.dirname— done inhost-cli-pins,local-ci,record-claude-hooks-schema-fixtures,sync-license-files(unusedfileURLToPath/dirnameimports dropped).run-packed-native-smoke.mjsusesspawnSync(...).status.request-render.ts— done.FlightRenderOptions.maximumStderrBytes/terminationGraceMshad no caller (invocation-worker.tspasses onlymaximumFlightBytes+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.package.jsoninvocations:classify-docs-only.mjs --listing-error→listing-error;--changed-files-count 2 --listing <tsv>→docs-only; count mismatch →truncated-listing;--bogus→ exit 1.rsc-runtime-topology.mjs --root . --output … --checkruns (reports the pre-existing staleness); missing--output/ absolute--output→ usage, exit 1.host-cli-pins.mjs printprints the pins.sync-license-files.mjsis a no-op on a synced tree.run-packed-native-smoke.mjswith no host → usage, exit 2.measure-hook-cold-start.mjs --check→hook 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;runin the cold-start script returns thespawnSyncresult instead of re-shaping it; removed the interface-era comment block fromcli-command.ts).Self-review
Reviewer:
gpt-5.6-sol-medium(generalPurpose; TraceDecay daemon was down sochange-risk-reviewercould not run). Scope: all 53 files vsorigin/main, every workflow andpackage.jsonscript invocation of the touched scripts, production importers of the newdurable-tree.ts, fsync/rename ordering, and the stdlib swap semantics (sleepabort path,sha256Filedigest,parseArgsdefaults,spawnSyncstatus). No merge risks found; nothing to fix or dismiss.