Skip to content

feat: add routing trace seeding to seed-insights#27782

Merged
hariombalhara merged 3 commits intomainfrom
devin/1770628338-seed-routing-traces
Feb 9, 2026
Merged

feat: add routing trace seeding to seed-insights#27782
hariombalhara merged 3 commits intomainfrom
devin/1770628338-seed-routing-traces

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented Feb 9, 2026

What does this PR do?

Adds RoutingTrace seed data to seed-insights.ts so that the routing trace dialog feature (assignment reason badge click → trace sheet) can be tested with realistic data.

New seedRoutingTraces() function called after seedBookingAssignments(). Finds bookings that already have both assignment reasons and routing form responses, then creates RoutingTrace records (up to 200) with realistic trace steps (route matched / attribute logic evaluated / fallback route used).

How should this be tested?

  1. Run yarn db-seed then yarn seed-insights — verify routing traces are created for bookings with assignment reasons
  2. Log in as teampro:teampro, navigate to Bookings → Upcoming, verify assignment reason badges appear and the routing trace sheet opens on badge click
  3. Run yarn seed-insights a second time — verify the log now reports 0 created, N skipped due to conflicts instead of misleadingly claiming all were created

Items for reviewer attention

  • Untyped array: traceData is declared as const traceData = [] without an explicit type annotation.
  • Catch-all error handling: The .catch() handler on routingTrace.create() catches all errors (not just unique constraint violations). For a seed script this is acceptable, but worth noting that non-constraint errors (e.g., connection issues) would be counted as "skipped due to conflicts."

Updates since last revision

  • Removed standalone seed-routing-trace.ts — all routing trace seeding now lives in seed-insights.ts only.
  • Addressed Cubic AI review feedback: added a skipped counter to track failed creates in the .catch() handler, and updated the console log to report actual success count vs skipped count for accurate feedback on re-runs.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A — seed scripts only.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works. N/A — seed scripts, no production code changed.

Link to Devin run: https://app.devin.ai/sessions/472032d4013b4c41998caef2a515eb91
Link to Devin run (review fixes): https://app.devin.ai/sessions/be21a5b14f6245ef815f9c300e2292b8
Requested by: @hariombalhara


Open with Devin

…script

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
@hariombalhara hariombalhara marked this pull request as ready for review February 9, 2026 13:00
@graphite-app graphite-app bot added enterprise area: enterprise, audit log, organisation, SAML, SSO core area: core, team members only labels Feb 9, 2026
@graphite-app graphite-app bot requested a review from a team February 9, 2026 13:00
@hariombalhara hariombalhara requested review from joeauyeung and removed request for a team February 9, 2026 13:00
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="scripts/seed-insights.ts">

<violation number="1" location="scripts/seed-insights.ts:861">
P3: The logged count is misleading - it reports `traceData.length` as the number of created routing traces, but silently caught errors (e.g., unique constraint violations on re-runs) are not tracked. Consider tracking skipped/failed creates and logging the actual success count vs skipped count for accurate feedback.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 9, 2026

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

@hariombalhara hariombalhara merged commit f66fffd into main Feb 9, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants