Repository navigation
fix(hosts): use recovery only for a forced legacy update #529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Not a test file itself. Tests that route a legacy daemon's update must not depend on what GitHub serves today. | ||
| // Before this build's release is published its lookup fails; afterwards it succeeds and an old daemon gains a Force | ||
| // (recovery) route. Stubbing the lookup pins the production state: the recovery helper is published and available. | ||
|
|
||
| /** Answer the release lookup of this build with a published release; every other request goes to the real fetch. | ||
| * Returns the function that restores `fetch`. */ | ||
| export function stubRecoveryRelease() { | ||
| const real = globalThis.fetch; | ||
| globalThis.fetch = async (input, init) => { | ||
| const url = String(input instanceof Request ? input.url : input); | ||
| if (!/^https:\/\/api\.github\.com\/repos\/[^/]+\/[^/]+\/releases\/tags\//.test(url)) return real(input, init); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Limit the stub to the installed recovery release. The matcher intercepts every GitHub release-by-tag lookup. A lookup for another tag or repository returns a synthetic 200 with the installed recovery tag instead of reaching real
|
||
| const { installedRecoveryTag } = await import("../recovery-release.ts"); | ||
| const assets = ["linux-x64.tar.gz", "darwin-arm64.tar.gz", "windows-x64.zip"].map((name) => ({ name: `ompweb-${name}`, digest: `sha256:${"a".repeat(64)}` })); | ||
| return Response.json({ tag_name: installedRecoveryTag(), assets }); | ||
| }; | ||
| return () => { globalThis.fetch = real; }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Qualify the normal-update claim.
An idle daemon can still be ineligible. For example, the v10 integration test shows that a shared installation blocks the update until the web package has been replaced. Say that an eligible host can update without Force again. Also clarify that an unsupported pin or phase selects recovery only with explicit Force approval.