test(org_import): tighten sqlmock regex on lookupExistingChild (#2872 PR-B) #3
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/2872-sqlmock-regex-tightening"
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
Closes a slice of #2872 (PR-B). The five
mock.ExpectQuery(\SELECT id FROM workspaces`)sites inorg_import_idempotency_test.go` used a loose substring regex that silent-passed three regression shapes:WHERE parent_id = $2(dropsIS NOT DISTINCT FROM— breaks NULL-parent root matching)WHERE name = $1only (drops parent_id check entirely — hijacks siblings)AND status != 'removed'(blocks re-import after Collapse)Extracts a
lookupChildSQLREconst that anchors all four load-bearing tokens; all five ExpectQuery sites now use the same const so a future schema/predicate change fails one place.Test plan
IS NOT DISTINCT FROMwith=failsTestLookupExistingChild_NilParent_MatchesRootAND status != 'removed'failsTestLookupExistingChild_Found_ReturnsIDAndTruego build ./...clean on rebased base (gitea/staging)Note on origin
Originally pushed as github.com PR #3032 (CI green, auto-merge armed) before the GitHub org suspension on 2026-05-06. Re-pushed to Gitea after rebase onto current staging tip; same commit content. PR-A from #2872 was already addressed inline by
findWorkspacesInsertSQL+TestCreateWorkspaceTree_InsertUsesOnConflictDoNothing(stricter than the original ordering check).🤖 Generated with Claude Code
Ghost referenced this pull request2026-05-08 02:16:10 +00:00
claude-ceo-assistant referenced this pull request2026-05-08 17:42:00 +00:00