Skip to content

Conversation

ericallam
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Sep 25, 2025

⚠️ No Changeset found

Latest commit: b38b75d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

  • Modified getExecutionSnapshotsSince to fetch snapshots ordered by createdAt descending.
  • Added a take: 50 limit to retrieve only the 50 most recent snapshots.
  • After fetching, the array of snapshots is reversed before further processing.
  • The function then applies enhanceExecutionSnapshot to the reversed results.
  • No public or exported entity declarations were changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request lacks any description and does not adhere to the required template, missing critical sections such as the issue link, checklist items, testing instructions, changelog summary, and screenshots. Without this information, reviewers cannot verify the context, testing approach, or impact of the change. Please add a detailed PR description following the repository template by including the Closes # reference, completing the checklist, outlining your testing steps, summarizing the changelog, and attaching relevant screenshots to provide full context for reviewers.
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 (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the primary change by indicating that the engine’s snapshot retrieval is now limited, and it follows the conventional commit style with a clear scope and prefix. This directly reflects the update in the code where the number of snapshots returned is capped. Reviewers scanning the history will immediately understand the main change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ea-branch-89

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d10281e and b38b75d.

📒 Files selected for processing (1)
  • internal-packages/run-engine/src/engine/systems/executionSnapshotSystem.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • internal-packages/run-engine/src/engine/systems/executionSnapshotSystem.ts
⏰ 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). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: Analyze (javascript-typescript)

Comment on lines +219 to 224
orderBy: { createdAt: "desc" },
take: 50,
});

return snapshots.map(enhanceExecutionSnapshot);
return snapshots.reverse().map(enhanceExecutionSnapshot);
}
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 | 🔴 Critical

Fix pagination: current desc + reverse drops older snapshots.

With the new take: 50 cap, ordering desc and then reversing means we only ever return the latest 50 snapshots after sinceSnapshot. If more than 50 snapshots were created since then, the earlier ones (closest to sinceSnapshot) never get returned, so clients can’t page through the backlog without data loss. Please keep the query ascending so the first call yields the oldest 50 after the cursor.

-    orderBy: { createdAt: "desc" },
-    take: 50,
+    orderBy: { createdAt: "asc" },
+    take: 50,
   });
 
-  return snapshots.reverse().map(enhanceExecutionSnapshot);
+  return snapshots.map(enhanceExecutionSnapshot);
📝 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
orderBy: { createdAt: "desc" },
take: 50,
});
return snapshots.map(enhanceExecutionSnapshot);
return snapshots.reverse().map(enhanceExecutionSnapshot);
}
const snapshots = await prisma.executionSnapshot.findMany({
where: { /* ...existing filters...*/ },
orderBy: { createdAt: "asc" },
take: 50,
});
return snapshots.map(enhanceExecutionSnapshot);
}
🤖 Prompt for AI Agents
In internal-packages/run-engine/src/engine/systems/executionSnapshotSystem.ts
around lines 219 to 224, the code queries snapshots with orderBy: { createdAt:
"desc" } and then reverses the result, which with take: 50 returns the newest 50
snapshots and drops older ones; change the query to orderBy: { createdAt: "asc"
} and remove the .reverse() so the database returns the oldest 50 snapshots
after sinceSnapshot (allowing correct pagination), then continue to map the
results with enhanceExecutionSnapshot.

@matt-aitken matt-aitken merged commit 8863ff0 into main Sep 25, 2025
29 checks passed
@matt-aitken matt-aitken deleted the ea-branch-89 branch September 25, 2025 10:53
samejr pushed a commit that referenced this pull request Oct 4, 2025
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