Skip to content

fix: broken dashboard tests#3078

Merged
chronark merged 20 commits intomainfrom
fix-tests
Apr 10, 2025
Merged

fix: broken dashboard tests#3078
chronark merged 20 commits intomainfrom
fix-tests

Conversation

@ogzhanolguncu
Copy link
Contributor

@ogzhanolguncu ogzhanolguncu commented Apr 7, 2025

What does this PR do?

Fixes # (issue)

If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Test A
  • Test B

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

  • Tests

    • Streamlined test assertions to enhance clarity and reliability.
    • Adjusted expected data outputs for time series granularity.
    • Removed an obsolete test case to prevent false failures.
  • Chores

    • Introduced a new type-checking script and updated TypeScript and Node definitions.
    • Updated CI configurations, including upgrading the Node version and expanding test coverage paths.
    • Minor syntax correction in error handling for organization selection.

@changeset-bot
Copy link

changeset-bot bot commented Apr 7, 2025

⚠️ No Changeset found

Latest commit: 4227b03

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

@vercel
Copy link

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 9, 2025 5:24pm
engineering ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 9, 2025 5:24pm
play ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 9, 2025 5:24pm
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 9, 2025 5:24pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 7, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request removes an obsolete test case for the unimplemented parseSavedFilters function and refactors test assertions to use await expect(...) for promise rejections in the getStructuredSearchFromLLM tests. It also updates expected granularity values in the getTimeseriesGranularity tests. Additionally, the PR adds a new typecheck script and upgrades dependency versions in the package.json, along with updates to GitHub Actions workflows for node version configuration and test matrix paths. No changes were made to public API declarations.

Changes

File(s) Change Summary
apps/dashboard/.../use-bookmarked-filters.test.ts Removed an obsolete test case for parseSavedFilters due to the function being unimplemented.
apps/dashboard/.../llm-search/utils.test.ts (logs & ratelimit) Refactored promise rejection assertions to use await expect(...) for the getStructuredSearchFromLLM tests; error handling remains unchanged.
apps/dashboard/.../granularity.test.ts Updated expected granularity values for various time ranges in the getTimeseriesGranularity tests.
apps/dashboard/package.json Added a new typecheck script and updated TypeScript (from 5.5.3 to ^5.7.3) and Node type definitions (from ^20.14.9 to ^22.14.0).
.github/workflows/autofix.ci.yaml Updated the node-version from 16 to 22 in the setup-node step.
.github/workflows/job_test_unit.yaml Added ./apps/dashboard to the test matrix paths and adjusted YAML formatting.

Suggested labels

Bug, 🕹️ oss.gg, :joystick: 150 points

Suggested reviewers

  • perkinsjr
  • mcstepp
  • chronark

🪧 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2025

Thank you for following the naming conventions for pull request titles! 🙏

@vercel vercel bot temporarily deployed to Preview – engineering April 7, 2025 11:51 Inactive
@vercel vercel bot temporarily deployed to Preview – www April 7, 2025 11:53 Inactive
@vercel vercel bot temporarily deployed to Preview – play April 7, 2025 11:53 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard April 7, 2025 11:54 Inactive
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: 2

🧹 Nitpick comments (2)
apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts (1)

33-33: Consider using a structured logging approach

While adding a log statement helps with debugging the OpenAI configuration issue, a simple console.log might not be ideal for production environments. Consider using a more structured logging approach with proper log levels.

-      console.log(openai);
+      console.debug("OpenAI configuration error:", { openai });
apps/dashboard/components/logs/hooks/use-bookmarked-filters.test.ts (1)

194-196: Consider skipping instead of removing the test

Rather than removing the test entirely, consider skipping it with the testing framework's skip functionality. This would maintain the test case for when parseSavedFilters is implemented in the future.

-  // Remove the failing test that uses parseSavedFilters since this function
-  // is not implemented in the current code
+  // TODO: Re-enable when parseSavedFilters is implemented
+  it.skip("should correctly parse saved filters", () => {
+    // Test implementation here
+  });

