Repository navigation
refactor(workflow-code): final-state audit cleanup - #10318
Conversation
…hat matches its ratio design The growth check is a ratio so a slow runner cannot fail it, but the former-block hint case runs seconds of wall clock and failed on vitest's 5s default under machine load.
…maliser filteredKinds stripped trailing slashes with /\/+$/, quadratic on a long run of slashes, and dropped a single leading ./ where pathFilter drops them all. Both now use givenFilterPath.
COLUMN_CALL scanned to the end of the file for every unclosed column.x( call, quadratic on a 2 MB declaration. The head is matched by regex and its ) found with indexOf, resuming after it as the global regex did, so the same calls match.
…ting it The restatement said the CLI carries no workspace dependency, but it bundles @sim/workflow-code, which already imports the helper from @sim/workflow-types.
…matches their ratio design Two expectLinearGrowth cases near the source caps passed alone but failed vitest's 5s default under machine load. Replaces the single-case timeout from the previous commit.
…ByteLength limits.ts carried its own utf8Bytes with the same contract (early stop past the cap, a lone surrogate as 3 bytes). Every caller now uses the shared helper; its test gains the surrogate cases the removed test covered.
…sal rules The set was a hand-kept copy of the four rule maps' keys, so a rule added without it could be hidden by the warning cap. It is now their union, and each rule's warning code is checked against CompileDiagnosticCode.
… local copies values.ts and function-returns.ts each wrote memberName; it now lives in babel.ts beside memberSegment. The loop-condition check strips Babel's (line:column) with babelMessage instead of a copy whose \s* prefix ran in quadratic time.
…me default constants The loop and parallel repair messages restated 5, 1 and 20 in text beside the constants that hold them, and the parallel default count lived privately in forms/subflow.ts.
…e's printNumber declaration/print.ts restated it beside the printKey and quoteString it already imports.
…espace scan stripComments' /^\s*\/\/.*$/gm let \s* run across newlines from every line start, quadratic on blank lines. Its output is only searched for core type names, so [ \t]* reads the same names.
…ap in sourceStatus Each server change searched every local change, quadratic in a directory of many changed files. The first local change of each resource and of each kind is indexed once, which picks the same entry the search did.
…-sdk-embedded-text already runs core-text, cookbook-text and two workspace-text cases compared the generated files byte for byte, as the generator's --check does in check:audits (the cookbook one with its own folder walk). The dotfile case moves to embedded-files.test.ts, the module it tests.
The .sim/AGENTS.md guides, the SDK README and the workflow code docs named 5 or 6 of the 13 warnings a check fails on. STRICT_FINDINGS (source-strict.ts) now holds each code with its phrase; check builds STRICT_CODES from it and both guides print every phrase, while the README and docs point at check --help. The workflow guide also names the skills, custom tools and MCP servers workspace.d.ts declares.
…names DESIGN.md said asking for or planning with a staged blob extends its expiry; only staging does (staging/store.ts). The rule named a NOUNS table that no longer exists and listed the embedded-text tests instead of check:workflow-sdk-embedded-text and the fixture-catalog pair.
… that it does The README calls the SYNTAX.md Diagnostics table every code's meaning, but it lacked nine, among them E_APPLY_UNRESOLVED_REF, E_APPLY_REF_OUT_OF_SCOPE and E_APPLY_VARIABLE_DELETE that the docs and the primer cite. codes.test.ts compares the table's codes with DIAGNOSTIC_CODES.
…nst --help scripting.mdx is a hand-written guide page, so check:cli-docs never reads its six source exit-code tables. Each must now list every code its command's --help names, and only real source codes.
A staging request of up to 1,000 blobs uploaded them one after another while holding its slot. mapWithConcurrency starts no more after a failure and waits for the running ones, so every written object is still recorded before the cleanup removes the unrecorded.
… adapter The MCP adapter's copy was the named one applied to the canonical declarations.
zonedClockDate had no caller since before #10129 moved timezone.ts into @sim/utils, and getSupportedTimezones, CommentaryWriter and resolveWorkflowRunSelection are used only inside their files; the unused-exports baseline shrinks by three.
…ipt the repo installs SOURCE_TYPESCRIPT_VERSION says it is the release the declarations are checked against, but the devDependency is a caret range: a lockfile bump would send agents to another tsc than CI runs.
Check STRICT_FINDINGS keys against DiagnosticCode, inline the column-call head regex, drop a TSDoc left on baseOf by the changedFields move, and drop the wall-clock diff-filter test that source-status.test.ts (linear pathFilter) and the repeated-./ kinds test already cover.
…ty help parse A secrets.ts change must meet every server change of its kind, the firstOfKind branch the map rewrite added; the scripting docs case now fails if the help wording stops yielding codes.
… browser-safe workflow-code workflow-code type-checks without node types, so a test reading SYNTAX.md cannot live there. The workflow-sdk README is the one that calls the table complete, so its package holds the check.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] This PR appears safe to merge; no actionable issues were found. SummaryThis PR removes duplicate helpers and speeds up workspace source reads, status checks, and staged uploads.
|
Summary
Final-state audit of workflows/workspace as code (#10129 through #10307). No behaviour change except where a test is listed.
Perf / super-linear regexes (each has a scaling test that fails on the old code)
workspaces source diff --server: the filter's trailing-slash strip/\/+$/was quadratic; it now uses the sharedgivenFilterPath, which also drops repeated./likepathFilterdoes, so./././tables/x.tsasks the server only for tables (test)COLUMN_CALLscanned to end of file per unclosedcolumn.x((66x growth at 8n); now head regex plusindexOf, same matches (test)sourceStatus: per-server-changelocal.findis now two first-seen maps (64x growth at 8n before; test also pins the root-file kind branch)babelMessageinstead of a copy with a quadratic\s*strip; SDKstripCommentsno longer lets\s*cross linesDead code / duplication removed
utf8Bytes(workflow-code) replaced by@sim/utils/pasteutf8ByteLengthat every callernormalizeBlockNamecopy in the CLI replaced by@sim/workflow-types(it is already bundled through workflow-code)memberName(2 copies) moved intobabel.ts;printNumbercopy in workspace-code; MCP adapter'schangedFieldscopyzonedClockDate(no caller);getSupportedTimezones,CommentaryWriter,resolveWorkflowRunSelectionun-exported; unused-exports baseline shrinks by 3check:workflow-sdk-embedded-textHacks replaced
REFUSABLE_WARNING_CODESis derived from the refusal rule maps (was a hand-kept copy); rule codes are type-checkedSTRICT_FINDINGStable (codes checked againstDiagnosticCode);check --helpand both.sim/AGENTS.mdguides build from itDrift fixed
workflows/codedocs named 5 or 6 of the 13 warningscheckfails onE_APPLY_UNRESOLVED_REF,E_APPLY_VARIABLE_DELETE); a workflow-sdk test now compares it withDIAGNOSTIC_CODESscripting.mdxsource exit-code tables are now checked against each command's--helpSOURCE_TYPESCRIPT_VERSIONis tested against the installedtypescriptworkspace.d.tscontents; rule file's staleNOUNSand artifact listTests
Deferred / product decisions (not in this PR)
maxRowsBytes(16 MB) andWORKSPACE_SOURCE_REQUEST_MAX_BYTES(58 MB) can't be reached: lower the limits or exempt the source routes from the proxyworkflows source check/statuswriteworkspace.d.tsand tsconfigs without the source command lock that the workspace versions takeholdUnavailablematches the credential placeholder inside the refusal message (pinned byreferences.integration.ts); a structured id on the gate finding would remove the text matcheffectiveBatchSizetruncates whileclampParallelBatchSizedoes not; the two index-scoped mode-key regexes disagree on malformed keysmapWithConcurrency-style copies elsewhere in apps/sim;canonicalJsonvsstableStringifyneed a "which one" noteType of Change
Testing
check:audits,check:test-types,check:migrations, docs compatibility,lint:check, root type-check: GATE PASScheck-block-registry.ts origin/staging,test:scriptsChecklist
test-auditauthoring gate)