Skip to content

feat: Show created/updated metadata for saved searches and dashboards#2031

Merged
kodiakhq[bot] merged 5 commits intomainfrom
drew/db-ss-metadata
Apr 7, 2026
Merged

feat: Show created/updated metadata for saved searches and dashboards#2031
kodiakhq[bot] merged 5 commits intomainfrom
drew/db-ss-metadata

Conversation

@pulpdrew
Copy link
Copy Markdown
Contributor

@pulpdrew pulpdrew commented Apr 1, 2026

Summary

This PR adds createdAt/By and updatedAt/By metadata to dashboard and saved searches.

Screenshots or video

Screenshot 2026-04-01 at 3 19 07 PM Screenshot 2026-04-01 at 3 19 57 PM Screenshot 2026-04-01 at 3 19 46 PM Screenshot 2026-04-01 at 3 19 38 PM Screenshot 2026-04-01 at 3 20 59 PM

How to test locally or on Vercel

This should be tested locally. In the preview environment, these fields are not populated (since they're maintained through automatic MongoDB createdAt/updatedAt values and createdBy/updatedBy values pulled from User accounts.

References

  • Linear Issue: Closes HDX-3461
  • Related PRs:

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Apr 7, 2026 2:27pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

🦋 Changeset detected

Latest commit: 081f2d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

E2E Test Results

All tests passed • 129 passed • 3 skipped • 1041s

Status Count
✅ Passed 129
❌ Failed 0
⚠️ Flaky 2
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew pulpdrew force-pushed the drew/db-ss-metadata branch from 1e6e308 to 0366e9f Compare April 1, 2026 19:28
@pulpdrew pulpdrew marked this pull request as ready for review April 1, 2026 19:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

PR Review

  • ⚠️ getDashboard now spreads _dashboard?.toJSON() instead of _dashboard — this is actually a necessary fix for populated refs to serialize correctly, but it's a behavioral change that could affect downstream consumers if any code relied on the Mongoose document shape. Looks intentional and correct; just worth noting.

  • ℹ️ userId is optional in createSavedSearch/updateSavedSearch (and updateDashboard), so createdBy/updatedBy can be undefined if userId is absent. Given getNonNullUserWithTeam is used in the router, this should rarely happen in practice, but userId could theoretically be undefined per the type. Non-blocking but worth a comment if this is a known edge case.

  • ✅ No critical bugs or security issues found. Metadata fields are properly optional, populate calls are scoped to email name only (no over-fetching), tests cover both list and update scenarios, and the SavedSearchListApiResponse schema correctly extends the existing SavedSearchSchema.

@pulpdrew pulpdrew requested review from a team and knudtty and removed request for a team April 1, 2026 19:56
@pulpdrew pulpdrew force-pushed the drew/db-ss-metadata branch from 0366e9f to c9632da Compare April 3, 2026 13:07
@github-actions github-actions bot added the review/tier-4 Critical — deep review + domain expert sign-off label Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🟡 Tier 3 — Standard

Introduces new logic, modifies core functionality, or touches areas with non-trivial risk.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Additional context: touches API routes or data models

Review process: Full human review — logic, architecture, edge cases.
SLA: First-pass feedback within 1 business day.

Stats
  • Files changed: 21
  • Lines changed: 527
  • Branch: drew/db-ss-metadata
  • Author: pulpdrew

To override this classification, remove the review/tier-3 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions github-actions bot added review/tier-3 Standard — full human review required and removed review/tier-4 Critical — deep review + domain expert sign-off labels Apr 6, 2026
Comment thread packages/app/src/types.ts Outdated
Comment on lines +35 to +38
createdAt?: string;
updatedAt?: string;
createdBy?: { email: string; name?: string };
updatedBy?: { email: string; name?: string };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not add these to the zod schema for SavedSearch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question - it is because the types differ, and I think I'd have to override them in a few places even if I did add them to SavedSearchSchema.

  1. They shouldn't be included API request bodies - they're set by Mongo
  2. The dates are Date types in mongoose documents (ISavedSearch type) but strings in the API response (SavedSearchPopulated)
  3. The users as ObjectId / strings in Mongoose documents, but populated with { email: string; name?: string } from the user table when when requesting them from the API (SavedSearchPopulated)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As part of addressing tech debt I have been incrementally upgrading api routes to use enforce the API types on the backend, and sharing those types on the frontend. See AlertsApiResponseSchema in common-utils/src/types.ts as an example. This could be an opportunity to add it for saved searches! Else I'll approve as-is once merge conflicts are addressed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated for the saved search list endpoint. Extending the same to dashboards was proving to be a somewhat extensive set of changes, so I think we can save that for another PR.

@kodiakhq kodiakhq bot merged commit f8d2edd into main Apr 7, 2026
17 checks passed
@kodiakhq kodiakhq bot deleted the drew/db-ss-metadata branch April 7, 2026 14:31
knudtty pushed a commit that referenced this pull request Apr 16, 2026
…#2031)

## Summary

This PR adds createdAt/By and updatedAt/By metadata to dashboard and saved searches.

### Screenshots or video

<img width="1466" height="342" alt="Screenshot 2026-04-01 at 3 19 07 PM" src="https://github.com/user-attachments/assets/c349a3d5-f8e3-4155-9938-c8f005cdcd52" />
<img width="1216" height="433" alt="Screenshot 2026-04-01 at 3 19 57 PM" src="https://github.com/user-attachments/assets/9542a631-bdda-484c-9cef-6b780667d1dc" />
<img width="1196" height="345" alt="Screenshot 2026-04-01 at 3 19 46 PM" src="https://github.com/user-attachments/assets/c05cd0cc-2ca4-4397-8acb-e31a81b882ec" />
<img width="1409" height="433" alt="Screenshot 2026-04-01 at 3 19 38 PM" src="https://github.com/user-attachments/assets/593a96d7-86be-45b2-9f0a-b3a8f00d1353" />
<img width="1447" height="181" alt="Screenshot 2026-04-01 at 3 20 59 PM" src="https://github.com/user-attachments/assets/88742578-3dbd-4305-921f-e2ecdd11d5d4" />


### How to test locally or on Vercel

This should be tested locally. In the preview environment, these fields are not populated (since they're maintained through automatic MongoDB createdAt/updatedAt values and createdBy/updatedBy values pulled from User accounts.

### References



- Linear Issue: Closes HDX-3461
- Related PRs:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants