fix: resolve dependency addresses from the bridge address, not assignedPort - #20
Merged
Merged
Conversation
MattDHill
force-pushed
the
fix/bridge-address-resolution
branch
from
July 25, 2026 01:23
3544d3d to
4dba0b6
Compare
`net.assignedPort` and `net.assignedSslPort` are raw metadata, and which of them is populated depends on how the dependency bound the port: a binding with addSsl frees `assignedPort` entirely. Reading either field directly breaks the moment a dependency changes its TLS arrangement, as LND just did (Start9Labs/lnd-startos#171). start-sdk 2.0.9 adds `sdk.host.getBridgeAddress`, which resolves the binding's own derived address — correct under either arrangement, and computed per binding so it also covers bridge-only bindings such as tor's SOCKS proxy. Adopt it and delete the local copy of the helper this package was carrying. `ssl` is passed only where the target publishes both a plaintext and a TLS address; elsewhere pinning it would assert a fact about how the dependency binds.
MattDHill
force-pushed
the
fix/bridge-address-resolution
branch
from
July 25, 2026 02:32
4dba0b6 to
d763e19
Compare
helix-nine
approved these changes
Jul 25, 2026
helix-nine
left a comment
There was a problem hiding this comment.
Reviewed: resolves dependency addresses via sdk.host.getBridgeAddress rather than the raw net.assignedPort / assignedSslPort fields, which are only populated depending on how the dependency bound the port. Verified live on a 0.4.0-beta.10 box across lnd, cln, fulcrum and lnbits.
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.
Why
This package resolved its dependencies' addresses by reading
bindings[<port>].net.assignedPort. That field is raw metadata, and which port field is populated depends on how the dependency bound the port — a binding withaddSslfreesassignedPortentirely and carries onlyassignedSslPort.LND hit exactly this when it moved REST behind the OS reverse proxy (Start9Labs/lnd-startos#171): every dependent silently resolved
null.What changed
Adopts
sdk.host.getBridgeAddress, added in start-sdk 2.0.9 (Start9Labs/start-technologies#3560, #3561), and deletes the local copy of the helper this package was carrying — one of 44 near-identical copies across the fleet.The helper resolves the binding's own derived bridge address, which is correct whether the dependency terminates its own TLS or hands the port to the OS proxy. It is computed per binding rather than per exported interface, so it also resolves bridge-only bindings such as tor's SOCKS proxy.
ssl:is passed only where the target binding publishes two bridge addresses —protocol: 'http'/'ws', orsecure: nullwithaddSsl. bitcoind's RPC is the clearest case (10.0.3.1:8332 ssl=falsealongside10.0.3.1:54404 ssl=true), so an undiscriminated lookup there is order-dependent. Where a binding publishes one address no discriminator is passed — pinning one would assert a fact about how the dependency binds, the coupling this change removes.On the lockfile diff
Larger than expected, and expected to stay that way for now. This package pins git dependencies that track
#nextbranches, which still resolve start-sdk 2.0.7, so npm nests a second SDK copy rather than hoisting one. It collapses once thosenextbranches carry 2.0.9. The lockfile has to be committed regardless —s9pk.mkand the reusable CI both runnpm ci, which fails on a lockfile out of sync withpackage.json. Functionally inert: the git deps are imported for types, and the s9pk build tree-shakes.Verification
tscand prettier clean against the published start-sdk 2.0.9. The resolution logic was verified live on a StartOS 0.4.0-beta.10 box: with LND onaddSsl,net.assignedPortreadsnullwhile the binding's bridge entry resolves to10.0.3.1:8080; LNbits connected through it (✔️ Backend LndRestWallet connected), and Fulcrum picked bitcoind's plaintext:8332leg over the TLS:54404one.Not exercised against a running instance of this service — compile-checked only.
Test plan
.const()should settle on one value and stay there.🤖 Generated with Claude Code