test(handlers): org_scope + workspace_abilities coverage (#1312, clean extract) #2114
Reference in New Issue
Block a user
Delete Branch "test/org-scope-abilities-coverage-clean"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds unit coverage for two previously-untested handler areas, extracted CLEAN from the bundled #1985 (which mixed these tests with a 40-file tracker rename + 16 cancel-in-progress flips under a misleading title). This PR is the two test files only — no production code, no workflow changes.
org_scope_test.go(191 lines):orgRootID/sameOrg/errNoOrgRoot— cross-tenant org-root resolution (#1953). 10 cases incl. happy-path non-root, workspace-is-root, no-rows, DB-error, empty-root.workspace_abilities_test.go(200 lines):PatchAbilitieshandler — 11 status-code cases.Both reuse the existing
withMockDB/makeReq/wsUUID*harness fromtokens_sqlmock_test.go(verified present on main; no redefinition/collision). All referenced symbols (orgRootID, sameOrg, errNoOrgRoot, PatchAbilities) verified present on main.Testing
Test-only addition; the Handlers Postgres Integration + Platform(Go) CI is the gate. Tests are genuine (assertions match actual source behavior), not stubs.
SOP checklist
Comprehensive testing performed: two real test files; the CI Go/Handlers lanes execute them. Verified honest (not empty/doctored): assertions map to actual
org_scope.go/workspace_abilities.gobehavior; harness symbols exist on main.Local-postgres E2E run: Handlers Postgres Integration runs the handler tests against real Postgres — that's the gate.
Staging-smoke verified or pending: N/A — test-only, no runtime/provisioning path.
Root-cause not symptom: adds the missing coverage directly; no production change.
Five-Axis review walked: correctness (assertions verified vs source), readability (table-driven), architecture (test-only), security (none), performance (none).
No backwards-compat shim / dead code added: confirmed.
Memory/saved-feedback consulted: yes —
feedback_no_silent_checklist_trim/ unbundling: split the valuable tests out of the misleading bundled #1985 so they merge cleanly on their own.Extracted from #1985 (closed). Closes part of #1312.
🤖 Generated with Claude Code
QA approved (#2114). Two honest test files (org_scope + workspace_abilities) extracted clean from the bundled #1985; assertions verified vs source; reuse existing harness; no production code. Real coverage, not stubs.
CTO authority. Clean test-only extract.
Non-author SOP ack (devops-engineer, engineers): test-only, clean extract from #1985. /qa-recheck /security-recheck
Security approved (#2114). Test-only, no security surface.