Skip to content

feat: enhance demo data seeding with documents and interview schedules#106

Closed
JoachimLK wants to merge 1 commit into
mainfrom
feat/improve-demo-data
Closed

feat: enhance demo data seeding with documents and interview schedules#106
JoachimLK wants to merge 1 commit into
mainfrom
feat/improve-demo-data

Conversation

@JoachimLK
Copy link
Copy Markdown
Contributor

@JoachimLK JoachimLK commented Mar 12, 2026

Summary

  • What does this PR change?
  • Why is this needed?

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Chore

Validation

  • I tested locally
  • I added/updated relevant documentation
  • I verified multi-tenant scoping and auth behavior for affected API paths

DCO

  • All commits in this PR are signed off (Signed-off-by) via git commit -s

Summary by CodeRabbit

  • Documentation

    • Expanded learning resources by 21 articles, bringing total coverage to 153 resources
    • Introduced new resource cluster focused on ATS ecosystem and integration topics
    • Reorganized content timeline and distribution across learning phases
  • Chores

    • Enhanced internal test data infrastructure

@railway-app railway-app Bot temporarily deployed to applirank / reqcore-pr-106 March 12, 2026 19:12 Destroyed
@railway-app
Copy link
Copy Markdown

railway-app Bot commented Mar 12, 2026

🚅 Deployed to the reqcore-pr-106 environment in applirank

Service Status Web Updated (UTC)
applirank ❌ Build Failed (View Logs) Mar 12, 2026 at 7:17 pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

The pull request expands content scope from 132 to 153 articles, extends phase timelines across four phases, and reorganizes clusters including a new Cluster 10 for ATS Integrations. Seed script enhancements add document and interview seeding capabilities with utility functions and idempotent execution.

Changes

