Skip to content

Fix incorrect FAL event type. Add regression exception & test#10268

Merged
inlined merged 4 commits intomainfrom
inlined.fal-eventtype-fixes
Apr 8, 2026
Merged

Fix incorrect FAL event type. Add regression exception & test#10268
inlined merged 4 commits intomainfrom
inlined.fal-eventtype-fixes

Conversation

@inlined
Copy link
Copy Markdown
Member

@inlined inlined commented Apr 6, 2026

For some reason, the CLI was using the wrong event type for AI Logic triggers. Fixed, and added a validator to throw & recommending upgrading the CLI if the blocking event type isn't known because it was maddening to figure out why these triggers were showing up as HTTP triggers (with blocking event types, we do the registration so there is no use for a fallthrough like to eventarc)

The redefinition of the event type constants was necessary to break circular logic. Maybe I should break down and put this all in services? The pattern should use some looking at in a future review.

@inlined inlined requested a review from shettyvarun268 April 6, 2026 17:57
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the AI Logic event names to use the new 'google.firebase.ailogic.v1' prefix and adds validation logic to detect and reject unrecognized blocking trigger types. I have reviewed the changes and suggest a minor refactoring in the validation logic to reduce nesting by reusing the service object, which aligns with the repository's style guide.

Comment on lines 92 to 101
if (backend.isBlockingTriggered(ep)) {
const service = serviceForEndpoint(ep);
if (service.name === "noop") {
throw new FirebaseError(
`Unrecognized blocking trigger type: ${ep.blockingTrigger.eventType}. Please update your CLI with ${clc.bold("npm install -g firebase-tools@latest")}.`,
{ exit: 1 },
);
}
}
serviceForEndpoint(ep).validateTrigger(ep, wantBackend);
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.

medium

The serviceForEndpoint(ep) function is called twice for blocking triggers. By calling it once and reusing the result, we can simplify the logic and reduce nesting, which aligns with the repository's style guide recommendation to keep code flat and efficient.

    const service = serviceForEndpoint(ep);
    if (backend.isBlockingTriggered(ep) && service.name === "noop") {
      throw new FirebaseError(
        `Unrecognized blocking trigger type: ${ep.blockingTrigger.eventType}. Please update your CLI with ${clc.bold("npm install -g firebase-tools@latest")}.`,
        { exit: 1 },
      );
    }
    service.validateTrigger(ep, wantBackend);
References
  1. Reduce nesting as much as possible. Code should avoid unnecessarily deep nesting or long periods of nesting. (link)

Copy link
Copy Markdown
Contributor

@shettyvarun268 shettyvarun268 left a comment

Choose a reason for hiding this comment

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

LGTM!
The nit about the double calling in validate.ts might be worth looking into.

@inlined inlined marked this pull request as ready for review April 8, 2026 03:47
@inlined inlined merged commit 0f5ca56 into main Apr 8, 2026
47 checks passed
@inlined inlined deleted the inlined.fal-eventtype-fixes branch April 8, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants