Skip to content

fix(papermc): fall back to SNAPSHOT form when metadata fetch rejects#41

Merged
ch99q merged 1 commit into
mainfrom
ch99q/api-resolve-offline-fallback
May 19, 2026
Merged

fix(papermc): fall back to SNAPSHOT form when metadata fetch rejects#41
ch99q merged 1 commit into
mainfrom
ch99q/api-resolve-offline-fallback

Conversation

@ch99q

@ch99q ch99q commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • papermc.resolveApiVersion handled !res.ok but let fetch rejections (DNS failure, offline, TLS) propagate. Since fix(platforms): make multi-platform builds work on latest MC versions #40 routed folia.api() through this helper instead of the deterministic ${mc}-R0.1-SNAPSHOT coordinate Folia used before, an offline build that could previously satisfy folia-api from the Maven cache started failing on the metadata fetch.
  • Wraps the fetch in try/catch so the SNAPSHOT form falls through on any network error, restoring offline-cached-build behaviour. Sponge's equivalent helper already had this shape; this brings the PaperMC helper in line.
  • Added unit tests covering all four resolution paths (build-stamped hit, no match, non-2xx, fetch reject), mocking globalThis.fetch.

Test plan

  • vp test src/platform/papermc/papermc.test.ts (6 passed)
  • vp check
  • CI

resolveApiVersion() handled non-2xx responses but let fetch's promise
rejection (DNS failure, offline, TLS) propagate. With folia.api() now
routed through this helper instead of the deterministic
${mc}-R0.1-SNAPSHOT coordinate it used before, an offline build that
could previously satisfy folia-api from the Maven cache started failing
on the metadata fetch.

Wrap the fetch in try/catch so the SNAPSHOT form falls through on any
network error, restoring offline-cached-build behaviour. Added unit
tests covering the four resolution paths (build-stamped hit, no match,
non-2xx, fetch reject).
@ch99q ch99q merged commit aa2d989 into main May 19, 2026
4 checks passed
@ch99q ch99q deleted the ch99q/api-resolve-offline-fallback branch May 19, 2026 16:42
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