Cohort / File(s) Summary
Documentation & Configuration
TOPICAL-AUTHORITY-MAP.md
Restructures content map: increases total articles to 153, extends Phase 1–4 timelines (now Weeks 1–20 span), adds Cluster 10 (ATS Integrations & Ecosystem), redistributes articles across clusters (e.g., Cluster 2: 25→29), updates cross-cluster links and phase totals.
Seed Script Enhancement
server/scripts/seed.ts
Introduces utility functions daysFromNow() and atHour() for date manipulation. Adds seedDocumentsAndInterviews() to generate CV/resume documents and interview records. Implements idempotent seeding that checks for existing interviews before inserting; runs for both new and existing organizations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Twenty more chapters to weave and align,
Four phases now dance through weeks twenty-nine,
A tenth cluster blooms where integrations play,
While seeds now grow documents every day,
The map grows richer, the data takes flight! 🌱✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template structure with no actual content filled in; all required sections lack substantive information. Fill in the Summary section explaining what changed and why, select the appropriate Type of change checkbox, and check the relevant Validation items.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding documents and interview schedules to the demo data seeding functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/improve-demo-data
📝 Coding Plan
  • Generate coding plan for human review comments

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
Copy Markdown

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/scripts/seed.ts`:
- Around line 717-727: The current idempotency check only inspects
schema.interview via the existingInterview query, which can cause partial
seeding; instead wrap the helper in a single transaction (use db.transaction)
and perform table-specific existence checks against schema.document and
schema.interview (e.g., similar to the existingInterview/select/eq pattern)
inside that transaction, then insert only the missing documents or missing
interviews (do not short-circuit both based on one table), and commit or
rollback the transaction so the additive seed is atomic and each table is
backfilled independently.
- Around line 113-116: The atHour function creates Date objects using setHours
(local machine timezone), causing scheduledAt to be misinterpreted when rows are
marked timezone: 'Europe/Berlin'; fix by making atHour produce a timezone-aware
timestamp that matches the persisted timezone: either (A) convert to Berlin time
using a tz-aware library (e.g., date-fns-tz or dayjs with timezone) so
atHour(date, hour, minute) builds the Date in 'Europe/Berlin' before saving, or
(B) switch persistence to UTC by changing the timezone assignment (the code that
sets timezone: 'Europe/Berlin') to 'UTC' and update atHour to use UTC setters
(setUTCHours) so stored timestamps and the timezone flag agree; update all
places that call atHour and the timezone assignment to keep them consistent
(refer to the atHour function and the timezone: 'Europe/Berlin' assignment).

In `@TOPICAL-AUTHORITY-MAP.md`:
- Line 122: The progress counter in the Phase 1 header ("**Phase 1 total: 41
articles** | Progress: 6/41") is incorrect—update the Progress portion to match
the actual completed count shown in the checklist and summary table by changing
"Progress: 6/41" to "Progress: 9/41" (ensure the string "Progress: 6/41" is
replaced accordingly); also scan the Phase 1 checklist and the summary table to
confirm consistency so future edits won't diverge.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f8c40bd8-f0e2-485e-a254-c28b636d8485

📥 Commits

Reviewing files that changed from the base of the PR and between 5525cf6 and 5f76073.

📒 Files selected for processing (2)
  • TOPICAL-AUTHORITY-MAP.md
  • server/scripts/seed.ts

Comment thread server/scripts/seed.ts
Comment on lines +113 to +116
function atHour(date: Date, hour: number, minute = 0): Date {
const d = new Date(date)
d.setHours(hour, minute, 0, 0)
return d
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's check the file exists and get its size
wc -l server/scripts/seed.ts

Repository: reqcore-inc/reqcore

Length of output: 89


🏁 Script executed:

# Read the atHour function and surrounding context (lines 110-120)
sed -n '110,120p' server/scripts/seed.ts

Repository: reqcore-inc/reqcore

Length of output: 377


🏁 Script executed:

# Read the code around line 959 to see the timezone assignment
sed -n '955,965p' server/scripts/seed.ts

Repository: reqcore-inc/reqcore

Length of output: 467


🏁 Script executed:

# Search for all uses of atHour to understand how it's being called
rg "atHour" server/scripts/seed.ts -n -B 2 -A 2

Repository: reqcore-inc/reqcore

Length of output: 1801


🏁 Script executed:

# Search for timezone references in the file to understand the full context
rg "timezone" server/scripts/seed.ts -n -B 1 -A 1

Repository: reqcore-inc/reqcore

Length of output: 215


🏁 Script executed:

# Find daysAgo and daysFromNow function definitions
rg "function daysAgo|function daysFromNow|const daysAgo|const daysFromNow|export.*daysAgo|export.*daysFromNow" server/scripts/seed.ts -n -A 3

Repository: reqcore-inc/reqcore

Length of output: 299


🏁 Script executed:

# Check imports at the top of seed.ts to see where these utilities come from
head -30 server/scripts/seed.ts

Repository: reqcore-inc/reqcore

Length of output: 1116


🏁 Script executed:

# Search for timezone field usage across the codebase to understand how it's consumed
rg "timezone" --type ts --type tsx -n -B 1 -A 1 | head -100

Repository: reqcore-inc/reqcore

Length of output: 90


🏁 Script executed:

# Look for database schema or models related to interviews and timezone
rg "scheduledAt" --type ts --type tsx -n -B 2 -A 2 | head -80

Repository: reqcore-inc/reqcore

Length of output: 90


🏁 Script executed:

# Search for timezone field usage without tsx type filter
rg "timezone" -n -B 1 -A 1 | grep -E "(\.timezone|interview|scheduledAt)" | head -50

Repository: reqcore-inc/reqcore

Length of output: 4541


🏁 Script executed:

# Look at the database schema for interviews to understand the timezone field
rg "timezone" server/database/schema.ts -n -B 2 -A 2

Repository: reqcore-inc/reqcore

Length of output: 128


🏁 Script executed:

# Check if there are any timezone conversion utilities being used anywhere
rg "toZonedTime|formatInTimeZone|tzOffsetFrom|getTimezoneOffset" -n

Repository: reqcore-inc/reqcore

Length of output: 45


🏁 Script executed:

# Look at how interviews are queried and used in the frontend/API
fd -e ts -e js | xargs grep -l "scheduledAt" | grep -v node_modules | head -10

Repository: reqcore-inc/reqcore

Length of output: 430


🏁 Script executed:

# Check if timezone field is used in any interview display or transformation logic
rg "interview" server/database/schema.ts -n -A 5 | grep -A 5 "timezone"

Repository: reqcore-inc/reqcore

Length of output: 128


🏁 Script executed:

# Find the database schema file
fd "schema" --type f -e ts | grep -v node_modules | head -20

Repository: reqcore-inc/reqcore

Length of output: 45


🏁 Script executed:

# Look at the google-calendar utility to understand how timezone is used
sed -n '290,305p' server/utils/google-calendar.ts

Repository: reqcore-inc/reqcore

Length of output: 548


🏁 Script executed:

# Get more context around the Google Calendar timezone usage
sed -n '350,365p' server/utils/google-calendar.ts

Repository: reqcore-inc/reqcore

Length of output: 604


🏁 Script executed:

# Check how the scheduledAt timestamp is created/stored in the database
rg "scheduledAt" server/api/interviews/index.post.ts -n -B 3 -A 3

Repository: reqcore-inc/reqcore

Length of output: 803


🏁 Script executed:

# Check the send-invitation logic to see how the timezone is applied to the scheduledAt time
cat server/api/interviews/\[id\]/send-invitation.post.ts | head -200

Repository: reqcore-inc/reqcore

Length of output: 7345


🏁 Script executed:

# Check if there are any timezone conversion libraries imported or used
rg "date-fns|dayjs|moment|tz|timezone" server/scripts/seed.ts -n

Repository: reqcore-inc/reqcore

Length of output: 433


🏁 Script executed:

# Look at the database schema for the interview table to confirm how scheduledAt is stored
sed -n '1,50p' server/database/schema/app.ts | grep -A 20 "interview"

Repository: reqcore-inc/reqcore

Length of output: 932


🏁 Script executed:

# Check if there are timezone conversion utilities in the utils directory
fd -e ts -path "*/utils/*" | xargs grep -l "timezone\|toZonedTime\|formatInTimeZone" 2>/dev/null

Repository: reqcore-inc/reqcore

Length of output: 233


🏁 Script executed:

# Let's examine the exact flow: how the seed timestamp ends up being used
# Check the ICS generation to see if it's timezone-aware
rg "generateInterviewICS" server/utils/ical.ts -n -A 30 | head -50

Repository: reqcore-inc/reqcore

Length of output: 1397


🏁 Script executed:

# Check if scheduledAt in the database stores the raw Date or if there's any conversion
rg "scheduledAt" server/database/schema/app.ts -n -B 2 -A 2

Repository: reqcore-inc/reqcore

Length of output: 661


🏁 Script executed:

# Check if there are any timezone utilities in the codebase
find server/utils -name "*.ts" -type f | xargs ls -la

Repository: reqcore-inc/reqcore

Length of output: 2377


🏁 Script executed:

# Look at how formatDateTimeUTC works to understand UTC handling
rg "formatDateTimeUTC" server/utils/ical.ts -n -B 2 -A 5

Repository: reqcore-inc/reqcore

Length of output: 1811


🏁 Script executed:

# Check if there's any timezone conversion happening when data is written to DB
rg "scheduledAt" server/api/interviews/index.post.ts -n -B 5 -A 5

Repository: reqcore-inc/reqcore

Length of output: 1212


🏁 Script executed:

# Let's trace the complete flow: what happens when we insert a seeded interview
# Check what the actual stored value looks like by examining the schema
cat server/database/schema/app.ts | grep -A 30 "export const interview = pgTable"

Repository: reqcore-inc/reqcore

Length of output: 1915


🏁 Script executed:

# Check if date-fns or similar timezone libraries are used anywhere in the project
rg "date-fns|dayjs|moment" package.json

Repository: reqcore-inc/reqcore

Length of output: 45


Build scheduledAt in the same timezone you persist.

atHour() uses Date#setHours(), which applies the machine's local timezone. Every inserted row is tagged as timezone: 'Europe/Berlin'. If this seed runs on a UTC or US host, the wall-clock time stored in the scheduledAt field will drift when interpreted as Berlin time—by hours in the UI, Google Calendar sync, and email invitations. Either seed the timestamp in Berlin time (using a timezone library like date-fns), or store UTC and set timezone: 'UTC'.

Applies to lines 113–116 (atHour definition) and 959 (timezone assignment).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/scripts/seed.ts` around lines 113 - 116, The atHour function creates
Date objects using setHours (local machine timezone), causing scheduledAt to be
misinterpreted when rows are marked timezone: 'Europe/Berlin'; fix by making
atHour produce a timezone-aware timestamp that matches the persisted timezone:
either (A) convert to Berlin time using a tz-aware library (e.g., date-fns-tz or
dayjs with timezone) so atHour(date, hour, minute) builds the Date in
'Europe/Berlin' before saving, or (B) switch persistence to UTC by changing the
timezone assignment (the code that sets timezone: 'Europe/Berlin') to 'UTC' and
update atHour to use UTC setters (setUTCHours) so stored timestamps and the
timezone flag agree; update all places that call atHour and the timezone
assignment to keep them consistent (refer to the atHour function and the
timezone: 'Europe/Berlin' assignment).

