Repository navigation
page-usage-tree 0.1.7: a bracketed IPv6 MAGPIE_ADDR in uppercase hex stays a gateway candidate - #2055
Merged
yetone merged 1 commit intoDec 5, 2026
Conversation
…stays a gateway candidate The bracketed-IPv6 pattern added in 0.1.6 matched only lowercase hex, so [FE80::1]:3425 was dropped. Match it case-insensitively and cover it with a test that fails on 0.1.6. Fixes magpie-community#2054 Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
Contributor
|
Shipped in page-usage-tree 0.1.7 (382e2c9). It's served from the dist branch ( |
yetone
added a commit
that referenced
this pull request
Dec 5, 2026
… stays the gateway (#2057) Fixes #2057, the sibling of #2054 that page-usage-tree 0.1.7 fixed (#2055). server.mjs's gatewayCandidates matched MAGPIE_ADDR with /^(\[[0-9a-f:.]+\]|[\w.-]+):\d+$/ and no i flag, so `[FE80::1]:3425` was dropped and the board asked http://127.0.0.1:3425. The pattern now has the i flag; the hostname branch already took either case. New test: MAGPIE_ADDR=[::FFFF:7F00:1]:<port> (127.0.0.1 written as an IPv4-mapped IPv6 address in uppercase hex, so nothing leaves the machine) is logged as gateway=http://[::FFFF:7F00:1]:<port>, not the 3425 default, and where the mapped address is reachable /api/overview is answered by the fake gateway on 127.0.0.1. page-usage-board 0.2.0 -> 0.2.1. Run at tree 2211cee (both commits on origin/main 382e2c9), on Linux (WSL2 magpie-desktop, Bun 1.4.2, Node 22, HOME=$(mktemp -d) in /tmp): - HOME=$(mktemp -d) bun test (root): 11302 pass, 47 skip, 0 fail, 758 files - bun test packages/chat: 87 pass, 1 skip, 0 fail - bun test packages/page-usage-board: 58 pass, 0 fail - node --test test/*.test.mjs (page-usage-board): 58 pass, 0 fail - bun scripts/check.mjs: ok - bun scripts/bumped.mjs origin/main (HQ, git only): ok - Red on the old code: chat's new test against origin/main's lib/gateway.mjs fails at [::1] (got http://127.0.0.1:3425), and with the new pattern minus the i flag at [FE80::1]; the board's new test against origin/main's server.mjs fails (gateway=127.0.0.1:3425 logged), the [::1] test beside it stays green. - The IPv4-mapped address answers on WSL Linux, so the board test's request branch ran there. Not tried: a real magpie listening on [::1], macOS and Windows (the board's request branch is skipped where the mapped address doesn't answer). Other MAGPIE_ADDR readers were checked and keep a bracketed or uppercase address: page-usage-tree, page-harnessweight (i flag already), page-model-quota (URL parse), window-warmup, fingerprint (passed through), agy-cli (bracket-aware, loopback only), agent-console (port only).
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.
Fixes #2054.
0.1.6 (#2045) added a bracketed-IPv6 branch to the
MAGPIE_ADDRpattern inlib/gateway.mjs, but the character class is[0-9a-f:.], so an address written in uppercase hex such as[FE80::1]:3425didn't match and was dropped. The first candidate fell back tohttp://127.0.0.1:3425.Change
lib/gateway.mjs: add theiflag to thehost:port/[v6]:portpattern. The hostname branch ([\w.-]+) already accepts either case, so only the IPv6 branch changes behaviour.test/gateway.test.mjs: new test,MAGPIE_ADDR=[FE80::1]:3425must stayhttp://[FE80::1]:3425. It fails on 0.1.6 (gothttp://127.0.0.1:3425) and passes with the fix.package.json: 0.1.6 → 0.1.7.Checks
node --test test/*.test.mjsin packages/page-usage-tree: 77 pass, 0 failHOME=$(mktemp -d) bun testin packages/page-usage-tree: 70 pass, 1 skip, 0 failbun scripts/check.mjs: cleanThe chat package's equivalent (#2051) isn't touched here.
This change was prepared with help from an AI assistant (Grok Bot). I reviewed it and ran the tests above.