Skip to content

fix: resolve alias target correctly in validate command#949

Merged
jackwener merged 1 commit intomainfrom
fix/validate-alias-resolution
Apr 11, 2026
Merged

fix: resolve alias target correctly in validate command#949
jackwener merged 1 commit intomainfrom
fix/validate-alias-resolution

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Fix validate site/alias silently checking 0 commands instead of resolving to the canonical command
  • Root cause: alias resolution logic was contradictory (!registry.has then registry.get on same key), and aliases registered as site/alias keys bypassed the block entirely
  • Simplify to always resolve via registry.get(target) which handles both canonical and alias keys

Context

Found by @codex-mini0 during release review. The bug was introduced in #943.

Test plan

  • opencli validate hupu/mention should now correctly resolve and validate the canonical command
  • opencli validate hupu/hot (canonical name) should continue to work
  • opencli validate hupu (site-level) should continue to work

The alias resolution logic checked `!registry.has(target)` before
calling `registry.get(target)`, which always returned undefined.
Moreover, aliases registered as `site/alias` keys meant `registry.has`
returned true, skipping the block entirely. The canonical name was
never resolved, so `validate site/alias` silently checked 0 commands.

Simplify to always resolve via `registry.get(target)` which handles
both canonical keys and alias keys correctly.
@jackwener jackwener merged commit 2469d12 into main Apr 11, 2026
11 checks passed
@jackwener jackwener deleted the fix/validate-alias-resolution branch April 11, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant