Skip to content

Conversation

@jiwei-aipolabs
Copy link
Contributor

@jiwei-aipolabs jiwei-aipolabs commented Jul 30, 2025

🏷️ Ticket

https://www.notion.so/Firebase-Integration-23b8378d6a4780c194b3e3878587380d?source=copy_link

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Function Name                        ┃ Operation  ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
β”‚ FIREBASE__CREATE_PROJECT             β”‚ No changes β”‚
β”‚ FIREBASE__GET_PROJECT                β”‚ No changes β”‚
β”‚ FIREBASE__LIST_PROJECTS              β”‚ No changes β”‚
β”‚ FIREBASE__CREATE_WEB_APP             β”‚ No changes β”‚
β”‚ FIREBASE__GET_WEB_APP_CONFIG         β”‚ No changes β”‚
β”‚ FIREBASE__CREATE_DATABASE            β”‚ No changes β”‚
β”‚ FIREBASE__LIST_APPS                  β”‚ No changes β”‚
β”‚ FIREBASE__GET_ADMIN_SDK_CONFIG       β”‚ No changes β”‚
β”‚ FIREBASE__FIRESTORE_GET_DOCUMENTS    β”‚ No changes β”‚
β”‚ FIREBASE__FIRESTORE_LIST_COLLECTIONS β”‚ No changes β”‚
β”‚ FIREBASE__FIRESTORE_QUERY_COLLECTION β”‚ No changes β”‚
β”‚ FIREBASE__MESSAGING_SEND_MESSAGE     β”‚ No changes β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Description

[Describe your changes in detail (optional if the issue you linked already contains a
detail description of the change)]

πŸŽ₯ Demo (if applicable)

πŸ“Έ Screenshots (if applicable)

βœ… Checklist

  • I have signed the Contributor License Agreement (CLA) and read the contributing guide (required)
  • I have linked this PR to an issue or a ticket (required)
  • I have updated the documentation related to my change if needed
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • All checks on CI passed

Summary by cubic

Added Firebase integration with support for project management, web app creation, database setup, Firestore operations, and messaging.

  • New Features
    • Defined 12 Firebase API functions for creating and managing projects, web apps, databases, Firestore documents, and sending messages.
    • Added app metadata and OAuth2 security configuration.

Summary by CodeRabbit

  • New Features

    • Added configuration for Firebase app integration, including metadata, security details, and OAuth2 support.
    • Introduced a comprehensive set of Firebase REST API functions, enabling operations such as project management, web app creation, database and Firestore access, and Cloud Messaging.
  • Chores

    • Added structured JSON configuration files to support standardized API interactions with Firebase services.

@vercel
Copy link

vercel bot commented Jul 30, 2025

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
aci-dev-portal βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 30, 2025 9:50pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 30, 2025

Walkthrough

Two new JSON configuration files have been introduced under backend/apps/firebase/. The first defines metadata and OAuth2 security details for the Firebase app, while the second specifies a set of REST API functions for interacting with various Firebase services, including project, app, database, Firestore, and messaging operations.

Changes

Cohort / File(s) Change Summary
Firebase App Configuration
backend/apps/firebase/app.json
Added a JSON file containing Firebase app metadata, display settings, OAuth2 security scheme, provider info, and categorization.
Firebase Functions API Definitions
backend/apps/firebase/functions.json
Added a JSON file defining multiple REST API functions for Firebase, including endpoints, parameters, validation, and descriptions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

In the warren, code hops anew,
Firebase configβ€”shiny and true!
Functions mapped with careful care,
OAuth keys floating in the air.
Bunnies cheer as endpoints grow,
JSON fields in tidy row.
Onward, Firebaseβ€”let’s go! πŸ‡βœ¨

Note

⚑️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
πŸ§ͺ Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch firebase_integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@recurseml
Copy link

recurseml bot commented Jul 30, 2025

✨ No files to analyze in this PR.

Need help? Join our Discord for support!
https://discord.gg/qEjHQk64Z9

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
backend/apps/firebase/app.json (1)

8-19: Consider adding access_type=offline (or equivalent) to guarantee refresh-token issuance

