Skip to content

Let spawn burst instances discover local nodes from the hybrid registry (#918) - #934

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/918
Oct 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/918

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Stacked on #926 (base fix/905). Review that first; this PR's diff is only the #918 change.

Problem

The hybrid registry (spawn-hybrid-registry) is written by local nodes and by burst members, but only LocalProvider.DiscoverPeers read it. EC2Provider.DiscoverPeers ran DescribeInstances on spawn:job-array-id and nothing else. A burst instance found its EC2 siblings but never the local nodes it was launched to work alongside. Local nodes saw burst instances; burst instances did not see local nodes.

Fix

  • Burst members read the registry. When Config.Burst is set (from spawn:burst=true), EC2Provider.DiscoverPeers also queries the registry and merges the entries with the tag peers through mergePeers:
    • Each instance appears once, keyed by instance ID. Burst members register too, so every EC2 member shows up in both sources.
    • When both sources list an instance, the tag entry wins, because it carries the spore.host DNS name.
    • Output is sorted by index, then provider, then instance ID.
  • A registry read failure does not fail discovery. If there is no table or access is denied, the member keeps its tag peers and logs a warning, as the local provider does.
  • Ordinary members stay tag-only, consistent with Register only hybrid job-array members with the hybrid registry (#904) #920. readsHybridRegistry() is false without Burst, so a spawn launch --count member never queries the table.
  • Config.Burst and its tag parse match Register only hybrid job-array members with the hybrid registry (#904) #920's hunks exactly. This PR does not depend on Register only hybrid job-array members with the hybrid registry (#904) #920, and git sees the same lines on both sides when they merge. Register only hybrid job-array members with the hybrid registry (#904) #920's pkg/provider/burst_tag_test.go is not duplicated; the tests here use their own names.
  • Region: the registry client is built from the EC2 provider's own config, already pinned to the IMDS region. That is where burst creates the table and launches members. It does not depend on Give spored's hybrid-registry client a region (#899) #902.
  • Shared reader: the query and parse code moved to pkg/provider/hybrid_registry.go and is used by both providers. The local provider's read now also follows LastEvaluatedKey pages. provider.HybridRegistryTable replaces the local provider's string literal. pkg/provider cannot import pkg/registry (a cycle), so a test in pkg/registry pins the two table names together.
  • IAM gate: Give spawn burst instances credentials, tags and a TTL (#905) #926's registryClientActions discovered DynamoDB calls only from pkg/registry/dynamodb.go. Burst members now also issue registry calls from pkg/provider/hybrid_registry.go with the spored role, so the gate scans both files. It fails if either file yields no calls. The action set is unchanged (Query was already granted).

Tests

pkg/provider/burst_discovery_test.go, run against Substrate. Members are built the way spored builds them: config read back from the instance's own tags with loadConfigFromEC2Tags.

  • TestEC2Provider_BurstMemberDiscoversLocalNodesFromTheRegistry is Burst (EC2) members of a hybrid job array never read the hybrid registry, so they cannot discover local nodes #918's suggested test. A burst member's discovery includes the registry's provider=local entry once and itself once (deduplicated), with its DNS name kept.
  • TestEC2Provider_OrdinaryMemberDiscoveryIsTagOnly: no spawn:burst means zero registry queries and no local peer.
  • TestEC2Provider_BurstMemberKeepsTagPeersWhenTheRegistryFails
  • TestReadsHybridRegistry and TestMergePeers test the gate and the merge directly (rule 2).
  • pkg/registry TestTableNameAgreesWithProvider

Each test was watched failing against a revert that compiles, with go vet clean on each reverted tree:

Revert Fails
if true || !p.readsHybridRegistry() (never read the registry) …DiscoversLocalNodesFromTheRegistry, …KeepsTagPeersWhenTheRegistryFails
gate drops p.config.Burst …OrdinaryMemberDiscoveryIsTagOnly, TestReadsHybridRegistry
dedupe → if false && seen[…] …DiscoversLocalNodesFromTheRegistry, TestMergePeers
tag parse → false && … …DiscoversLocalNodesFromTheRegistry, …KeepsTagPeersWhenTheRegistryFails
registry error → return nil, err …KeepsTagPeersWhenTheRegistryFails
registry entries take precedence over tag entries …DiscoversLocalNodesFromTheRegistry, TestMergePeers
HybridRegistryTable renamed TestTableNameAgreesWithProvider
provider reader calls client.Scan (source text the gate reads) TestBothSporedPolicyPathsGrantTheHybridRegistry, TestHybridRegistryGrantIsNarrow

make check passes except TestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker, which needs a Docker daemon. make check-nested reports all 9 nested modules clean. No public-package surface changed (pkg/provider and pkg/registry are internal), so api/public-surface.txt is unchanged. No AWS resources were created and no instances were launched.

Caveat, filed separately

Fixes #918

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.07463% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/provider/ec2.go 77.77% 3 Missing and 1 partial ⚠️
pkg/provider/hybrid_registry.go 91.30% 3 Missing and 1 partial ⚠️
pkg/provider/local.go 33.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…ry (#918)

The hybrid registry is written by local nodes and burst members alike, but
only LocalProvider read it. EC2Provider.DiscoverPeers looked at tags only, so
a burst instance saw its EC2 siblings and never the local nodes of its job
array: discovery worked one way.

A burst member (spawn:burst=true, parsed into Config.Burst exactly as #920
does) now also queries the registry and merges its entries with the tag
peers, one entry per instance, the tag entry winning a collision since it
carries the spore.host DNS name. A registry read failure keeps the tag peers
and logs a warning. Ordinary members stay tag-only and never query the table.

The registry query and its parsing move into pkg/provider/hybrid_registry.go,
shared with the local provider (which also gains pagination). The table name
is pinned to registry.TableName by a test, and the spored IAM grant gate now
discovers the DynamoDB calls this reader makes as well as PeerRegistry's.

Fixes #918.
@scttfrdmn
scttfrdmn merged commit fc21051 into main Oct 17, 2026
8 checks passed
@scttfrdmn
scttfrdmn deleted the fix/918 branch October 17, 2026 07:03
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.

Burst (EC2) members of a hybrid job array never read the hybrid registry, so they cannot discover local nodes

1 participant