Comment thread server/scripts/seed.ts
Comment on lines +717 to +727
// Idempotency: skip if interviews already exist for this org
const [existingInterview] = await db
.select({ id: schema.interview.id })
.from(schema.interview)
.where(eq(schema.interview.organizationId, orgId))
.limit(1)

if (existingInterview) {
console.log('ℹ️ Documents & interviews already seeded. Skipping.')
return
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make the additive seed atomic and table-specific.

This guard only checks interview rows, but the function inserts document rows first. If a run fails after creating some documents and before the first interview insert, rerunning will create a second set of resumes; the opposite case also blocks document backfill entirely once any interview exists. Please wrap this helper in a transaction and gate/backfill documents and interviews independently.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/scripts/seed.ts` around lines 717 - 727, The current idempotency check
only inspects schema.interview via the existingInterview query, which can cause
partial seeding; instead wrap the helper in a single transaction (use
db.transaction) and perform table-specific existence checks against
schema.document and schema.interview (e.g., similar to the
existingInterview/select/eq pattern) inside that transaction, then insert only
the missing documents or missing interviews (do not short-circuit both based on
one table), and commit or rollback the transaction so the additive seed is
atomic and each table is backfilled independently.

Comment thread TOPICAL-AUTHORITY-MAP.md
---

**Phase 1 total: 35 articles** | Progress: 6/35
**Phase 1 total: 41 articles** | Progress: 6/41
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the Phase 1 progress counter.

This line says 6/41, but the checked items in Phase 1 already add up to 9 completed articles, and the summary table below also totals 9 done. Leaving both numbers in the same document will cause churn the next time someone updates the roadmap.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@TOPICAL-AUTHORITY-MAP.md` at line 122, The progress counter in the Phase 1
header ("**Phase 1 total: 41 articles** | Progress: 6/41") is incorrect—update
the Progress portion to match the actual completed count shown in the checklist
and summary table by changing "Progress: 6/41" to "Progress: 9/41" (ensure the
string "Progress: 6/41" is replaced accordingly); also scan the Phase 1
checklist and the summary table to confirm consistency so future edits won't
diverge.

@JoachimLK JoachimLK closed this Mar 19, 2026
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.

1 participant