Skip to content

Keep the Azure DevOps project-not-found error instead of clearing it - #347

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/304-ado-project-not-found
Oct 7, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/304-ado-project-not-found

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #304

What changed

  • MakeAzureDevOpsRequestAsync called ClearStatus() after every action that returned normally. So when UpdateRepositoriesAsync found no project matching the owner, the error it set was cleared straight away, and the provider showed OK.
  • BuildProvider now counts SetStatus calls (StatusSetCount). The wrapper compares the count before and after the action, and clears the status only when the action didn't set one itself. A later successful request still clears the error, as the issue's acceptance criteria ask.
  • The not-found status now comes from a small ReportProjectNotFound(OwnerName) helper, so a test can exercise it.

Why not the triage comment's preferred option

The triage comment preferred returning foundProject out of the lambda and setting the error after the wrapper returns. That path only runs with a live ProjectClient session (offline, VssConnection.GetClient<T>() throws, see AzureDevOpsSessionTests), so no unit test could cover it. Changing the wrapper can be tested without a network connection. It also covers any future action that reports its own status. The cost is one counter field.

Tests

  • New AzureDevOpsStatusTests:
    • AProjectNotFoundErrorSurvivesTheRequestThatReportedIt: the error is still set after the request returns.
    • ALaterSuccessfulRequestClearsTheError: a later successful request returns the provider to OK.
  • To check the test catches the bug, I made the wrapper clear the status unconditionally again. AProjectNotFoundErrorSurvivesTheRequestThatReportedIt failed (Status was OK), then passed again once the fix was put back.
  • Full suite: 87/87 passing locally. The build has no warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B6YhFsbKVvV6YZVxUJzexE


Generated by Claude Code

…g it [patch]

MakeAzureDevOpsRequestAsync called ClearStatus() after every action that
returned normally, so the error UpdateRepositoriesAsync sets when an owner
matches no project was wiped straight away. The wrapper now clears the
status only when the action did not set one itself, and a later
successful request still clears it.

Fixes #304

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B6YhFsbKVvV6YZVxUJzexE
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit db4dfa2 into main Oct 7, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/304-ado-project-not-found branch October 7, 2026 05:34
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.

Azure DevOps "Project not found" error status is cleared immediately, so a mistyped or deleted project never shows as an error

2 participants