Skip to content

fix(states): resolve state names strictly instead of fuzzily - #25

Open
nogara wants to merge 1 commit into
cpatrickalves:mainfrom
nogara:fix/states-strict-resolution
Open

nogara wants to merge 1 commit into
cpatrickalves:mainfrom
nogara:fix/states-strict-resolution

Conversation

@nogara

@nogara nogara commented Oct 20, 2026

Copy link
Copy Markdown

Summary

State names resolved fuzzily, so --state qa picked whichever state scored highest. A work item could land in "pronto p/ qa" when the user meant "em qa", with no warning. wi ls --state also ORed every state whose name contained the text.

State names now resolve strictly, in this order:

  1. UUID
  2. Exact name, case-insensitive
  3. The only state whose name contains the query as a whole word
  4. The only state whose name contains the query as a substring

Steps 3 and 4 print State matched: "x" -> "y" on stderr. An ambiguous, unknown or fuzzy-only name fails with a ValidationError (exit code 5) that lists the project's states. Before, an unknown name exited with 3.

Applies to wi create --state, wi update --state, wi ls --state and state show/update/delete. wi ls --state applies the same rules per project. Other resources keep fuzzy resolution. The decision is recorded as ADR-0009, and AGENTS.md, the README, docs/architecture.md and the skill docs are updated.

Test plan

  • uv run ruff check src/
  • uv run pytest tests/: 202 passed, including new resolver and wi ls --state tests
  • Used daily against a self-hosted Plane instance

Notes

Based on main. It touches commands/work_items.py next to where #16 adds _validate_date, so whichever merges second needs a trivial rebase. I can rebase this one.

🤖 Generated with Claude Code

https://claude.ai/code/session_013dQcgZHVdyPjyJMov9Ljba

`--state qa` fuzzy-matched whichever name scored highest, so a work item
could silently land in "pronto p/ qa" when the user meant "em qa", and
`wi ls --state` ORed every state containing the text.

State names now resolve in order: UUID, exact case-insensitive name,
the only name containing the query as a whole word, then the only name
containing it as a substring (with a `State matched: "x" -> "y"` notice
on stderr). Ambiguous, unknown or fuzzy-only names raise a
ValidationError listing the project's states. `wi ls --state` applies
the same rules per project. Other resources keep fuzzy resolution.
Recorded as ADR-0009.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HcDT5cKbMgPEE4tTPZqhKs
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