58 Commits
Author SHA1 Message Date
Waleed 85ea094e7a chore(redis): require Redis and remove the no-Redis fallbacks (#10272)
* chore(redis): require Redis and remove the configuration fallbacks

* chore(redis): remove the remaining no-Redis paths across the app, realtime, setup and deploy config

* fix(redis): resolve rate-limit storage lazily and address review findings

* improvement(redis): address review threads and simplify the leftovers of the fallback removal

* fix(redis): keep unit tests off a real Redis and update integration tests for lazy channels

* chore(redis): drop stale fallback references after rebasing
2026-11-20 19:56:20 -08:00
Waleed e6f6a0f36f improvement(config): derive enterprise flags from one registry, add REGISTRATION_MODE, merge vLLM and LiteLLM (#10271)
* improvement(config): derive enterprise flags from one registry and merge the vLLM and LiteLLM providers

* improvement(auth): replace the three signup toggles with REGISTRATION_MODE

* fix(config): address review findings

* fix(setup): advise the registration mode in effect; refresh docs fence sizes

* improvement(config): simplify the registry and registration seams; retire the sandbox readiness marker

* fix(config): expose the registration mode through getRegistrationMode

* chore(docs): refresh the compatibility baseline after rebasing

* fix(providers): use static log messages in the self-hosted core; document registration helpers
2026-11-20 19:40:04 -08:00
Waleed 2689d4e4ca improvement(ci): install e2e browser system packages from a per-image cache (#10258)
* improvement(ci): install e2e browser system packages from a per-image cache

* fix(ci): time the browser install itself and let an updated package set save under a new key

* fix(ci): save a newly filled browser package cache even when the suite fails

* fix(ci): report why a cached browser package install fell back

* fix(ci): install cached browser packages with dpkg so apt never refetches them

* fix(ci): repair apt state only after a failed cached dpkg install

* fix(e2e): start the markdown keyboard selection inside the word and compare settled chip screenshots
2026-11-20 14:47:41 -08:00
Waleed 170279a066 improvement(ci): start http e2e jobs beside the e2e build (#10244)
* improvement(ci): start http e2e jobs beside the e2e build

* fix(ci): bound the wait-script test's child process
2026-11-20 11:16:46 -08:00
Waleed 892d8d8b5a improvement(ci): run the large permission import e2e beside organization search (#10225) 2026-11-19 20:20:16 -08:00
Waleed bc8f09ccb1 feat(workflow-code): workflows and workspace as code (#10129)
* test: type the MCP base address the concealment check compares

* fix(workspace-code): check file path collisions on a segment tree, not a map of every prefix

Keeping every folder prefix of every path still held about a million prefix strings for
20,000 deep paths. A tree of folded segments costs one fold per segment and holds each
segment once, so the depth cap is no longer needed.

* refactor: drop the exports of isSuspiciousCharacter and readFolderWritten, used only in their files

* docs(workflow-code): CI needs a personal key; document workspace-key E_APPLY_FORBIDDEN and --only

workflows.source.apply and create deny workspace API keys, so the CI guidance now asks for a
personal API key or an OAuth login. Workspace as code names the kinds a workspace key cannot
write (workflows, skills, secrets, deployments), the E_APPLY_FORBIDDEN refusal, and narrowing
an apply with --only.

* docs(workflow-code): link the code pages from workflows, CLI, getting started, API and MCP

Adds a For coding agents section to Workflows as code (get, edit, check, status, apply, starting
from .sim/AGENTS.md), a prefer-source note on the API build guide, and an MCP section on editing
a whole workflow with getWorkflowSource and applyWorkflowSource.

* docs(self-hosting): document the WORKFLOW_CODE preview flag

Adds a Preview features section with WORKFLOW_CODE and links it from the in-preview callouts on
the workflows and workspace as code pages.

* feat(workflow-code): Code tab header with Preview label, CLI copy and docs; Download as code

The Code tab gets a title row: a Preview badge, a button copying
sim workflows source get <workflowId> --dir ./<workflow-name-slug>, and a link to the docs.
The workflow menu gains Download as code beside Export workflow, saving the draft as the
single TypeScript file the Code tab shows (function code inline). The download revalidates the
cached source by ETag first, so an edit since the tab last read is never missed.

* chore(rules): load the workflow-code rule for the v2 source routes, contracts and staging cleanup

* feat(llms): list workflows as code in llms.txt

* docs(cli): workflows and workspaces as code in the README, help epilogue and source group descriptions

Adds a README section (get, check, status, diff, apply and the coding-agent loop), a source get
example to the root help, and describes both source groups as read and apply, marked (preview)
while the server flag gates them. Regenerating the CLI docs changes nothing: the pages list each
command, not group descriptions or the root epilogue.

* test(workspace-source): a re-run adopting a stopped MCP replace with stored() headers still needs an admin

A workspace key re-running an interrupted replace is refused with E_APPLY_FORBIDDEN, the
owner's re-run finishes it, and a read-only member's get prints the adopted server's
literal headers as stored().

* feat(workflow-code): roll the workflow-code flag out by organization, workspace or user

Every source use case, the Code tab layout and useFeatureFlag now evaluate
workflow-code against the workspace, its organization and the acting user,
so AppConfig orgIds/workspaceIds/userIds allowlists take effect. Adds the
rollout plan to the workflow-code design doc.

* feat(mothership): grant the workflow-code entitlement where the source commands run

computeEntitlements now sends workflow-code to the worker for a workspace or
organization chat whose rollout has the flag on, ahead of the worker's
ENTITLEMENTS enum (the wire accepts any name). The CLI inventory marks every
workflows source and workspaces source command with entitlement: workflow-code
so the worker can hide them once it reads the field.

* docs(api): say how workspace source blobs are staged, and that dryRun previews

The applyWorkspaceSource description pointed MCP readers at Stage Workspace
Source Blobs, a multipart route MCP does not expose; it now names the CLI and
the blob upload route. The MCP write tool no longer claims no write can be
previewed: the source applies take dryRun.

* feat(analytics): record workflow source reads and dry runs, and workspace source applies

Adds workflow_source_read, workflow_source_dry_run and workspace_source_applied
beside workflow_source_applied: same attribution, kinds and counts only. A
refused dry run is now a dry-run event, never an apply.

* docs(workflows): commit written.json and point workspace CI to its own section

* test: read the MCP server URL as nullable in the stopped-replace check

* test(workflow-code): resolve the workspace before the flag in the HEAD 403 check

The flag now needs the workspace's organization, so the read routes resolve
the workspace first; the test gives them one to resolve.

* test(analytics): one workspace_source_applied per apply, refused, partial or committed

Busy, rejected and partial applies each record exactly one event with their
outcome, the committed retry one more, and a dry run none.

* fix(cli): resend a rate-limited GET even when its response body is lost

Cancelling an errored body rejects, so a 429 whose body was lost threw the raw
stream error instead of resending.

* fix(tests): order the workspace source "nothing was written" snapshots by id

The snapshots compared before and after a refused apply selected rows with no
ORDER BY, so their order was whichever index the planner chose: on the
workflow table the sort, unique-name and workspace_id indexes each return a
workspace's rows in a different order. Once autovacuum analyzed the table
between the two reads the plan could change, and the cross-kind test failed
with equal rows in a different order. Forcing the second read off index scans
reproduced the exact failure; ordering by id makes the comparison
plan-independent.

* refactor(source): one vocabulary for the fingerprint of what the server stores

PlannedChange.serverFingerprint is storedFingerprint and KindAdapter.fingerprintNow is
storedFingerprintNow; the workflow adapter's currentFingerprint() is readStoredFingerprint;
the sf1: helper in print-stored is storedSourceFingerprint, beside the kinds' rf1:
storedFingerprint; the workflow apply's local and EvaluatedSource field are storedFingerprint,
as source-commit already named it. The 409 wire field currentFingerprint is unchanged.

* fix(workflow-sdk): the workspace runtime exports defineSecrets and defineCredentials

secrets.d.ts and credentials.d.ts declare them and the cookbook imports them, but the
runtime entry did not export them, so running such a file failed with 'export not found'
instead of SimSdkNotExecutable. codeFile now re-exports core's stub, as tool.d.ts declares.
A test keeps the runtime's exports equal to every value the declarations declare.

* fix(workspace-source): re-scan deletes for new users under the apply lease

The plan's in-use scan ran before the lease, so an apply that saved a workflow
using a resource another apply was about to delete went unseen: the deleting
apply took the lease and deleted anyway. The apply now scans its deletes again
once it holds the lease and refuses (E_APPLY_STALE, nothing written) a delete
that a workflow the plan did not find now uses; a scan timeout still fails
closed.

* fix(cli): take a stale source-directory lock over safely, never through a link

Two commands that found one lock stale could both remove it: the later one's
removal deleted the live lock the first had taken, admitting two writers. A
takeover now claims the stale lock folder it removes (only one command can) and
checks it is still stale first, so a lock that replaced it is left alone.

The lock path also bypassed the source directory's symlink checks: a .sim or
command.lock that is a link was followed. Both are now refused
(SOURCE_SYMLINK) before the lock is created, read or removed.

* fix(cli): workflow commands in a workspace folder hold the workspace directory lock

A single-workflow apply, create or get inside workflows/<key>/ of a workspace
directory rewrites the workspace's written record and base, but took no lock, so
it could interleave with a workspace command (or another folder's) and lose a
record. These commands now hold the workspace directory's command lock for the
whole command, refused like a workspace command (SOURCE_DIR_BUSY, exit 10)
with nothing read or written.

* fix(cli): status recommends commands in its own scope, with --allow-delete for dropped data

The command workspaces source status recommended dropped the scope it was asked
for: status --only tables suggested an apply of every kind, and a status pointed
at a workspace with --workspace suggested one at the profile's. Every
recommended command now carries --only and, when the target is not the
profile's default, --workspace.

It also asked for --allow-delete only for whole-resource deletes, so an update
that drops a column was suggested without it and refused. It now uses the same
destructive count the apply prints.

* fix(cli): an apply that reprints a tool as stored() removes its old code file

When the server keeps a tool's code as stored() (it holds a credential), the
apply reprints tools/<key>.ts without tools/<key>.js, but saving the answer
left the old .js and its digest behind, so the next apply failed with
E_TOOL_CODE. Saving an apply now removes, from disk and the written record,
every text file the directory sent for a reprinted resource that the reprint no
longer holds (workflow folders keep pruning by lock).

* refactor(table): move cell value rules into @sim/workspace-code/table-cells

The per-type coerce/validate/salvage/equality rules, the row loops (required
cells, coercion policy, batch unique scan) and the pure date, currency, ttl and
select helpers move from apps/sim/lib/table into the workspace-code package
(timezone helpers into @sim/utils/timezone). The column-type registry spreads
CELL_RULES into each definition and validation.ts delegates, so there is one
implementation. The workspace source table adapter refuses declared rows with
refusedTableRows, which the CLI can now run offline.

* feat(sim-cli): workspaces source check validates table rows files offline

Each tables/<key>.rows.jsonl (managed or seed) is read against its declaration
and checked with the write's own rules (refusedTableRows): a malformed line, an
undeclared column, a managed key two lines share, an empty required cell, a
unique value two rows share, a value its column's type or options cannot hold.
Each is an E_TABLE_ROWS error at its line.

* fix(workspace-source): credential adoption never takes a credential from a key bound outside source

* test(workspace-code): assert linear growth, not a wall-clock budget, for hostile inputs

The file-grouping test asserted 20,000 deep paths group within 6 s and took 7.2 s
on a CI runner. It now counts the characters case folding reads at depth 100 and
400 (about 4x linear, 15x for the per-prefix fold it guards against), which no
machine load changes. The two compile tests with a 3 s budget (JWT pattern,
numeric precision) now compare the fastest of three runs at n and 4n: reverting
either fix gives about 15x against a bound of 9.

* fix(table): a seed reshape refuses a table that gained rows since the plan saw it empty

* fix(table): a keyed row write inside a reshape runs at the bulk-write statement timeout

* fix(workspace-source): hold the apply lease from before the plan, not only the writes

An apply planned before taking the lease, so another apply could write between
its plan and its writes: the first then wrote half of itself and failed
(E_NAME_TAKEN, E_APPLY_STALE), or deleted a resource a workflow had just
started using, because its in-use check had run before the other apply's save.
A non-dry-run apply now takes the lease first and plans and writes under it, so
a second apply is refused SOURCE_BUSY before it reads anything. This replaces
the post-lease in-use re-scan, which covered only deletes. Dry runs still take
no lease; the per-write lease confirm and stored-fingerprint re-checks stay for
UI edits, which the lease does not order.

* fix(workspace-code): literal-secret findings carry a span but no code frame

E_MCP_LITERAL_SECRET, E_DEPLOY_SECRET, W_TOOL_LITERAL_SECRET and the workflow
W_LITERAL_SECRET framed the line holding the secret, echoing it over v2 and MCP.
They keep their span; the finding cap and the server locator drop the frame too.

* fix(workspace-source): a secret declared without a description records no base entry, so it is never falsely stale

* test(workflow-code): time hostile inputs with Date.now, repeated past the clock's resolution

The package has no Node or DOM types, so performance is not declared. Each
growth timing now repeats the work until it spans 25 ms, so millisecond steps
do not swing the ratio.

* fix(workspace-code): an env reference or helper call is never read as an object

headers: env.TOKEN parsed with no finding into a header named $env, and
defineTable(column.string()) reported the encoding's $call/args fields. Both
now get one finding that names the value and how to write the object.

* feat(workflow-code): mixed-script block names, workflow inputs, env hint target

- E_LOOKALIKE_NAME also refuses a block name with a word mixing Latin with
  Cyrillic, Greek, Armenian or Cherokee letters (Unicode script property, no
  confusables table), naming the code point; W_ when the block is stored.
- startInputs and INPUT_TRIGGER_TYPES (shared with apps/sim) read a workflow's
  Start trigger inputs; W_CHILD_INPUT_UNKNOWN and W_CHILD_NO_START join the
  vocabulary for the CLI's offline child-call check.
- CompileInput.envDeclaredIn points a W_ENV_UNKNOWN hint at secrets.ts.

* feat(sim-cli): workspaces source check covers skills, child inputs and workspace.d.ts

- skill('<key>') is checked against skills/ like every other kind; a key with
  a non-ASCII letter names its code point and script.
- A child workflow call is checked against the child's Start trigger in the
  same directory (W_CHILD_INPUT_UNKNOWN, raised on new blocks; W_CHILD_NO_START).
- A get keeps the server's resource manifest beside workspace.d.ts, and check
  regenerates workspace.d.ts from it and the directory's declarations, typing
  new keys and each workflow's inputs without a request.
- Did-you-mean hints on E_MAT_UNKNOWN_RESOURCE, W_TABLE_UNKNOWN_COLUMN and
  W_ENV_UNKNOWN (which points at secrets.ts); a warning raised to an error no
  longer says it is kept as written.
- check --help lists every kind it checks.

* fix(workspace-code): check the option cap before a linear duplicate scan; pin a duplicate column to itself

A select's repeated-option scan was quadratic and ran before the maxOptions cap:
80k options took 7 s per parse (now ~0.1 s). E_TABLE_DUPLICATE_COLUMN spanned the
whole defineTable argument instead of the second column.

* perf(workspace-code): group a status's changed files in linear time; key server findings by code

localResourceChanges copied the kind's array per file: 40k files took 3.3 s.
SERVER_FINDINGS is now checked against WorkspaceDiagnosticCode.

* perf(workflow-code): print a fill in linear time by advancing an offset

printFill re-spread the remaining parts for every content/separator pair, so a
number-only array printed in quadratic time (40k numbers took 17.5 s). The rest
of the fill is now queued as the same parts from a later offset.

* fix(workflow-code): refuse a tool param or operation option the builder pins

A tool builder's fixed params and the operation option overwrote the method's
pin silently, so the tool stored an operation the method contradicts and printed
back as raw(). Report E_FIXED_PARAM, as the block path does.

* refactor(workflow-code): look a tool's builder up once

toolBuilderPath found the builder, returned its path, and compileToolCall looked
it up again behind an early return that could not fire.

* fix(workspace-code): cap knowledge document findings apart from knowledge.ts's own

Document findings were uncapped and counted against the field reporter's
100-finding budget, so the declaration's own findings became E_LIMIT_EXCEEDED.
The field reporter now counts only what it appends.

* fix(workspace-source): a workflow delete is fingerprinted only once its live triggers are counted

* fix(workflow-code): exclude a retyped block from rename inference by its own id

A retype matched by lock ident (or against a prev block the canvas renamed)
excluded the prev block under the new key, not the one it retyped, so another
new block of the old type could inherit the old id, its run history and its
webhook. Record the retyped prev id and exclude that.

* fix(workspaces): a key claim that loses a concurrent race refuses with 409 or retries, never a raw 23505

claimResourceKey read the key with select-for-update, but an unheld key has no row to lock, so a
concurrent get (allocation) or claim could insert first and the plain insert failed with a unique
violation on either index, surfacing as a 500. The insert now skips on conflict and the claim
re-reads the committed winner: kept, ResourceKeyTakenError, or a retry that replaces a key the
resource was allocated meanwhile. Rebinding deletes and re-inserts so it shares the same path.

* perf(workflow-code): push identity group keys instead of re-spreading the group

Each push copied the whole group, quadratic when many unmatched blocks share a
type and parent.

* fix(workflow-sdk): new on a runtime export throws SimSdkNotExecutable; one stub for both entries

The Proxy target was an arrow function, which has no [[Construct]], so the
construct trap never ran and new t() threw a TypeError. The workspace runtime
re-declared notExecutable and seven identical functions; both entries now share
the stub in not-executable.ts.

* feat(workflow-code): x.error compiles in the handler of an onError edge

The executor returns { error: <message> } as a failed block's output when an
error edge leaves it (BlockExecutor errorOutput, block-executor.ts:738-740,
returned at :868-877). Compile accepted no such path, so the INDEX promise of
${x.error} failed with W_UNKNOWN_OUTPUT_PATH. Now x.error checks once the edges
are known: accepted with an error edge, refused with a hint to wire onError
without one. Block<O> types error in the SDK, INDEX says how the handler reads
it, and the integrations cookbook shows it.

* fix(workflow-code): compile stored() in a loop or parallel's meta.extra

The printer writes a container param holding a detected credential as stored()
under meta.extra, but compileContainer passed no keep callback, so the print
failed to compile. Keep the stored value as a regular block's extra does.

* fix(workflow-sdk): never embed a dotfile from the cookbook

WORKSPACE_COOKBOOK embedded every file on disk under cookbook/workspace, so a
.DS_Store or editor swap file would be written into every user's example
directory. The listing now lives in embedded-files.ts, shared with the drift test.

* docs(knowledge): say why an upload's processing relay is safe on every surface

* perf(workflow-code): read each node's successors once in the cycle check

stronglyConnected called successors on every step of a frame, and the caller
maps the node's whole outgoing list each time, so a block wired to many targets
cost O(deg^2). Read them once when the frame is pushed.

* perf(workflow-code): test a restored inactive value with withStoredValue

staysInactiveWithPrev rebuilt the block's whole activity inputs (every param,
the modes, the ids deploy reads) for each inactive id on each pass. Build them
once per pass and swap the one value in, tracking the pass's restores.

* fix(workflow-code): keep collapsed on inputFormat fields whose id stays inline

Canonicalize drops the editor's collapsed flag from every field, but materialize
restored it only for fields whose id moved to the lock, so a field with a shared
or missing name lost it whenever the list changed.

* feat(sim-cli): no login exits 13 with AUTH_REQUIRED

Not logged in, an OAuth login that expired and cannot refresh, and a 401 from
the server exited 1 with CLI_ERROR, the same as a source with errors. They now
exit 13 (AUTH_REQUIRED_EXIT_CODE) with the code AUTH_REQUIRED (a 401 keeps the
server's code when it sends one). A status still falls back to the local view
without a login, and its note now reads as sentences.

* fix(workflow-code): write a subflow collection holding a $sim object back unwrapped

Canonicalize and compile wrap an object with its own $sim key as a literal node,
but materialize wrote forEachItems and distribution raw into block.data and the
loops and parallels maps, so after any config change the executor iterated the
wrappers. Unwrap literal nodes there, and say so in jsonField's TSDoc.

* fix(sim-cli): source diff filters resolve against --dir; cancellation and 413 keep their exit

- diff ./, an absolute path or a path from the current directory selected
  nothing and printed "No local changes."; filters now resolve against --dir and
  one that selects no file is refused (SOURCE_PATH_UNMATCHED).
- A cancelled request carries REQUEST_CANCELLED, so status no longer reports it
  as an unreachable server; noAnswer() is the one copy of that predicate.
- workflows/workspaces source status and diff map a 413 to exit 7, as get does.

* fix(workspace-source): holding a change for one credential key keeps another key's unreachable refusal

* fix(sim-cli): an apply drops the written.json entries of the resources it deleted

The record kept every deleted resource's files, so status reported the delete
forever (exit 11) and recreating the key made get refuse with SOURCE_LOCAL_EDITS.
An entry is dropped only when its file is gone and the returned base no longer
holds the resource or blob, so a held or failed delete stays retryable.

* fix(workspace-source): a chat auth type source cannot name leaves the deployment out instead of reading as public

* perf(workflow-code): bucket wiring and order dependencies by scope once per print

Each scope's wiring rescanned the members of every enclosing scope and refiltered
their edges by edgeScope, and each scope's declaration order was handed every
dependency in the workflow: O(scopes x blocks). Bucket edges by the scope they
print in, and dependencies by the scope they order, in one pass.

* fix(workspace-source): file creates of one name check every key they may take, and a lost key claim refuses the create

* perf(workflow-code): memoize buildFieldIndex and group pair members in one pass

The index was rebuilt for every block in print and compile and for every tool,
and each canonical pair rescanned every subBlock for its members: O(pairs x
subBlocks) per call. Group the members once, and memoize the read-only index by
block, trigger mode and pinned ids.

* refactor(workflow-code): sort compiled edges with canonicalize's compareEdges

Compile kept its own copy of the comparator, and the CWM edge order is hashed
(canonicalHash), so two copies could drift.

* chore(workspace-source): unexport WorkspaceSourceChange, used only in its own file

* docs(workflow-code): move compileRegularBlock's TSDoc onto it

It sat above BlockShape's own TSDoc, documenting nothing.

* fix(workspace-source): the staging sweep removes objects before their rows, keeping a row whose object survived

* docs(workflow-code): describe LoopSpec as canonicalize reads it

The TSDoc said the spec is the loops map's config and that canonicalize never
fills defaults; loopSpec reads block.data first, never takes the map's count,
and falls back to a for loop of 5.

* refactor(workflow-code): stop exporting ConfigItem

Nothing imports it; it is only printedConfig's item type.

* refactor(workflow-code): read pinned values and the catalog block once

compileMetaParams rebuilt the map of every stored value once per pinned id, and
needsTodo looked the catalog block up twice though collectParams already holds it.

* fix(table): a reshape resolves each column update to its id, so a by-name swap renames both

* fix(workspace-source): a get leaves out a secret named __proto__ instead of printing an unapplyable secrets.ts

secrets.ts printed every stored secret, but the declaration reader refuses a
__proto__ key, so after a get the whole file stopped applying. The secret is
now listed in skipped.json with the reason; MCP header names the reader refuses
already round-trip-fail into skipped.

* perf(sim-cli): a status past one dry run prunes its whole read instead of walking the directory again

When the workflow folders exceed one dry run, status read the directory a
second time: a second walk, read and hash of every file. It now prunes the
unchanged folders from the read it already made.

* perf(sim-cli): workspaces source apply walks the directory once, inside its lock

assertWorkspaceDir walked every kind folder outside the lock before
readWorkspaceDir walked it again; the apply now checks the read it made and
runs the full check only to refuse. orphanedWorkflowFiles groups the answer's
paths by folder once instead of per lock, assertBaseWorkspace reuses
baseWorkspaceOf, and printPlan no longer shadows counts.

* fix(sim-cli): --only reads past an empty segment instead of refusing an unnamed kind

* refactor(workspace-code): un-export four unused types, name the skill locator apart from a line's offset, fix two TSDocs

* feat(workspace-source): an existing column becomes required in the same apply as the managed rows that fill it

* perf(workspace-source): list MCP servers' tools concurrently while planning tool references

* perf(workflows): a batched source read prints its workflows concurrently

* fix(workflow-types): hold a container's edges to the handle they leave from

A loop or parallel's start handle connects only into the container, and any other
handle never does. The shared scope rule ignored the handle, so the editing engine
kept a start edge to a block extracted from the loop (and an end edge to a block
moved into it): edges the canvas never draws and workflow source refuses
(E_EDGE_SCOPE), so such a workflow could not be applied back from its own source.

* fix(editing): refuse an error edge from a block with no error output

The engine accepted an 'error' handle on any block, so a trigger or a loop or
parallel container could store an error edge the canvas has no port for and
source cannot write (E_ERROR_PORT_UNSUPPORTED). It now follows the source
catalog's errorPort rule.

* fix(editing): normalize row ids only on fields declared as row lists

Row-id normalization keyed on the subblock id alone, so any field that shares an
id with a table field (supabase's JSON code 'params', 'metrics', 'headers',
'variables') was coerced to a row list: a JSON object or code text was replaced
by [] and the value lost. It now applies only where the block declares the id as
a row-list type.

* fix(workflow-code): keep the pair member a trigger-mode pair's mode does not select

Deploy reads every member of a trigger-mode pair, so the inactive-param restore
never brought back the member the mode does not select. An unchanged apply of a
block toggled into trigger mode dropped that member's stored value, and editing
the selected member dropped the other one. The pair's value is now its
mode-selected member's, and the other members keep their stored values, as on
the canvas.

* fix(workflow-code): write only the subflow config fields an edit changes

Canonicalize fills a loop's count (5) and the collection and conditions the
subflow map holds when block.data omits them; a changed config wrote all of them
back, so renaming the block a loop condition reads also stored count, collection
and condition fields nobody edited. Fields equal to the stored config keep their
stored spelling, absence included.

* fix(workflow-source): compile a block renamed in source against the block it continues

Compile matched the stored block by key, while materialize keeps a renamed
block's id through its ident (lock-ident). Renaming a block in source therefore
refused its stored() secret (E_STORED_VALUE_MISSING), turned a stored cycle into
E_EDGE_CYCLE, and reset fields source never writes (a note's color) to their
defaults. compileSource re-keys the stored model to the source's renames and
compiles again.

* refactor(sim-cli): name what source helpers do and fix their docs

- mergedGitattributes merges .gitignore too: withMissingLines.
- isMissing reads the code through errorCode, not a cast.
- workflows source check calls workspaceFolderOf directly.
- Exit codes 5, 6 and 7 document workspaces source as well.
- workflows source resources lists MCP servers; any source get writes it.
- Two TSDocs a reflow mangled.

* perf(workflow-persistence): read only live in-workspace graph rows in a batch load

loadWorkflowsFromNormalizedTablesRaw read every block, edge and subflow row of every requested id,
then dropped the ones outside the workspace, and kept archived workflows the read snapshot
discarded afterwards. Each graph query now filters by the live in-workspace ids as a subquery.
Measured on 100 live + 300 archived workflows of 30 blocks: loadWorkflowReadSnapshots median
579ms -> 151ms.

* perf(workflows): one credential lookup for a batch load's block migrations

loadWorkflowsFromNormalizedTables ran each workflow's block migrations serially inside the
REPEATABLE READ snapshot, and the credential-id migration queried once per workflow holding a
legacy account id. The batch now prefetches the credential ids for every workflow's legacy ids in
one query, and only queries again for an id a migration surfaces that the prefetch did not ask
about, so the result is unchanged: N serial round trips become one.

* fix(api): one ETag revalidation path; tagged v2 bodies are revalidated, and cached per request

- ifNoneMatchSatisfied was copied in the internal and v2 JSON builders; definition.ts now owns
  entityTagMatches and notModifiedResponse.
- The v2 builder answered a tagged 200 and its 304 with private, no-store, which forbids keeping
  the body the ETag exists to revalidate. Both now say private, no-cache, as the internal one did.
- The v2 validated-body LRU was keyed by the tag alone and served across principals and inputs,
  though present() reads the parsed request. It is keyed by tag and parsed request now, and
  entityTag documents that it must be a strong validator of the result for every caller.
- The internal builder's HEAD branch re-checked a missing authorize() that definition-time
  validation already refuses; it captures the authorize phase once instead.

* fix(workflow-sdk): codegen uses its layout helpers; INDEX.md lists legacy builders only when there are some

- generate.ts builds block, models and index paths from layout.ts; blockTypesFile
  leaves the barrel; layout.ts reads TOOL_NAMESPACE.
- @when names both fields of an and clause.
- typecheckSdkDirectory spreads SOURCE_COMPILER_OPTIONS.
- The cookbook declares ORDERS_API_KEY, which its tool reads, and says a new
  query string updates an MCP server in place; column.ttl() says one per table.
- Doc fixes: arrayOf, declaredBlockTypes order, core.d.ts names tsc.

* fix(schedules): a written zero is an invalid schedule field, not a missing one

The reason classifier read fields through getSubBlockValue (value || ''), so a numeric 0 counted
as empty. It now checks undefined, null and '' explicitly.

* docs(environment): state the non-empty invariant both env paths share

* chore(scripts): name the pure package an offender is in, not always workflow-code

* refactor(chat-deployments): one identifier-ownership check, and one live-chat read per replace pre-check

* refactor(workflows): the code tab names its directory with the shared slugify

* refactor: keep types no other module imports private

* refactor(workflows): drop the field-by-field source apply presenter

The response schema already strips the result's internal fields, so both routes present the
result as it is.

* refactor(workspace): the workflow-code flag is required of every flags producer

* refactor(utils): one mapWithConcurrency, with documented failure semantics

apps/sim had its own mapWithConcurrency next to @sim/utils/concurrency's, with different failure
semantics: it rejected through Promise.all as soon as one item failed while its other workers kept
starting items nobody awaited. Every caller now uses the @sim/utils one: after a failure no item
starts, and the first failure is thrown once the running items settle, so nothing the batch began
is still running when the caller handles it. mapSettledWithConcurrency (attempt every item, keep
each outcome) moves alongside it. createConcurrencyLimit, MATERIALIZE_CONCURRENCY and
waitWithAbort stay in apps/sim.

* perf(workspace-source): a knowledge plan never downloads a document named in neither the base nor the directory

* docs(workspace-code): CI commits back what apply rewrote, tsc step, Gmail provider

- The scripting.mdx CI job runs tsc after check (which regenerates
  workspace.d.ts), and on merge commits back the files the apply rewrote, with
  [skip ci] and contents: write; a protected branch opens a pull request instead.
- workspace-code.mdx says what check now covers (skills, child inputs, rows,
  workspace.d.ts).
- The cookbook credentials.ts shows Gmail's provider id, google-email (the id
  apps/sim/lib/oauth/oauth.ts registers for Gmail).
- The docs baseline records the changed CI fence.

* docs(cli): regenerate the CLI reference for the check help and exit 13

* test(api): the source catalog's tagged 200 is private, no-cache

* fix(workspace-source): a renamed or name-taken stored() tool reports only that, not a missing stored tool

* fix(workspace-source): a deleted chat's base no longer records its password variable

* fix(table): reshape audit entries name columns, never their ids

* refactor(workflows): drop the never-filled SourcePlan.notes, share the stale message, and read a rename's folder from the loaded workflow

* refactor(source): one managed-row key, one tool-input field list, and no unreachable fallbacks

* docs(source): gated manifest sections, the required-column 400, carried tags and the manifest limit

* chore(source): regenerate the v2 OpenAPI and MCP operations for the documentation changes

* test(workspace-code): bound the option-cap and status-grouping fixes by n vs 4n growth, not wall clock

The ratio helper is exported from @sim/workflow-code/scaling.test-helpers so
other packages' scaling tests share it.

* fix(workflow-code): x.error is a string in a JSON field

The executor's error output is the failure message, so a reference to it in a
JSON body (response, API body) is stored quoted, as compile and print decide
through refValueKind; bare, a message would break the JSON.

* refactor(workspace-code): rowKeyText reads any cell value, so the table row writer shares it

* chore: drop the apply wire type no module reads, and shrink the non-null baseline the batch load cleared

* test(workspace-source): the cookbook apply test holds the Gmail credential the cookbook declares

* fix(workflow-code): keep a stored field the printer left out as inactive

Compile fills an omitted param with its default, then keeps the stored value only
when the field is inactive, judged with the default in place. A standalone
advanced field runs once non-empty, so a stored '' choice (cloudflare's 'Active
only' certificate filter) read as active under the default and every apply
replaced it with 'all'. Inactivity is now judged with the stored value.

* refactor(utils): point the merged mapWithConcurrency callers at @sim/utils

* test(workflow-source): prove canvas, JSON API and source stay in lockstep

A seeded fuzz applies random sequences of real editing-engine operations (add,
delete, move, edit fields, connect, disconnect, insert into and extract from
loops and parallels, rename, enable, retype, trigger and advanced mode, loop
config, variables) to corpus workflows, then asserts the source of the result
applies back as a no-op and one random source edit changes exactly that field.
Failures shrink to a one-minimal edit list. Every registry block type is added
(or, for legacy and single-instance types, edited) with non-default values in
each subblock kind it has. Each divergence fixed on this branch keeps a minimal
regression. The integration suite runs the full stack on Postgres: JSON write,
editing operations, source get and apply, JSON read, and a canvas-built workflow
against the one created from its source.

* chore: drop exports the cell-rule move left unused; move the timezone baseline entry

* chore(audits): count staging's new integration double-cast in the merged ratchet

* test(workflow-source): satisfy the audits in the fidelity suites

* test(workspaces): wait with the shared sleep helper

* fix(cli): recover a command lock abandoned before its owner was recorded

The takeover claim inside the lock refreshed the lock folder's mtime before
the staleness re-check, so a lock with no owner.json never read as stale and
every command returned SOURCE_DIR_BUSY. Judge an unrecorded lock's age from
the sighting taken before the claim, and guard against a replacement lock by
checking the folder is still the one seen (dev/ino) and still stale.

* chore(helm): bump chart to 1.11.22 for the source-staging cleanup cron

* fix(workspace-source): match managed row keys after their column's coercion

planRows compared declared key cells with stored ones before coercing them,
so a number key written as "007" counted the stored row 7 as removed and the
apply refused without --allow-delete, though the keyed write coerces "007"
to 7 and matches it. Coerce the declared key with the key column's cell rule
(the reject policy a keyed write uses) before matching.

* fix(workflow-code): print a JSON code field in meta.extra as its stored text

An advanced JSON code field the serializer still forwards under an operation that
hides it prints under meta.extra, which compile reads verbatim. It printed as an
object literal, so compile stored a native object and an unchanged apply rewrote
the stored text (minified, or not at all equal when it held references). It now
prints as text there; only a builder param takes the literal form.

* fix(workflow-source): keep a block keyed __proto__ in the lock and hints

buildLockFromState, hintsFromSourceMeta and printStoredSource assigned by bracket,
so a block whose name normalizes to __proto__ set the prototype instead of an
entry: it vanished from the lock, and renaming it in source lost its identity
(compile treated it as new and reset its unwritten fields).

* test(workflow-source): regressions from the long fidelity run

A JSON field forwarded under a hiding operation, a block keyed __proto__, and the
by-design collision-key refusal the fuzz now leaves out.

* fix(cli): workspaces source status and diff refuse a directory holding no workspace source

A mistyped --dir, an empty directory, the wrong working directory (--dir
defaults to .) or a workflow folder read as clean: status exited 0 after a
dry run of no kinds, and diff printed "No local changes.". They now refuse
it with the reason and the get to run, as apply and check do.

* fix(cli): status recommends the get that restores a removed kind folder, not an apply

Removing a managed kind's folder or root file (tables/, secrets.ts) stops
managing the kind: an apply leaves its resources alone. status reported its
recorded files as deleted and recommended apply --yes, which wrote nothing, so
the next status said the same thing again (exit 11 forever) while get refused
to write the files back. When every local change is in such a kind, status now
recommends get --only <folders> --force, which restores them, and says how to
delete the resources instead.

* fix(utils): mapWithConcurrency throws the first failure in time

The shared helper threw the failure of the lowest-numbered slot, so a slow
slot-0 error masked an earlier one from another slot. The apps/sim helper it
replaced (Promise.all) threw the first failure, and the TSDoc still promises
that.

* fix(cli): workspace source commands handle a directory no one may write

Every workspace source command takes the directory's lock by creating
.sim/command.lock, so in a read-only checkout status, diff and apply --dry-run
crashed with a raw EACCES stack trace. Commands that only read (status, diff,
a dry run) now run without the lock there, since nothing can rewrite the
directory; get, check and apply are refused as SOURCE_DIR_UNWRITABLE with the
reason.

* fix(cli): status refuses a broken .sim/written.json instead of calling every file created

A merge conflict that leaves markers in .sim/written.json (two branches that
each applied) made status read every file as created and recommend an apply.
It now refuses with SOURCE_WRITTEN_INVALID and names the get that rewrites the
record. A broken .sim/base.json names its way out too (SOURCE_BASE_INVALID).

* docs(cli): status and diff help name exit 7, and the workflow guide exit 13

status and diff exit 7 when the server refuses the source as too large (413),
as exit-codes.ts documents, but their help listed only 0, 11, 12 and 1. The
workflow directory's .sim/AGENTS.md now names exit 13 (not logged in) as the
workspace guide does. CLI docs regenerated.

* fix(executor): splice already-escaped values into JSON strings as written

Escaping every reference landing inside a JSON string literal fixed values that
broke the JSON (quotes, newlines, stray backslashes), but it also re-escaped
values that were already valid string content. A deployed workflow whose env
var holds a key with literal \n escapes, or that escaped a value in a Function
block to work around the old bug, now sent backslash-n instead of a newline.
Only a value that would break the literal is escaped now; one that is already
valid string content splices raw, exactly as before.

* fix(table): write every row's cancellation when one write fails

cancelWorkflowGroupRuns cancels every row's queued jobs, then writes each row's
cancelled status. The shared mapWithConcurrency starts nothing after a failure,
so one failed write left the later rows of the page 'running' with no job behind
them; the apps/sim helper it replaced still wrote them. The writes now all
settle before the first failure is thrown.

* fix(cli): count a workflow changed only on the server as unchanged in workspace status

The status dry run sends every workflow folder whole to detect drift, so the server plans an
update for a folder edited only in Sim. An apply sends that folder by its base and leaves it
unchanged, so the status plan line said 'Applying would: 1 update' for an apply that changes
nothing.

* fix(cli): an interrupted source command releases the directory lock

Ctrl-C during a workspace source command left .sim/command.lock behind. A
later command takes a lock over only when its owner ran on the same host, so
one left in a folder shared with a dev container or another machine stayed
until removed by hand (exit 10 every time). The lock is now removed on
SIGINT/SIGTERM before the signal ends the process, as a staged write's folder
already is.

* test(workspace-source): a key-claim failure trigger left by a killed run no longer breaks the next one

* fix(e2e): expire the workflow source e2e session in UTC

session.expires_at is a timestamp without a zone that the app reads as UTC. now() writes the
database's local time, so on a Postgres west of UTC the one-hour session was already expired
and the canvas-route check got 401.

* fix(cli): get keeps a directory bound to its workspace when its base does not parse

get decided which workspace a directory belongs to only from a base that
parsed cleanly, so one this CLI refuses (a field a later CLI added, a bad
fingerprint) read as no base: get then used the profile's workspace, and
--workspace naming another one was not refused (SOURCE_OTHER_WORKSPACE). It now
reads workspaceId as leniently as apply and status do.

* fix(cli): print nested source apply results as JSON in text output

`sim workflows source apply --output text` printed the modified blocks as
`modified	[object Object]`.

* test(workflow-code): alternate small and large runs in the growth check so machine load slows both sides

* fix(workspace-source): in-use scan reads the live deployment version

A delete of a resource that a deployed workflow's live version still uses,
while its draft no longer does, now warns W_RESOURCE_IN_USE naming the
live version, unless the same apply publishes the draft or undeploys it.

* fix(workspace-source): class a refused apply by the errors that refuse it

The rejected error counted and classed every error, including those of
changes the plan holds back, which refuse nothing. The plan now returns
the refusing errors (plan-level plus non-held changes) and the error
classes from those.

* fix(workspace-source): a key taken after a committed write reports the write

A key claim that found the key held by another live resource after the
write committed threw, dropping the written resource from applied. write()
now returns it with E_NAME_TAKEN; the apply records it as applied, keeps
the base entry unchanged, and stops so no later write resolves the key to
the other resource.

* test(workspace-source): per-process source slot refuses past its cap with 429

* fix(cli): check table row columns when the row holds a non-string reference

Compiled row data stores a non-string reference bare ("n": <score.value>), which JSON.parse
refuses, so check skipped the whole row: an unknown column or select option in any row writing a
number, boolean or object output went unreported. Parse it as a JSON field instead.

* feat(workflow-code): hint api for http.request and fn for javascript.* builders

An agent guessing the HTTP request block as http.request got E_UNKNOWN_BUILDER with no hint:
no edit distance reaches api.

* docs(workflow-code): correct workspace-key, rows, written.json and create claims; fill agent-guide gaps

- credentials bind with a workspace API key; secrets and deployments do not (guide, CI docs, API description)
- table rows are source when a table opts in; list rows.jsonl and the limits
- .sim/written.json is committed, not gitignored; drop stale tsc sizes; exit 9
- a created-not-yet directory has no base: create --dry-run, not status
- guide: api is the HTTP block, W_* print as error in check, self-hosted apiKey, promote setup

* test(workspace-source): a key-claim failure trigger left by a killed run no longer breaks the next one

* test(workflow-code): alternate small and large runs in the growth check so machine load slows both sides

* test(workflow-code): time the block-cap round trip by thread CPU, so machine load cannot fail it

* fix(workflow-code): never print a credential through the response body form

The response(name, { body, status, headers }) form printed its fields'
stored values verbatim, so a response block holding a detected credential
(an Authorization header, a token in the body) printed the secret into the
file while W_LITERAL_SECRET claimed it printed as stored(). Such a block now
keeps its own params, where the field prints as stored(), and compile warns
W_LITERAL_SECRET when source writes one in the form.

* fix(workflow-code): check agent tool calls the way blocks are checked

compileToolCall accepted any builder as a tool (api.tool, condition.tool,
trigger.gmail.tool.poller), stored any param key unchecked, and never warned
about a literal secret, though print writes these tools as raw(tool) and
warns W_LITERAL_SECRET. A tool call now needs a builder with a tool form
(E_UNKNOWN_BUILDER), each param must be one its tool type declares
(E_UNKNOWN_PARAM with a did-you-mean, W_FIELD_NOT_APPLICABLE for another
operation's), and a literal secret warns as on a block.

SYNTAX.md and core.d.ts no longer document agent.tool() or
runWorkflow.tool(): neither is typed, and print writes such tools as
raw(tool).

* fix(workflow-code): refuse stored() and codeFile() in a loop or parallel config

compileConfig dropped any config value that was not a plain value, so
loop.forEach('L', { collection: stored() }) or a codeFile() condition
compiled silently to a loop with no collection or condition. Both are now
E_UNSUPPORTED_SYNTAX with the form to write instead.

* fix(workflow-code): give every compile finding a hint that names its fix

E_TARGET_TRIGGER, E_ERROR_PORT_UNSUPPORTED (a loop or parallel has none:
wire onError from its children), E_UNKNOWN_BRANCH in meta.branches (lists
the branches), W_VALUE_KIND (the literal form the field takes) and
E_UNKNOWN_IDENTIFIER for undefined, NaN and Infinity had no hint. The test
catalog's loop and parallel now have no error port, like the real catalog.

* fix(table): keep batch rows that keep a unique value in the DB check

batchUpdateRows excluded every batch row from each unique column's DB check and
compared the rest by the values it read before taking the value locks. A row the
batch leaves alone could take the value from a concurrent edit after that read,
so both it and the batch's writer stored the same unique value. Each column's DB
check now skips only the batch rows that rewrite that column.

* docs(tables): say add-column refuses a required column rows leave empty

* fix(cli): Ctrl-C during an apply write names what it may have done

An interrupt while the apply request was in flight exited 130 silently, so
nobody learned the write may have landed. The lock's interrupt handler (which
already releases the lock) now prints the same next step a lost answer gets,
then ends with the signal.

* fix(cli): a status without a login recommends sim login

With no login on the profile, status shows the local view (the server is
treated as unreachable) and its note says to log in, but next was
apply --dry-run, which only exits 13. next is now the login, then status again,
for workflows and workspaces alike.

* fix(cli): check offline with no cached catalog names the get that caches it

A fresh clone checked while the server could not be reached failed with the
raw "Could not reach …" and no next step. It is now CATALOG_NOT_CACHED (exit
1) naming sim workspaces source get, as a check with no credentials already
is; no login keeps its AUTH_REQUIRED refusal (exit 13, naming sim login).

* fix(workflow-code): keep meta.retry within the bounds the loader pins it to

Persistence saves a retry policy verbatim but loads it clamped (2-5 tries,
0-5000 ms, whole numbers), and canonicalize kept a well-formed policy raw.
A file writing maxTries: 10 stored 10, read back as 5, and every re-apply
of the unchanged file showed a retry change. Compile now refuses an
out-of-range policy with a hint naming the bounds, and canonicalize pins
the numbers as the loader does, so a printed policy always compiles back
unchanged.

* Revert "fix(workflow-types): hold a container's edges to the handle they leave from"

This reverts commit 62872bd29b.

* chore: regenerate the OpenAPI spec and MCP operations for the workspace-key description

* docs(cli): document exit 13 (AUTH_REQUIRED), exit 9 and the 429 resend policy

Both exited 1 before this branch. State which requests are resent (every GET and the
all-or-nothing source writes), the 6-retry count and the one-minute wait cap, in the
scripting exit-code section, troubleshooting, the CLI reference preamble, the README and the
source agent guides.

* fix(workspace-source): managed table rows guard a delete and a column renamed on the server

An --allow-delete of an undeclared managed table whose rows were written
since the base deleted those unseen edits; it is now E_APPLY_STALE. A rows
edit on a table whose declaration is unchanged while the server renamed or
removed one of its columns wrote the cells by names the table no longer
has, silently dropping them; it is now E_APPLY_STALE.

* fix(workspace-source): a stored() tool or MCP server deleted on the server stays deleted

An unchanged directory whose tool code or MCP header is stored() was
refused (E_APPLY_STALE / E_TOOL_STORED_MISSING / E_MCP_STORED_MISSING)
once the resource was deleted on the server, blocking every other kind.
It now reads as I_SERVER_DELETED like any other deleted resource.

* docs(workflow-sdk): document a child workflow's output shape

runWorkflow's result is the child's first response block output ({ data, status, headers }),
else its last block's output, so a response body field is result.data.field; a deployed parent
runs the child's deployed version. Stated in INDEX.md's How it runs, the runWorkflow TSDoc, the
agents example and the agent guide.

* fix(workflow-code): round-trip stored container edges source cannot draw

Stored workflows hold container edges the canvas never draws: a loop or
parallel start edge to a block outside it (the editing engine keeps one when it
extracts a block, and the executor runs it as the container's exit), an end edge
into the container's own child, and an error edge from a container. Source
printed the first two through p.to()/x.to() and every one through onError, and
compile refused them (E_EDGE_SCOPE, E_ERROR_PORT_UNSUPPORTED), so such a workflow
could not apply its own source back.

The printer now writes a mismatched container edge as edge() with its stored
handle, compiled with W_SUBFLOW_HANDLE_SCOPE (the warning names the exit form),
and compile keeps an error edge from a block with no error port when the stored
workflow holds it (W_ERROR_PORT_STORED). The corpus gains both edge shapes.

* fix(editing): keep a stored error edge the engine no longer adds

Since the engine refuses new error edges from loops and parallels, an edit that
re-sends a container's connections dropped the error edge it already stored.
Error edges the graph held before the batch are kept; only new ones are
refused.

* test(workflow-source): stored mismatched container edges survive every write path

The extract and move-into-loop regressions now assert the engine keeps the
edge and source round-trips it; a stored container error edge survives an
engine edit that re-sends its connections; and an integration check writes a
loop start edge to an outside block through PUT /state, edits through the
engine, and applies the source back unchanged.

* fix(workspace-source): type the in-use scan rows for the query builder

* fix(tables): accept a required column on a table with rows again outside workspace source

facb1c4f4d made every surface refuse adding a required column that existing rows
leave empty, which turned a call third-party integrations make on the v1 and v2
table APIs into a 400. The refusal is now an addTableColumn option only
workspace-source apply sets, so its plan and apply agree while the table APIs,
Copilot and undo keep staging's behaviour. Restores staging's undo hook,
OpenAPI description and contract comment.

* fix: attempt every independent side effect of a fan-out after one fails

The shared mapWithConcurrency starts nothing after a failure, where the apps/sim
helper it replaced kept starting the rest. For fan-outs of independent side
effects that left Slack targets undispatched, tombstones and cancellation
writes unwritten, stale-dispatch cancel events unsent, project file retirements
and chat image sweeps unrun. mapEachWithConcurrency attempts every item, then
throws the first failure; those callers use it.

* chore(e2e): name the workspace source e2e report variable like its siblings

WORKSPACE_SOURCE_REPORT_PATH becomes WORKSPACE_SOURCE_E2E_REPORT_PATH, matching every other
source e2e's <SUITE>_E2E_* variables; the CI http-e2e script passes the new name.

* feat(workflow-code): warn on a condition or router branch no edge leaves

W_BRANCH_UNWIRED names the branch and the wiring that fixes it. A branch the stored workflow
already leaves unwired is not reported, and check fails on it only for a block the lock does not
bind, so existing workflows keep checking clean.

* fix(workflow-code): read a Start block's untouched blank input row as no fields

Every new workflow's Start block is seeded with one unnamed string field, which execution skips,
so `get` on a fresh workflow printed `inputFormat: { '': 'string' }`. A list holding only that
starter field now canonicalizes as empty and prints `inputFormat: {}`; an unchanged apply keeps
the stored field byte for byte, and a blank field beside named ones still prints as stored.

* fix(workflow-source): fingerprint a stored workflow the same for every reader

The sf1 fingerprint hashed the reader's canonical model, which names a
credential the reader may see by key and one they may not see by id, so a
member applying source a teammate read got a false 409. It now hashes every
credential by its stored id. A credential key the reader cannot resolve,
standing where the stored workflow holds a credential they cannot see, keeps
the stored credential whatever the key (W_APPLY_CREDENTIAL_KEPT), so an
unchanged or edited teammate source applies without confirming any key.

* fix(workflow-source): refuse workflow names and descriptions v2 refuses

Source could set an empty or whitespace name, a name over 255 characters or
a description over 50,000, which v2 create and update refuse. The plan now
refuses the fields a write sets with E_WORKFLOW_META_INVALID at the header,
reading the limits from the v2 workflow contract.

* fix(workspace-source): keep unkeyed managed rows out of source, and check required fills at plan

A row the table grid's "add row" makes has an empty key cell, so a get printed it as a line the
apply refuses (E_TABLE_ROWS): get -> apply of an unchanged directory failed. Such a row has nothing
a line can match it by, so it is no longer managed: a get leaves it out of the rows file with
I_TABLE_ROWS_UNKEYED, neither rows fingerprint counts it, and the keyed write never removes it.

Making a column required trusted the declared rows to fill it even when no rows write was planned,
so a row added in the UI made the apply fail mid-reshape. The declared rows now stand for the
table only when a managed rows write is planned, and the rows that write keeps (unkeyed ones) are
checked too.

* fix(workspace-source): compare managed rows with the base under the key it recorded

Changing a managed table's rows key and editing a row in one apply was a false E_APPLY_STALE: the
server's rows were fingerprinted under the new key and compared with a base fingerprinted under
the old one. The staleness check now reads the server under the key the table is still marked by.

* fix(workspace-source): a reader's concealed MCP get applies back unchanged

A get by a member who may not rewrite headers prints every literal header value as stored(); the
plan resolved each stored() to a keyed hash, while a value that is not a credential prints (and
fingerprints) as its text, so a writer applying that directory unchanged always planned a header
update. stored() now resolves to the value as a get prints it.

* fix(workflow-source): answer a racing source rename with SOURCE_NAME_TAKEN

Two source renames onto one name in one folder both passed the name SELECT;
the second hit the unique index and answered 500. The commit now maps that
unique violation to WorkflowSourceNameTakenError, and the apply route answers
it, like the create route, with 409 SOURCE_NAME_TAKEN.

* fix(workspace-source): an unchanged file the server can no longer hand to source is a no-op

A declared file edited past the blob cap in the Files tab, or one an older file moved beside it
now takes the path of by letter case, refused the whole apply of an unchanged directory
(E_FILE_TOO_LARGE / E_FILE_PATH_COLLISION). Unchanged since the get that read it, the declaration
now leaves the file as the server has it (I_SERVER_CHANGED); a directory that changes it is still
refused.

* fix(workflow-source): report a dry run's needsRedeployment for the draft it would write

A dry run answered needsRedeployment for the draft as stored, so an edit of a
draft in step with its deployment said false and a revert said true. A dry run
that would change the draft now compares the draft it would write with the
active deployment; a no-op or refused dry run still reports the stored draft.

* fix(workflow-source): record no refused apply for a plan-only evaluation

A workspace plan or dry run evaluates each workflow planOnly, so planning a
locked workflow recorded workflow_source_applied ok:false although nothing was
applied. A planOnly run records nothing; the commit that follows records its
own outcome.

* fix(workspace-source): a knowledge document replace that stops partway resumes without losing tags

A replace uploaded the replacement under the document's own name, then carried the old one's tags
and deleted it. Stopped after the upload, the next apply deleted the old document without
carrying its tags; stopped and then edited again, the two same-named documents read as a server
change (E_APPLY_STALE) until deduplicated by hand, since nothing told the replacement from a
document uploaded twice in the UI.

The replacement is now uploaded under a name that names the old document, takes its tags, the old
one is deleted, and the replacement is renamed. The next apply finishes a stopped replace whose
replacement holds the declared bytes (tags carried, old deleted, renamed), or removes the
replacement and replaces again; a replacement left before its rename stands for its name. The
duplicate-by-hash rule this replaces is gone: an unmarked duplicate is ambiguous, as any other.

* test(workflow-code): compare n with 8n in the growth check, so allocation noise on a slow runner stays far from the quadratic bound

* fix(workflow-source): never keep a hidden credential over a key the apply binds

A credential key the enclosing workspace apply binds in the same run is not an
unknown key, so it resolves to that credential rather than keeping the stored
one.

* test(workflow-code): read and write input-format rows through their real shape in the API-built round trip

* fix(workflow-code): keep a hidden credential on a block the source renames

compileSource now returns the stored model it compiled against, re-keyed by the
source's renames, and keptCredentials pairs compiled blocks with it, so a member
who cannot see a credential can rename the block holding it.

* fix(sim-cli): offline check passes stored container error edges, cycles and branches on bound blocks

The offline check compiles without the stored workflow, so it refused an
onError on a loop or parallel and a cycle that a get printed and the server
keeps, and told the agent to delete them. compileWorkflow takes storedUnread:
an edge between two lock-bound blocks may be stored, so it reports
W_ERROR_PORT_STORED / W_EDGE_CYCLE saying an apply keeps it only if the stored
workflow holds it, and the error stays for a new block. E_ERROR_PORT_UNSUPPORTED
hints no longer say to remove the edge. W_BRANCH_UNWIRED never fails the check
on a bound block, --strict included, matching its stored exemption.

* fix(serializer): never evaluate a viewer-scoped default on the server

* fix(sim-cli): keep a downloaded workflow's stored inputs typed in workspace.d.ts

* fix(sim-cli): exit 13 when the server refuses a stored login's refresh token

* fix(workflow-code): offline check binds a block renamed in source through its lock ident

storedUnread now takes the lock, and compile counts a source block whose ident is one vacated
lock entry's as bound (lockIdentRenames, materialize's lock-ident rule, shared with
compileSource), so a renamed block's stored container error edge or stored cycle warns offline
as the server accepts it.

* fix(sim-cli): regenerate workspace.d.ts from local workflow inputs on a workflows check

A per-folder `sim workflows source check` in a workspace directory already
compiled every workflow's Start inputs for its child-call findings but left
workspace.d.ts on the stored inputs, so a parent mapping an input added to the
child since the get failed tsc with an excess-property error. It now refreshes
workspace.d.ts the way `sim workspaces source check` does.

* fix(workflows): refuse new edge cycles in the editing engine as edge_cycle skips

The edit engine (Copilot edits, v2 operations) could create an edge that
closes a cycle, which the canvas and realtime refuse and the executor
cannot run. createValidatedEdge now runs the shared wouldCreateCycle check
and reports a refused edge as an edge_cycle skipped item. Edges the
workflow already stored are exempt, so a stored cycle survives unrelated
edits and restated connections. Publishes edge_cycle in the v2 skipped-item
enum and regenerates the OpenAPI document and CLI types.

* fix(workflow-code): declare lock and base as type aliases so they fit the open generated API types

* feat(mothership): sync the workflow-code entitlement into the generated protocol

* test(workflow-source): stamp updatedAt on direct block writes so a migrate-on-read save cannot undo them
2026-11-19 12:51:01 -08:00
Waleed 708e4b2b22 feat(search): import large permission snapshots in bounded parts (#10191)
* feat(search): import large permission snapshots in bounded parts

* fix(search): validate permission upload manifests and file inputs

* fix(search): reject exhausted permission import revisions
2026-11-18 16:20:38 -08:00
Waleed 4b4a78bc28 fix(files): keep Markdown tables readable while scrolling (#10041)
* fix(files): keep Markdown tables readable while scrolling

* fix(files): track Markdown overlays during table scrolling

* fix(files): contain wrapped inline code in WebKit

* fix(files): preserve short Markdown table layout

* fix(files): clean up Markdown fixtures after API failures
2026-11-14 00:49:11 -08:00
Waleed a716b1b3ef chore(deps): bump turbo to 2.11.10 (#9903)
* chore(deps): bump turbo to 2.11.10

* docs(ci): describe the Turborepo 2.11 task-level planner flag
2026-11-11 14:10:09 -08:00
Waleed 5bffff69cb feat(search): update GitLab permission CSVs through the API (#9841)
* feat(search): update GitLab permission CSVs through the API

* fix(search): align GitLab CSV updates with CLI and API policies

* test(cli): cover confirmation for GitLab permission replacement
2026-11-10 10:47:44 -08:00
Waleed fb9163dd0b revert(org): hold the org view and People redesigns for #9687 (#9740)
* Revert "improvement(org): move the People page onto the new design system (#9720)"

This reverts commit 76259293f2.

* Revert "fix(org): drop the removed shortcuts slot from the landing test (#9715)"

This reverts commit f17f1b6795.

* Revert "improvement(org): move the organization view onto the new design system (#9708)"

The redesigned org view ships all at once with #9687. The shared modules later
staging work builds on stay: member-integrations and the accounts key factory.
The legacy integration detail opens the saved-credential modal for Jama and Flow,
which #9723 added only to the new view.

* fix(org): keep staging's shared modules and revert only the redesigned views

Hooks, contracts, key factories and lib helpers stay at staging, and the legacy
view adapts to them. Jama and Flow reconnect through the saved-credential modal
and disconnect through Search. Exports only the new views used are unexported or
deleted, and the e2e script returns to the legacy view's selectors.
2026-11-06 11:11:17 -08:00
Waleed a144143750 improvement(org): move the organization view onto the new design system (#9708)
Move the organization view onto the Platform design system: sidebar, Home with Email, Calendar and activity widgets, Integrations, Sim Links, and Search as its own destination, with server prefetch for the first read.

Members now land on Home with the Assistant composer. Styles stay scoped under data-platform-ui and check:platform-css enforces the boundary.
2026-11-05 09:41:38 -08:00
Waleed e89400f435 improvement(extension): simplify page access and enable voice input (#9683)
* improvement(extension): enable page access across websites

* fix(extension): distinguish unreadable pages from missing access

* improvement(extension): keep page-access copy concise

* test(extension): wait for the page access action

* fix(extension): complete access grants after dialog dismissal

* test(extension): exercise voice restart and sign-in recovery

* test(extension): grant microphone for the embedded app origin

* fix(extension): enable voice input and resume signed-in panels safely

* refactor(extension): shorten copy and verify session recovery

* fix(extension): clear stale authentication when returning to Chat

* fix(extension): keep recovery actions accessible and connected

* test(extension): use accessible link fields and retain voice proof

* test(extension): preserve link-flow failures when capturing evidence
2026-11-04 17:18:35 -08:00
Waleed f9939fcc11 improvement(ci): avoid redundant browser dependency updates (#9680)
* improvement(ci): avoid redundant browser dependency updates

* fix(ci): retain historical benchmark provisioning and docs triggers
2026-11-04 11:31:47 -08:00
Waleed e1a45a035e improvement(ci): run WebKit acceptance in pinned browser containers (#9652) 2026-11-03 17:28:18 -08:00
Waleed 18d12ad57b improvement(ci): partition extension acceptance by fixture lifecycle (#9643)
* improvement(ci): partition extension acceptance by fixture lifecycle

* docs(ci): describe the three extension acceptance groups
2026-11-03 15:13:00 -08:00
Waleed 4a3e62d5fd improvement(ci): validate pushes independently of deployments (#9642)
Run push validation independently of the deployment queue, and require the exact trusted successful run before migrations. Preserve deployment and release ordering.

Validate the admission protocol with real Bash/jq boundary cases and guard mutations.
2026-11-03 15:00:42 -08:00
Waleed 2e513a82c6 feat(people): add a synced organization chart (#9628)
* feat(people): add a synced organization chart

* fix(people): keep provisioning responsive during directory sync

* fix(people): refresh published charts and isolate sync retries

* fix(people): preserve sync drafts and label paged search
2026-11-03 14:32:25 -08:00
Waleed 3227822b31 improvement(ci): avoid unrelated asset checks and browser downloads (#9641)
* improvement(ci): fetch only the docs acceptance revision

* improvement(ci): install only the Chromium runtime each suite uses

* improvement(ci): keep library media on the landing acceptance path
2026-11-03 14:19:09 -08:00
Waleed 1a14c8736e improvement(ci): target acceptance and reuse validated build caches (#9583)
Select acceptance work from the task graph, separate docs site and platform checks, and preserve complete comparison history for push attribution.

Build docs once and run isolated acceptance groups in parallel after bounded server readiness. Reuse validated content and incremental build inputs with bounded retention.

Validate native source/toolchain fingerprints and restored output integrity, seed trusted branch caches, and balance desktop smoke across four whole-file shards. Bound organization-search diagnostics and reclaim closed-PR merge-ref caches.

Validation: full root tests, all workspace types, lint and 62 audits; real cache invalidation and Git attribution controls; complete hosted docs, integration, organization-search, Electron and packaged smoke coverage; final-head bot reviews.
2026-11-02 13:18:56 -08:00
Waleed 5216fd464e improvement(ci): overlap independent acceptance and recovery checks
Run extension native and access acceptance in parallel with independent fixtures, apps, databases, and reports. Overlap independent desktop-pickup deadlines and isolated recovery backoff cases, and use faster integration runners with the existing GitHub fallback.

Update Playwright for the upstream WebKit compositor fix and disable focus emulation at the native blur boundary after reloads. Preserve all acceptance assertions and real timing contracts.

Validated with root tests, all workspace type checks, lint, all audits, generated-artifact checks, real integration and Electron acceptance runs, and negative controls for the protected behaviors.
2026-11-01 22:15:28 -08:00
Waleed 974dd6cd3e improvement(ci): shorten the acceptance critical path (#9556)
* improvement(ci): refresh integration shard duration weights

* improvement(ci): parallelize acceptance suites and avoid slow dependency restores

* improvement(ci): advance extension access polling in acceptance tests

* chore(ci): document acceptance timing and shard refresh

* fix(ci): settle extension screenshots after advancing browser timers

* fix(ci): finish finite animations in clock-controlled extension checks

* fix(ci): preserve access revalidation budgets with virtual timers
2026-11-01 19:52:49 -08:00
Waleed 4dd5ef348d feat(people): organization People page with profiles, reporting lines, and people-data import (#9517)
* feat(people): organization People page with profiles, reporting lines, and people-data import

* fix(people): clearable manager and department pickers, exact spreadsheet dates and row numbers, loop checks through suspended members

* fix(people): consistent profile reads, capability-aware navigation, unambiguous email matching, stricter dates, guarded workbook parsing

* fix(people): read a page and its managers from one snapshot

* fix(people): send import rows as positional cells so wide files stay within request limits
2026-10-31 03:12:15 -07:00
Waleed 00e25a4b8c feat(sim-links): organization Sim links (go links) with sim/<name> redirects (#9484)
Org-scoped Sim links: sim/<name> redirects with case- and punctuation-insensitive names, {*} variable links with same-site defaults, unlisted and restricted links, visit counts with a most-used view, an illustrated empty state, audit entries, and the org-scoped sim-links feature flag. Destinations keep a fixed http(s) origin; dot-segment values and control characters are refused.
2026-10-30 16:48:47 -07:00
Waleed 5facc5f265 feat(extension): bring Sim chat and page context to Chrome (#9454)
* feat(extension): bring Sim chat and page context to Chrome

* refactor(extension): consolidate page capture in the chat composer

* fix(extension): align shared chat and harden capture lifecycle

* fix(extension): revalidate access and protect page previews

* fix(extension): refresh permissions and retain completed answers

* fix(extension): keep workspace selection recoverable

* chore(extension): tighten production QA evidence

* fix(extension): retain drafts through permission-policy outages

* fix(extension): enforce policy independently of access requests
2026-10-30 02:34:04 -07:00
Waleed 9f3d3e1ab9 fix(search): remove the extra assistant tools gate (#9468)
Remove the redundant Assistant tool rollout gate while retaining organization access, account ownership, source restrictions, and action approval policies.

Keep Search editing and submission disabled until hydration is ready, then autofocus the field. Cover early edits and draft restoration with a held-script browser regression.
2026-10-30 00:37:29 -07:00
Waleed 929021d7ef feat(search): unify organization search and reviewed assistant actions (#9428)
* feat(search): move assistant into organization search

* feat(search): add personal assistant actions and per-tool permissions

* chore(search): finalize migration and validation artifacts

* chore(search): align regression fixtures with account permissions

* chore(tests): make asynchronous validation deterministic

* fix(db): rebase assistant migration and preserve atomic expansion

* docs(search): show dedicated organization search navigation

* fix(search): preserve drafts and harden reviewed action delivery

* fix(search): finalize refusal stream contract and validation

* test(search): assert credential rejection independently of wording

* fix(search): align review limits and isolate OAuth token refresh

* fix(docs): preserve spacing above nested sidebar sections

* docs(search): remove stale mode instructions and clarify actions

* fix(search): distinguish unavailable account connections

* chore(search): validate rebased migration and module graph

* fix(tests): wait for durable text before recovery faults

* fix(tests): wait for Search URL persistence before reload
2026-10-29 03:56:02 -07:00
Waleed a34e2e7696 fix(ci): fail the promote wait on a digest lookup error instead of retrying it (#9430) 2026-10-28 18:22:28 -07:00
Waleed 8563d2582e fix(ci): predict the promoted app digest instead of trusting a read right after the retag (#9416)
* fix(ci): predict the promoted app digest instead of trusting a read right after the retag

* fix(ci): bound the promoted-tag wait by elapsed time and each ECR read by a timeout
2026-10-28 12:12:31 -07:00
Waleed 60b02de5ab fix(ci): pick the CodeDeploy action when the app Deploy stage has sidecar actions (#9359)
The app pipeline's Deploy stage can now also run a CodeBuild image deploy
for the sandbox worker host. The cutover wait required exactly one Deploy
action, so Trigger.dev promotion failed whenever that action was present.
Select the CodeDeployToECS action by provider; everything after it is
unchanged.
2026-10-24 00:20:55 -07:00
Waleed 003c3527b1 improvement(ci): run affected suites and reuse production builds (#9297)
* improvement(ci): reuse E2E builds and rebalance integration runners

* improvement(ci): use free integration runners and shard browser viewports

* improvement(ci): share production builds across HTTP and Electron suites

* improvement(ci): select affected task groups with Turborepo

* improvement(ci): scope type checks and right-size hosted runners

* improvement(ci): partition macOS desktop smoke coverage

* fix(ci): retain integration coverage for shared UI and harness changes

* fix(ci): preserve landing dependencies and favor integration latency

* docs(ci): clarify paired provider benchmark count

* ci: retain free GitHub integration runners

* docs(ci): clarify push and manual check selection

* fix(ci): preserve hosted SCIM entitlement coverage
2026-10-22 11:05:50 -07:00
Waleed 5c7d838d8b chore(ci): tag production promotions with release-<sha> for rollback retention (#9061)
* chore(ci): tag production promotions with release-<sha> for rollback retention

* improvement(ci): share one promote-image script across repos
2026-10-14 19:07:22 -07:00
mzxchandra bca78367ac feat(project-files): add core storage and realtime operations (#9016)
* refactor(files): unify mutation accounting and retention

* feat(project-files): add core storage and realtime operations

* feat(files): unify document read subscriptions and write capabilities

* fix(files): resolve capability type and artifact checks

* fix(docs): hide unreleased Project file references

* fix(files): address review admission and collaboration gaps

* test(cli): load canonical documentation in suite setup

* fix(files): bound seed reads and preserve browser snapshots

* fix(files): keep read provenance private unless requested

* fix(files): classify raw Project downloads as opaque
2026-10-14 16:14:37 -07:00
Waleed 6b0c69e357 improvement(ci): track flaky checks daily and fix the live flakes (#9038)
## Summary
- Add a daily `ci-flakes` workflow (`scripts/report-ci-flakes.ts`): a job that failed on a CI attempt and passed on a re-run of the same commit files one `ci-flake` issue per failing test (Vitest `FAIL` lines and the E2E harnesses' `[Suite] FAIL` lines), or per job when its log names none. Occurrences are keyed by job id, so the overlapping 3-day lookback never double-counts, and a closed issue reopens when its flake recurs. Dependency-free, so the job needs no install
- Fix the live flakes found in the last two weeks of re-runs:
  - GitHub rate-limit reset test: pin the clock; a second boundary between building the header and reading it gave 899000
  - OAuth token and token-family integration tests: import the auth graph statically, so its cold load (up to ~43s on a slow runner) no longer counts against the first test's 30s timeout
  - stop-after E2E: wait for the sibling-pause claim until the resume request settles, not a fixed 2s that a slow `next dev` round trip outlasts
  - HTTP E2E readiness: 300s → 600s; healthy cold compiles take 60–185s and a degraded runner ran past 300s with every step 3–6x slower
- Reconciliation-window integration test: print each scan's plan when a window statement reads past the bound, so its next failure names the cause (diagnostics only; the cause isn't confirmed yet)
- Mobile e2e and usage-log flakes were already fixed by later commits, so nothing changes there
- Testing rules: a short section on the flake workflow and how to fix one (no retries, longer timeouts, or skips)
2026-10-14 14:33:35 -07:00
Waleed 03f2029e66 improvement(seo): fix soft 404s, per-integration freshness, and docs markdown for AI crawlers (#9006)
* improvement(seo): fix soft 404s, per-integration freshness, and docs markdown for AI crawlers

* test(seo): crawl the production build for landing SEO regressions

* chore(landing): remove the post and author loading skeletons the slug pages no longer use

* fix(seo): resolve docs slugs through the catalog, keep API pages negotiable, and harden the crawler suite

* fix(docs): carry the landing-page backlink into integration markdown

* test(seo): match the visible date attribute case-insensitively
2026-10-13 23:04:08 -07:00
Waleed 7d090d1e7f ci: ratchet type errors in apps/sim test files (#8959)
* ci: ratchet type errors in apps/sim unit tests per file

apps/sim's tsconfig excludes *.test.ts(x), so ~3.4k test files are never
type-checked and any new test can add errors. check:test-types runs the
native tsc on apps/sim/tsconfig.tests.json (the app config with tests left
in), counts errors per file, and compares with a shrink-only baseline,
matching check:explicit-any's semantics: a rise or a new file fails, a drop
fails until --update shrinks it, --update never raises, --update --init only
creates a missing baseline. Output it cannot place (global diagnostics, a
crash) fails outright instead of reading as fewer errors.

It type-checks the whole app, so it runs in its own test-types job gated
like test (wired into ci-gate.sh), not in check:audits. On failure the job
uploads counts.json and the compiler output; --counts <file> lets the
baseline be bootstrapped or shrunk from that artifact without a local
compile.

* ci: commit the test type-error baseline from CI and drop the one-time --init path

Baseline from run 38342772080's test-types counts: 3209 errors in 874 files.
--update stays shrink-only; a missing baseline is restored from git.

* ci: ratchet test type errors per file and TS code, with command-level tests

A per-file count let one new error replace a fixed one with the total flat.
The baseline is now { file: { TSnnnn: count } }: any (file, code) count
that rises fails, including a new code in a baselined file, and --update
stays shrink-only per pair. The key stops at the code: line and column
move with edits, and messages print types that change with unrelated
source or compiler versions.

--diagnostics <file> replaces --counts: it reads a saved compiler output
(the CI artifact's diagnostics.txt) through the same parser and undercount
checks, so a fix can shrink the baseline without a local compile. The
baseline was migrated from run 38342772080's diagnostics.txt with the
script's parser: 3209 errors in 874 files across 52 codes, every per-file
total equal to the previous baseline's.

Command-level tests run the real script on fixture diagnostics: unchanged,
a rising count, a new code replacing a fixed error, a new file, a dropped
count, --update refusing a raise, --update shrinking, and unparseable or
inconsistent output. The checks.yml comment now describes the artifact as
input for shrinking the existing baseline.

* ci: verify saved test-type diagnostics against the compile's exit status

--diagnostics read an empty or truncated diagnostics.txt as fewer errors,
so a failed compile's artifact plus --update could erase the baseline.
--report now writes status.json (exit code and printed error count) once
the compile's output and exit code agree, and --diagnostics requires it:
exit 0 must mean no errors, the parse must match the recorded count, and
a missing or malformed status fails. Command-level tests cover each case
and that --update never writes the baseline from such input.

Also passes a route context to the socket-token route test's POST call,
the one new test type error (TS2554) the ratchet caught after #8958.

* ci: read the saved compiler status through toRecord
2026-10-12 21:51:14 -07:00
mzxchandra 4af0f265c0 fix(ci): remove Project image digest migration gate (#8961) 2026-10-12 20:56:10 -07:00
mzxchandraandgreptile-apps[bot] eef9d29e4e feat(projects): enforce Project membership and retire the connector (#8590)
* feat(projects): add project identity and lifecycle foundation

* feat(projects): create projects with their initial environment

* docs(projects): record project files follow-up

* docs(projects): explain project and workspace creation flows

* fix(projects): stage activation after compatible writers deploy

* feat(projects): enforce membership after the staged backfill

* fix(projects): retry writes after concurrent membership changes

* fix(projects): align integration fixtures with membership constraints

* refactor(projects): prepare compatible writers for the SQL backfill

* refactor(projects): backfill through bounded SQL migration batches

* fix(projects): clean up automatically created fixture Projects

* fix(projects): backfill only families missing membership

* fix(projects): bound the trigger installation lock window

* fix(workflows): guard restore against concurrent workspace archive

* fix(projects): keep workflow lifecycle guards at workspace scope

* fix(workflows): guard restore against concurrent workspace archive

* fix(projects): close lifecycle races and surface rollout conflicts

* fix(workflows): return not found when import loses archive race

* fix(projects): tighten rollout checks and deduplicate lifecycle validation

* test(projects): detect missing lifecycle validation calls

* test(projects): verify concurrent lifecycle lock contention

* test(projects): update new workspace fixtures for enforcement

* fix(tests): create Project membership in desktop and CLI fixtures

* fix(tests): restore Project enforcement fixtures after migration renumbering

* fix(tests): scope migration probes and align remaining Project fixtures

* feat(projects): prepare workspace project column compatibility

* test(projects): clean up compatibility fixtures atomically

* feat(projects): move membership to workspace column with rollout bridge

* test(projects): align transfer mocks with workspace membership

* test(projects): provision required membership in transfer unit fixtures

* improvement(workspaces): present API responses explicitly

* feat(projects): prepare legacy membership with a resumable operator tool

* fix(projects): support PostgreSQL 16 column migration

* fix(projects): allow multi-batch copies to finish

* fix(projects): support PostgreSQL 16 preparation and current fixtures

* fix(projects): reconcile memberships during schema push

* fix(projects): enforce safe schema push provisioning

* test(projects): provision newly merged workspace fixtures

* fix(projects): use the direct connection for push reconciliation

* test(billing): wait for parked transactions before racing writers

* test(billing): freeze the clock for exact deadline assertions

* fix(projects): close operator verification and contention gaps

* test(billing): stabilize member ledger timeout checks

* fix(projects): await cleanup and bound backfill artifacts

* fix(projects): honor operator cancellation and status exits

* fix(projects): reject verification of conflicted plans

* fix(projects): defer archive repair on database contention

* fix(projects): coordinate read-only maintenance commands

* ci(projects): use the standard PostgreSQL test coverage

* fix(projects): support trigger-free column rollout

* fix(projects): run bounded membership backfill before enforcement

* test(projects): verify column-only archive repair assignment

* fix(projects): retain healthy indexes during schema push

* ci(projects): use standard integration coverage for enforcement

* fix(projects): correct rollout fixtures and schema-push index

* fix(projects): reconcile assigned environments before enforcement

* fix(projects): preserve backfill repair and resume guarantees

Lock and verify effective legacy memberships before materializing reviewed
assignments and applying the shared detach policy. Reject resume reports
whose code hash differs before changing their checkpoint. Isolate local
pubsub subscriber failures so healthy archive subscribers still receive
notifications.

Extend existing CLI and real-database integration coverage for mixed
memberships, concurrent and stale connector changes, unchanged mismatched
reports, replay, and local subscriber delivery.

* test(projects): align fixture lifecycle with enforced project ownership

* test(projects): skip archive repair suite when Redis is unset

* chore(projects): normalize enforcement SQL whitespace

* feat(projects): commit membership authority before reconciliation

* fix(projects): switch membership authority after compatible rollout

* test(projects): guard optional authority fixtures explicitly

* test(projects): seed authority in billing lock-order mock

* fix(projects): bound authority barriers and verify push replay

* fix(projects): pin operator schema and pace detach repairs

* docs(projects): record native constraint rollout decisions

* refactor(projects): replace integrity triggers with native foreign keys

* fix(projects): recognize completed rollout without its marker

* fix(projects): retire rollout marker with legacy membership

* test(projects): model expansion authority in workspace move fixtures

* fix(projects): keep repair reads compatible with expansion schema

* fix(projects): retain project name for workspace archival

* docs(projects): consolidate permanent storage rules in README

* fix(tests): seed Project membership in new staging fixtures

* Update packages/db/scripts/reconcile-project-membership.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-10-12 18:42:38 -07:00
Waleed caa925a86b ci: run the mobile e2e suite on a production build, one job per browser (#8948)
* ci: run the mobile e2e suite on the shared production build, one job per browser

The build job now packages .next (zstd, cache excluded) and uploads it for a
day. A new e2e-mobile job, one per browser (chromium, webkit), extracts it and
serves it with `next start`, so the suite no longer waits on dev compiles or
runs both browsers back to back. The mobile group leaves the e2e matrix.

On runs that execute e2e, the build bakes NEXT_PUBLIC_APP_URL=http://localhost:3000,
which is what production images bake, so the served build is the one that ships.
Content-only pull requests keep the hosted value, under which next build
prerenders every post.

http-e2e.sh gains a `next start` mode used only by mobile: it installs only the
selected browser, drops the dev heap override, and rebuilds the HTTP status log
from RouteHandler's JSON lines at LOG_LEVEL=INFO. The ci gate treats e2e-mobile
like e2e: a skip passes only when `full` is exactly false.

* ci: build mobile's artifact in its own job and keep the hosted build untouched

The `build` job is back to staging byte for byte: its www.sim.ai build is CI's
only render of every post, and it must stay on every run. A new `e2e-build`
job, gated on `full` with its own Turbo cache key, builds with
NEXT_PUBLIC_APP_URL=http://localhost:3000 (the Dockerfile default, so the same
public-env mode production images use; images run the standalone server) and
packages and uploads it for e2e-mobile, now kept 3 days and without
.next/trace.

e2e-mobile fails fast when the downloaded build prerendered posts, which only a
hosted build does; the URL is no marker, since next.config's redirects name
www.sim.ai in every build. The ci gate treats e2e-build like e2e.

* ci: key the non-hosted guard on prerendered post pages, not every /blog/ route

* ci: expect the socket-token rate limit in the mobile e2e suite

Each document load mints one realtime token from a route capped at 30/min
per IP. On the production build the suite loads well over 30 documents a
minute from loopback, so the route's designed 429 is recorded apart from
httpErrors (only with Retry-After), and each browser must still mint at
least once.
2026-10-12 16:54:12 -07:00
Waleed d3e97f4f03 ci: scope pull request checks to what the diff can affect (#8946)
* ci: scope pull request checks to what the diff can affect

A `changes` job classifies the pull request's files against explicit
allowlists (.github/scripts/ci-changes.sh, replacing
desktop-live-changes.sh):

- content posts, author profiles and their public assets: lint, test, build
- apps/docs: lint, test
- apps/desktop: lint, test, desktop-live
- agent guidance (.agents, .claude, .cursor, AGENTS.md, CLAUDE.md, root README): lint

Any other file, any .github change, an empty diff, or a diff that cannot
be worked out runs everything; pushes and dispatches always run
everything. The live desktop suite keeps its own skip list, now including
the content asset folders it previously missed.

`ci` accepts a skip only when `changes` set that job's flag to exactly
`false`, so a failed or skipped `changes`, or a lost output, fails it.

* ci: move the ci gate into a tested script and reject non-boolean change flags

The ci aggregator's skip rules now live in .github/scripts/ci-gate.sh, read from
NEEDS, with table-driven tests covering every guard. The change-classifier test
helper fails on any flag value other than exactly true or false.
2026-10-12 15:39:25 -07:00
Waleed 140f1ae9a6 fix(e2e): connect the mobile suite to realtime and give dev-server round trips the server budget (#8937)
* fix(e2e): connect the mobile suite to realtime and give dev-server round trips the server budget

- Start the realtime server for the mobile group. Without it every workspace page raised a
  persistent "Reconnecting..." toast ~2s after load; on the locked-workflow reload it raced the
  lock toast and, when it arrived second, sat in front of the Unlock Workflow action, so the tap
  timed out on "subtree intercepts pointer events"
- Wait 120s, the suite's budget for a next dev round trip, for the URL after a sidebar link tap,
  the Files list after it, and the table cell after a reload. next dev spent 16.4s (application
  code 70ms) serving the /home RSC payload and left the rows request unanswered past 20s
- Install the browsers while the app boots

* fix(e2e): stop the background browser install on exit and surface install and realtime logs on failure
2026-10-12 13:33:35 -07:00
Waleed e4434b2cbd improvement(mobile): refine responsive chat and workspace layouts (#8842)
Make navigation, chat composers, resource controls, settings, and workflow panels fit narrow touch screens while preserving desktop and fullscreen layouts. Add the Chromium/WebKit mobile CI matrix and the mobile design-review checklist.

Keep workflow actions visible in compact panels and attachment scrolling bounded, with shared cues for hidden content. Stabilize clock-sensitive billing assertions and the post-commit connector deletion test without changing production behavior.
2026-10-09 14:21:08 -07:00
Waleed 1897cbb24b chore(google-ads): remove synthetic E2E suite (#8857) 2026-10-09 10:43:59 -07:00
Waleed 66e535d526 fix(mcp): add directory verification compatibility (#8825)
* fix(mcp): add directory verification compatibility

* test(mcp): verify ownership challenge over HTTP
2026-10-08 19:02:06 -07:00
Waleed 039ae7ad5d fix(google-ads): align reporting with current API access (#8812)
* fix(google-ads): align reporting with current API access

* fix(google-ads): preserve nullable inputs and redact retired credentials
2026-10-08 14:32:39 -07:00
Waleed 31a911d9d7 improvement(desktop): ship the background executor without a flag, close its QA gaps (#8782)
* improvement(desktop): ship the background executor without a flag

* fix(desktop): wait on the shell's own startup signal before refusing a run

A background terminal run on a fresh shell waited a flat 8 s for the first
prompt and then failed with NO_SHELL_INTEGRATION. A startup file that stops
at a question (oh-my-zsh's update prompt) holds the prompt indefinitely, so
the run failed with a message blaming the shell's integration.

The generated startup files now send a SimStartup marker before any of the
user's files run. A shell that never sends it within 8 s of spawning is not
instrumented and is refused as before (an unsupported shell at once). One
that did gets 30 s to reach its prompt, which tolerates slow startup files
on a busy machine; past that the run is refused with the screen it is stuck
on, so the agent can ask the user to answer it. Stop now ends the wait, and
a shell that exits mid-wait reports SESSION_CLOSED.

* test(desktop): durable E2E reports, hermetic shells, and a real network cut

- background-executor and terminal-cancel record each check through one
  shared helper as it finishes. The background-executor report was written
  from module state in afterAll, so a worker restart after a failure wiped
  it and the report could read green. Reports from an earlier run are
  replaced, not appended to. check-report.spec.ts forces a worker restart in
  a nested Playwright run and asserts the failure stays.
- The executor fixture launches the app with zsh and an empty ZDOTDIR, so a
  developer's .zshrc (an unanswered oh-my-zsh update prompt) cannot hold the
  first prompt and fail unrelated scenarios.
- Scenario B now cuts the network at the socket level: every open
  connection, the doorbell stream included, drops and new ones are reset.
  It asserts the result lands exactly once, the doorbell reopens, and new
  work is picked up after reconnecting.

* test(desktop): a call declined in a background chat is never claimed or run

The fixture Sim can now decline a held call the way Sim settles it, and the
executor suite checks the device never claims it and its command never runs
after the approval notification.

* test(desktop): run the live desktop suite with the background executor on

The live suite's Sim has Redis, so with the executor shipped always-on every
turn now binds to the app and runs in the background. The proxy answers the
app's registration as an install without Redis would, so the chat-view tests
keep covering that path, and the round trip asserts the app stays dormant.
Two tests let Sim's own answer through: a call issued after the user switched
chats runs on the desktop, and a result reported across a network cut (every
connection dropped, the first report landing late) reaches the agent exactly
once.

* fix(desktop): measure a shell's startup bound from when its startup files began

The 30 s bound ran from spawn, so a shell whose startup marker arrived late
on a busy machine got less than the promised time for its startup files.
The deadline now starts at the marker.

* test(desktop): drop the outer runner's variables with the shared omit helper
2026-10-07 21:20:02 -07:00
Waleed 1f8c281ec7 fix(executor): preserve stop-after across pause and resume (#8776)
* fix(executor): preserve stop-after across pause and resume

* fix(executor): retain stop targets while sibling branches pause
2026-10-07 20:18:48 -07:00
Waleed 9ab24e9327 ci: faster, cheaper, consistently named CI (#8750)
* ci: shard integration and unit tests, run e2e groups in parallel, add a ci gate

The PR critical path was the PostgreSQL integration suite (~15 min), run in full on an
8 vCPU runner once per provisioning path. Its files run one at a time, so the runner sat
mostly idle.

- integration: each provisioning path (push, migrate) is split into 4 Vitest shards on
  4 vCPU runners. Both paths keep the full suite: migrations add triggers, checks and
  NOT VALID constraints that db:push does not, so the schemas differ.
- e2e: the four next-dev groups (scim, cli, stop-after, desktop-inbox) run as a matrix,
  each on its own database. The boot/wait/stop shell lives once in http-e2e.sh.
- lint: lint, audits, type-check and schema sync split off from the tests.
- test: apps/sim unit tests sharded 2 ways; shard 1 also runs root scripts and the other
  workspaces. Each shard has its own Turbo cache disk.
- ci: one aggregate job that fails unless every check passed (skipped is allowed), so a
  ruleset can require a single stable check.

Deploy gating is unchanged: migrate still requires the whole Test and Build workflow.

* ci: short names, one setup action, aligned pins, explicit secrets

Naming
- Workflow files: test-build -> checks, migrations -> migrate, deploy-trigger-dev ->
  trigger-dev, docs-embeddings -> docs, companion-pr-check -> companion, stickydisk-gc
  -> disk-gc. ci.yml, helm.yml and codeql.yml keep their paths: they sign or analyze, and
  the path is part of the signer identity and code-scanning key.
- Composite actions: setup-workspace -> setup, cache-mount -> cache, docker-build -> image.
- Every workflow and job display name is a short lowercase id, matching the job id, with
  any matrix value in parentheses: ci / checks / integration (push, 1/4), image-amd64 (app).

Duplicates
- Nine hand-written Setup Bun + actions/cache + bun install blocks use the setup action.
  It gains node-version (empty keeps the runner's Node, as those jobs had) and registry-url
  (npm publishing). This also ends restoring node_modules from another lockfile through the
  `${runner.os}-bun-` prefix restore key.
- The runner expression is anchored once per file and aliased after.

Consistency
- One SHA per action: checkout v6 (helm was on v4, codeql on v5), setup-node v6 (desktop
  on v4), cache v5 (desktop-release on v4), softprops/action-gh-release v3.0.3 (was v1,
  Node 16). Redis 8.2 everywhere.
- secrets: inherit replaced by the secrets each callee reads; the checks workflow reads none.
  The dev migration gets only DEV_DATABASE_URL, and staging/production never see it.
- Timeouts on the three macOS desktop-e2e jobs (none before, so a hang billed 6 hours),
  and a cache for their Electron, electron-builder and Playwright downloads.
- Publish workflows: values moved from ${{ }} in run blocks to env, concurrency on the
  npm/PyPI publishers, persist-credentials: false on checkouts that never push.
- Dependabot for github-actions (one grouped weekly PR), and actionlint in the lint job.

Fixes
- PyPI version check matched substrings (0.1.1 "existed" once 0.1.10 did) and treated a
  PyPI outage as "not published". It now asks PyPI for the exact version and fails on
  anything but 200 or 404.

Job wiring (runner, if, needs, permissions, timeout, outputs) is unchanged: verified by
loading the old and new ci.yml, checks.yml and helm.yml and comparing every job.

* ci: run the ci gate on cancelled runs so a cancelled head never passes

* docs(desktop): point the release notes at the renamed workflow and jobs
2026-10-07 13:38:22 -07:00
Waleed b74b9ddeed fix(ci): count both sides of a rename in the desktop live gate, keep canary reports (#8751) 2026-10-07 11:22:41 -07:00
Waleed af5501bdbd improvement(desktop): Electron E2E for desktop tool lifetimes against a live local Sim (#8697)
* improvement(desktop): Electron E2E for desktop tool lifetimes against a live local Sim

Runs the real Electron app against a local Sim (Postgres, Redis, realtime) with a
recording proxy and a scripted stand-in worker, covering chat switches, Stop,
sign-out, approval-gated and stopped claims, and the flag-off foreground round trip.
The spec skips unless a live Sim is configured; the http-e2e job provides one.

* improvement(desktop): use shared helpers, confirm Redis MONITOR, stage desktop build on the workspace disk

* improvement(desktop): bundle the desktop app without macOS prebuilds in the Linux E2E step

* improvement(desktop): report desktop E2E failures inline and trace runner memory

* improvement(desktop): run the live desktop E2E in its own job on a larger runner

* improvement(desktop): warm the live desktop E2E routes and wait on outcomes instead of time

- Compile every route, page and client chunk the tests use in a named warm-up step before any timed hold
- Send retries only while no turn reached Sim; every held request and poll is bounded
- Stop and sign-out tests wait for the import's own report and assert one exact terminal state
- Clicks fail fast with the dev overlay's error instead of a blocked click

* improvement(desktop): retype and resend a message the hydrating composer dropped

* improvement(desktop): run the live desktop E2E against the merged background executor

- The dormancy check accepts the app's own registrations, refused while signed out and answered
  as not enabled once signed in, and still forbids inbox, doorbell, claim, lease and completion
- The app and realtime server run in their own sessions and stop through stop-session.sh

* improvement(desktop): release the held read at the moment its view lets go, and report the call's error on a wrong terminal state

* improvement(desktop): read the chat body's desktop capabilities with toRecord

* improvement(desktop): hold the read's own report across Stop, dismiss dev console notices, and keep failure diagnostics

* improvement(desktop): stop the live E2E apps by their E2E_APP tags

* improvement(desktop): deliver the claim held across Stop to Sim even if Electron gave up on it, and require its 410

* improvement(desktop): warm every route the live E2E reaches, keep sends honest, and check dormancy layer by layer

- Warm-up runs the tests' own flows (read, import, a chat switch during a live turn, Stop, login)
  and waits until every request the app made has been answered
- send() resends only when the UI did not take the message; a taken message whose turn never
  reaches Sim fails as a lost send
- Stop and sign-out tests assert exact outcomes without holding the tool's report (the stopped tool
  reports nothing since #8732)
- Dormancy checks registration, device records, binding, routes and the doorbell as separate soft
  assertions
- CI: per-run E2E_APP tags, retries 0, and a path filter for pull requests

* improvement(desktop): wait with the shared sleep helper while the dev app settles

* improvement(ci): detect live desktop suite changes with git, covering chat pages and auth routes

* improvement(ci): run the live desktop suite unless every change is clearly unrelated, and fail open

- The change check skips only docs, the other apps and published content; any change elsewhere,
  and any failure to fetch or diff the base, runs the suite
- settled() discounts only requests a hold is keeping from Sim right now
- The warm-up's Stop turn waits for its stream to close instead of on a promise that never settles
2026-10-07 03:31:59 -07:00