Skip to content

Conversation

@HarshMN2345
Copy link
Member

@HarshMN2345 HarshMN2345 commented Oct 29, 2025

What does this PR do?

image image image

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • Project search now recognizes credential-related queries (endpoint, API key, project ID) and provides direct navigation to Settings
    • Enhanced project search filtering to include project ID, region, and endpoint in search results
  • Improvements

    • Better text parameter handling for region endpoint display

@railway-app
Copy link

railway-app bot commented Oct 29, 2025

This PR was not deployed automatically as @HarshMN2345 does not have access to the Railway project.

In order to get automatic PR deploys, please add @HarshMN2345 to your workspace on Railway.

@appwrite
Copy link

appwrite bot commented Oct 29, 2025

Console

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Appwrite has a Discord community with over 16 000 members.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Walkthrough

This pull request enhances the project search functionality and improves text truncation parameter handling. The projects searcher now detects credential-related query terms to short-circuit to Settings navigation, retrieves API endpoints for richer searchable context, and implements tokenized filtering across project name, ID, region, and endpoint fields. Simultaneously, the truncateText action is extended to accept optional text parameters, allowing callers to provide initial text and updates without relying solely on node.textContent, with regionEndpoint updated to pass region names to the action.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring extra attention:

  • Credential query detection logic in projects.ts: Verify the term matching and Settings navigation behavior handle edge cases correctly and do not unintentionally trigger on partial matches
  • Tokenized filtering implementation: Confirm the token parsing and "all tokens present" requirement work as expected for various query patterns and special characters
  • API endpoint retrieval and project store integration: Ensure getApiEndpoint calls are properly error-handled and the project store context is available in the searcher context
  • truncateText parameter propagation: Verify that the optional text parameter is correctly passed from regionEndpoint and that the update method properly handles undefined newText fallback to node.textContent
  • Backward compatibility: Check that existing callers of truncateText without the new text parameter continue to function correctly

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: show project Go to Settings for credential queries" directly describes the primary functionality added in the main file being modified (src/lib/commandCenter/searchers/projects.ts). The changes implement detection of credential-like query terms (endpoint, api key, project id) and provide a "Go to Settings" navigation shortcut, which is exactly what the title conveys. The supporting changes to the truncateText action and regionEndpoint component are enabling modifications that don't alter the core purpose. The title is concise, specific, and clear enough that a teammate scanning the git history would understand the feature being added.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-SER-443-make-api-endpoint-searchable-command-center

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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 (1)
src/lib/commandCenter/searchers/projects.ts (1)

56-70: Consider using map instead of flatMap for clarity.

Since each project produces exactly one navigation item, using map instead of flatMap would be more direct and slightly more efficient.

-        .flatMap((project) => {
+        .map((project) => {
             const href = `${base}/project-${project.region}-${project.$id}`;
 
             const label = project.name;
 
-            return [
-                {
-                    label,
-                    callback: () => {
-                        goto(href);
-                    },
-                    group: 'projects'
-                }
-            ];
+            return {
+                label,
+                callback: () => {
+                    goto(href);
+                },
+                group: 'projects'
+            };
         });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b9feaf and 2003299.

📒 Files selected for processing (3)
  • src/lib/commandCenter/searchers/projects.ts (1 hunks)
  • src/lib/components/id.svelte (2 hunks)
  • src/lib/components/regionEndpoint.svelte (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/lib/commandCenter/searchers/projects.ts (3)
src/routes/(console)/project-[region]-[project]/store.ts (1)
  • project (11-11)
src/lib/stores/sdk.ts (2)
  • sdk (153-176)
  • getApiEndpoint (47-59)
src/lib/stores/organization.ts (1)
  • organization (62-62)
⏰ 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). (2)
  • GitHub Check: build
  • GitHub Check: e2e
🔇 Additional comments (2)
src/lib/components/regionEndpoint.svelte (1)

41-41: LGTM! Correctly leverages updated truncateText signature.

Passing region?.name explicitly to the action enables proper reactive truncation when the region changes, and the optional chaining safely handles undefined cases.

src/lib/components/id.svelte (1)

32-33: LGTM! Backward-compatible enhancement for explicit text management.

The optional parameters enable callers to explicitly provide text for truncation while maintaining backward compatibility with existing usage that relies on node.textContent. The update method correctly receives new text values from Svelte's action lifecycle when parameters change.

Also applies to: 73-74

Comment on lines +32 to +33
export function truncateText(node: HTMLElement, text?: string) {
let originalText = text ?? node.textContent;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this needed? 🤔

actions should always work with elements and usually shouldnt have a new context passed 👍🏻

Comment on lines +11 to +24
const q = query.toLowerCase().trim();
const wantsCredentials =
q.includes('endpoint') ||
q.includes('api key') ||
q.includes('api-key') ||
q.includes('apikey') ||
q.includes('project id') ||
q.includes('project-id') ||
q === 'id' ||
q.endsWith(' id') ||
q.startsWith('end') ||
q.includes('api end') ||
(q.includes('api') && q.includes('end'));

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can make this simpler:

const keywords = [
  'endpoint',
  'api key',
  'api-key',
  'apikey',
  'project id',
  'project-id',
  'api end'
];

const wantsCredentials = keywords.some(k => q.includes(k));

something like this maybe

} as const;
.filter((project) => {
const endpoint = getApiEndpoint(project.region);
const searchable = [project.name, project.$id, project.region, endpoint]
Copy link
Contributor

Choose a reason for hiding this comment

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

i dont think we need the endpoint here 👍🏻

Comment on lines +56 to 70
.flatMap((project) => {
const href = `${base}/project-${project.region}-${project.$id}`;

const label = project.name;

return [
{
label,
callback: () => {
goto(href);
},
group: 'projects'
}
];
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.flatMap((project) => {
const href = `${base}/project-${project.region}-${project.$id}`;
const label = project.name;
return [
{
label,
callback: () => {
goto(href);
},
group: 'projects'
}
];
});
.map((project) => {
const href = `${base}/project-${project.region}-${project.$id}`;
const label = project.name;
return {
label,
callback: () => {
goto(href);
},
group: 'projects'
};
});

why flatmap over map?

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