feat: embed publish constraints (required piece + trigger lock)
Supporting ticket for a customer-submitted PR. activepieces/activepieces#13590 is the feature request; this tracks the contributed implementation of it, opened by the customer who asked for it Needs a core-team review and merge, nothing else.
PR
activepieces/activepieces#14076, Jason Fill (jasonfill). Open since Jul 6, last push Jul 20, 4 commits, 951 additions / 11 deletions across 15 files. Auto-closed once by the unsolicited-PR policy on Jul 16, then reopened with keep-open (existing customer, discussed beforehand).
Scope
Two per-flow embed publish constraints on flow.metadata.embedConstraints, no DB migration. Set by the vendor at flow creation via CreateFlowRequest.metadata; the embedded end user cannot change them.
requiredPieceNames: string[]. Publish blocked unless a non-skipped step (action or trigger) uses one of the listed pieces. Subflow triggers exempt.triggerLock: 'none' | 'locked' | 'frozen'.lockedblocks swapping or clearing the trigger piece with inputs still editable,frozenmakes the whole trigger read-only.
Shared helper embedConstraintsUtil in core-execution, re-exported through @activepieces/shared, so UI and server read one source of truth. Server guards in flow.service.ts: publish check in updatedPublishedVersionId(), plus assertTriggerLockAllowsUpdate on UPDATE_TRIGGER and IMPORT_FLOW, both returning 409. UPDATE_METADATA now carries the existing embedConstraints key over. UI greys out Publish with a reason tooltip and hides the trigger Replace affordance. Docs page added at docs/embedding/publish-constraints.mdx.
State
Greptile 5/5 on the latest commit ("safe to merge", no files flagged). Two earlier findings (EMPTY-trigger alignment, service-principal exclusions) already addressed. CLA signed, GitGuardian and mergefreeze green. The CE and EE e2e jobs report skipping, so no e2e ran against this branch.
Tests included: unit coverage for flowSatisfiesRequiredPiece and a 449-line API integration suite (required-piece missing / present / subflow-exempt, locked piece swap, frozen edit, locked input-only edit, and both bypasses).
Blockers
- Merge conflicts against main.
mergeable: CONFLICTING, branch untouched since Jul 20. Rebase needed before anything else. - Worth confirming in review: the whole guarantee rests on the
UPDATE_METADATAcarry-over, sinceflow.metadatais otherwise builder-writable. Also check scope against activepieces/activepieces#13590, which listed trigger pinning as out of scope for v1.
Source: activepieces/activepieces