Skip to content

fix: revert app computation cache#40536

Closed
dvj1988 wants to merge 3 commits intoreleasefrom
chore/revert-app-computation-cache
Closed

fix: revert app computation cache#40536
dvj1988 wants to merge 3 commits intoreleasefrom
chore/revert-app-computation-cache

Conversation

@dvj1988
Copy link

@dvj1988 dvj1988 commented May 1, 2025

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14788719117
Commit: 66914c5
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js
List of identified flaky tests.
Fri, 02 May 2025 05:49:14 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Removed client-side caching logic for computation results and dependency maps, simplifying evaluation processes.
    • Updated several interfaces and method signatures to eliminate cache-related parameters and metadata.
  • Tests
    • Updated and removed tests related to caching functionality to reflect the elimination of the cache system.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 1, 2025

Walkthrough

This change removes the entire application computation caching mechanism from the evaluation flow. All references to cacheProps and related types, arguments, and logic are eliminated from sagas, worker handlers, and utility modules. The caching logic for dependency maps and all keys is deleted, resulting in direct computation each time without cache lookups or storage. Associated test files for the cache and related metadata are also deleted or updated to reflect the absence of cache parameters. Function and method signatures are updated to remove cache-related arguments, and all error handling or branches related to caching are stripped out.

Changes

File(s) Change Summary
app/client/src/sagas/EvaluationsSaga.test.ts, app/client/src/sagas/EvaluationsSaga.ts Removed cacheProps from evaluation saga logic and tests; updated calls and expected arguments.
app/client/src/workers/Evaluation/handlers/evalTree.ts, app/client/src/workers/Evaluation/types.ts Removed cacheProps from function parameters and types; updated EvalTreeRequestData interface.
app/client/src/workers/Evaluation/__tests__/evaluation.test.ts, app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts Updated tests to remove metadata argument from setupFirstTree calls; removed unused imports.
app/client/src/workers/common/AppComputationCache/AppComputationCache.test.ts Deleted all tests for the computation cache module.
app/client/src/workers/common/AppComputationCache/index.ts, app/client/src/workers/common/AppComputationCache/types.ts Deleted the entire computation cache implementation and related types.
app/client/src/workers/common/DataTreeEvaluator/dataTreeEvaluator.test.ts, app/client/src/workers/common/DataTreeEvaluator/index.ts Removed all cache logic and parameters from data tree evaluator and related tests.
app/client/src/workers/common/DependencyMap/index.ts Removed dependency map caching logic; always recomputes dependencies; updated function signature.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant Saga
    participant Worker
    participant Evaluator

    UI->>Saga: Trigger evaluation
    Saga->>Worker: Send evaluation request (no cacheProps)
    Worker->>Evaluator: setupFirstTree(unEvalTree, configTree)
    Evaluator->>Evaluator: Compute allKeys and dependency map directly
    Evaluator-->>Worker: Return evaluation result
    Worker-->>Saga: Send evaluation result
    Saga-->>UI: Update UI with result
Loading

Possibly related PRs

  • appsmithorg/appsmith#40301: Removes all usage of the cacheProps object and related caching logic, which directly reverses or removes the caching features that this PR previously enhanced.

Suggested labels

Core Query Execution, Task, CI, skip-changelog

Suggested reviewers

  • rajatagrawal
  • ApekshaBhosale

Poem

No more cache to slow us down,
Fresh trees grow each time around.
Dependency maps, computed anew,
No props to track, just code that's true.
Out with the old, in with the lean—
Evaluation flows, crisp and clean!
🚀


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92ad304 and 66914c5.

📒 Files selected for processing (12)
  • app/client/src/sagas/EvaluationsSaga.test.ts (0 hunks)
  • app/client/src/sagas/EvaluationsSaga.ts (0 hunks)
  • app/client/src/workers/Evaluation/__tests__/evaluation.test.ts (1 hunks)
  • app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts (1 hunks)
  • app/client/src/workers/Evaluation/handlers/evalTree.ts (0 hunks)
  • app/client/src/workers/Evaluation/types.ts (0 hunks)
  • app/client/src/workers/common/AppComputationCache/AppComputationCache.test.ts (0 hunks)
  • app/client/src/workers/common/AppComputationCache/index.ts (0 hunks)
  • app/client/src/workers/common/AppComputationCache/types.ts (0 hunks)
  • app/client/src/workers/common/DataTreeEvaluator/dataTreeEvaluator.test.ts (0 hunks)
  • app/client/src/workers/common/DataTreeEvaluator/index.ts (1 hunks)
  • app/client/src/workers/common/DependencyMap/index.ts (2 hunks)
💤 Files with no reviewable changes (8)
  • app/client/src/workers/Evaluation/types.ts
  • app/client/src/workers/Evaluation/handlers/evalTree.ts
  • app/client/src/sagas/EvaluationsSaga.test.ts
  • app/client/src/workers/common/DataTreeEvaluator/dataTreeEvaluator.test.ts
  • app/client/src/workers/common/AppComputationCache/types.ts
  • app/client/src/workers/common/AppComputationCache/AppComputationCache.test.ts
  • app/client/src/sagas/EvaluationsSaga.ts
  • app/client/src/workers/common/AppComputationCache/index.ts
