Skip to content

Comments

[WEB-2706] fix: Add fallback when db initialisation fails#5973

Merged
pushya22 merged 8 commits intopreviewfrom
handle-db-intialization-failure
Nov 8, 2024
Merged

[WEB-2706] fix: Add fallback when db initialisation fails#5973
pushya22 merged 8 commits intopreviewfrom
handle-db-intialization-failure

Conversation

@SatishGandham
Copy link
Contributor

@SatishGandham SatishGandham commented Nov 7, 2024

Fixes screen stuck on workspace loader when the DB initialisation fails.

Summary by CodeRabbit

  • New Features

    • Enhanced database initialization with improved error handling and timeout mechanisms.
    • Added performance monitoring for database initialization processes.
    • Introduced a new constant BOOLEAN_FIELDS for better data handling.
    • Added functionality to synchronize accepted inbox issues with the local database.
    • Updated moveIssue method to return the moved issue object, ensuring state persistence.
    • New asynchronous function for adding issues to the persistence layer.
  • Bug Fixes

    • Improved logging for various states during database initialization to aid debugging.
    • Enhanced error handling in database execution methods for clearer feedback.
  • Documentation

    • Updated method signatures for better clarity and consistency in the Storage, DBClass, and WorkspaceDraftService functionalities.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

Walkthrough

The changes in this pull request involve substantial updates to the Storage class in web/core/local-db/storage.sqlite.ts, the DBClass in web/core/local-db/worker/db.ts, and related utility functions. Enhancements include improved error handling, logging, and control flow mechanisms for database initialization and synchronization. The initialize and _initialize methods now feature robust error handling and logging, while the DBClass introduces a timeout mechanism for database initialization. These modifications aim to improve the overall reliability and performance of the database management system.

Changes

File Path Change Summary
web/core/local-db/storage.sqlite.ts Updated initialize, _initialize, syncIssues, and clearStorage methods for error handling and logging. Enhanced control flow for database readiness checks. Added BOOLEAN_FIELDS constant for data formatting.
web/core/local-db/worker/db.ts Modified init method to include a timeout mechanism for database initialization. Improved error handling feedback.
web/core/local-db/utils/constants.ts Added new constant BOOLEAN_FIELDS containing ["is_draft"].
web/core/local-db/utils/utils.ts Introduced addIssueToPersistanceLayer function for adding issues to the persistence layer. Updated updatePersistentLayer to use this new function.
web/core/services/issue/workspace_draft.service.ts Changed moveIssue method return type from Promise<void> to Promise<TIssue>.
web/core/store/inbox/inbox-issue.store.ts Integrated addIssueToPersistanceLayer in updateInboxIssueStatus for accepted issues.
web/core/store/issue/workspace-draft/issue.store.ts Updated moveIssue method to call addIssueToPersistanceLayer and changed return type to Promise<TIssue>.
apiserver/plane/app/serializers/issue.py Added project_id and workspace_id fields to IssueCreateSerializer, modifying create and update methods to utilize these fields.

Possibly related PRs

Suggested labels

🐛bug, ⚙️backend, 🌟improvement

Suggested reviewers

  • rahulramesha
  • sriramveeraghanta

🐰 In the land of code where the rabbits play,
Errors are caught, come what may.
With logging and spans, the database sings,
Robustness and grace, oh, what joy it brings!
Clear paths ahead, no more delays,
Hopping along in the best of ways! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

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

🧹 Outside diff range and nitpick comments (3)
web/core/local-db/worker/db.ts (2)

Line range hint 38-67: Improve error handling and connection management.

The current error handling could be enhanced to provide better diagnostics and ensure proper cleanup:

  1. The generic error message might hide important details about initialization failures
  2. No cleanup is performed when initialization fails
  3. Missing validation of SQLite instance before operations

Consider implementing these improvements:

     try {
       const m = await SQLiteESMFactory();
       this.sqlite3 = SQLite.Factory(m);
       const vfs = await MyVFS.create("plane", m);
       this.sqlite3.vfs_register(vfs, true);
       
       // ... timeout and db initialization code ...
 
       this.instance.db = db;
       this.instance.exec = async (sql: string) => {
+        if (!this.instance.db) {
+          throw new Error('Database connection is not initialized');
+        }
         const rows: any[] = [];
         await this.sqlite3.exec(db, sql, (row: any[], columns: string[]) => {
           rows.push(mergeToObject(columns, row));
         });
 
         return rows;
       };
       return true;
     } catch (error) {
+      // Cleanup on initialization failure
+      this.instance = {} as SQLiteInstance;
+      this.sqlite3 = null;
+
+      // Provide more specific error information
+      const errorMessage = error instanceof Error ? error.message : 'Unknown error';
+      const context = error instanceof Error && error.stack ? `\nStack: ${error.stack}` : '';
-      throw new Error(`Failed to initialize database: ${(error as any)?.message}`);
+      throw new Error(`Database initialization failed: ${errorMessage}${context}`);
     }

Transaction management concerns require attention

The verification confirms the architectural concerns:

  1. The transaction handling only checks for "BEGIN;" syntax, while the codebase shows multiple transaction start patterns in different files.
  2. The transaction promise queue (tp) and resolver array (tpResolver) implementation lacks proper error handling and cleanup:
    • No rejection handling for failed transactions
    • No cleanup of pending transactions on database close
    • No comprehensive timeout mechanism (only one timeout found, not for transaction management)
  3. The class mixes database operations with transaction management, making it harder to maintain and test.

