fix(test): use valid URI format for plan handle IDs

- Update plan handle ID format to match TimeSafari specification
  - Default format: https://endorser.ch/entity/{26-char-ULID}
  - ULID: 26 characters, Crockford base32 encoded
  - Validates RFC 3986 URI format

- Add ULID generation functions
  - generateULID() creates 26-character Crockford base32 strings
  - generateValidPlanHandleId() creates full URI format IDs
  - Auto-generates valid IDs for testing

- Update DEFAULT_TEST_PROJECT_IDS
  - Now generates valid URI format IDs automatically
  - Removes placeholder warnings (IDs are now valid format)

- Add URI validation to seed scripts
  - Validates plan IDs match RFC 3986 URI format
  - Error messages with format examples
  - Blocks seeding with invalid formats

- Update test-user-zero.ts config
  - Auto-generates valid URI format plan IDs
  - Clear documentation of required format
  - Note that real IDs from database should replace test IDs

- Update documentation
  - Document default URI format specification
  - Explain ULID structure and encoding
  - Show examples of valid formats

This ensures all test project IDs match the actual TimeSafari plan
handle ID format, preventing validation errors during prefetch testing.
This commit is contained in:
Matthew Raymer
2025-10-29 12:20:55 +00:00
parent 7a19a56ea2
commit 848387b532
4 changed files with 128 additions and 73 deletions

View File

@@ -62,14 +62,31 @@ cd /home/matthew/projects/timesafari/crowd-master
## Plan Handle ID Format
Plan handle IDs can have different formats depending on your TimeSafari backend:
Plan handle IDs **must be valid URIs** (RFC 3986 format).
- **UUID format**: `550e8400-e29b-41d4-a716-446655440000`
- **Hash format**: `abc123def456789`
- **Sequential**: `plan_001`, `plan_002`
- **Custom format**: Whatever your backend generates
### Default Format (System-Generated)
**Important**: Check your actual TimeSafari API/database to determine the correct format.
**`https://endorser.ch/entity/{ULID}`**
- **ULID**: 26-character string, Crockford base32 encoded
- **Example**: `https://endorser.ch/entity/01GQBE7Q0RQQAGJMEEW6RSGKTF`
### Custom Global URIs
Any valid URI with a scheme is accepted:
- `https://endorser.ch/entity/01GQBE7Q0RQQAGJMEEW6RSGKTF` (default)
- `http://example.com/project/123` (custom)
- `did:ethr:0x1234...` (DID format)
- Any URI matching: `^[A-Za-z][A-Za-z0-9+.-]+:`
**Validation**: The format must match RFC 3986 URI specification.
### ULID Format Details
- **Length**: Exactly 26 characters
- **Encoding**: Crockford base32 (0-9, A-Z excluding I, L, O, U)
- **Structure**: Timestamp + random component
- **Purpose**: Globally unique, lexicographically sortable identifiers
## Updating Test Configuration