test(handlers): add org_helpers pure function tests (#713) #744
No reviewers
Labels
No Label
merge-queue
merge-queue
merge-queue
merge-queue-hold
release-blocker
release-test
security
test-label-sre
tier:high
tier:low
tier:medium
triage-test
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#744
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "test/713-org-helpers-pure-coverage"
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 isolated tests for the six pure helper functions in
org_helpers.gothat were entirely missing coverage:Test plan
go test -race ./...— Go not locally available, CI will verifynpm test && npm run buildpasses on canvas side🤖 Generated with Claude Code
Exercises the six pure helpers in org_helpers.go that were missing coverage: isSafeRoleName: - valid: alphanumeric, hyphen, underscore - invalid: empty, ".", "..", path sep, space, @, :, #, %, quotes, backslash, ~, backtick, brackets, +, =, ^, ?, |, >, *, &, ! hasUnresolvedVarRef: - no vars → false - vars resolved → false - vars left intact → true - empty expansion with orig vars → true expandWithEnv: - empty input / no vars / ${VAR} / $VAR / prefix+suffix / multi-var mergeCategoryRouting: - both empty → {} - defaults only → defaults preserved - ws overrides narrows/drops/adds categories - empty ws list → drops category - empty key → skipped renderCategoryRoutingYAML: - nil/empty → "" - keys sorted deterministically (alpha < middle < zebra) - special chars in key/value escaped by yaml.Marshal appendYAMLBlock: - nil existing → block unchanged - empty block → existing unchanged - existing ends without \n → \n inserted before block - existing ends with \n → no double newline mergePlugins: - empty inputs → [] - basic dedup merge (defaults first) - !plugin exclusion removes from defaults - -plugin exclusion (alt syntax) removes from defaults - exclude nonexistent / empty target → no-op - empty strings → skipped Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>[core-qa-agent] N/A — test-only. No production code changes.
[core-qa-agent] N/A — test-only. No production code changes.
[core-qa-agent] N/A — test-only. No production code changes.
[core-qa-agent] Five-Axis Review — APPROVED
Correctness
All pure-function helpers are thoroughly covered:
("${FOO}", "")) counts as "unresolved" — aligns with expected string-comparison semantics.${FOO}and bare$FOOexpansion tested; missing-var → empty is verified.[]removes the category entirely) is well-tested. Empty-key-skipped case is present.!and-prefix exclusion tested; deduplication and empty-string filtering verified.No correctness issues found.
Readability
Well-structured with ASCII-art section dividers. Consistent table-driven test pattern throughout. Test names are descriptive and precise.
Architecture
In-package (
package handlers) with zero external dependencies (only"testing"). Correct approach for testing unexported pure helpers without leaking them.Security
N/A — imports only
"testing", no I/O.Performance
N/A for unit tests.
Verdict: APPROVE — thorough coverage of all pure helpers, including all meaningful boundary and edge cases.