Locations needing attention:

  • web/core/local-db/worker/db.ts: Transaction management implementation
  • web/core/local-db/utils/*.ts: Various transaction usage patterns that might conflict with the current implementation
🔗 Analysis chain

Line range hint 73-119: Address transaction management concerns and potential race conditions.

The TODO comment about transaction handling indicates potential issues:

  1. The current implementation might fail with different transaction start syntaxes
  2. Transaction queue management could lead to race conditions
  3. No timeout mechanism for hanging transactions

Consider these architectural improvements:

  1. Extract transaction management into a separate class
  2. Implement proper transaction timeout handling
  3. Add transaction cleanup on database close

Let's verify the transaction handling patterns in the codebase:


Let me gather more information about the transaction handling implementation to verify the concerns.


Let me check one more aspect about the transaction promise handling to complete the verification.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for different transaction start patterns that might bypass the current logic
rg -i "begin\s*(transaction)?" --type ts

Length of output: 2849


Script:

#!/bin/bash
# Check the transaction management implementation
rg -A 10 "tp\s*=" --type ts

# Look for transaction cleanup in close method
ast-grep --pattern 'close() {
  $$$
}'

# Check for transaction timeout implementation
rg -i "timeout" --type ts -g "db.ts"

Length of output: 218


Script:

#!/bin/bash
# Check the transaction promise (tp) and resolver implementation
rg -B 5 -A 10 "tpResolver" --type ts

# Look for any error handling in transaction management
rg -B 3 -A 3 "reject.*transaction" --type ts

Length of output: 2815

web/core/local-db/storage.sqlite.ts (1)

129-132: Preserve original error stack trace when rethrowing

When throwing an error in the catch block, creating a new Error with a concatenated message can lead to the loss of the original error's stack trace, making debugging more difficult. To maintain the original stack trace, consider rethrowing the original error or using the cause property (if supported in your environment).

Consider modifying the code as follows:

} catch (error) {
  this.status = "error";
  this.db = null;
- throw new Error(`Failed to initialize database worker: ${error}`);
+ throw error;
}

Or, to add context while preserving the stack trace:

} catch (error) {
  this.status = "error";
  this.db = null;
+ error.message = `Failed to initialize database worker: ${error.message}`;
  throw error;
}

If your environment supports the cause property:

} catch (error) {
  this.status = "error";
  this.db = null;
- throw new Error(`Failed to initialize database worker: ${error}`);
+ throw new Error(`Failed to initialize database worker`, { cause: error });
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7574206 and a8728fc.

📒 Files selected for processing (2)
  • web/core/local-db/storage.sqlite.ts (2 hunks)
  • web/core/local-db/worker/db.ts (1 hunks)
🔇 Additional comments (1)
web/core/local-db/storage.sqlite.ts (1)

78-78: Good use of tracing for database initialization

Wrapping this._initialize(workspaceSlug) with startSpan enhances performance monitoring and tracing during database initialization.

Comment on lines 39 to 52
// Fallback in rare cases where the database is not initialized in time
const p = new Promise((resolve) => setTimeout(() => resolve(false), 5000));
const dbPromise = this.sqlite3.open_v2(
`${dbName}.sqlite3`,
this.sqlite3.OPEN_READWRITE | this.sqlite3.OPEN_CREATE,
"plane"
);

const db = await Promise.any([dbPromise, p]);

if (!db) {
throw new Error("Failed to initialize in time");
}

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance the fallback mechanism implementation.

While the timeout fallback is a good addition, consider these improvements:

  1. Make the timeout duration configurable instead of hardcoding 5000ms
  2. Use Promise.race instead of Promise.any to preserve original error information
  3. Add debug logging for initialization failures

Here's a suggested implementation:

-      // Fallback in rare cases where the database is not initialized in time
-      const p = new Promise((resolve) => setTimeout(() => resolve(false), 5000));
-      const dbPromise = this.sqlite3.open_v2(
+      const DB_INIT_TIMEOUT_MS = 5000; // Consider moving to config
+      const timeoutPromise = new Promise((_, reject) => 
+        setTimeout(() => reject(new Error(`Database initialization timed out after ${DB_INIT_TIMEOUT_MS}ms`)), 
+        DB_INIT_TIMEOUT_MS)
+      );
+      
+      const dbPromise = this.sqlite3.open_v2(
         `${dbName}.sqlite3`,
         this.sqlite3.OPEN_READWRITE | this.sqlite3.OPEN_CREATE,
         "plane"
       );
 
-      const db = await Promise.any([dbPromise, p]);
-
-      if (!db) {
-        throw new Error("Failed to initialize in time");
-      }
+      const db = await Promise.race([dbPromise, timeoutPromise]);
📝 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
// Fallback in rare cases where the database is not initialized in time
const p = new Promise((resolve) => setTimeout(() => resolve(false), 5000));
const dbPromise = this.sqlite3.open_v2(
`${dbName}.sqlite3`,
this.sqlite3.OPEN_READWRITE | this.sqlite3.OPEN_CREATE,
"plane"
);
const db = await Promise.any([dbPromise, p]);
if (!db) {
throw new Error("Failed to initialize in time");
}
const DB_INIT_TIMEOUT_MS = 5000; // Consider moving to config
const timeoutPromise = new Promise((_, reject) =>
setTimeout(() => reject(new Error(`Database initialization timed out after ${DB_INIT_TIMEOUT_MS}ms`)),
DB_INIT_TIMEOUT_MS)
);
const dbPromise = this.sqlite3.open_v2(
`${dbName}.sqlite3`,
this.sqlite3.OPEN_READWRITE | this.sqlite3.OPEN_CREATE,
"plane"
);
const db = await Promise.race([dbPromise, timeoutPromise]);

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

🧹 Outside diff range and nitpick comments (1)
web/core/local-db/worker/db.ts (1)

Line range hint 26-68: Consider architectural improvements for better error handling and reliability.

The current implementation could benefit from several architectural improvements:

  1. Create specific error types for different failure scenarios (timeout, initialization, etc.)
  2. Implement a retry mechanism with exponential backoff for transient initialization failures
  3. Consider separating database lifecycle management (init/close) from query execution into separate classes

This would improve error handling, reliability, and maintainability of the code.

Would you like me to provide a detailed implementation for any of these suggestions?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a8728fc and 2d7c10c.

📒 Files selected for processing (1)
  • web/core/local-db/worker/db.ts (3 hunks)
🧰 Additional context used
🪛 Biome
web/core/local-db/worker/db.ts

[error] 69-69: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 114-114: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 121-121: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (1)
web/core/local-db/worker/db.ts (1)

39-52: The previous review suggestions for the fallback mechanism remain valid.

The current implementation of the fallback mechanism could be improved as per the previous review comment. The suggestions about configurable timeout, using Promise.race, and adding debug logging would make the code more maintainable and debuggable.


runQuery(sql: string) {
return this.instance.exec(sql);
return this.instance?.exec && this.instance.exec(sql);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve optional chaining implementation.

The current pattern instance?.exec && instance.exec(sql) is verbose and potentially unsafe. If instance becomes null between the check and execution, it could still throw.

Apply these changes for safer optional chaining:

-    return this.instance?.exec && this.instance.exec(sql);
+    return this.instance?.exec?.(sql);
-      await (this.instance?.exec && this.instance.exec(sql));
+      await this.instance?.exec?.(sql);
-    return await (this.instance?.exec && this.instance.exec(sql));
+    return await this.instance?.exec?.(sql);

Also applies to: 114-114, 121-121

🧰 Tools
🪛 Biome

[error] 69-69: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

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

🧹 Outside diff range and nitpick comments (1)
web/core/local-db/utils/constants.ts (1)

3-4: Consider adding documentation for the constant.

Adding a brief comment explaining the purpose of BOOLEAN_FIELDS would help other developers understand its role in type conversion during database operations.

+// Fields that should be converted to boolean type when formatting local issues
 export const BOOLEAN_FIELDS = ["is_draft"];
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2d7c10c and 3a87397.

📒 Files selected for processing (2)
  • web/core/local-db/storage.sqlite.ts (4 hunks)
  • web/core/local-db/utils/constants.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/local-db/storage.sqlite.ts
🔇 Additional comments (1)
web/core/local-db/utils/constants.ts (1)

3-4: LGTM! The constant follows the established pattern.

The new BOOLEAN_FIELDS constant is well-structured and follows the same pattern as other field type constants in the file.

Comment on lines +3 to +4
export const BOOLEAN_FIELDS = ["is_draft"];

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Based on the search results, particularly from web/core/local-db/utils/schemas.ts and other files, I can now generate a final response.

Update BOOLEAN_FIELDS constant to include all relevant boolean fields

The constant should include additional boolean fields found in the codebase:

  • is_draft
  • is_local_update
  • is_bot
  • is_favorite
  • is_locked
  • is_subscribed

These fields are used across various models and schemas in the application, particularly in issues and pages.

🔗 Analysis chain

Verify completeness of boolean fields list.

Let's ensure we haven't missed any boolean fields that should be included in this constant.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for potential boolean fields in the codebase
# Look for field definitions or type annotations containing 'boolean' or 'bool'
# focusing on model/schema definitions and database-related files

echo "Searching for potential boolean fields in models and schemas..."
rg -i "boolean|bool" --type ts --type tsx web/

Length of output: 213


Script:

#!/bin/bash
# Let's try a different approach to find boolean fields
# 1. Search for boolean type annotations in TypeScript files
# 2. Search for boolean fields in schema definitions
# 3. Search for is_ prefixed fields which are commonly boolean

echo "Searching for boolean type annotations..."
rg -t ts ":\s*(boolean|Boolean)" web/

echo -e "\nSearching for is_ prefixed fields..."
rg -t ts "is_\w+\s*[:=]" web/

echo -e "\nSearching specifically in schema/model files..."
fd "schema|model" web/ -e ts -x rg -l "boolean|Boolean|is_\w+"

Length of output: 105064

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: 5

🧹 Outside diff range and nitpick comments (3)
web/core/services/issue/workspace_draft.service.ts (1)

Line range hint 62-67: Consider enhancing error handling.

The current error handling directly throws the error response without type safety. Consider adding proper error typing and handling.

 async moveIssue(workspaceSlug: string, issueId: string, payload: Partial<TWorkspaceDraftIssue>): Promise<TIssue> {
   return this.post(`/api/workspaces/${workspaceSlug}/draft-to-issue/${issueId}/`, payload)
     .then((response) => response?.data)
     .catch((error) => {
-      throw error?.response;
+      const errorMessage = error?.response?.data?.error || 'Failed to move issue';
+      throw new Error(errorMessage);
     });
 }
web/core/store/inbox/inbox-issue.store.ts (1)

7-8: Fix typo in imported function name.

The imported function name contains a typo: "Persistance" should be "Persistence".

web/core/store/issue/workspace-draft/issue.store.ts (1)

25-26: Fix typo in imported function name.

The imported function name contains a spelling error: "Persistance" should be "Persistence".

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3a87397 and 3de955d.

📒 Files selected for processing (5)
  • web/core/local-db/utils/utils.ts (2 hunks)
  • web/core/local-db/worker/db.ts (3 hunks)
  • web/core/services/issue/workspace_draft.service.ts (1 hunks)
  • web/core/store/inbox/inbox-issue.store.ts (2 hunks)
  • web/core/store/issue/workspace-draft/issue.store.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/local-db/worker/db.ts
🔇 Additional comments (4)
web/core/services/issue/workspace_draft.service.ts (1)

Line range hint 62-67: Verify the impact of return type change.

The return type change from Promise<void> to Promise<TIssue> is a breaking change. Let's verify all callers have been updated.

✅ Verification successful

Let me analyze the usage of moveIssue method in the codebase.


Let me try a different pattern to find the implementation.


Let me try one more search to find the store implementation.


Based on the search results, I can now provide the final response:

The return type change is handled correctly in the codebase.

The only caller of moveIssue service method is in web/core/store/issue/workspace-draft/issue.store.ts, and it correctly handles the response by only using it for side effects (removing the issue from local state) without depending on the return type. The change from Promise<void> to Promise<TIssue> is safe as the caller is not using the returned value.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all references to moveIssue method to verify they handle the returned TIssue
# Test: Search for moveIssue method calls
rg -A 5 "moveIssue\(" --type ts

Length of output: 19902


Script:

#!/bin/bash
# Let's find the implementation of the moveIssue method in workspace-draft store to see how it handles the response
ast-grep --pattern 'moveIssue = async ($$$) => {
  $$$
}'

Length of output: 59


Script:

#!/bin/bash
# Search for moveIssue implementation in the workspace draft store
rg -A 10 "moveIssue.*workspaceDraftService" --type ts

Length of output: 55


Script:

#!/bin/bash
# Search for moveIssue method in workspace draft store with more context
rg -A 15 "moveIssue.*=.*async" web/core/store/issue/workspace-draft/issue.store.ts

Length of output: 2366

web/core/local-db/utils/utils.ts (1)

Line range hint 22-69: Verify DB initialization failure handling.

While these changes improve error handling for issue persistence, they don't directly address the PR's main objective of handling DB initialization failures. We should verify the initialization code in the DB worker.

Let's check the DB initialization code:

web/core/store/issue/workspace-draft/issue.store.ts (2)

64-64: LGTM! Return type change improves type safety.

The updated return type Promise<TIssue> better reflects the actual return value and enhances type safety.


353-356: Verify persistence layer implementation.

Let's verify the implementation of addIssueToPersistanceLayer to ensure it properly handles DB initialization failures.

✅ Verification successful

Let me verify the implementation of addIssueToPersistanceLayer to check how it handles DB initialization failures.


Let me continue checking the full implementation and error handling of addIssueToPersistanceLayer since we only see the beginning of the function.


Let me try a different approach to get the complete implementation including the error handling part.


Let me check the implementation of updateIssue since it's the core function being called within addIssueToPersistanceLayer.


Based on the code analysis, I can now provide a final response about the DB initialization failure handling.

DB initialization failure is properly handled in the persistence layer

The implementation shows proper defensive checks:

  1. addIssueToPersistanceLayer has a try-catch block that logs errors without crashing
  2. updateIssue has early-exit guards:
    if (document.hidden || !rootStore.user.localDBEnabled || !persistence.db) return;
  3. The persistence layer operations are non-blocking - if DB operations fail, the main application flow continues

This implementation aligns with handling DB initialization failures gracefully by:

  • Checking DB availability before operations
  • Gracefully handling errors without disrupting the application
  • Making persistence operations optional through feature flags
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the implementation of addIssueToPersistanceLayer

# Search for the implementation
rg -A 10 "addIssueToPersistanceLayer" "web/core/local-db"

# Look for error handling patterns
rg -A 5 "catch.*error.*db" "web/core/local-db"

Length of output: 124958


Script:

#!/bin/bash
# Search for the implementation of addIssueToPersistanceLayer
rg -A 10 "export const addIssueToPersistanceLayer" "web/core/local-db/utils/utils.ts"

Length of output: 384


Script:

#!/bin/bash
# Get the complete implementation including error handling
rg -A 30 "export const addIssueToPersistanceLayer" "web/core/local-db/utils/utils.ts"

# Also check for any DB initialization error handling patterns
rg -A 10 "catch.*error.*db" "web/core/local-db/utils/utils.ts"

Length of output: 863


Script:

#!/bin/bash
# Try with more context lines and different pattern
rg -A 50 "addIssueToPersistanceLayer.*=.*async" "web/core/local-db/utils/utils.ts"

# Also search for any database error handling patterns in the file
rg -B 5 -A 10 "} catch \(" "web/core/local-db/utils/utils.ts"

Length of output: 2103


Script:

#!/bin/bash
# Search for updateIssue implementation
rg -A 20 "updateIssue.*=.*async" "web/core/local-db"

# Also look for any database initialization or setup code
rg -A 10 "initializeDB|setupDB|createDB" "web/core/local-db"

Length of output: 1721

"description_html",
]);
await updateIssue({ ...issuePartial, is_local_update: 1 });
addIssueToPersistanceLayer(issue);
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

Fix async operation handling in updatePersistentLayer.

The current implementation has potential issues:

  1. Using forEach with async operations doesn't wait for completion
  2. Missing error handling for addIssueToPersistanceLayer
  3. Silent failure when issue is not found

Here's the suggested fix:

 export const updatePersistentLayer = async (issueIds: string | string[]) => {
   if (typeof issueIds === "string") {
     issueIds = [issueIds];
   }
-  issueIds.forEach(async (issueId) => {
+  await Promise.all(issueIds.map(async (issueId) => {
     const dbIssue = await persistence.getIssue(issueId);
     const issue = rootStore.issue.issues.getIssueById(issueId);
 
-    if (issue) {
-      addIssueToPersistanceLayer(issue);
+    if (!issue) {
+      logError(`Issue ${issueId} not found in store`);
+      return;
     }
-  });
+    
+    const success = await addIssueToPersistanceLayer(issue);
+    if (!success) {
+      logError(`Failed to update issue ${issueId} in persistent layer`);
+    }
+  }));
 };

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +22 to +58
export const addIssueToPersistanceLayer = async (issue: TIssue) => {
try {
const issuePartial = pick({ ...JSON.parse(JSON.stringify(issue)) }, [
"id",
"name",
"state_id",
"sort_order",
"completed_at",
"estimate_point",
"priority",
"start_date",
"target_date",
"sequence_id",
"project_id",
"parent_id",
"created_at",
"updated_at",
"created_by",
"updated_by",
"is_draft",
"archived_at",
"state__group",
"cycle_id",
"link_count",
"attachment_count",
"sub_issues_count",
"assignee_ids",
"label_ids",
"module_ids",
"type_id",
"description_html",
]);
await updateIssue({ ...issuePartial, is_local_update: 1 });
} catch (e) {
logError("Error while adding issue to db");
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve error handling and code structure in addIssueToPersistanceLayer.

Several improvements can be made to enhance reliability and maintainability:

  1. The error message should include more details about the failure
  2. The JSON serialization/deserialization is unnecessary and could impact performance
  3. The list of picked fields should be extracted to a constant
  4. Consider adding return value for error handling

Here's the suggested implementation:

+const ISSUE_PERSISTENCE_FIELDS = [
+  "id", "name", "state_id", "sort_order", "completed_at", "estimate_point",
+  "priority", "start_date", "target_date", "sequence_id", "project_id",
+  "parent_id", "created_at", "updated_at", "created_by", "updated_by",
+  "is_draft", "archived_at", "state__group", "cycle_id", "link_count",
+  "attachment_count", "sub_issues_count", "assignee_ids", "label_ids",
+  "module_ids", "type_id", "description_html"
+] as const;

-export const addIssueToPersistanceLayer = async (issue: TIssue) => {
+export const addIssueToPersistanceLayer = async (issue: TIssue): Promise<boolean> => {
   try {
-    const issuePartial = pick({ ...JSON.parse(JSON.stringify(issue)) }, [
-      "id", "name", "state_id", /* ... other fields ... */
-    ]);
+    const issuePartial = pick(issue, ISSUE_PERSISTENCE_FIELDS);
     await updateIssue({ ...issuePartial, is_local_update: 1 });
