Skip to content

tk: Fix inconsistent project identifier handling#228

Merged
neongreen merged 1 commit intomainfrom
claude/audit-project-reference-bugs-011CUi3dGcwTfs78Z1Ggio9i
Nov 1, 2025
Merged

tk: Fix inconsistent project identifier handling#228
neongreen merged 1 commit intomainfrom
claude/audit-project-reference-bugs-011CUi3dGcwTfs78Z1Ggio9i

Conversation

@neongreen
Copy link
Copy Markdown
Owner

This commit introduces a newtype pattern in Go to prevent bugs related to project reference resolution. Previously, projects could be referenced by UID, alias, or name, but these were all handled as strings, leading to inconsistent behavior and potential bugs.

Changes:

  • Add ProjectRef type for unresolved project references (UID, alias, or name)
  • Add ResolveProjectRef() function that takes ProjectRef and returns ProjectUID
  • Update preferredAliasForProject() to take ProjectUID instead of string
  • Fix project alias add command to resolve any project reference
  • Fix project rm command to use standard resolution logic
  • Fix task creation to display friendly alias instead of raw UID
  • Update all call sites to use strongly-typed functions

This follows the Haskell-style newtype pattern to make invalid states unrepresentable at compile time. Functions that need a resolved ProjectUID now explicitly take that type, while functions that accept user input take ProjectRef and resolve internally.

This commit introduces a newtype pattern in Go to prevent bugs related to
project reference resolution. Previously, projects could be referenced by UID,
alias, or name, but these were all handled as strings, leading to inconsistent
behavior and potential bugs.

Changes:
- Add ProjectRef type for unresolved project references (UID, alias, or name)
- Add ResolveProjectRef() function that takes ProjectRef and returns ProjectUID
- Update preferredAliasForProject() to take ProjectUID instead of string
- Fix project alias add command to resolve any project reference
- Fix project rm command to use standard resolution logic
- Fix task creation to display friendly alias instead of raw UID
- Update all call sites to use strongly-typed functions

This follows the Haskell-style newtype pattern to make invalid states
unrepresentable at compile time. Functions that need a resolved ProjectUID
now explicitly take that type, while functions that accept user input take
ProjectRef and resolve internally.
@mergify
Copy link
Copy Markdown

mergify Bot commented Nov 1, 2025

🧪 CI Insights

Here's what we observed from your CI run for 02c7656.

🟢 All jobs passed!

But CI Insights is watching 👀

@neongreen neongreen merged commit 73b8938 into main Nov 1, 2025
4 checks passed
@neongreen neongreen deleted the claude/audit-project-reference-bugs-011CUi3dGcwTfs78Z1Ggio9i branch November 1, 2025 23:52
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.

2 participants