Allow signed updates to more mature release channels
This commit is contained in:
@@ -1,10 +1,16 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v0.6.2.2_alpha — 2026-11-26
|
||||||
|
|
||||||
|
- Allow signed updates to the same or a more mature release channel, including Beta at the same numerical version as Alpha.
|
||||||
|
- Report when a release is excluded because of its numerical version or channel.
|
||||||
|
|
||||||
## v0.6.2.1_alpha — 2026-11-26
|
## v0.6.2.1_alpha — 2026-11-26
|
||||||
|
|
||||||
- Show verified update availability and installation readiness in the hover monitor, main window, and tray menu. Windows notifications can be turned off and repeat checks do not repeat them.
|
- Show verified update availability and installation readiness in the hover monitor, main window, and tray menu. Windows notifications can be turned off and repeat checks do not repeat them.
|
||||||
- Wait for ARM to finish saving settings and history and exit before replacing any application files. Show independent installation progress and report restart or recovery results.
|
- Wait for ARM to finish saving settings and history and exit before replacing any application files. Show independent installation progress and report restart or recovery results.
|
||||||
- Restore the prior tray-only or expanded presentation after an update and let users open the changelog from the success confirmation.
|
- Restore the prior tray-only or expanded presentation after an update and let users open the changelog from the success confirmation.
|
||||||
|
- Published the signed Windows x64 installer and portable ZIP from Jenkins build #7.
|
||||||
|
|
||||||
## v0.6.1.1_alpha — 2026-11-26
|
## v0.6.1.1_alpha — 2026-11-26
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,108 @@
|
|||||||
# Adaptive Resource Monitor implementation report
|
# Adaptive Resource Monitor implementation report
|
||||||
|
|
||||||
|
## v0.6.2.2_alpha — Update channel correction
|
||||||
|
|
||||||
|
Windows Program Compatibility Assistant recorded the archived
|
||||||
|
`release/v0.6.2.1_alpha/AdaptiveResourceMonitor-v0.6.2.1_alpha-windows-x64-setup.exe`
|
||||||
|
launching at 7:44:03 PM CST on November 26. The installed uninstaller was
|
||||||
|
written in the same second and its data was written at 7:44:12 PM. The
|
||||||
|
new application started at 7:44:13 PM. Gitea published build #7 at 7:48:46
|
||||||
|
PM. The installer was launched from the release archive, outside the
|
||||||
|
disposable test paths and before the update was available publicly.
|
||||||
|
A production updater transaction or receipt for this launch was absent.
|
||||||
|
The available audit and session records do not identify the launcher.
|
||||||
|
Jenkins build #7 compiled and archived the files, and publication #8
|
||||||
|
handled Gitea publication. The recorded isolated installer tests used
|
||||||
|
disposable targets. Production fingerprints now bracket development
|
||||||
|
validation, and the release procedure requires the installed UI and a
|
||||||
|
complete updater receipt for live acceptance.
|
||||||
|
|
||||||
|
The corrective version changes only the Bug-Fix counter. Discovery,
|
||||||
|
download and installation now share a policy that allows the installed
|
||||||
|
channel and more mature channels while rejecting lower numerical versions.
|
||||||
|
The release index distinguishes channel and version exclusions from
|
||||||
|
signature or metadata failures. There was no explicit channel preference
|
||||||
|
in the existing settings. All 34 regression tests passed, including signed
|
||||||
|
same-number Alpha-to-Beta discovery and the full channel matrix.
|
||||||
|
|
||||||
|
## v0.6.2.1_alpha publication and production assessment — 2026-11-26
|
||||||
|
|
||||||
|
### Publication and anonymous verification
|
||||||
|
|
||||||
|
Publish Release #8 succeeded using the seven artifacts from Build and
|
||||||
|
Archive #7 at commit `035fb8ddc918337fdf6cf9743082aacae940b9db`. No build
|
||||||
|
was run for publication. Gitea published the Alpha prerelease at 7:48:46 PM
|
||||||
|
CST. Its version tag resolves to the pinned commit, and the public release
|
||||||
|
notes match the tagged changelog and signed manifest.
|
||||||
|
[Public release](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases/tag/v0.6.2.1_alpha)
|
||||||
|
[Publish Release #8](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Publish-Release/8/)
|
||||||
|
|
||||||
|
Jenkins and an independent anonymous download verified all seven attachments
|
||||||
|
against the archived bytes. The Ed25519 signature, Windows x64 architecture,
|
||||||
|
package types, executable versions, package lengths, SHA-256 checksums and
|
||||||
|
build identity passed. The earlier v0.6.1.1_alpha release is still public.
|
||||||
|
|
||||||
|
| Windows x64 package | Bytes | SHA-256 |
|
||||||
|
| --- | ---: | --- |
|
||||||
|
| Installer | 60,163,795 | `7d79e692b88819298c6ae00bf6041cdcea77c2171965a784f39fd2961179080a` |
|
||||||
|
| Portable ZIP | 74,681,911 | `966edc69169ab607f810e67af0def5ac1ad86360bfcd3996e884104b4ae32b98` |
|
||||||
|
|
||||||
|
### Production Alpha acceptance
|
||||||
|
|
||||||
|
The first production inspection found v0.6.2.1_alpha already installed and
|
||||||
|
running. ARM logged the earlier instance stopping at 7:43:48 PM CST and the
|
||||||
|
new version starting at 7:44:15 PM, before the target release became public.
|
||||||
|
The production profile had no staged updater download, transaction plan or
|
||||||
|
completion receipt. The required production self-update from v0.6.1.1_alpha
|
||||||
|
could not be performed or established from that starting state. Automatic
|
||||||
|
shutdown, installation, restart and the success notification for that
|
||||||
|
transition remain unverified. The working installation was preserved.
|
||||||
|
|
||||||
|
- Windows registration, the installed executable and the build receipt report
|
||||||
|
v0.6.2.1_alpha from build #7. All 298 installed payload files matched the
|
||||||
|
verified archive. One ARM process was running in the console session with
|
||||||
|
no orphaned ARM installer or maintenance process observed.
|
||||||
|
- Rain, Phantom and LAMP had established SSH connections owned by ARM, and
|
||||||
|
Windows Credential Manager returned entries for all three saved references.
|
||||||
|
The production settings and pinned host-key file stayed byte-identical
|
||||||
|
during this assessment. A pre-upgrade data comparison for the earlier
|
||||||
|
version change was unavailable. Persistent recording is disabled, and
|
||||||
|
startup and periodic update checks remain disabled.
|
||||||
|
- Explorer returned one registered tray icon for ARM. Six passive samples
|
||||||
|
showed six different rendered frames. Foreground hover, tray-menu and
|
||||||
|
All Systems interactions were outside this passive production check.
|
||||||
|
- The frozen v0.6.1.1_alpha release client discovered and verified the
|
||||||
|
published Alpha as an eligible upgrade. The frozen client from the production
|
||||||
|
v0.6.2.1_alpha executable verified the same release as current. Both checks
|
||||||
|
used the actual public endpoint and no Gitea authentication.
|
||||||
|
|
||||||
|
**Alpha production self-update acceptance did not pass.**
|
||||||
|
|
||||||
|
### Beta promotion blocked
|
||||||
|
|
||||||
|
The version comparison and discovery test used updater code read from the
|
||||||
|
installed v0.6.2.1_alpha executable. Numeric counters sort before maturity,
|
||||||
|
and the supported tags sort `alpha < beta < rc < stable`. Same-number Beta
|
||||||
|
has a higher version key, but the shipped client only considers its current
|
||||||
|
prerelease channel and eligible stable releases. It skipped the signed Beta
|
||||||
|
fixture before requesting its manifest and selected the signed Alpha fixture
|
||||||
|
as current. The fixture's Beta signature independently verified. The tests
|
||||||
|
also confirmed same-version installation rejection, Beta-to-Alpha downgrade
|
||||||
|
rejection, eligible numeric progression and malformed-version rejection.
|
||||||
|
|
||||||
|
Production remains on v0.6.2.1_alpha. VERSION.md and the numerical version
|
||||||
|
counters are unchanged. No Beta build, tag, publication, production
|
||||||
|
notification exercise or installation was performed. An updater
|
||||||
|
compatibility change would require a separately authorized corrective release.
|
||||||
|
|
||||||
|
### Publication cleanup
|
||||||
|
|
||||||
|
Removed 138,981,356 measured bytes of temporary anonymous downloads and
|
||||||
|
previous-updater test files. The verifier removed its temporary payload
|
||||||
|
extractions, and Jenkins deleted its publication workspace. The published
|
||||||
|
releases, their archived packages and the existing validation evidence
|
||||||
|
were retained.
|
||||||
|
|
||||||
## v0.6.2.1_alpha — Update notifications and installation lifecycle
|
## v0.6.2.1_alpha — Update notifications and installation lifecycle
|
||||||
|
|
||||||
The Minor counter advanced. The hover monitor, expanded window and tray menu
|
The Minor counter advanced. The hover monitor, expanded window and tray menu
|
||||||
@@ -10,9 +113,76 @@ shutdown and process exit, shows independent installation progress and
|
|||||||
checks the restarted version before reporting success. The release uses
|
checks the restarted version before reporting success. The release uses
|
||||||
the existing Jenkins build and authorized publication jobs.
|
the existing Jenkins build and authorized publication jobs.
|
||||||
|
|
||||||
Production self-update acceptance follows authorized publication using the
|
### Native Windows validation
|
||||||
installed v0.6.1.1_alpha updater. Its maintenance launcher handles the first
|
|
||||||
upgrade. The newly installed application reads the legacy completion receipt.
|
- The 28-test regression suite passed. The private desktop suite passed on
|
||||||
|
native Windows, including update availability, rejected signatures,
|
||||||
|
downloading, install readiness, deferral and notification deduplication.
|
||||||
|
Both Design Creations themes and the confirmation's View Changelog action
|
||||||
|
passed. The notification also appeared in the separate remote tray menu
|
||||||
|
and the pinned remote and All Systems popup. Live telemetry, individual
|
||||||
|
tray sources and separate network IN and OUT remained operational.
|
||||||
|
- Disposable installed and portable x64 copies updated to a signed local
|
||||||
|
fixture. The installer exited with code 7 when its destination executable
|
||||||
|
was running. The updater waited for the original process and its clean
|
||||||
|
shutdown acknowledgement. An exit without acknowledgement left the
|
||||||
|
payload untouched. The independent helper displayed progress while the
|
||||||
|
installer installed the verified update.
|
||||||
|
- The installed upgrade restored the expanded window and the portable
|
||||||
|
upgrade restored tray-only mode. The restarted process ran as the same
|
||||||
|
user in the same Windows session at the same elevation. A second launch
|
||||||
|
exited without creating another instance. Settings, Windows Credential
|
||||||
|
Manager references, saved fixture credentials, the SSH trust file and
|
||||||
|
existing SQLite samples survived. Each lifecycle test exited with code 0.
|
||||||
|
- A fixture with a signed commit mismatch exercised rollback after
|
||||||
|
replacement. The previous portable executable was restored byte for byte
|
||||||
|
and restarted. A separate interrupted replacement recovered from the
|
||||||
|
persisted journal and cleared its RunOnce entry.
|
||||||
|
- The previous v0.6.1.1_alpha frozen launcher applied the exact signed
|
||||||
|
portable archive from Jenkins #7 on a private desktop. It restarted
|
||||||
|
v0.6.2.1_alpha, the new application displayed confirmation from the legacy
|
||||||
|
receipt and the fixture profile remained identical. The installed
|
||||||
|
lifecycle tests used a disposable installer AppId.
|
||||||
|
|
||||||
|
### Jenkins release candidate
|
||||||
|
|
||||||
|
Build and Archive #7 completed on the native Windows agent after an SCM
|
||||||
|
change. The pinned source
|
||||||
|
commit is `035fb8ddc918337fdf6cf9743082aacae940b9db`. Jenkins validated PE
|
||||||
|
metadata, installer and portable package identity, ZIP integrity and two
|
||||||
|
portable launches. All seven archived files were retrieved and verified
|
||||||
|
locally against the same commit and build. The ARM Ed25519 verification key,
|
||||||
|
signature, package version, architecture, filenames, sizes and SHA-256
|
||||||
|
hashes passed. The archive includes the checksums, signed manifest, public
|
||||||
|
key, release notes and build receipt alongside the two packages.
|
||||||
|
[Jenkins build record](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Build-and-Archive/7/)
|
||||||
|
|
||||||
|
| Windows x64 artifact | Bytes | SHA-256 |
|
||||||
|
| --- | ---: | --- |
|
||||||
|
| AdaptiveResourceMonitor-v0.6.2.1_alpha-windows-x64-setup.exe | 60,163,795 | `7d79e692b88819298c6ae00bf6041cdcea77c2171965a784f39fd2961179080a` |
|
||||||
|
| AdaptiveResourceMonitor-v0.6.2.1_alpha-windows-x64-portable.zip | 74,681,911 | `966edc69169ab607f810e67af0def5ac1ad86360bfcd3996e884104b4ae32b98` |
|
||||||
|
|
||||||
|
The verified archive is in `release/v0.6.2.1_alpha`. Six captures of the
|
||||||
|
hover, expanded window, tray menu, About tab, installation progress and
|
||||||
|
successful update are in `evidence/v0.6.2.1_alpha`. The availability captures
|
||||||
|
show the signed local fixture version.
|
||||||
|
|
||||||
|
### Production status before publication
|
||||||
|
|
||||||
|
At the end of prepublication validation, production and the public release
|
||||||
|
index still reported v0.6.1.1_alpha. The executable, settings and pinned SSH
|
||||||
|
host-key file matched the before-test hashes. The new progress window
|
||||||
|
applies to updates started from v0.6.2.1_alpha onward.
|
||||||
|
|
||||||
|
### Validation cleanup
|
||||||
|
|
||||||
|
Removed the staged compiler, private test key, test-only builds, profiles,
|
||||||
|
QA scripts, temporary extractions and two superseded captures. Manual
|
||||||
|
cleanup removed 2,536,086,381 bytes by logical file size. The two local
|
||||||
|
package builds automatically removed another 686,018,471 bytes of build
|
||||||
|
staging. The disposable Windows apps and their recovery entries were
|
||||||
|
cleared. Jenkins cleaned its build workspace. The verified #7 archive
|
||||||
|
and six requested captures are retained as release and validation evidence.
|
||||||
|
|
||||||
## Initial public release and production upgrade — 2026-11-26
|
## Initial public release and production upgrade — 2026-11-26
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ throughput scale per machine.
|
|||||||
Open the About tab from the monitor
|
Open the About tab from the monitor
|
||||||
window or tray menu for build information, version history and support links.
|
window or tray menu for build information, version history and support links.
|
||||||
|
|
||||||
|
Signed update discovery supports gaining release maturity from v0.6.2.2_alpha
|
||||||
|
onward. Production acceptance and promotion status are recorded in the
|
||||||
|
implementation report. [Public releases](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases)
|
||||||
|
|
||||||
The application version is defined in [VERSION.md](VERSION.md). Open **About →
|
The application version is defined in [VERSION.md](VERSION.md). Open **About →
|
||||||
Check for Updates** to check the public ARM Releases page. Downloading and
|
Check for Updates** to check the public ARM Releases page. Downloading and
|
||||||
installing are separate actions. Settings can enable startup or periodic checks.
|
installing are separate actions. Settings can enable startup or periodic checks.
|
||||||
|
|||||||
@@ -23,3 +23,18 @@ never include private configuration, credentials or signing keys.
|
|||||||
Existing version tags must point to the same commit. A public release for that
|
Existing version tags must point to the same commit. A public release for that
|
||||||
version is accepted only if its attachments match the pinned archive. Use a
|
version is accepted only if its attachments match the pinned archive. Use a
|
||||||
new authorized application version for any change to its released bytes.
|
new authorized application version for any change to its released bytes.
|
||||||
|
|
||||||
|
Before publishing a channel promotion, verify discovery and eligibility
|
||||||
|
with the already-shipped updater. The v0.6.2.1_alpha updater requires an
|
||||||
|
Alpha corrective release before it can discover Beta. Starting with
|
||||||
|
v0.6.2.2_alpha, a release can progress to a more mature channel at identical
|
||||||
|
numerical version counters. Production self-update acceptance and signed
|
||||||
|
fixture discovery are required before the promoted release is published.
|
||||||
|
|
||||||
|
Record the production executable version, process and profile fingerprints
|
||||||
|
before and after development validation. Run candidate launch tests from
|
||||||
|
isolated folders and profiles. Validate an installer in a disposable
|
||||||
|
environment that has no production installation with the same Windows
|
||||||
|
application ID. A production self-update starts from the current installed
|
||||||
|
application's update controls after publication. Retain its shutdown
|
||||||
|
acknowledgement, transaction log and restart receipt as acceptance evidence.
|
||||||
|
|||||||
@@ -28,8 +28,15 @@ JSON manifest and a base64 Ed25519 signature. Protocol 1 includes the
|
|||||||
application ID, Windows x64 architecture, exact VERSION.md value, Git commit,
|
application ID, Windows x64 architecture, exact VERSION.md value, Git commit,
|
||||||
Jenkins build number and release notes. Its installed and portable package
|
Jenkins build number and release notes. Its installed and portable package
|
||||||
records carry the exact filename, byte count and SHA-256. The trusted public
|
records carry the exact filename, byte count and SHA-256. The trusted public
|
||||||
key is embedded in both executables. A client accepts its own release channel
|
key is embedded in both executables.
|
||||||
and eligible stable releases. A package for installation must be strictly newer.
|
|
||||||
|
Starting with v0.6.2.2_alpha, a client accepts its own release channel and more
|
||||||
|
mature channels. Supported channels in order are Alpha, Beta, Release
|
||||||
|
Candidate (`rc`) and Stable. The numerical version must be at least as high
|
||||||
|
as the installed version. Maturity breaks ties at identical numerical
|
||||||
|
versions. A verified identical release can confirm that ARM is current.
|
||||||
|
Downloading and installing require a strictly newer version. About reports
|
||||||
|
version and channel exclusions separately from verification failures.
|
||||||
|
|
||||||
## Installed and portable applications
|
## Installed and portable applications
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v0.6.2.1_alpha
|
v0.6.2.2_alpha
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ from urllib.error import HTTPError, URLError
|
|||||||
from urllib.parse import quote, urlsplit
|
from urllib.parse import quote, urlsplit
|
||||||
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
||||||
|
|
||||||
from .update_release import MANIFEST, MAX_MANIFEST_SIZE, Release, UpdateError, eligible, source_config, verify_file, verify_manifest
|
from .update_release import (
|
||||||
|
MANIFEST, MAX_MANIFEST_SIZE, Release, UpdateError, eligible, exclusion_reason, source_config, verify_file, verify_manifest,
|
||||||
|
)
|
||||||
from .version import VERSION, version_key
|
from .version import VERSION, version_key
|
||||||
|
|
||||||
MAX_INDEX_SIZE = 2 * 1024**2
|
MAX_INDEX_SIZE = 2 * 1024**2
|
||||||
@@ -29,6 +31,7 @@ class Check:
|
|||||||
published: str | None
|
published: str | None
|
||||||
release: Release | None
|
release: Release | None
|
||||||
issues: tuple[str, ...]
|
issues: tuple[str, ...]
|
||||||
|
exclusions: tuple[str, ...] = ()
|
||||||
|
|
||||||
|
|
||||||
class ReleaseClient:
|
class ReleaseClient:
|
||||||
@@ -88,8 +91,10 @@ class ReleaseClient:
|
|||||||
break
|
break
|
||||||
ordered = sorted(rows, key=version_key, reverse=True)
|
ordered = sorted(rows, key=version_key, reverse=True)
|
||||||
issues = []
|
issues = []
|
||||||
|
exclusions = []
|
||||||
for version in ordered:
|
for version in ordered:
|
||||||
if not eligible(version, installed):
|
if reason := exclusion_reason(version, installed):
|
||||||
|
exclusions.append(f"{version}: {reason}")
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
if len(rows[version]) != 1:
|
if len(rows[version]) != 1:
|
||||||
@@ -106,8 +111,8 @@ class ReleaseClient:
|
|||||||
except (UpdateError, HTTPError, KeyError, TypeError, AttributeError) as exc:
|
except (UpdateError, HTTPError, KeyError, TypeError, AttributeError) as exc:
|
||||||
issues.append(f"{version}: {exc.code if isinstance(exc, HTTPError) else exc}")
|
issues.append(f"{version}: {exc.code if isinstance(exc, HTTPError) else exc}")
|
||||||
continue
|
continue
|
||||||
return Check(ordered[0], release, tuple(issues))
|
return Check(ordered[0], release, tuple(issues), tuple(exclusions))
|
||||||
return Check(ordered[0] if ordered else None, None, tuple(issues))
|
return Check(ordered[0] if ordered else None, None, tuple(issues), tuple(exclusions))
|
||||||
|
|
||||||
def download(self, release, kind, storage, progress, cancelled):
|
def download(self, release, kind, storage, progress, cancelled):
|
||||||
signed = verify_manifest(release.envelope, self.source["public_key"], release.version)
|
signed = verify_manifest(release.envelope, self.source["public_key"], release.version)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from cryptography.exceptions import InvalidSignature
|
|||||||
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
||||||
|
|
||||||
from .branding import APP_MODEL_ID
|
from .branding import APP_MODEL_ID
|
||||||
from .version import ROOT, version_key
|
from .version import CHANNELS, ROOT, version_key
|
||||||
|
|
||||||
MANIFEST = "arm-update-windows-x64.json"
|
MANIFEST = "arm-update-windows-x64.json"
|
||||||
ARCHITECTURE = "windows-x64"
|
ARCHITECTURE = "windows-x64"
|
||||||
@@ -106,7 +106,16 @@ def verify_file(path, package):
|
|||||||
raise UpdateError("Package SHA-256 does not match the signed manifest")
|
raise UpdateError("Package SHA-256 does not match the signed manifest")
|
||||||
|
|
||||||
|
|
||||||
def eligible(version, installed):
|
def exclusion_reason(version, installed):
|
||||||
|
"""Return the policy reason a tag cannot be considered for this installation."""
|
||||||
candidate = version_key(version)
|
candidate = version_key(version)
|
||||||
current = version_key(installed)
|
current = version_key(installed)
|
||||||
return candidate >= current and candidate[-1] in (current[-1], 3)
|
if candidate[:4] < current[:4]:
|
||||||
|
return f"Numerical version is older than installed {installed}"
|
||||||
|
if candidate[-1] < current[-1]:
|
||||||
|
return f"{CHANNELS[candidate[-1]].capitalize()} releases are ineligible for a {CHANNELS[current[-1]]} installation"
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def eligible(version, installed):
|
||||||
|
return exclusion_reason(version, installed) is None
|
||||||
|
|||||||
@@ -247,6 +247,8 @@ class UpdatePanel(QGroupBox):
|
|||||||
self.status.setText("No eligible verified update is available.")
|
self.status.setText("No eligible verified update is available.")
|
||||||
if value.issues:
|
if value.issues:
|
||||||
self.status.setText(self.status.text() + " Rejected " + "; ".join(value.issues)[:380])
|
self.status.setText(self.status.text() + " Rejected " + "; ".join(value.issues)[:380])
|
||||||
|
if value.exclusions:
|
||||||
|
self.status.setText(self.status.text() + " Excluded " + "; ".join(value.exclusions)[:380])
|
||||||
if value.release or not value.issues:
|
if value.release or not value.issues:
|
||||||
try:
|
try:
|
||||||
write_atomic(self.last_file, json.dumps(datetime.now().astimezone().isoformat()).encode())
|
write_atomic(self.last_file, json.dumps(datetime.now().astimezone().isoformat()).encode())
|
||||||
|
|||||||
@@ -105,6 +105,84 @@ class UpdateTests(unittest.TestCase):
|
|||||||
with patch.object(self.client, "read", side_effect=URLError("unavailable")), self.assertRaises(URLError):
|
with patch.object(self.client, "read", side_effect=URLError("unavailable")), self.assertRaises(URLError):
|
||||||
self.client.check(VERSION, "installed")
|
self.client.check(VERSION, "installed")
|
||||||
|
|
||||||
|
def test_signed_discovery_allows_the_same_or_a_more_mature_channel(self):
|
||||||
|
channels = ("alpha", "beta", "rc", "stable")
|
||||||
|
for index, installed_channel in enumerate(channels):
|
||||||
|
installed = f"v0.6.2.2_{installed_channel}"
|
||||||
|
for maturity, offered in enumerate(channels):
|
||||||
|
newer = f"v0.6.2.3_{offered}"
|
||||||
|
with self.subTest(installed=installed, candidate=newer):
|
||||||
|
row, envelope = self.row(self.metadata(newer))
|
||||||
|
with patch.object(self.client, "read", side_effect=[canonical([row]), envelope]) as read:
|
||||||
|
found = self.client.check(installed, "installed")
|
||||||
|
self.assertEqual(found.issues, ())
|
||||||
|
if maturity >= index:
|
||||||
|
self.assertEqual(found.release.version, newer)
|
||||||
|
self.assertEqual(found.exclusions, ())
|
||||||
|
else:
|
||||||
|
self.assertIsNone(found.release)
|
||||||
|
self.assertIn(f"ineligible for a {installed_channel} installation", found.exclusions[0])
|
||||||
|
self.assertEqual(read.call_count, 1)
|
||||||
|
|
||||||
|
def test_same_number_beta_is_selected_over_signed_current_alpha(self):
|
||||||
|
alpha, beta = "v0.6.2.2_alpha", "v0.6.2.2_beta"
|
||||||
|
old, _ = self.row(self.metadata(alpha))
|
||||||
|
current, signature = self.row(self.metadata(beta))
|
||||||
|
with patch.object(self.client, "read", side_effect=[canonical([old, current]), signature]):
|
||||||
|
found = self.client.check(alpha, "portable")
|
||||||
|
self.assertEqual((found.published, found.release.version, found.exclusions), (beta, beta, ()))
|
||||||
|
with patch.object(self.client, "read", return_value=canonical([old])) as read:
|
||||||
|
rejected = self.client.check(beta, "portable")
|
||||||
|
self.assertIsNone(rejected.release)
|
||||||
|
self.assertIn("Alpha releases are ineligible", rejected.exclusions[0])
|
||||||
|
self.assertEqual(read.call_count, 1)
|
||||||
|
|
||||||
|
def test_more_mature_channel_cannot_downgrade_the_numerical_version(self):
|
||||||
|
row, _ = self.row(self.metadata("v0.6.2.1_stable"))
|
||||||
|
with patch.object(self.client, "read", return_value=canonical([row])) as read:
|
||||||
|
found = self.client.check("v0.6.2.2_alpha", "installed")
|
||||||
|
self.assertIsNone(found.release)
|
||||||
|
self.assertIn("Numerical version is older", found.exclusions[0])
|
||||||
|
self.assertEqual(read.call_count, 1)
|
||||||
|
|
||||||
|
def test_identical_verified_release_cannot_be_downloaded_as_an_update(self):
|
||||||
|
row, envelope = self.row(self.metadata(VERSION))
|
||||||
|
with patch.object(self.client, "read", side_effect=[canonical([row]), envelope]):
|
||||||
|
found = self.client.check(VERSION, "installed")
|
||||||
|
self.assertEqual(found.release.version, VERSION)
|
||||||
|
with self.assertRaisesRegex(UpdateError, "newer"):
|
||||||
|
self.client.download(found.release, "installed", self.work, lambda *_: None, lambda: False)
|
||||||
|
self.assertFalse(list(self.work.iterdir()))
|
||||||
|
|
||||||
|
def test_discovery_rejects_unsupported_and_malformed_tags(self):
|
||||||
|
rows = [{"draft": False, "tag_name": tag} for tag in (
|
||||||
|
"v0.6.2.2_preview", "v0.6.2_beta", "v00.6.2.2_beta", "v0.6.2.65536_alpha",
|
||||||
|
)]
|
||||||
|
with patch.object(self.client, "read", return_value=canonical(rows)) as read:
|
||||||
|
found = self.client.check("v0.6.2.2_alpha", "installed")
|
||||||
|
self.assertIsNone(found.published)
|
||||||
|
self.assertIsNone(found.release)
|
||||||
|
self.assertEqual(read.call_count, 1)
|
||||||
|
|
||||||
|
def test_discovery_preserves_signature_architecture_and_gitea_classification_checks(self):
|
||||||
|
beta = self.metadata("v0.6.2.2_beta")
|
||||||
|
stable = self.metadata("v0.6.2.2_stable")
|
||||||
|
tampered = json.loads(self.sign(beta))
|
||||||
|
tampered["manifest"]["notes"] = "Modified"
|
||||||
|
for metadata, envelope, flag, expected in (
|
||||||
|
(beta, canonical(tampered), True, "signature is invalid"),
|
||||||
|
(beta | {"architecture": "windows-arm64"}, None, True, "metadata is invalid"),
|
||||||
|
(beta, None, False, "classification disagrees"),
|
||||||
|
(stable, None, True, "classification disagrees"),
|
||||||
|
):
|
||||||
|
with self.subTest(expected=expected, tag=metadata["version"]):
|
||||||
|
row, signature = self.row(metadata, envelope)
|
||||||
|
with patch.object(self.client, "read", side_effect=[canonical([row | {"prerelease": flag}]), signature]):
|
||||||
|
found = self.client.check("v0.6.2.2_alpha", "installed")
|
||||||
|
self.assertIsNone(found.release)
|
||||||
|
self.assertEqual(found.exclusions, ())
|
||||||
|
self.assertIn(expected, found.issues[0])
|
||||||
|
|
||||||
def test_download_cancel_and_resume(self):
|
def test_download_cancel_and_resume(self):
|
||||||
release = verify_manifest(self.sign(self.metadata()), self.public)
|
release = verify_manifest(self.sign(self.metadata()), self.public)
|
||||||
cancel = Event()
|
cancel = Event()
|
||||||
|
|||||||
Reference in New Issue
Block a user