Skip to content

fix(api): stop Trigger.dev deploy failing on @trycompai/auth/participation#3393

Merged
tofikwest merged 1 commit into
mainfrom
tofik/fix-trigger-api-participation-bundle
Jul 10, 2026
Merged

fix(api): stop Trigger.dev deploy failing on @trycompai/auth/participation#3393
tofikwest merged 1 commit into
mainfrom
tofik/fix-trigger-api-participation-bundle

Conversation

@tofikwest

@tofikwest tofikwest commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the broken Deploy API to Trigger.dev job on main (introduced by #3378):

Failed to build code
Error: Build failed with 1 error:
src/utils/org-participation.ts:7:7: ERROR: Could not resolve "@trycompai/auth/participation"

Why

The API's Trigger.dev deploy bundles the task notifiers with esbuild. The trigger deploy workflow builds db / email / integration-platform but not @trycompai/auth, so its dist/ doesn't exist. #3378 added @trycompai/auth/participation imports into org-participation.ts and task-item-assignment-notifier.ts — both reachable from the bundled task notifiers — so esbuild had nothing to resolve. (The auth index is never reached in the bundle, which is why only the subpath failed.)

How

Mirror the pattern the app already uses for Trigger.dev-bundled code (apps/app/src/lib/org-participation-rule.ts): a dependency-free local copy of the tiny participation predicate, so the trigger bundle never imports @trycompai/auth (which also pulls in better-auth, unbundleable).

  • New apps/api/src/utils/org-participation-rule.ts — pure, zero imports.
  • org-participation.ts + task-item-assignment-notifier.ts import the local mirror instead of the subpath.
  • Drift-guard spec asserts the mirror stays byte-for-byte equivalent to @trycompai/auth/participation across every role × internal-flag combination.
  • Jest moduleNameMapper resolves @trycompai/auth/participation → source, so the guard runs without needing the auth dist built.

This restores the trigger bundle to its known-good pre-#3378 state (no @trycompai/auth in the bundle).

Verify

  • No source file imports @trycompai/auth/participation anymore (only the spec, which isn't bundled).
  • API typecheck clean for the changed files; org-participation + task-item-assignment-notifier specs pass (15 tests, incl. the drift guard).

🤖 Generated with Claude Code


Summary by cubic

Fixes the API Trigger.dev deploy by removing the broken @trycompai/auth/participation import from bundled code. Uses a local, dependency‑free participation rule and adds a drift guard to keep it in sync.

  • Bug Fixes
    • Added apps/api/src/utils/org-participation-rule.ts (pure, no imports).
    • Updated org-participation.ts and the task notifier to import the local rule.
    • Added org-participation-rule.spec.ts to compare outputs with @trycompai/auth/participation.
    • Mapped @trycompai/auth/participation to source in Jest so the guard runs without the auth dist/.

Written for commit 02f24fc. Summary will update on new commits.

Review in cubic

…ation

The API's Trigger.dev deploy bundles task notifiers with esbuild, which failed
with "Could not resolve @trycompai/auth/participation". The auth package's dist
is not built in the trigger deploy workflow (it builds db/email/integration-
platform only), and the API's org-participation code — reachable from the task
notifiers — imported that subpath, so esbuild had nothing to resolve.

Mirror the app's approach for Trigger.dev-bundled code: use a dependency-free
local copy of the tiny participation predicate (`org-participation-rule.ts`)
instead of importing `@trycompai/auth`. This keeps the trigger bundle free of
the auth package (which also pulls better-auth, unbundleable). A drift-guard
spec asserts the mirror stays identical to `@trycompai/auth/participation`, and
a jest moduleNameMapper resolves that subpath to source so the guard runs
without needing the auth dist built.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzEVwhhoFghng6SDMGecMq
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Jul 10, 2026 7:42pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Jul 10, 2026 7:42pm
portal Skipped Skipped Jul 10, 2026 7:42pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit 1ba1d20 into main Jul 10, 2026
10 checks passed
@tofikwest tofikwest deleted the tofik/fix-trigger-api-participation-bundle branch July 10, 2026 19:47
claudfuen pushed a commit that referenced this pull request Jul 10, 2026
# [3.101.0](v3.100.1...v3.101.0) (2026-07-10)

### Bug Fixes

* **api:** reject assignees that aren't members of the organization ([dd071b6](dd071b6))
* **api:** stop Trigger.dev deploy failing on @trycompai/auth/participation ([#3393](#3393)) ([1ba1d20](1ba1d20))
* **org:** address 2nd review pass — harden vendor assignee, unify UI rule, guard boundaries ([ef1a53f](ef1a53f))
* **org:** address review — align browser-automation, tighten null validation, keep dep boundary ([415ee40](415ee40))
* **org:** address review — spread-safe participant filter, confirm internal toggle ([26cecbe](26cecbe))
* **org:** unify participation where-fragment, guard deactivated author, skip needless query ([77df89c](77df89c))

### Features

* **isms:** add Roles, Responsibilities & Authorities document (CS-698) ([#3391](#3391)) ([c013515](c013515))
* **org:** treat platform admins as members in internal organizations ([e179c58](e179c58))
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.101.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants