Skip to content

Fix federated chunk fetch: URL residue + project-scope routing (todo #153) - #272

Merged
flupkede merged 1 commit into
developfrom
fix/federated-chunk-fetch-153
Sep 17, 2026
Merged

flupkede merged 1 commit into
developfrom
fix/federated-chunk-fetch-153

Conversation

@flupkede

Copy link
Copy Markdown
Owner

Remote chunk fetch was broken in multi-repo serve mode (todo #153). Two independent defects:

1. Stray %7D in the peer URL (chunk_ref path)

The URL was built with CHUNK_PATH.replace("{id", …) — missing the closing brace. With CHUNK_PATH = "/chunk/{id}" the result was /chunk/2058} (wire: %7D), which peers answer 400. Introduced by the axum 0.8 route-syntax migration (#256): the old .replace(":id", …) became .replace("{id", …) but the template grew a }.

Why tests missed it: axum's {id} parameter happily captures 2058} including the stray brace, so every mock-based test matched. The new test's route echoes the exact path it was hit on (/chunk/2058), so any placeholder residue fails.

2. project=<peer>/<alias> + chunk_id → "Unknown alias"

get_chunk only supported the chunk_ref form for remote fetches; a plain project= mount fell into local routing and died. project= mounts now route through the same federated_get_chunk path search uses (mounted projects only — local aliases always win a name clash), via a synthetic <peer>/<alias>:<id> ref.

Tests

  • get_chunk_requests_the_exact_chunk_path_without_placeholder_residue — fails without fix 1
  • get_chunk_routes_mounted_remote_projects_through_federation — fails without fix 2; hermetic (temp config file — discovered the hard way that ServeState::new(config, None) gets its config reloaded from the real disk file, which made the first test run hit a production peer)

Changelog

### Fixed entry under the pending version.

…ting (todo #153)

Two independent defects in remote chunk fetch:
1. The peer URL replaced '{id' without the closing brace, producing
   /chunk/2058%7D — axum's {id} param swallowed the stray '}' into the
   captured value, so mock-based tests passed while real peers answered
   400. Replace the full '{id}' placeholder; pinned by a test whose route
   echoes the exact path it was hit on.
2. get_chunk(project=<peer>/<alias>, chunk_id) died with 'Unknown alias':
   mounted remote projects now route through the same federated fetch
   search uses (local aliases win name clashes). Hermetic routing test
   (temp config file — the in-memory config is reloaded from disk, which
   previously leaked the developer's real peers into the test).
@flupkede
flupkede merged commit e2c787f into develop Sep 17, 2026
7 checks passed
@flupkede
flupkede deleted the fix/federated-chunk-fetch-153 branch September 17, 2026 10:07
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.

1 participant