⏰ Context from checks skipped due to timeout of 90000ms (25)
  • GitHub Check: perform-test / ci-test / ci-test (59)
  • GitHub Check: perform-test / ci-test / ci-test (58)
  • GitHub Check: perform-test / ci-test / ci-test (57)
  • GitHub Check: perform-test / ci-test / ci-test (56)
  • GitHub Check: perform-test / ci-test / ci-test (53)
  • GitHub Check: perform-test / ci-test / ci-test (52)
  • GitHub Check: perform-test / ci-test / ci-test (51)
  • GitHub Check: perform-test / ci-test / ci-test (49)
  • GitHub Check: perform-test / ci-test / ci-test (47)
  • GitHub Check: perform-test / ci-test / ci-test (45)
  • GitHub Check: perform-test / ci-test / ci-test (44)
  • GitHub Check: perform-test / ci-test / ci-test (43)
  • GitHub Check: perform-test / ci-test / ci-test (41)
  • GitHub Check: perform-test / ci-test / ci-test (40)
  • GitHub Check: perform-test / ci-test / ci-test (38)
  • GitHub Check: perform-test / ci-test / ci-test (37)
  • GitHub Check: perform-test / ci-test / ci-test (33)
  • GitHub Check: perform-test / ci-test / ci-test (31)
  • GitHub Check: perform-test / ci-test / ci-test (23)
  • GitHub Check: perform-test / ci-test / ci-test (22)
  • GitHub Check: perform-test / ci-test / ci-test (15)
  • GitHub Check: perform-test / ci-test / ci-test (13)
  • GitHub Check: perform-test / ci-test / ci-test (5)
  • GitHub Check: perform-test / ci-test / ci-test (4)
  • GitHub Check: perform-test / ci-test / ci-test (2)
🔇 Additional comments (4)
app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts (1)

192-192: Cache metadata parameter removed from setupFirstTree call.

The fourth parameter containing metadata properties (appId, pageId, timestamp, appMode, etc.) has been removed from this call, aligning with the broader codebase changes that eliminate caching from the evaluation process.

app/client/src/workers/Evaluation/__tests__/evaluation.test.ts (1)

580-580: Cache metadata parameter removed from test setup.

The fourth parameter containing cache-related metadata has been removed from the setupFirstTree call, consistent with the application-wide removal of computation caching.

app/client/src/workers/common/DataTreeEvaluator/index.ts (1)

299-299: Direct computation replaces cache lookup for allKeys.

Now directly computing allKeys instead of attempting to fetch from cache, which aligns with the removal of the app computation caching mechanism. This change simplifies the code path but may impact performance for large trees.

Consider monitoring performance impact of this change, especially for applications with large data trees where recomputation may be expensive.

app/client/src/workers/common/DependencyMap/index.ts (1)

56-78:

Details

✅ Verification successful

Removed caching in dependency map creation.

The code now directly computes dependencies by iterating through all entities instead of attempting to retrieve them from cache. This change is consistent with the overall approach of removing the caching layer.

You might want to add performance monitoring or tracing for this code path, as dependency map computation could be expensive for complex applications with many interdependent entities.


🏁 Script executed:

#!/bin/bash
# Script to determine the complexity of entity dependencies in your app
echo "Analyzing dependency map complexity..."
find . -type f -name "*.ts" -o -name "*.tsx" | xargs grep -l "createDependencyMap" | wc -l

Length of output: 179


#!/bin/bash
# List all occurrences of createDependencyMap for context
grep -R -n "createDependencyMap" .
``}```

---



</details>

**Add performance tracing around dependency map creation**

The removal of caching means full entity traversal on each run—this can be costly in large apps. Instrument the `createDependencyMap` path in `app/client/src/workers/common/DependencyMap/index.ts` to capture and emit timing metrics:

• At the very start of `createDependencyMap`, record a timestamp (e.g. `performance.now()`).  
• After `DependencyMapUtils.makeParentsDependOnChildren(dependencyMap)`, calculate elapsed time.  
• Use your existing telemetry/metrics service (e.g. `TelemetryService.log`) to emit a `"DependencyMapCreationTime"` event.

Example diff:  
```diff
@@ -1,5 +1,9 @@
 export function createDependencyMap(
   unEvalTree: DataTree,
   configTree: ConfigTree,
   allKeys: Set<string>,
 ) {
+  const start = performance.now();
   const dependencyMap = new DependencyMap();
   const dataTreeEvalRef = { errors: [] as EvalError[] };

   Object.keys(configTree).forEach((entityName) => {
@@ -56,7 +60,11 @@
       for (const path of Object.keys(entityDependencies)) {
         const pathDependencies = entityDependencies[path];
         const { errors, references } = extractInfoFromBindings(
           pathDependencies,
           allKeys,
         );

         dependencyMap.addDependency(path, references);
         dataTreeEvalRef.errors.push(...errors);
       }
     });

     DependencyMapUtils.makeParentsDependOnChildren(dependencyMap);
+  const duration = performance.now() - start;
+  TelemetryService.log("DependencyMapCreationTime", { duration });
+  console.debug(`Dependency map computed in ${duration.toFixed(2)}ms`);
   return { dependencyMap, errors: dataTreeEvalRef.errors };
 }

This will help surface performance regressions as your application scales.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

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

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.

@github-actions github-actions bot added the Bug Something isn't working label May 1, 2025
@dvj1988 dvj1988 added the ok-to-test Required label for CI label May 2, 2025
@dvj1988 dvj1988 requested a review from vsvamsi1 May 2, 2025 05:15
@dvj1988 dvj1988 marked this pull request as ready for review May 2, 2025 05:15
@dvj1988 dvj1988 requested a review from ApekshaBhosale as a code owner May 2, 2025 05:15
@dvj1988 dvj1988 closed this May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working ok-to-test Required label for CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant