refactor(framework): quality pass over the rest of the package#616
Merged
Conversation
…oject-path resolver
…ck skeleton into withProject
…hboard reads at one altitude
… a leaf types module
… seven positional args
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.
Rom-method quality pass over the rest of
@gemstack/framework, picking up where #615 (the big/complex files) left off. Every remaining file (~65) and every function was rated across 7 independent review slices before any edit; only the significant refactors were applied, one commit each, build + full suite green at each step (544 tests, 543 pass, 0 fail, unchanged from baseline). Behavior-preserving throughout: no public export removed, no user-facing string changed.Net
-17lines across 36 files.Duplication folded to one (DRY)
*-preset.tsfiles: identical render body + params shape x5, now derived from onedefinePreset553c14bemit/ signal-filter / framing-combine /readCode(copied across claude-code, codex, fake) ->driver/session-support.ts0f7b983try/getContext) +projectPath(defined 2x, inlined once) ->fromContext+resolveProjectPathed380d4reads.telefuncresolve+guard+catch skeleton (x8 uniform readers) ->withProject98c515freadLiveMetawas a byte copy of the store's69d69e5c66d0b0finishEmptya41756e--vanillabuilt-in/docs decision spelled two ways -> one boolean500daa8Seams (right side of the boundary)
events.ts(a data module now); the formatter is its own surface, parallelingrun-view.ts316cf14onEventsChannel lifecycle intostream-channel.ts(the file named for it);onEventsreads as "stream from this source"11ea07fisSameOriginRequestdown into its only caller + shared request/result types into a leafdashboard/types.ts, breaking theserver<->telefunc-serveimport cycle27b5b82Altitude / simplify
startDashboard: early-return the broken-install 503 stub, so the main path drops the tripleclientBundleDirgate and thetelefuncMount!non-null assertion30bd2a6makeTelefuncMount: one request-context object instead of 7 positional args (callers no longer pass anundefinedplaceholder)00a4a67promptItem, dropping its re-declared deps type5ff2aa3682345dCoverage checklist
100% of the remaining package was rated before editing, in 7 slices. Each slice produced a per-file + per-function rating list and a tick list to prove nothing was skipped.
index,todo-loop,maintenance,control,agent,sandbox,preflight,host-execevents,relay,preview,logs,run-view,jsonl-tailsystem-prompt,system-prompt-file,prompt-template,presets,config, the five*-presetquota-poller,consumption-guard,usage,update-check,install,project,fake-script,node-fs,clientdriver/:claude-code,types,codex,claude-code-quota,fake,child-registry,indexdashboard/:server,dashboard,telefunc-serve,projects,overview,quota,docs,git-status,open-in-app,static,queue,file-status,github,bundle,indexdashboard-rpc/+store/index: the 6*.telefunc,context,register,stream-channel,events-tail,indexRatings clustered 4-9 (the five preset files were the one 4). Nothing rated a lazy 10.
Considered, deliberately not done
Kept out to honor "significant only" and behavior-preserving:
nodeMaintenanceFs/ theRegistryFs+MaintenanceFsmerge: these fight the deliberate four-factorynode-fsconvention (refactor(framework): one node:fs adapter behind the four factories #584) and would couple two contracts that only happen to coincide today.GitRunnerout ofproject.ts: wide churn (7 importers) for low payoff.*_PRESET_NAMEexports: they are public API; folded into thedefinePresettable instead of removed.serveFile: their policies genuinely differ (SPA-fallback + immutable cache + buffered read vs 403 + streamed), so only the content-type table was shared.Deferred: behavior-changing fixes (need changesets, separate PRs)
Surfaced by the review but out of scope for a behavior-preserving refactor:
relay.tsingestBodydecodes per-chunk (multibyte UTF-8 can corrupt at a chunk boundary) and caps on UTF-16 length, not bytes.claude-codeparseUsagesetscostUsd: 0when the line has usage but no cost, violating theDriverUsagecontract ("omit, never 0") and diverging from codex.runAgentCliemits a spuriouserrorevent after an abort already rejected the turn.preferencessavePreferencesrejects on a failed write instead of returning the advertised{ ok: false }.No changeset: refactor only.