+    return true;
   } catch (e) {
-    logError("Error while adding issue to db");
+    logError(`Failed to add issue ${issue.id} to db: ${e.message}`);
+    return false;
   }
 };
📝 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
export const addIssueToPersistanceLayer = async (issue: TIssue) => {
try {
const issuePartial = pick({ ...JSON.parse(JSON.stringify(issue)) }, [
"id",
"name",
"state_id",
"sort_order",
"completed_at",
"estimate_point",
"priority",
"start_date",
"target_date",
"sequence_id",
"project_id",
"parent_id",
"created_at",
"updated_at",
"created_by",
"updated_by",
"is_draft",
"archived_at",
"state__group",
"cycle_id",
"link_count",
"attachment_count",
"sub_issues_count",
"assignee_ids",
"label_ids",
"module_ids",
"type_id",
"description_html",
]);
await updateIssue({ ...issuePartial, is_local_update: 1 });
} catch (e) {
logError("Error while adding issue to db");
}
};
const ISSUE_PERSISTENCE_FIELDS = [
"id", "name", "state_id", "sort_order", "completed_at", "estimate_point",
"priority", "start_date", "target_date", "sequence_id", "project_id",
"parent_id", "created_at", "updated_at", "created_by", "updated_by",
"is_draft", "archived_at", "state__group", "cycle_id", "link_count",
"attachment_count", "sub_issues_count", "assignee_ids", "label_ids",
"module_ids", "type_id", "description_html"
] as const;
export const addIssueToPersistanceLayer = async (issue: TIssue): Promise<boolean> => {
try {
const issuePartial = pick(issue, ISSUE_PERSISTENCE_FIELDS);
await updateIssue({ ...issuePartial, is_local_update: 1 });
return true;
} catch (e) {
logError(`Failed to add issue ${issue.id} to db: ${e.message}`);
return false;
}
};