If this OAuth client will run in backend/CLI contexts you’ll usually need a long-lived refresh token. Google only returns one when the authorization request explicitly asks for offline access (or includes prompt=consent). Surfacing these parameters in the security-scheme block (or at least documenting the requirement) avoids surprise 401s once the short-lived access token expires.

backend/apps/firebase/functions.json (2)

355-360: databaseId is required but hidden from UI – add it to visible or drop from required

FIREBASE__FIRESTORE_GET_DOCUMENTS declares databaseId as required yet omits it from the visible list.
That means front-end generators will not render the input, forcing users to fall back on raw-JSON editing. Either:

  1. add "databaseId" to visible, or
  2. keep it hidden but remove it from required and rely on the default "(default)".

100-104: Expose pageToken to enable pagination when listing projects

pageToken is optional but excluding it from visible prevents callers from traversing result pages. Consider:

-          "visible": ["pageSize"],
+          "visible": ["pageSize", "pageToken"],

This keeps strict whitelisting intact while supporting full pagination workflows.

πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 2762f63 and 08cacca.

πŸ“’ Files selected for processing (2)
  • backend/apps/firebase/app.json (1 hunks)
  • backend/apps/firebase/functions.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
πŸ““ Common learnings
Learnt from: jiwei-aipolabs
PR: aipotheosis-labs/aci#538
File: backend/apps/microsoft_calendar/functions.json:276-308
Timestamp: 2025-07-22T19:31:44.823Z
Learning: In backend/apps/microsoft_calendar/functions.json and similar API function definitions, the `additionalProperties: false` restriction on query objects is intentionally designed for strict validation, even if it blocks some legitimate OData/HTTP headers. The user prefers explicit whitelisting of parameters over flexible schema validation.
Learnt from: jiwei-aipolabs
PR: aipotheosis-labs/aci#540
File: backend/aci/server/app_connectors/microsoft_onedrive.py:85-87
Timestamp: 2025-07-22T11:42:10.132Z
Learning: User jiwei-aipolabs prefers concise code review suggestions and finds detailed error handling with multiple specific status codes too verbose.
backend/apps/firebase/functions.json (1)

Learnt from: jiwei-aipolabs
PR: #538
File: backend/apps/microsoft_calendar/functions.json:276-308
Timestamp: 2025-07-22T19:31:44.823Z
Learning: In backend/apps/microsoft_calendar/functions.json and similar API function definitions, the additionalProperties: false restriction on query objects is intentionally designed for strict validation, even if it blocks some legitimate OData/HTTP headers. The user prefers explicit whitelisting of parameters over flexible schema validation.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: cubic Β· AI code reviewer
  • GitHub Check: Format, Lint, and Test
  • GitHub Check: Compose Tests
  • GitHub Check: Format & Lint
πŸ”‡ Additional comments (3)
backend/apps/firebase/app.json (1)

21-28: LGTM – minimal, well-scoped app descriptor

Naming, categorisation and placeholder secrets are all consistent with the rest of the connector catalogue.

backend/apps/firebase/functions.json (2)

440-470: Very restrictive structuredQuery may block common Firestore queries

Only from and limit are allowed; fields like where, orderBy, offset, etc. are disallowed by additionalProperties: false.
If the intent is to start small, fine – but be aware that most real-world queries will require at least where/orderBy.


1-567: Overall: schema is consistent with previous connectors and honours the strict-validation preference

Paths, HTTP methods, and additionalProperties: false usage align with your earlier Microsoft Calendar & OneDrive specs. Nice work keeping the catalogue uniform.

Comment on lines +514 to +558
"message": {
"type": "object",
"description": "The message to send.",
"properties": {
"token": {
"type": "string",
"description": "Registration token to send a message to."
},
"topic": {
"type": "string",
"description": "Topic name to send a message to."
},
"notification": {
"type": "object",
"description": "Notification payload.",
"properties": {
"title": {
"type": "string",
"description": "The notification's title."
},
"body": {
"type": "string",
"description": "The notification's body text."
}
},
"required": [],
"visible": ["title", "body"],
"additionalProperties": false
},
"data": {
"type": "object",
"description": "Arbitrary key/value payload.",
"properties": {},
"required": [],
"visible": [],
"additionalProperties": {
"type": "string"
}
}
},
"required": [],
"visible": ["token", "topic", "notification", "data"],
"additionalProperties": false
}
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

