fix(model): count only providers holding a Public provide key#5
Open
Ryanmello07 wants to merge 2 commits into
Open
fix(model): count only providers holding a Public provide key#5Ryanmello07 wants to merge 2 commits into
Ryanmello07 wants to merge 2 commits into
Conversation
A provider without a provide_mode=3 key cannot accept a contract from a client outside its own network, so counting it advertises supply nobody can reach. On beta this reported 39 US providers when 2 were reachable. Filters both UpdateClientLocations and UpdateClientScores: GetProviderLocations gates on loadLocationStables as well, so fixing only the first leaves the symptom in place. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QtgqtCmKJRXdsQ5ktiqwkg
…e score filter
Review follow-ups to "count only providers holding a Public provide key".
1. The location *group* source query in UpdateClientScores was still bare
`connected = true AND valid = true`. It fills locationGroupClientScores ->
the clientScoreLocationGroup* redis keys -> loadClientScores ->
FindProviders2 whenever a spec carries a LocationGroupId, so a user
selecting a promoted group (e.g. "Strong Privacy Laws") still received
providers that cannot accept their contract, and CreateContract rejected
them with NoPermission. Same EXISTS predicate as the other two queries.
2. The UpdateClientScores filter had no test of its own -- every existing
test that reaches it gives all its clients a Public key, so deleting the
clause broke nothing. Two new tests set up connected+valid providers that
are identical except for the Public provide key:
- TestUpdateClientScoresCountsOnlyPublicProviders covers the per-location
query through loadLocationStables (the gate GetProviderLocations uses)
and loadClientScores.
- TestUpdateClientScoresGroupCountsOnlyPublicProviders covers the group
query through the group cache.
Both were verified to fail with their respective EXISTS clause removed.
3. The SQL comments claimed the destination "must hold a key for exactly
that mode". That is not an invariant the code holds:
resolveNonCompanionProvideMode lets a Stream-only destination settle a
cross-network contract as a companion stream. Reworded to state the
intent -- a companion-only destination is a return path, not general
provider supply, so excluding it from provider counts is deliberate.
No SQL change.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QtgqtCmKJRXdsQ5ktiqwkg
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Filters provider counting to clients holding
provide_mode=3. Observed on beta: 39 US providers advertised, 2 reachable.Both
UpdateClientLocationsandUpdateClientScoresare filtered, sinceGetProviderLocationsalso gates onloadLocationStables(populated byUpdateClientScores) — filtering only the first leaves the symptom in place.Two existing beta tests (
TestUpdateClientLocationsCountsClientsWithoutReliabilityScores,TestUpdateClientScoresCountsClientsWithoutReliabilityScores) connected a client with no provide key at all; they now set a Public key explicitly, since the reliability-score join is what they are testing.🤖 Generated with Claude Code
https://claude.ai/code/session_01QtgqtCmKJRXdsQ5ktiqwkg