Comment on lines +99 to +102
// If issue accepted sync issue to local db
if (status === EInboxIssueStatus.ACCEPTED) {
addIssueToPersistanceLayer(inboxIssue.issue);
}
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

Enhance error handling for local DB synchronization.

The local DB sync operation is not wrapped in error handling, which could lead to silent failures. Consider:

  1. Wrapping the addIssueToPersistanceLayer call in a try-catch
  2. Adding a fallback mechanism if the sync fails
  3. Implementing a timeout for the sync operation

Here's a suggested improvement:

   // If issue accepted sync issue to local db
   if (status === EInboxIssueStatus.ACCEPTED) {
-    addIssueToPersistanceLayer(inboxIssue.issue);
+    try {
+      await Promise.race([
+        addIssueToPersistanceLayer(inboxIssue.issue),
+        new Promise((_, reject) => 
+          setTimeout(() => reject(new Error('DB sync timeout')), 5000)
+        )
+      ]);
+    } catch (error) {
+      console.error('Failed to sync issue to local DB:', error);
+      // Implement fallback mechanism here
+    }
   }
📝 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
// If issue accepted sync issue to local db
if (status === EInboxIssueStatus.ACCEPTED) {
addIssueToPersistanceLayer(inboxIssue.issue);
}
// If issue accepted sync issue to local db
if (status === EInboxIssueStatus.ACCEPTED) {
try {
await Promise.race([
addIssueToPersistanceLayer(inboxIssue.issue),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('DB sync timeout')), 5000)
)
]);
} catch (error) {
console.error('Failed to sync issue to local DB:', error);
// Implement fallback mechanism here
}
}

💡 Codebase verification

Based on the implementation found, I can now provide the final response:

DB error handling needs improvement

The current implementation of addIssueToPersistanceLayer has basic error handling but could be enhanced:

  • It catches errors but only logs them using logError("Error while adding issue to db")
  • No error propagation to the caller, making it impossible to handle DB failures at the inbox level
  • The error message is generic and doesn't include the actual error details

Suggested improvements:

  • Pass the actual error object to logError instead of just a string message
  • Consider propagating the error to allow proper handling in the inbox store
  • Add retry mechanism for transient DB failures
🔗 Analysis chain

Verify the local DB sync implementation.

Let's verify the implementation of addIssueToPersistanceLayer to ensure it properly handles DB initialization failures.


Let me gather more information about the error handling in the implementation.


Let me try one more search to find the complete implementation and error handling:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the implementation and error handling in addIssueToPersistanceLayer
echo "Searching for addIssueToPersistanceLayer implementation..."
rg -A 10 "export.*addIssueToPersistanceLayer"

# Search for DB initialization failure handling
echo "Searching for DB initialization handling..."
rg -l "db.*initialize.*catch|db.*init.*error"

Length of output: 1069


Script:

#!/bin/bash
# Get full implementation of addIssueToPersistanceLayer including error handling
rg -A 20 "export const addIssueToPersistanceLayer" web/core/local-db/utils/utils.ts

# Search for any DB-related error handling patterns
rg "catch.*db|db.*error" web/core/local-db/utils/utils.ts

# Look for where the DB is initialized
rg -A 10 "initializeDb|setupDb|createDb" web/core/local-db/

Length of output: 706


Script:

#!/bin/bash
# Search for the complete file content to see the full implementation
cat web/core/local-db/utils/utils.ts

# Also search for any error handling patterns in the file
rg "catch|throw|error" web/core/local-db/utils/utils.ts

# Look for DB initialization in index files
rg -A 10 "db" web/core/local-db/index.ts

Length of output: 5661

Comment on lines +353 to +356

// sync issue to local db
addIssueToPersistanceLayer(response);

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for persistence layer sync.

While the sync to persistence layer is correctly placed after the successful API response, it lacks error handling. Consider wrapping it in a try-catch block to prevent any persistence failures from affecting the UI.

        // sync issue to local db
-        addIssueToPersistanceLayer(response);
+        try {
+          await addIssueToPersistanceLayer(response);
+        } catch (error) {
+          // Log the error but don't throw to prevent UI disruption
+          console.error("Failed to sync issue to persistence layer:", error);
+        }
📝 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
// sync issue to local db
addIssueToPersistanceLayer(response);
// sync issue to local db
try {
await addIssueToPersistanceLayer(response);
} catch (error) {
// Log the error but don't throw to prevent UI disruption
console.error("Failed to sync issue to persistence layer:", error);
}

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: 0

🧹 Outside diff range and nitpick comments (1)
apiserver/plane/app/serializers/issue.py (1)

98-99: LGTM! Consider adding field documentation.

The addition of read-only project_id and workspace_id fields is well-implemented and enhances the serializer's context. Consider adding docstrings to document their purpose and usage.

Add documentation above the fields:

+    # Read-only fields to expose project and workspace IDs
     project_id = serializers.UUIDField(source="project.id", read_only=True)
     workspace_id = serializers.UUIDField(source="workspace.id", read_only=True)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3de955d and 84d6ba1.

📒 Files selected for processing (2)
  • apiserver/plane/app/serializers/issue.py (1 hunks)
  • web/core/local-db/worker/db.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/local-db/worker/db.ts

@pushya22 pushya22 merged commit acba451 into preview Nov 8, 2024
@pushya22 pushya22 deleted the handle-db-intialization-failure branch November 8, 2024 11:39
aaryan610 added a commit that referenced this pull request Apr 9, 2025
* chore: silo imports integrations (#1610)

* fix: silo service initial setup

* feat: moved controllers inside runner

* feat: created core definations for apps and context

* feat: added interfaces required for apps

* feat: moved shared definations

* feat: added logger as an injection for apps

* feat: changes to controllers

* feat: added vm based app execution inside manager

* feat: added dummy implementations for core constructs

* feat: moved controllers to routes

* feat: created worker moduler for processing message queue requests

* feat: added task manager defination

* feat: added context and manager separations

* feat: created defaults for the defination implementation

* feat: added async task management inside apps

* feat: removed unnecessary arguments in function calls

* feat: added context builder for app instances

* feat: added runtime type safety with zod

* feat: added packaged definition structure for silo apps

* feat: added package based configuration for engine and definitions

* feat: added custom eslint rule for throws decorator

* feat: added custom eslint rule for try catch

* feat: removed custom eslint config

* feat: added authentication controller inside engine

* feat: added auth in silo engine

* feat: migrated jira ui module to plane

* chore: removed jira app

* chore: moved engine components into src_engine directory

* feat: added base template inside new src directory

* feat: migrated worker interface with mq and redis store inside new src

* feat: created jira migrator and jira importer types

* chore: migrated worker's helper inside the base directory

* feat: added logic for booting up root worker

* feat: added jira and jira auth service inside jira app

* feat: added all transformers inside jira package

* feat: added authorization types for jira

* feat: added jira authentication oauth class

* feat: added jira transformer and pull mechanisms inside jira app

* feat: addded batching logic inside jira migrator

* feat: embedded silo sdk inside jira migrator

* feat: added plane migrator inside engine

* feat: added plane migrator for push inside migration controller

* feat: added controller methods for migration

* feat: added credentials and job routes in controller

* feat: added linear importer

* feat: added linear pull function as importer

* feat: added transformation for linear data

* feat: added pull mechanism for linear

* feat: attached linear data importer with migration controller

* fix: removed hardcoded jira from cycle and module migrator

* feat: fixed build errors

* chore: addeed example env

* feat: added authentication routes for jira

* feat: added linear route controller

* fix: restructuring

* fix: sdk configs setup

* fix: merge conflicts

* fix: sdk setup

* chore: added jira and linear importers and separate packages

* feat: moved transformation parts to linear package

* feat: decoupled jira logical parts with worker

* fix: linear silo app to use linear package

* fix: build errors and dependency resolution with packages in silo

* fix: module build errors in silo

* fix: linear authorization flow

* feat: added logic for segregated workers

* feat: attached task manager with the base starter

* feat: added migrations, query and schema into db directory

* feat: added linear importer and jira importer app structure

* feat: added silo core package

* chore: migrated worker and main engine controller inside apps

* fix: made linear integration working

* silo: added cors

* feat: added base64 state changes with jira

* chore: updated silo env

* fix: jira token cookie

* feat: added issue attachments in linear job

* feat: added credentials controller

* feat: added github package inside silo packages

* feat: added resource fetching in jira api service

* feat: added credentials locking

* feat: created resources endpoint for jira

* feat: added endpoints for getting jira data

* fix: credentials not working

* chore: exported jira types

* chore: added jira states

* fix: jira project pagination issue

* chore: initiated silo folder in web

* feat: added github routes and services in silo app

* feat: improvided auth service and added background worker for github

* feat: added task manager for github

* fix: build updates

* fix: updated plane sdk and updated jira importer

* chore: updated the importer layout

* chore: removed as any from table component

* chore: integrated importer dashboard

* fix: tsup fixes

* fix: removed unnecessary files

* fix: removing tsup for building silo packages

* fix: build related issues

* feat: modified project and issue sdk service to add more methods

* feat: added installation webhook hook handler

* feat: added issue comment handler

* feat: added issue events handler interface

* feat: added pull request interface handler

* feat: added github worker for handling bg tasks

* feat: attached manager into main controller

* fix: build issues

* fix: eslint fixes

* fix: silo build errors

* fix: silo app build errors types

* fix: reverting the cloud branch

* fix: updated package json in silo service

* fix: branch build cloud updated

* fix: build errors in apps while using sdk due to ts-alias paths

* fix: branch build cloud workflow fixes

* feat: added user mentions with github sync

* fix: docker compose setup updates

* fix: bot user comments with github

* feat: initialized github plane worker

* fix: docker compose build fixes

* fix: docker build fixes envs updated in example file

* feat: added plane github webhook worker

* chore: updates folder structure and handled job services

* chore: resolved build errors in silo chore

* fix: docker compose cloud added

* feat: added issue handler with labels

* fix: build process docker compose

* feat: added issue edit and comment edits in github sync

* chore: updated jira workflow

* feat: added plane webhook types

* feat: added plane webhook event handlers

* feat: added workspace connection schema

* chore: handled the job start and jira dashboard

* feat: added query for getting entity connection

* chore: updated constants, file naming convention

* chore: resolved merge conflicts

* feat: added worspace and entity connection tables

* feat: added workspace and entity connections for pr, comment as well

* fix: github import with usermapping

* feat: added plane issue synce to github

* chore: integrated linear and updated jobs query

* feat: added hostname changes

* conflict: updated jira config and added issue transformation count in dashboard

* conflict: updated job

* chore: updated Jira status

* chore: updated Jira status

* fix: batch processing

* fix: batch key release

* chore: updated workflow for building images

* fix: detached silo build

* chore: updates linear and resolved build errors

* fix: batch key missing

* fix: merge issues with Credential types

* fix: issues with github mereg

* fix: linear workflow

* chore: updated linear queries

* feat: updated plane bg tasks to send webhook on desc change

* feat: added plane transformations for github

* feat: added connection schema and comment handler inside github worker

* chore: modified dashboard labels

* fix: docker compose fixed for running silo services

* feat: added key based deduping for webhook events

* feat: added schema based tables

* feat: added redis based payload dispatch and dedup

* feat: added migrations and changed connection table schema

* feat: modified github etl for changed webhook process

* feat: implemented redis ttl based arch with github

* feat: implemented gitlab silo package

* feat: added github user authentication

* feat: modified linear dashboard and services

* feat: changed yarn lock

* feat: added user auth into comments as well

* feat: addded gitlab authentication service

* fix: state activity not being reconized by external apis

* feat: added gitlab package for apis and sdk

* feat: added gitlab merge request integration

* fix: code cleanup for gitlab

* feat: added title references to gitlab

* feat: added magic words in github integration

* chore: removed logging token response

* feat: added slack authentication flow

* feat: added user and team level authentication for slack

* feat: added services for slack integration

* feat: added blockkit components inside slack interaction

* feat: modified slack service for addded thread ephemeral messages

* feat: added handlers and views

* feat: asana importer.
* fix: build errors.

* feat: added thread sync to slack

* feat: added changes with merge

* chore: handle asana token refresh.

* fix: builder for giving warning

* chore: remove console logs.

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
Co-authored-by: gurusainath <gurusainath007@gmail.com>

* fix: feature flags implementation

* fix: build errorsg

* fix: build errors

* chore: add missing silo packages.

* fix: updating package version for build issues in docker

* Added PAT based authentication for Jira Integration and Private bucket attachment uploads (#1642)

* feat: added pat authentication for jira service

* feat: added jira oauth and pat authentication strategy

* feat: added PAT auth for linear sdk

* feat: blocked routes for jira oauth

* fix: added OAuth Enabled key for authentication route

* feat: added PAT routes for linear and jira

* feat: added default value to job status

* feat: added credentials PAT filter

* feat: added credential fetch condition for PAT token

* chore: basic PAT token UI.

* fix: pat token implementation for jira

* chore: Jira personal access token form.

* fix: controller jira projects

* chore: handle migration steps without resourceId

* fix: jira project logo

* fix: migrator and attachment

* chore: update issue attachment external apis

* fix: attachments private bucket changes for silo

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>

* chore: Asana importer UI. (#1630)

* chore: UI improvements for Jira importer personal access token authentication (#1648)

* feat: added pat authentication for jira service

* feat: added jira oauth and pat authentication strategy

* feat: added PAT auth for linear sdk

* feat: blocked routes for jira oauth

* fix: added OAuth Enabled key for authentication route

* feat: added PAT routes for linear and jira

* feat: added default value to job status

* feat: added credentials PAT filter

* feat: added credential fetch condition for PAT token

* chore: basic PAT token UI.

* fix: pat token implementation for jira

* chore: Jira personal access token form.

* fix: controller jira projects

* chore: handle migration steps without resourceId

* fix: jira project logo

* fix: migrator and attachment

* chore: update issue attachment external apis

* fix: attachments private bucket changes for silo

* chore: minor UI improvements

* chore: ui improvement

* chore: fix importer list

---------

Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>

* fix: github package dependency with silo (#1622)

* fix/deps

* fix: axios

* chore: fix formatting.

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* Runway silo store (#1672)

* chore: silo store init

* chore: infra update for maintenance mode (#5963)

* [WEB-2728] improvement: add `true-transparent` variant for textarea. (#5960)

* fix: renaming and formatting

* chore: app sidebar behaviour (#5964)

* chore: infra update for maintenance mode (#1667)

* [WEB-2728] improvement: new UI for custom property settings. (#1663)

* chore: importer store integration for jira and resolved build error

---------

Co-authored-by: pushya22 <130810100+pushya22@users.noreply.github.com>
Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com>

* Basic Jira issue type and custom properties migration (#1676)

* chore: issue type migration.

* chore: update issue types api for pagination

* chore: update jira migrator for issue types

* chore: issue type sdk types and service updates

* typo: issue service files name update

* typo: issue service files name update

* fix: issue type fetch and create request.

* fix: build

* fix: issue type migration

* chore: minor improvements

* chore: issue property fetch for jira

* chore: issue property fetch

* fix: type errors

* chore: temp fix for batches completion logic.

* chore: add issue type check

* chore: issue property basic migration.

* fix: updated base silo base url

* remove console log.

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
Co-authored-by: gurusainath <gurusainath007@gmail.com>

* chore: add silo base url and silo base path in dockerfile

* chore: update in runway silo

* chore: custom field attributes structure.

* chore: helper for test settings config.

* chore: add logo props

* chore: custom field migrations

* chore: all simple properties migrations.

* chore: issue property options

* chore: update could not fetch feature

* chore: feature flag service in packages silo core

* chore: feature flagging

* chore: issue property values.

* [WEB-2742] chore: issue link ui revamp (#5971)

* chore-issue-link-ui

* chore: issue link ui revamp

* chore: upload image in the intake form (#1677)

* fix: editor user config (#1679)

* fix: editor user config (#5974)

* fix: pi chat bug fixes (#1670)

* chore: pi empty state

* fix: response change handled

* fix: handled api failure

* fix: formatted ai messages

* fix: reverted the pi pallete

* fix: integrated  models api

* fix: disabled regenerating new chat

* fix: page loading fixed

* fix: dynamically imported markdown

* fix: removed extras

* fix: minor css

* fix: handled pi chat in bulk ops

* [WEB-2706] fix: Add fallback when db initialisation fails (#5973)

* Add fallback when db initialization fails

* add checks for instance.exec

* chore: convert issue boolean fields to actual boolean value.

* change instance exec code

* sync issue to local db when inbox issue is accepted and draft issue is moved to project

* chore: added project and workspace keys

---------

Co-authored-by: rahulramesha <rahulramesham@gmail.com>
Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>

* fix related to activity (#5972)

* fix: renamed inbox to intake (#5967)

* feat: intake

* chore: intake model migration changes

* dev: update dummy data

* dev: add duplicate apis for inbox

* dev: fix external apis

* fix: external apis

* chore: migration file changes

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>

* chore: removed the validation in patch request (#1680)

* chore: changed inbox to intake (#1682)

* chore: fix custom fields option fetch logic.

* fix: renamed inbox to intake (#5967)

* feat: intake

* chore: intake model migration changes

* dev: update dummy data

* dev: add duplicate apis for inbox

* dev: fix external apis

* fix: external apis

* chore: migration file changes

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>

* fix: intake loading (#5966)

* fix: intake loading

* fix: image upload in space

* chore: silo feature flag service

* fix: jira issue pull logic

* chore: map user picker custom property using display names.

* fix: silo github package dependencies.

* fix: silo github package

* chore: add lucide icons mappings

* fix: removed constants

* fix: package.json dependency fix for silo

* chore: update batching logic to handle trees

* chore: take job hostname from .env

* fix: build issues

* chore: fix migrations

* chore: asana custom field import

* chore: remove unused values

* chore: update oauth enabled envs

* chore: fix builds

* chore: asana batching logic.

* chore: asana PAT auth endpoint

* chore: delete credential endpoint

* fix: silo jira importer

* chore: fix silo refresh token callback

* chore: update linear batching logic

* dev: jira store migration

* chore: fetching jobs

* chore: updating job store

* chore: build error in store

* chore: job store updates

* chore: returning the jira resource details

* chore: add pat token validation

* chore: updated URL in the silo

* chore: issues count

* chore: fix merge conflicts

* dev: resolved merge conflict

* chore: removed logs

* feat: added comment import with linear

* chore: build fixes

* chore: add missing status class

* chore: updated Jira

* chore: loader in summary

* chore: Asana importer improved UI with mobx store

* fix: jobs api

* chore: make dashboard view true

* chore: updating the jira dashboard toggler

* chore: minor ui improvements.

* chore: fix job order logic.

* chore: Linear integration

* fix: slack linkback workflow

* chore: update service token logic

* chore: deactivate credentials

* dev: updated linear states mapping

* chore: asana priority mapping.

* chore: updated linear config

* fix:images not loading when issue is imported

* chore: asana comments

* chore: asana attachements

* chore: linear attachements pull

* chore: deactivating the importers

* chore: minor bug fix in priority mapping

* chore: handled feature flag, reload jobs and dashboard load

* chore: handled verfication check in start and re-run job

* chore: code cleanup

* feat: added controller routes for disconnecting and getting current status

* chore: update silo to be a single service

* fix: credentials

* chore: handled map states and map priority on worksapce and project change of importers

* chore: handled loaders in importers

* chore: updating linear team details

* chore: update assets

* chore: replaced migration

* fix: condition for credential availability

* chore: slack integration

* chore: handled modal confirmation and linear issue count in summary

* feat: modified cycles and modules services in order to create new entities

* feat: added base types and modified services

* feat: added command method inside slack integration

* feat: added new helper methods

* feat: added Slack Private Metadata types

* feat: added command and weblink modals

* feat: created types for custom input blocks

* feat: created issue linkback modal

* feat: created issue create modal full

* feat: created unfurl views for project, modules and cycles

* fix: modified project select modal for ensuring proper types for entities and payload

* feat: added command handler

* feat: modified block action to handle weblink and comment buttons

* feat: modified message event to handle link unfurls

* feat: modified view submission to handle weblink submission and commands

* feat: modified slack worker

* feat: added slack types

* feat: added update message method and new overflow type

* fix: refactored issue linkback to add overflow instead buttons

* fix: added await

* fix: deps bump

* feat: remove description from issue linkback

* fix: message as description and not title

* chore: webhook integration for slack

* chore: constructd base url for silo webhook

* chore: handlded same domain validation

* chore: handled exception

* Merge branch 'preview' into feat/slack

* fix: auth state

* chore: yarn.lock

* fix: import order

* feat: added changes for user profile integration settings

* feat: Github Configuration UI into integrations  (#1863)

* chore: github UI (#1721)

* chore: typos integrations and importers

* chore: github integration base

* fix: github integration context updates

* chore: resolved build errors

* chore: github store and services

* chore: updated instance serializer

* fix: issue migrator to handle linear image component

* chore: github integration

* chore: removed logs

* chore: updated UI

* chore: revamp ui github integration

* chore: removed logs

* implemented edit and remove entity connection in github

* chore: updated github dark and light logos

* fix: issue serializer fixes

* chore: updated config object in entity connection

* chore: updated the config type and handled the build error

* feat: fixed github label for allowing payload

* fix: slash commands

* chore: filter out the removed cycle from issue detail (#6138)

* feat: workflows (#1849)

* chore: state workflows

* fix: actor endpoints

* chore: add feature flaggging

* chore: single endpoint for managing actors

* chore: patch endpoint for workflow transition

* chore: add workflow manager on single endpoint

* chore: add external api validation for workflow transitions

* chore: correct comments

* chore: add workflow transition

* chore: update permission for guest users

* [MOBIL-518] feat: Mobile push notifications (#1848)

* chore: implemented mobile push notification

* chore: updated the notification job

* chore: handled the response

* chore: updated private key

* chore: issue push notification updates

* chore: resolved the boolean validation on mobile push notification

* chore: added push notification to the notification activity

* chore: updated push notification logic

* chore: removed mutation for push notification

* feat: added endpoint for getting the authenticated user

* feat: added user mapping when authenticated inside github

* fix: github import

* fix: merge yarn lock

* fix: remove target hostname check

* fix: interchange request from env host

* fix: target host

* feat: added base64 private key

---------

Co-authored-by: guru_sainath <gurusainath007@gmail.com>
Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
Co-authored-by: pushya22 <130810100+pushya22@users.noreply.github.com>
Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com>

* fix: installation webhook handler and webhook connection

* fix: profile import

* feat: added dynamic member account connection

* fix: credential controller

* fix: modified store to not check for external api token for members

* chore: updated auth imports in github integration

* fix: redis consumption mechanism

* fix: reduced dedup interval

* fix: updated redis consumer for a homogeneus key

* fix: modified logic for deduping

* feat: link creation over github pull request state change

* chore: gitlab store integration

* chore: updated gitlab components

* chore: Updated github_hostname key

* fix: key logic with redis

* fix: added github logo for links and modified pull request link content

* feat: added member sync when adding new member into plane

* feat: separated queues for integrations and importers

* fix: initail etl package setup

* fix: etl folder structuring

* fix: module resolutions and exported etl package

* feat: added body transformation for plane to github html description

* feat: added generic asset endpoint for getting the resource

* feat: added asset service

* fix: asset service url on redirect

* feat: added content parser for parsing html to markdown

* Improvised Import Speed from `42 minutes / 1000 Issues` to `30 seconds / 1000 Issues` 🚅 (#1948)

* feat: added issue batch queue to celery and simplified structure

* feat: added data import background task

* feat: added generic asset url

* feat: added handler for issue properties and assets

* feat: added comment images and also added issue properties import

* fix: cancel button alignment inside the job dashboards

* feat: added job acknowledgement inside celery

* feat: added separate amqp url for celery

* fix: sdk build errors

* fix: docker build errors

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>

* Silo - user imports alert flow UI and silo backend API changes (#1961)

* feat: added workspace member list endpoint

* feat: added endpoint for getting additional users inside asana, jira and linear

* feat: added additional users endpoint inside jira

* fix: changed payload for response

* feat: warn for additional users in importers

* jira server user import flow with warn complete

* labels data type fix for jira import

* add skip user import ui component + linear user import warn flow

* add asana import user warn flow

* add jira importer user import warn flow + api fixes

* feat: added optional user import

---------

Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>

* feat: added optional project_id inside generic asset endpoint

* feat: added attachment endpoint for github client

* feat: added function to handle github private images

* add user_id in github connection post request

* fix: proxy image construction

* fix: etl build using tsup

* fix: key setting and images

* feat: added images inside issue comments

* feat: added issue link and issue linkback for github and plane

* fix: build process of etl package

* feat: handled edge cases and tweaked UI a little bit

* fix github logo in dark mode

* fix: issues not getting synced when external source is different

* feat: added conditional rendering for gh

* fix: link item for pulls

* fix:naming

* fix: build fixes

* fix: build

* fix: build

* fix: build and lint errors

* fix: etl packaging

* fix: build errors

* fix: docker build errors

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
Co-authored-by: gurusainath <gurusainath007@gmail.com>
Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
Co-authored-by: pushya22 <130810100+pushya22@users.noreply.github.com>
Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com>
Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
Co-authored-by: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com>
Co-authored-by: Akshita Goyal <36129505+gakshita@users.noreply.github.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
Co-authored-by: rahulramesha <rahulramesham@gmail.com>
Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com>
Co-authored-by: Saurabhkmr98 <70131915+Saurabhkmr98@users.noreply.github.com>
Co-authored-by: Saurabhkmr98 <saurabhkapur73@gmail.com>
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.

5 participants