Integrate the Design Creations license and refine the monitor

This commit is contained in:
2026-11-26 21:46:52 -06:00
parent d2f8550111
commit 8079bf0ca6
51 changed files with 989 additions and 42 deletions

View File

@@ -9,7 +9,7 @@ from arm.providers.ssh import probe_command
SECRET = "arm-fixture-only"
COMMAND = probe_command().encode()
FRAME = (
"os\tLinux fixture\nboot\t{boot}\ncpu\tcpu\t{busy} 0 200 500 0 0 0 0 0 0\n"
"os\tLinux fixture\nboot\t{boot}\nuptime\t12345.67\ncpu\tcpu\t{busy} 0 200 500 0 0 0 0 0 0\n"
"cpu\tcpu0\t{busy} 0 200 500 0 0 0 0 0 0\n"
"ram\tMemTotal\t16384\nram\tMemAvailable\t12000\n"
"ram\tSwapTotal\t2024\nram\tSwapFree\t1024\n"

View File

@@ -35,6 +35,8 @@ class Providers(unittest.TestCase):
sleep(.85)
second = [p.sample() for p in providers]
self.assertTrue(reading(second[0], "cpu.util").valid)
self.assertGreater(reading(second[0], "system.uptime").value,
reading(first[0], "system.uptime").value)
self.assertTrue(reading(second[1], "ram.util").valid)
for sample in second:
self.assertTrue(all(r.timestamp == sample.timestamp for r in sample.readings))
@@ -48,6 +50,7 @@ class Providers(unittest.TestCase):
second, _ = parser.parse(FRAME.format(boot=1, busy=200), 11, 11)
self.assertEqual(os_label, "Linux fixture")
self.assertIsNone(reading(first, "cpu.util").value)
self.assertEqual(reading(first, "system.uptime").value, 12345.67)
self.assertEqual(reading(second, "cpu.util").value, 100)
self.assertEqual(reading(second, "disk.read").value, 51200)
self.assertEqual(reading(second, "net.total").value, 200)
@@ -55,6 +58,8 @@ class Providers(unittest.TestCase):
self.assertEqual(reading(second, "gpu.vram_pct").value, 25)
reset, _ = parser.parse(FRAME.format(boot=2, busy=400), 12, 12)
self.assertIsNone(reading(reset, "disk.read").value)
invalid, _ = parser.parse(FRAME.format(boot=2, busy=500).replace("12345.67", "-1"), 13, 13)
self.assertIsNone(reading(invalid, "system.uptime").value)
def test_directional_deltas_skip_reboot_reset_and_interface_replacement(self):
def frame(boot, rx, tx, index):

View File

@@ -16,7 +16,7 @@ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from arm.branding import APP_MODEL_ID
from arm.config import Settings
from arm.update_client import ReleaseClient, UpdateCancelled
from arm.update_release import MANIFEST, UpdateError, artifact_name, canonical, verify_manifest
from arm.update_release import LICENSE_NOTE, MANIFEST, UpdateError, artifact_name, canonical, verify_manifest
from arm.update_state import Phase, notice, notify_once, result_for, transaction_from_ack
from arm.update_worker import unpack_portable, wait_parent
from arm.version import VERSION, version_key
@@ -84,6 +84,20 @@ class UpdateTests(unittest.TestCase):
bad["packages"]["portable"][field] = value
return verify_manifest(self.sign(bad), self.public, NEW)
def test_update_license_must_match_the_signed_release(self):
new_license = b"# Distinct license terms\n"
meta = self.metadata()
with self.assertRaisesRegex(UpdateError, "no signed software license"):
self.client.read_license(verify_manifest(self.sign(meta), self.public))
meta["notes"] += f"\n\n{LICENSE_NOTE}{sha256(new_license).hexdigest()}"
release = verify_manifest(self.sign(meta), self.public)
with patch.object(self.client, "read", return_value=new_license) as read:
self.assertEqual(self.client.read_license(release), new_license.decode())
self.assertTrue(read.call_args.args[0].endswith(f"/raw/tag/{NEW}/LICENSE.md"))
with patch.object(self.client, "read", return_value=b"Changed text"):
with self.assertRaisesRegex(UpdateError, "does not match"):
self.client.read_license(release)
def test_discovery_verified_current_and_older(self):
for version in (NEW, VERSION, OLD):
row, raw = self.row(self.metadata(version))

View File

@@ -257,6 +257,9 @@ def validate_packages(release, work, result, upgrade_from=None, captures=None, p
assert json.loads((payload / "BUILD.json").read_text())["version"] == VERSION
assert VERSION in (payload / "CHANGELOG.md").read_text(encoding="utf-8")
assert (payload / "Third-party notices" / "README.md").is_file()
assert (payload / "LICENSE.md").read_bytes() == (ROOT / "LICENSE.md").read_bytes()
assert "Redistributions in binary form" in (
payload / "Third-party notices" / "NVIDIA-NVML-Python-LICENSE.txt").read_text(encoding="utf-8")
for name in ("LGPL-3.0-only.txt", "GPL-3.0-only.txt"):
assert (payload / "Third-party notices" / name).read_bytes() == (
ROOT / "packaging" / "qt-notices" / name).read_bytes()
@@ -377,6 +380,30 @@ def verify_branding(session, results, captures=None):
assert not session.expanded.monitor_visible
assert not session.about_page.app_image.picture.isNull()
assert not session.about_page.company_image.picture.isNull()
assert session.about_page.view_license.isEnabled()
assert any(label.text() == "DC-ANCSA v1.0" for label in session.about_page.findChildren(QLabel))
seen_geometry = []
def inspect_license():
from arm.software_license import LicenseDialog
dialog = session.qt.activeModalWidget()
assert isinstance(dialog, LicenseDialog)
content = dialog.browser.toPlainText()
assert "Design Creations Attribution-NonCommercial-ShareAlike License" in content
assert "Additional permissions and reserved rights" in content
assert dialog.browser.isReadOnly() and dialog.browser.verticalScrollBar().maximum() > 0
if not seen_geometry:
dialog.move(80, 90)
dialog.resize(650, 530)
else:
assert dialog.geometry() == seen_geometry[0]
seen_geometry.append(dialog.geometry())
dialog.reject()
for _ in range(2):
QTimer.singleShot(0, inspect_license)
session.about_page.view_license.click()
assert len(seen_geometry) == 2
session.about_page.open_link("THIRD_PARTY.md")
assert session.about_page.document_group.title() == "Third-party Notices"
assert "CPython" in session.about_page.browser.toPlainText()
@@ -517,6 +544,15 @@ def verify_update_notices(session, wait_for, results, captures):
wait_for(lambda: update.job is None)
assert not menu.update.isVisible() and expanded.update_banner.isHidden()
assert hover.popup_size() == initial_size
update.accept_outcome((Phase.SUCCESS, "ARM installed and restarted."))
confirmation = update.root / "confirmation.json"
before = confirmation.read_bytes()
assert hover.update_banner.label.text() and expanded.update_banner.label.text()
assert hover.update_banner.action.text() == "View Changelog"
hover.update_banner.action.click()
assert session.about_page.document_group.title() == "Change Log"
assert hover.update_banner.isHidden() and expanded.update_banner.isHidden()
assert confirmation.read_bytes() == before
expanded.close()
finally:
fixture.doCleanups()
@@ -662,15 +698,15 @@ def verify_machine_display(session, wait_for, results, captures):
app.processEvents()
viewport = hover.simultaneous.viewport()
local_header = hover.sections[local].title
local_card = hover.sections[local].cards["ram"].plot
section_objects = dict(hover.sections)
viewport_origin = lambda: viewport.mapToGlobal(QPoint(viewport.width() // 2, 3))
point = lambda w: w.mapToGlobal(w.rect().center())
bottom = viewport.mapToGlobal(QPoint(viewport.width() // 2, viewport.height() - 3))
before = persisted()
drag_to(hover.drag, local_header, point(local_header), bottom, cancel=True)
drag_to(hover.drag, local_card, point(local_card), bottom, cancel=True)
assert persisted() == before
drag_to(hover.drag, local_header, point(local_header), bottom, scroll_to_end=True)
drag_to(hover.drag, local_card, point(local_card), bottom, scroll_to_end=True)
assert hover.displayed == (rain, phantom, lamp, phantomnet, local)
assert persisted().order == hover.displayed and hover.sections == section_objects
assert tuple(tray.entries) == hover.displayed
@@ -856,8 +892,13 @@ def evaluate_app(work, results, short=False, captures=None):
assert len(set(modes.values())) == 4, modes
results["rendered_modes"] = modes
assert ConfigStore(root / "settings.json").load().mode == "Composite"
menu.pin.trigger()
session.activate_icon(LOCAL, QSystemTrayIcon.ActivationReason.Trigger)
assert session.popup.isVisible() and not session.popup.pinned
assert all(action.text() != "Pin Resource Monitor" for action in menu.actions())
session.popup.pin.click()
assert session.popup.isVisible() and session.popup.pinned
session.activate_icon(LOCAL, QSystemTrayIcon.ActivationReason.Trigger)
assert session.popup.pinned
assert sum(card.isVisible() for card in session.popup.cards.values()) == len(RESOURCES)
wait_for(lambda: session.popup.frameGeometry().isValid())
if not short: