Skip to content

fix: fail on ambiguous entity names instead of taking the first - #307

Open
nikosavola wants to merge 2 commits into
lucassabreu:mainfrom
nikosavola:nikosavola/push-lpnxoltukkkt
Open

nikosavola wants to merge 2 commits into
lucassabreu:mainfrom
nikosavola:nikosavola/push-lpnxoltukkkt

Conversation

@nikosavola

Copy link
Copy Markdown
Contributor

A name matching several projects or tasks silently resolved to whichever the API listed first, so writes could hit the wrong entity.

- a name matching several projects or tasks silently resolved to whichever
  the api listed first, so writes could hit the wrong entity

Co-Authored-By: DeepSeek V4.1 <noreply@deepseek.com>
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.66102% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.78%. Comparing base (176547e) to head (4555393).

Files with missing lines Patch % Lines
pkg/cmd/time-entry/util/interactive.go 0.00% 6 Missing ⚠️
pkg/search/find.go 86.66% 4 Missing ⚠️
pkg/search/errors.go 91.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
+ Coverage   32.46%   32.78%   +0.32%     
==========================================
  Files         141      141              
  Lines        9016     9067      +51     
==========================================
+ Hits         2927     2973      +46     
- Misses       5974     5979       +5     
  Partials      115      115              
Flag Coverage Δ
unittests 32.78% <79.66%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pkg/search/errors.go
Comment on lines +68 to +74
if len(cs) > maxCandidatesInError {
return prefix + strings.Join(cs[:maxCandidatesInError], ", ") +
fmt.Sprintf(", and %d more",
len(e.Candidates)-maxCandidatesInError)
}

return prefix + strhlp.ListForHumans(cs)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this logic should be moved to a new func at strhlp

Suggested change
if len(cs) > maxCandidatesInError {
return prefix + strings.Join(cs[:maxCandidatesInError], ", ") +
fmt.Sprintf(", and %d more",
len(e.Candidates)-maxCandidatesInError)
}
return prefix + strhlp.ListForHumans(cs)
return prefix + strhlp.LimitedListForHumans(cs, maxCandidatesInError)

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