4.5 KiB
Getting Valid Plan Handle IDs for Testing
Author: Matthew Raymer
Version: 1.0.0
Status: Testing Setup Guide
Overview
Plan handle IDs must match the format used by your TimeSafari database. The placeholder IDs (test_project_1, etc.) are not valid. This guide explains how to obtain real plan handle IDs for testing.
Methods to Get Valid Plan Handle IDs
Method 1: Create Projects in TimeSafari App
- Start TimeSafari app (development or test app)
- Create a project via the UI
- Get the plan handle ID:
- Open browser DevTools (F12)
- Check Network tab for API responses when creating/loading projects
- Look for the
handleIdfield in API responses - Or check localStorage/database for the plan record
Method 2: Query Your Local Database
If you have access to your local TimeSafari database:
-- SQLite example
SELECT handleId FROM plans LIMIT 5;
-- Or check what format handleIds use
SELECT handleId, name FROM plans WHERE name IS NOT NULL LIMIT 10;
Method 3: Use Starred Projects from Account Settings
- Open TimeSafari app
- Star some projects in the UI
- Check account settings:
// In browser console or app const settings = await $accountSettings(); console.log(settings.starredPlanHandleIds);
Method 4: Check API Responses
- Query your localhost API:
curl http://localhost:3000/api/v2/report/plans?planHandleIds=[] - Look for existing projects in the response
Method 5: Extract from Crowd-Master Database
If you're using crowd-master for testing:
cd /home/matthew/projects/timesafari/crowd-master
# Check your local database or API for actual plan handle IDs
Plan Handle ID Format
Plan handle IDs can have different formats depending on your TimeSafari backend:
- UUID format:
550e8400-e29b-41d4-a716-446655440000 - Hash format:
abc123def456789 - Sequential:
plan_001,plan_002 - Custom format: Whatever your backend generates
Important: Check your actual TimeSafari API/database to determine the correct format.
Updating Test Configuration
Once you have valid plan handle IDs:
Update Test Config
Edit test-apps/daily-notification-test/src/config/test-user-zero.ts:
starredProjects: {
planIds: [
"your-real-plan-id-1", // Replace with actual IDs
"your-real-plan-id-2",
"your-real-plan-id-3"
],
// ...
}
Update Seed Script Defaults
Edit scripts/seed-test-projects.js:
const DEFAULT_TEST_PROJECT_IDS = [
"your-real-plan-id-1", // Replace with actual IDs
"your-real-plan-id-2",
"your-real-plan-id-3"
];
Pass IDs via Command Line
You can also provide IDs when starting the test server:
# Start test server with your real plan IDs
node scripts/test-api-server-with-seed.js 3000 "id1,id2,id3"
# Or when seeding
node scripts/seed-test-projects.js seed http://localhost:3000 "id1,id2,id3"
Quick Setup Workflow
- Start your local TimeSafari API (if you have one)
- Create 3-5 test projects via the UI or API
- Note the plan handle IDs from the responses
- Update test-user-zero.ts with those IDs
- Restart test server with real IDs
Using Placeholder IDs (Limited)
The placeholder IDs (PLACEHOLDER_ID_1, etc.) will work for testing the structure and flow of the prefetch system, but:
- ❌ Won't match real projects in your database
- ❌ API responses will be empty or fail validation
- ❌ Can't test actual starred projects querying
For full testing, you must use real plan handle IDs.
Troubleshooting
"Invalid plan handle ID" errors
- Check the format matches your database
- Verify IDs exist in your TimeSafari database
- Check API logs for validation errors
Empty API responses
- Plan IDs don't exist in database
- IDs are in wrong format
- Database query is failing
Cannot find plan IDs
- Check Network tab in DevTools when creating projects
- Query database directly
- Check localStorage/IndexedDB for plan records
- Look at API response when loading projects list
Example: Finding IDs via Browser DevTools
- Open TimeSafari app in browser
- Open DevTools → Network tab
- Create a new project
- Look for POST/GET requests to
/api/v2/plansor similar - Check response JSON for
handleIdfield - Copy the
handleIdvalue
Example response might look like:
{
"handleId": "abc123def456789",
"name": "My Test Project",
...
}
Use that handleId in your test configuration.