Is there a plan to implement the parseSavedFilters function in the future? If not, removing the test is appropriate.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 042a00e and 2b5110d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • .github/workflows/job_test_dashboard.yaml (1 hunks)
  • .github/workflows/pr.yaml (1 hunks)
  • apps/dashboard/components/logs/hooks/use-bookmarked-filters.test.ts (1 hunks)
  • apps/dashboard/lib/trpc/routers/logs/llm-search/utils.test.ts (1 hunks)
  • apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.test.ts (1 hunks)
  • apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts (1 hunks)
  • apps/dashboard/lib/trpc/routers/utils/granularity.test.ts (4 hunks)
  • apps/dashboard/package.json (3 hunks)
🧰 Additional context used
🧬 Code Definitions (3)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.test.ts (2)
apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts (1)
  • getStructuredSearchFromLLM (26-98)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.ts (1)
  • getStructuredSearchFromLLM (7-78)
apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.test.ts (2)
apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.ts (1)
  • getStructuredSearchFromLLM (26-98)
apps/dashboard/lib/trpc/routers/logs/llm-search/utils.ts (1)
  • getStructuredSearchFromLLM (7-78)
apps/dashboard/lib/trpc/routers/utils/granularity.test.ts (1)
apps/dashboard/lib/trpc/routers/utils/constants.ts (2)
  • HOUR_IN_MS (1-1)
  • DAY_IN_MS (2-2)
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: Test Go API Local / Test (Shard 6/8)
  • GitHub Check: Test Go API Local / Test (Shard 5/8)
  • GitHub Check: Test Packages / Test ./internal/clickhouse
  • GitHub Check: Test Go API Local / Test (Shard 8/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Test Go API Local / Test (Shard 4/8)
  • GitHub Check: Test Go API Local / Test (Shard 7/8)
  • GitHub Check: Test Packages / Test ./internal/keys
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test Packages / Test ./internal/resend
  • GitHub Check: Test Packages / Test ./internal/hash
  • GitHub Check: Test Agent Local / test_agent_local
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Build / Build
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
.github/workflows/pr.yaml (1)

26-28: LGTM! Good addition of dashboard tests to PR workflow

Adding dashboard tests to the PR workflow is a great improvement that aligns with the PR objective of fixing broken dashboard tests.

.github/workflows/job_test_dashboard.yaml (1)

1-16: LGTM! Well-structured workflow for dashboard tests

The workflow is properly structured with all necessary steps to run dashboard tests. It uses the existing install action and specifically targets the dashboard directory.

apps/dashboard/lib/trpc/routers/logs/llm-search/utils.test.ts (1)

31-38: Improved promise rejection test pattern.

Refactoring to use await expect(...).rejects.toThrowError() pattern instead of directly awaiting the promise makes the test more readable and follows modern testing best practices for asserting promise rejections.

apps/dashboard/lib/trpc/routers/ratelimit/llm-search/utils.test.ts (1)

47-54: Improved promise rejection test pattern.

Refactoring to use await expect(...).rejects.toThrowError() pattern instead of directly awaiting the promise improves readability and follows modern testing best practices for asserting promise rejections.

apps/dashboard/package.json (2)

10-11: Good addition of typecheck script.

Adding a dedicated typecheck script allows developers to verify type correctness separately from building or running tests, which is a TypeScript best practice.


105-105:

Details

✅ Verification successful

Verify TypeScript version compatibility.

The TypeScript version has been updated to a newer version (^5.7.3). Make sure this version is compatible with your codebase and other dependencies.


🏁 Script executed:

#!/bin/bash
# Check TypeScript compatibility with other dependencies
cd apps/dashboard
echo "Checking TypeScript version compatibility..."
npx typesync
pnpm dlx npm-check-updates --target=minor -u typescript

Length of output: 5129


TypeScript Compatibility Verified – New Version Adopted

  • The compatibility check upgraded TypeScript from ^5.1.3 to ^5.8.3 (see shell output from pnpm dlx npm-check-updates).
  • Running npx typesync added one new typing (@types/jsdom), which appears correct.
  • Please confirm that the new version (^5.8.3) works seamlessly with your codebase and that all dependent modules remain compatible.
apps/dashboard/lib/trpc/routers/utils/granularity.test.ts (1)

166-166:

Details

❓ Verification inconclusive

Increased time series granularity for longer time ranges.

The verification context time ranges (7-30 days) now use more fine-grained intervals. This will provide more detailed data points for visualization but might increase data processing overhead. Ensure the implementation has been updated and performance is acceptable.

Also applies to: 171-171, 203-203


🏁 Script executed:

#!/bin/bash
# Look for performance considerations or optimizations in time series data handling
echo "Checking for time series performance optimizations..."
rg -i "(optimize|performance|cache)" --glob "*.ts" --max-depth 5 apps/dashboard/lib/trpc/routers/utils/

Length of output: 222


Performance Impact Verification Required for Increased Granularity

The updated time series granularity for longer time ranges (7–30 days) now uses per-hour intervals (e.g. expectedGranularity: "perHour"), which should provide more detailed data points for visualization. However, this increased granularity may also lead to additional data processing overhead. Our automated search in the relevant directory did not reveal any explicit performance optimizations or caching mechanisms, so please perform a manual performance verification to confirm that the implementation remains efficient.

Please review:

  • apps/dashboard/lib/trpc/routers/utils/granularity.test.ts at lines 166, 171, and 203

@vercel vercel bot temporarily deployed to Preview – play April 8, 2025 08:53 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering April 8, 2025 08:54 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard April 8, 2025 08:56 Inactive
@vercel vercel bot temporarily deployed to Preview – www April 8, 2025 08:56 Inactive
Add proper minimum node version and fix fmt warning
@vercel vercel bot temporarily deployed to Preview – play April 8, 2025 09:13 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering April 8, 2025 09:16 Inactive
@vercel vercel bot temporarily deployed to Preview – play April 8, 2025 09:17 Inactive
@vercel vercel bot temporarily deployed to Preview – www April 8, 2025 09:17 Inactive
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

🧹 Nitpick comments (1)
.github/workflows/autofix.ci.yaml (1)

15-16: Node Version Update
The Node.js version has been updated to 22 under the actions/setup-node@v4 step. This upgrade should improve compatibility with newer packages and features, which might help resolve the broken dashboard tests. Please double-check that all subsequent steps and any dependencies in your CI workflow function correctly with Node 22.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2b5110d and 911b039.

📒 Files selected for processing (2)
  • .github/workflows/autofix.ci.yaml (1 hunks)
  • apps/dashboard/components/logs/hooks/use-bookmarked-filters.test.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/dashboard/components/logs/hooks/use-bookmarked-filters.test.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test Agent Local / test_agent_local
  • GitHub Check: Test API / API Test Local
🔇 Additional comments (1)
.github/workflows/autofix.ci.yaml (1)

27-37: Formatting Improvement in lint_docs Job
The removal of the extra blank line at the end of the lint_docs job enhances the consistency and readability of the YAML file. This is a minor formatting improvement that contributes to the overall maintainability of the CI configuration.

@vercel vercel bot temporarily deployed to Preview – dashboard April 8, 2025 09:19 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering April 9, 2025 12:47 Inactive
@vercel vercel bot temporarily deployed to Preview – www April 9, 2025 12:47 Inactive
@vercel vercel bot temporarily deployed to Preview – play April 9, 2025 12:47 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard April 9, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – play April 9, 2025 12:58 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering April 9, 2025 12:58 Inactive
@vercel vercel bot temporarily deployed to Preview – www April 9, 2025 12:59 Inactive
@ogzhanolguncu ogzhanolguncu requested a review from chronark April 9, 2025 13:05
@vercel vercel bot temporarily deployed to Preview – engineering April 9, 2025 17:21 Inactive
@vercel vercel bot temporarily deployed to Preview – www April 9, 2025 17:22 Inactive
@vercel vercel bot temporarily deployed to Preview – play April 9, 2025 17:22 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard April 9, 2025 17:24 Inactive
ts: true

- name: Build
if: ${{ matrix.path != './apps/dashboard' }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why? it's a good idea to test the build

Copy link
Contributor Author

gotcha dashboard requires some env for building its okay to do it there right I mean in job_test_unit ? Some dummy envs should do the trick

Copy link
Collaborator

chronark commented Apr 9, 2025

oh I see

Copy link
Collaborator

chronark commented Apr 9, 2025

ok fuck it, keep it as you have it

Copy link
Contributor Author

yeah that was the another reason for skipping build 😄

@chronark chronark merged commit f4619f3 into main Apr 10, 2025
32 of 37 checks passed
@chronark chronark deleted the fix-tests branch April 10, 2025 06:44
@coderabbitai coderabbitai bot mentioned this pull request Nov 6, 2025
18 tasks
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.

2 participants