Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
Thermo-nuclear review — feat/active-pieces-integration
Target: the full branch diff d29d84c07a…HEAD. It has 270 files and about 13,000 lines of code
outside docs and .po files. The uncommitted working tree holds only packages/database/src/types.ts.
That change is a regen reorder of three FK relations. Do not commit it.
Four read-only reviewers covered four areas:
- ee connections and migrations
- jobs integrations and the catalog
- ee workflow definition and runtime
- erp UI and services, and the react Date components
Each reviewer re-opened every finding at its file:line. The lead re-checked the items marked [V].
Nobody ran typecheck, tests or a build, because of the RAM limit. This review does not claim a green build.
Nobody has fixed any finding below.
Blockers
B1 [V] Pluck on a field the type does not declare still "succeeds" with list<null>
packages/ee/src/workflows/runtime/filter.ts:160-202. When walkPath misses, declared is
undefined and the card does not refuse. Every pick returns null. The node returns Succeeded
and types the list from a sample as list<null>. The build side (definition/data-operations.ts:170-171)
declares no output for the same card. So the builder builds downstream steps against nothing.
The validator never checks drafts or test runs, so this reaches real runs.
data-consistency.test.ts misses it: only its primitive lists get the bogus field (:121-122).
Fix:
- Add
if (declared === undefined) return { ok: false, reason: … }. - Add
list<record>andlist<entity>with"nope"to the test matrix. - Delete
sample, the nested ternary (:194-202) andtypeOfValue(:297-314). They are then dead code.
B2 [V] The Settings card says "Healthy" for up to 5 h after a token dies at run time
apps/erp/app/modules/settings/settings.service.ts:2697-2705 caches a healthy result for
INTEGRATION_CACHE_TTL * 5. The TTL is 3600 (:2082), so the cache lasts 5 hours.
The comment says that every path that changes health clears the key.
markExpired (packages/ee/src/integrations/connections.ts:697-711) does not clear it.
The comment at integrations.connections.tsx:70 also says "five minutes", which is wrong.
Fix: clear the key from the caller of markExpired, or cut the healthy TTL to minutes. Correct both comments.
B3 [V] A failed connections lookup tells the author the app "isn't connected" and hides the step
apps/erp/app/modules/workflows/ui/Builder/config/forms/IntegrationNodeForm.tsx:325-344 checks
only connectionsError !== "reconnect". A lookup can fail with errorCode: "failed"
(api+/workflows.options.ts:93) or a 500. Then the form shows the Connect banner.
It also hides the step picker and every input of an existing node, and it offers no retry.
Fix: branch on "failed". Show the same error and "Try again" that OptionsField.tsx:97-135 shows,
and use the retry that the hook already returns.
B4 [V] A vendor call that succeeded can be reported as failed (→ duplicate sends on re-run)
packages/jobs/src/workflows/actions/integration.ts:115-153 has three problems in one block:
JSON.stringify(result)sits in the sametryasaction.run. A circular or BigInt result lands in the catch as "<label>rejected this: …". By then the email or message already went out.- For Gmail,
resultstores the rawGaxiosResponse. That object includesconfig, with the base64 request body. It holds no token today only because gaxios serializesHeadersto{}.redactForLogmatches keys, so it cannot see inside the string. - The code matches
SCOPE_ERRORagainst theHttpErrormessage, and that message embeds the request body. This is prior MINOR 19, still open.
Fix:
- Treat only a throw from
action.runas a vendor failure. - Serialize with a replacer that drops
configandrequest. RunredactForLogon the object first. - Match a scope error on the status or error code, not on the message text.
B5 [V] connect.ts re-implements oauth-popup.ts — and reintroduces the bug that file exists to prevent
packages/ee/src/integrations/connect.ts:16-49 awaits fetch and then calls window.open.
The canonical beginOAuthPopup (packages/ee/src/oauth-popup.ts:5-30) opens the popup inside the click.
It does this because Chrome blocks a popup opened after an await.
When Chrome blocks it here, the fallback navigates the whole page away. connect.ts also copies the popup geometry.
Fix: build startIntegrationConnect on beginOAuthPopup(). Open it in the click, then call
navigate(url) or close(). Delete popupFeatures and openConsentPopup.
B6 [V] Untranslated user-facing copy (Lingui-from-day-one)
packages/react/src/Date/TimeCombobox.tsx:195"No matching time";DateTimePicker.tsx:156aria-label="Time".ConnectionsTab.tsx:219renders the raw status enum.- The
tfallback atConnectionsTab.tsx:105-108never runs, becauseconnect.ts:46always throws English. The tab also toasts the connect route's own English strings (integrations.connections.$piece.connect.ts:37,46,60). This is prior MINOR 23. useIntegrationInstall.ts:78toast moved over still untranslated.ui/Runs/DataDetail.tsxrenders engine English (filter.ts:125,206,226"Counted N.").nodes/meta.ts:179,185usesDATA_OPERATIONS[op].label(English) while the form uses the translateduseDataOperationLabel— card and form can disagree. Fix: throw/return codes and word them in the UI;t/Transfor the rest.
B7 Non-atomic writes and a per-row loop the root AGENTS.md forbids
disconnectConnection(packages/ee/src/integrations/connections.ts:375-400) makes two writes: a vault RPC, then a row UPDATE. ItssecretRef: nullis also redundant, becausedelete_connection_secretalready sets it to null (migration…120101:98).revokeConnectionsForPiece(:412-430) runs that pair once per row, in a loop.
Fix: add one revoke_connection RPC. It deletes the secrets and sets Revoked in one statement.
B8 New route action written the legacy way, with no service function
apps/erp/app/routes/x+/settings+/integrations.connections.tsx:21-92 calls assertIsPost, then
requirePermissions, then the ee building blocks directly. conventions-forms.md says not to write
new actions this way. The action also takes pieceName for cache invalidation from the client
(:65-76, ConnectionsTab.tsx:274).
Fix:
- Add
renameIntegrationConnectionanddisconnectIntegrationConnectionasdefineServiceFninsettings.server.ts, withpermission: { update: "settings" }. - Let the service functions clear the cache and read
pieceNamefrom the row.
B9 [V] Forked toPlainValue
packages/jobs/src/workflows/integrations/properties.ts:140-160 (toPlain) is
actions/values.ts:9-27 again; workflow-actions.md says "Don't fork it." Import it.
B10 Test theater in connections.test.ts
packages/ee/src/integrations/connections.test.ts:47-200 is a hand-written in-memory Supabase.
It has its own or, lt and vault logic. The "two callers race" test (:319) proves the fake,
not READ COMMITTED. .claude/rules/testing-no-mock-theater.md names this pattern.
Fix:
- Keep the pure tests.
- Export
sameAccount,accountIdentityandexpiringSoon, and test them directly. - Stub only
fetchfor the token-endpoint branches.
Code-judo / simplification
- One per-operation rule, not four. "pluck needs record/entity", "field must resolve",
"a list field needs flatten", "join needs text" are re-derived in
operationsFor(data-operations.ts:106-117),cardResultType(:147-188),checkTypes(data-node.ts:152-198) andrunCard(filter.ts:143-216). MakecardResultTypereturn{ type } | { refusal }; validator emits the refusal,operationsForfilters on it, the runtime calls it for refusal + declared type. ~60 lines of parallel guards and their "a draft is never validated" comments go. The three flags (loops,usesClausesidentical everywhere;usesField≡=== "pluck") collapse to oneaccepts(of)per entry. - Drop the flat
operation/field/flattenfilter-node fields. They were added on this branch alongsideoperations(basefilterNodehad onlysource/combinator/clauses), so they are back-compat for a shape that never shipped. Synthesize card-0 incardsOf;operationOf's flat path, the probe atvariables.ts:299-304and test-helper noise disappear. (Caveat: unless a preview env holds drafts with them.) - Action and integration executors/kinds are near copies. Input resolution
runtime/integration.ts:37-60≈runtime/action.ts:25-50→ oneresolveStepInputs(inputs, declared, ctx)(makelinkStatetake(inputs, declared, name)). Node kindsnodes.ts:716-772≈:662-714→ onestepNodeKindfactory; giveBatchableStepoutputs. - One connection-auth resolver.
integration.ts:66-113(read, piece check, refresh, three error classes) is re-implemented inworkflows.service.ts:861-927(propertyProvider), which has already drifted — it never callsmissingScopes. ExtractresolvePieceAuth(companyId, piece, connectionId)returning a tagged outcome. (Also:readConnection/requiredScopesForatintegration.ts:66,77throw outside anytry.) - Single-pass props.
integration.ts:119-127walksaction.propsthree times (omittedProps, filter,pinnedValues) thentoPropsValuerepeats "fall back to pin" ×3 (properties.ts:181,187,194) and re-checks MARKDOWN (visibility.ts:50). OnetoPropsValue(piece, action, props, inputs)loop deletespinnedValues,omittedPropsand ~60 lines. - One walk over the output schema.
toOutputTypes+toOutputPaths(outputs.ts) andproject.ts:36-37recompute both per run →describeOutputs(schema); foldproject.tsintooutputs.ts.project.ts:65's.slice(0, MAX_LIST_ITEMS)is redundant withlistValue. - Pieces as data.
gmail/config.tsx,google-calendar/config.tsx,slack/config.tsxandhooks.server.tsrepeat id/logo/settings: []/z.object({})/onClientInstalland three identicalonUninstalllambdas. APIECESconst +definePieceIntegration(piece, {...})+ onemapfor hooks. - Second OAuth-state mechanism. HMAC signer in
settings.service.ts:8715-8785beside the cookie-bound single-useissueOAuthState/consumeOAuthState(packages/auth/src/lib/oauth-state.server.ts:179,192, which already has anextrashook). ExtendOAuthStateExtrasand drop the signer — or document why two exist. MappedPropertyre-spread.integrations/catalog.ts:66-128copies every field with conditional spreads and casts, thenee/catalog/build.ts:168-194strips undefined again. HavetoValueTypereturnActionInputLike; rename allowlistlinks.when.prop→inputsolinkspasses through.- FilterForm decomposition.
FilterForm.tsx233 → 533 lines, mostly one ~280-linecards.map. Extract<SourceListPicker>and<OperationCardEditor>(with<FieldPicker>/<ClauseList>). renderStepInputis a 15-argument function.StepInput.tsx:54; both callers pass the same hook value and resolve labels identically (ActionForm.tsx:386-397,IntegrationNodeForm×2). Make it<StepInput …/>that callsuseChoiceOptions()itself.hintis dropped for Pairs/MultiChoice/Options.IntegrationNodeForm's three banners (:267-344) → one<ConnectBanner>; addpath.to.integrationAccounts(piece)(string repeated 3× +workflows.service.ts:805).- Slack reader outside the "ONLY place".
slack/lib/service.ts:282,289re-inlinesSELECT_COLUMNSand anas unknown ascast;:246hand-filtersActiveinstead ofusableConnections;readConnectionAccessToken(connections.ts:636-655) repeatsresolveConnectionAuth's read + guard (prior MINOR 12/15/16, still open).
Risks / questions
- Refresh race
connections.ts:549,564,584— tokens read before the claim, exchanged after; a vendor that rotates refresh tokens getsinvalid_grant→markExpiredcondemns a healthy connection. Latent today (Google doesn't rotate, Slack doesn't expire). Re-read after winning the claim. - Slack
team_idin two companies — nothing at connect time refuses it; afterwards every inbound interaction for the first company throwsAmbiguousSlackWorkspaceError(slack/lib/service.ts:274-295). - CDN logos for non-piece integrations — jira/linear/xero/quickbooks/stripe-connect cards
now load from
cdn.activepieces.com(piece-logo.tsx:18): third-party dependency, viewer IP + Referer leak (incl.CONTROLLED_ENVIRONMENT), and out of scope.alt={piece}renders the slug. - Vendor JSON goes through the column coercer
values.ts:109-125viaproject.ts:66,70:Boolean("false") === true,String(obj)→"[object Object]",new Date(raw)(banned bydate-handling.md). The rule promises "null for anything mistyped". Needs a strictfromJson. - Flattened pluck drops items past 100 and misreports
filter.ts:203-206—listValue'sdroppedis discarded ("Took 2000 values" holding 100). ItemRef.cardnever checked against the card it sits in (filter.ts:78-81,variables.ts:138); card ids not unique/non-empty (schema.ts:93-104) whiledataLoopListusesfindIndex. Derive the card from position, or validate +.refineuniqueness.- [V]
operationOf's "falls back" can never fire —dataOperationSchemais a strict enum (schema.ts:95,117), so removing an operation later makes saved workflows unparseable. Pick one policy (.catch("filter")or delete the claim).in DATA_OPERATIONSalso matches prototype keys. - Run-level error not redacted/capped
engine/execute.ts:640,656-660(firstErrorraw; step row getsredactText). A batch withfailedItems > 0carrieserror: null(:262). accountLabelFor(integrations.connections.callback.ts:219) has no timeout; a stalled identity endpoint hangs the callback.markIntegrationInstalledread-then-insert race (settings.service.ts:2523-2555, prior MINOR 11).workflows.service.ts:947String(option.value)on object-valued dropdowns, hidden by the cast at:937-942.workflows.options.ts:50indexesOPTIONS_PROVIDERS[providerId]withoutObject.hasOwn(?provider=constructor); not exploitable today.store.ts:272setNoticeslacks the empty→empty identity guard its siblings have; every debounce re-renders subscribers.- Nested remapped output paths ignored (
outputs.ts:117-131) though the comment says types and paths "can never disagree". vendorTextdoesn't escape\but the generator emitsmsg`${label}`raw; step labels skipassertLabelIsSafe(prior MINOR 18).- Prior Q1 still open: backfilled 10 Slack scopes vs the required set → every legacy Slack card reads "Reconnect needed".
- Scope:
shared.service.ts:250-255(TEMPLATE_ASSET_PREFIX, commit f48533564f) is a quote-PDF fix unrelated to integrations — split it out.
Suggested improvements
- Dead exports:
packages/ee/src/index.tsconnections block (no importer; putsexchangeAuthorizationCode/exchangeRefreshTokenin a client-reachable barrel); 20 of 32 names inpackages/jobs/src/workflows/integrations/index.tsunused. - Duplicated dot-path walkers
oauth.ts:94-108,outputs.ts:137-144→getPath(packages/ee/src/integrations/secrets.ts:132-140). Duplicated option parsingvisibility.ts:32-41/properties.ts:55-61. registry.ts:93-108getPieceActionre-implementsgetPieceActionsand repeatsloadPiece's allowlist check.check-workflow-catalog.ts: diff is mostly re-indent (-w= +47/−4); keep a synccheck(), extractcompareMapfor the three copy-pasted blocks (:222-268), drop theWORKFLOW_ACTIONSalias. Label text is never compared, only keys.retention.ts:40-54duplicates the generic key-capping branch (:77-85).- Misplaced/orphan JSDoc:
data-operations.ts:92-102,connections.ts:106-109,:722-727(also contradictscallback.ts:121-122),hooks.server.ts:54-64,visibility.ts:28,workflows.service.ts:740,791,useIntegrationInstall.ts:13-21; staleconnections.ts:14. workflows.service.ts:852hardcodesconnectionId— useINTEGRATION_CONNECTION_INPUT.useWorkflowOptions.ts:8imports a type from server-onlyworkflows.service— move to models/types.TimeCombobox.tsx:95,102-104effect mirrorscommittedintodraft— deriveisEditing ? draft : committed.OptionsProviderContext.clientandsearchare unused (workflows.service.ts:753,759,941).integrations.$id.tsx:997-1026awaits two independent reads serially —Promise.all.date.ts:237-240setshourtwice;parseTypedTime(:319,337) deadisIntegerchecks and accepts3.5as 3:05.data-node.ts:168empty-string field gets a double message;notices.ts:93redundantString();integration.ts:141JSON.stringify(undefined)→ use?? null.- Tests:
data-consistency.test.ts:155name doesn't match what it exercises; pervasiveas never/as unknown ascasts (:39-112). packages/jobs/manifests/schema.jsonreorders two unrelated columns — local churn.OutputHandle.tsx: IIFE in JSX →<FieldList>; timers typed viaas unknown as number.
Not a finding: one reviewer said two files grew past 1,000 lines. Both were already over 1,000 at the base:
integrations.$id.tsx (1679 → 1734) and IntegrationForm.tsx (1119 → 1136).
No file crosses 1,000 lines on this branch. The closest are workflows.service.ts (713 → 956)
and ee/workflows/catalog/build.ts (723 → 923).
Docs freshness
- [V] Specs.
.ai/specs/2026-08-31-workflow-integration-outputs.mdstill "draft" and2026-08-31-data-node-operation-chain.md"Approved (pending user sign-off)" though both are implemented; the four "implemented" specs (2026-09-01-*×3 relevant,2026-09-04-integration-datetime-inputs.md) are not moved to.ai/specs/implemented/perkeep-sources-in-sync.md. - [V]
.claude/rules/workflow-integrations.mdpoints at.ai/specs/2026-08-27-workflow-integrations.mdand.ai/research/activepieces-integrations.md— neither exists; itspaths:includespackages/workflows/src/runtime/integration.ts(the engine moved topackages/ee). It also documentsconnect.ts/openConsentPopupas the shared entry point (see B5). - [V]
linkifystill described inpackages/ee/src/workflows/AGENTS.md:361-365and.claude/rules/workflow-engine.md:204-205; this branch replaced it withlinks. - [V]
.claude/rules/workflow-actions.md:30"2 integration steps" — the generated catalog has 7. packages/jobs/AGENTS.mdcallsbuildPieceActionDeclarationsthe "fifth input"; the rule and code say sixth.TestRunPanel.tsxdoc comment and footer ("not saved") contradictworkflow-run-history.md(test runs writeisTest = truerows) — user-facing copy is wrong.packages/jobs/src/backups/schema.ts:40-42comment is false sinceget_connection_secretreads by vault name.- Migration
20261020120101…sql:39policy comment quotes the old manifest rule.
TLDR
Blockers
- B1 pluck on an undeclared field succeeds with
list<null>(filter.ts:160) - B2 health cache stays Healthy 5 h after
markExpired(settings.service.ts:2705) - B3 lookup failure shows "isn't connected" and hides the step (
IntegrationNodeForm.tsx:325) - B4 serialization in the vendor
try→ sent-but-"failed"; raw Gaxios response stored (integration.ts:115) - B5
connect.tsduplicatesoauth-popup.tsand opens after await - B6 untranslated copy (TimeCombobox, DateTimePicker, ConnectionsTab status, connect errors, DataDetail, meta labels)
- B7 non-atomic disconnect + per-row revoke loop (
connections.ts:375-430) - B8 legacy-style connections action, no service function, client-supplied
pieceName - B9 forked
toPlainValue(properties.ts:140) - B10 mock-theater Supabase fake in
connections.test.ts
Code-judo
- one per-operation rule table replaces 4 copies
- drop never-shipped flat filter fields
- shared
resolveStepInputs+stepNodeKindfor action/integration - one
resolvePieceAuth(erp copy already drifted on scopes) - single-pass
toPropsValue - one
describeOutputswalk, foldproject.ts PIECESconst +definePieceIntegration- reuse
issueOAuthStateinstead of a second HMAC state - drop
MappedPropertyre-spread - decompose
FilterForm StepInputas a component + oneConnectBanner- Slack reader back inside
connections.ts
Risks
- refresh race (latent)
- Slack
team_idacross companies - CDN logos for non-piece cards
fromColumncoercion of vendor JSON- flatten drops >100 silently
ItemRef.cardunchecked / duplicate card idsoperationOffallback can't fire- run error not redacted
- no timeout on
accountLabelFor - install race
String(option.value)Object.hasOwnon providerssetNoticesidentity- nested output paths
- label escaping
- legacy Slack scopes
- unrelated quote-PDF commit
Suggestions
- dead barrel exports
- duplicated path walkers / option parsing
- registry dup
- catalog-check
compareMap - retention dup
- misplaced JSDoc
- hardcoded
connectionId - server type import
- TimeCombobox derived state
- unused
client/search Promise.all- date helper nits
- test casts
- manifest churn
Docs
- spec statuses + not moved to
implemented/ workflow-integrations.mddead links/pathslinkifyin AGENTS/rule- "2 integration steps"
- "fifth input"
- test-run "not saved" copy
- backups comment
- migration comment
Verdict
Block. The branch has three correctness bugs that a user can see (B1–B3). B4 can report a sent message as a failure. B5 copies a canonical helper and brings back the bug it prevents. The branch also has untranslated copy and non-atomic writes, which the root AGENTS.md forbids. Simplifications 1, 3, 4 and 5 are still open. Each one deletes a parallel copy of logic.