token OR topic must be required – current schema permits sending an empty message and will 400

The FCM messages:send endpoint rejects a request unless at least one target (token, topic, or condition) is supplied.
Your schema marks every field optional, so nothing prevents a caller from posting { "message": {} }, leading to a runtime failure that static validation could have caught.

@@
               "additionalProperties": false
             }
           },
-          "required": [],
+          "required": [],
+          "oneOf": [
+            { "required": ["token"] },
+            { "required": ["topic"] }
+          ],
           "visible": ["token", "topic", "notification", "data"],
           "additionalProperties": false

You may also want to surface the condition field for parity with the REST API.

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"message": {
"type": "object",
"description": "The message to send.",
"properties": {
"token": {
"type": "string",
"description": "Registration token to send a message to."
},
"topic": {
"type": "string",
"description": "Topic name to send a message to."
},
"notification": {
"type": "object",
"description": "Notification payload.",
"properties": {
"title": {
"type": "string",
"description": "The notification's title."
},
"body": {
"type": "string",
"description": "The notification's body text."
}
},
"required": [],
"visible": ["title", "body"],
"additionalProperties": false
},
"data": {
"type": "object",
"description": "Arbitrary key/value payload.",
"properties": {},
"required": [],
"visible": [],
"additionalProperties": {
"type": "string"
}
}
},
"required": [],
"visible": ["token", "topic", "notification", "data"],
"additionalProperties": false
}
},
"message": {
"type": "object",
"description": "The message to send.",
"properties": {
"token": {
"type": "string",
"description": "Registration token to send a message to."
},
"topic": {
"type": "string",
"description": "Topic name to send a message to."
},
"notification": {
"type": "object",
"description": "Notification payload.",
"properties": {
"title": {
"type": "string",
"description": "The notification's title."
},
"body": {
"type": "string",
"description": "The notification's body text."
}
},
"required": [],
"visible": ["title", "body"],
"additionalProperties": false
},
"data": {
"type": "object",
"description": "Arbitrary key/value payload.",
"properties": {},
"required": [],
"visible": [],
"additionalProperties": {
"type": "string"
}
}
},
"required": [],
"oneOf": [
{ "required": ["token"] },
{ "required": ["topic"] }
],
"visible": ["token", "topic", "notification", "data"],
"additionalProperties": false
}
πŸ€– Prompt for AI Agents
In backend/apps/firebase/functions.json between lines 514 and 558, the message
schema currently allows all target fields (token, topic) to be optional, which
permits sending an empty message and causes a 400 error at runtime. Update the
schema to require at least one of token, topic, or condition fields by making
them conditionally required or adding a validation rule that enforces this.
Also, add the condition field to the message properties to match the FCM REST
API and ensure proper validation before sending messages.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

cubic analysis

1 issue found across 2 files β€’ Review in cubic

React with πŸ‘ or πŸ‘Ž to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

"active": true,
"protocol": "rest",
"protocol_data": {
"method": "GET",
Copy link
Contributor

Choose a reason for hiding this comment

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

documents:listCollectionIds must be called with POST, not GET, otherwise the request will fail at runtime.

Prompt for AI agents
Address the following comment on backend/apps/firebase/functions.json at line 44:

<comment>documents:listCollectionIds must be called with POST, not GET, otherwise the request will fail at runtime.</comment>

<file context>
@@ -0,0 +1,569 @@
+[
+  {
+    &quot;name&quot;: &quot;FIREBASE__CREATE_PROJECT&quot;,
+    &quot;description&quot;: &quot;Adds Firebase to an existing Google Cloud project. Note: This requires Firebase project creation permissions.&quot;,
+    &quot;tags&quot;: [&quot;project&quot;, &quot;create&quot;],
+    &quot;visibility&quot;: &quot;public&quot;,
+    &quot;active&quot;: true,
+    &quot;protocol&quot;: &quot;rest&quot;,
+    &quot;protocol_data&quot;: {
</file context>

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.

1 participant