test(handlers): add org_helpers pure function tests (#713)
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>