Compare commits

...

1 Commits

Author SHA1 Message Date
core-be 9ca6997a57 test(handlers): add validateWorkspaceID pure function coverage
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 3s
CI / Detect changes (pull_request) Successful in 4s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 13s
E2E API Smoke Test / detect-changes (pull_request) Successful in 4s
E2E Chat / detect-changes (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 4s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 2s
Harness Replays / detect-changes (pull_request) Successful in 3s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 3s
gate-check-v3 / gate-check (pull_request) Successful in 3s
qa-review / approved (pull_request) Failing after 3s
security-review / approved (pull_request) Failing after 3s
CI / Platform (Go) (pull_request) Successful in 4m23s
sop-tier-check / tier-check (pull_request) Successful in 5s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 52s
CI / Canvas (Next.js) (pull_request) Successful in 6m27s
CI / Python Lint & Test (pull_request) Successful in 6m29s
CI / all-required (pull_request) Successful in 5m53s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 42s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 2s
Harness Replays / Harness Replays (pull_request) Successful in 3s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2m17s
E2E Chat / E2E Chat (pull_request) Failing after 5m14s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
audit-force-merge / audit (pull_request) Successful in 11s
6 test cases for validateWorkspaceID (untested on main):
- valid v4 UUID
- valid v1 UUID
- empty string → error
- non-UUID string → error
- short UUID → error
- invalid hex char → error

Contributes to workspace_crud.go test coverage gap.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 03:50:43 +00:00
@@ -165,3 +165,43 @@ func TestValidateWorkspaceFields_YAMLCharsAllowedInEmptyName(t *testing.T) {
t.Errorf("empty name with valid role: expected nil, got %v", err)
}
}
// ─── validateWorkspaceID ───────────────────────────────────────────────────────
func TestValidateWorkspaceID_ValidUUIDv4(t *testing.T) {
if err := validateWorkspaceID("550e8400-e29b-41d4-a716-446655440000"); err != nil {
t.Errorf("valid v4 UUID: expected nil, got %v", err)
}
}
func TestValidateWorkspaceID_ValidUUIDv1(t *testing.T) {
// UUIDv1 format is also accepted by uuid.Parse.
if err := validateWorkspaceID("6ba7b810-9dad-11d1-80b4-00c04fd430c8"); err != nil {
t.Errorf("valid v1 UUID: expected nil, got %v", err)
}
}
func TestValidateWorkspaceID_EmptyString(t *testing.T) {
if err := validateWorkspaceID(""); err == nil {
t.Error("empty string: expected error, got nil")
}
}
func TestValidateWorkspaceID_NotAUuid(t *testing.T) {
if err := validateWorkspaceID("not-a-uuid"); err == nil {
t.Error("not-a-uuid: expected error, got nil")
}
}
func TestValidateWorkspaceID_WrongLength(t *testing.T) {
if err := validateWorkspaceID("550e8400-e29b-41d4-a716"); err == nil {
t.Error("short UUID: expected error, got nil")
}
}
func TestValidateWorkspaceID_InvalidCharacters(t *testing.T) {
// 'g' is not a valid hex character.
if err := validateWorkspaceID("550e8400-e29b-41d4-a716-44665544000g"); err == nil {
t.Error("invalid hex char: expected error, got nil")
}
}