feat(orchestrator): hub page for requirements 085 to 099
085 calm Match deck: no header hourglass, centred bare empty state, the release card as a deck card (Cancel, Skip, Release), fixed card height. 086 motion: vanish() fade everywhere with a lint test, view transitions, a lub-dub heartbeat for working objects, confetti that lands and fades. 087 time readout under the pivot of every analog clock. 088 prune dialog grouped by prefix with tri-state boxes, search, stepper and sticky footer. 089 one-row task toolbar with Filter and Actions menus and a filter chip. 090 card border by state colour with a soft glow and owner avatars. 091 draggable limit lines with staged changes and one Save, a Limits menu with the matrix, View toggles, the GPU cause in its tooltip. 093 request chips Open, Expired, Stale, Failed, All and a signed Delete. 094 closed cards leave the deck within 5 s; open in Claude stamps. 095 compact agent message box with Post/Call, attach, mic and Send in the field. 096 Reject on an expired card drops it silently as Drop (expired). 097 Show filter in Match's right-click menu. 098 docked speech bubbles carry the speaker's avatar and a skip button. 099 Match card headlines cut to 120 characters with the full title in the tooltip; the code box keeps the whole command. tests/test_hub_path_links.py: a unicode fixture without German. Full make test green through the queue (2605 tests, ruff, shellcheck, markdownlint). Gate missed on the operator's word: break 7 %, the E2E specs (13 new, 15 updated) run next. 🎯 Fix: 92 % 💥 Break: 7 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 86 🚦 Gate: ⛔ break 7 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ee52644c8
commit
6323f087bc
95 files changed
+5807
-704
No files matched your search
@@ -1,4 +1,4 @@
|
||||
"""Exercise requirement 084: the order check and the tighter-or-looser rule of the page, and the hub's limits endpoint with its passkey."""
|
||||
"""Exercise requirements 084 and 091: the order check, the pixel-to-value mapping and the staged-change classification of the page, and the hub's limits endpoint taking a batch of staged values under one passkey proof."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -62,6 +62,23 @@ console.log(JSON.stringify({
|
||||
said: L.loosened(L.withValue(calm, "ram", "mayday", 96), calm).map(L.said),
|
||||
profile: [L.profileOf(calm, profiles), L.profileOf(L.withValue(calm, "cpu", "lower", 49), profiles), L.profileOf(null, profiles)],
|
||||
untouched: calm.cpu.upper,
|
||||
round: Array.from({length: 101}, (_, value) => value).filter((value) => L.valueAt(L.pixelOf(value, 6, 114), 6, 114) !== value),
|
||||
pixels: [L.pixelOf(100, 6, 114), L.pixelOf(0, 6, 114), L.pixelOf(50, 6, 114), L.pixelOf(90, 6, 114)],
|
||||
edges: [L.valueAt(-40, 6, 114), L.valueAt(500, 6, 114), L.valueAt(6, 6, 114), L.valueAt(114, 6, 114), L.valueAt(L.pixelOf(85, 6, 114) + 0.4, 6, 114), L.valueAt(L.pixelOf(85, 6, 114) - 0.6, 6, 114)],
|
||||
staged: {
|
||||
tighter: L.review(balanced, balanced, {"cpu.upper": 85, "ram.lower": 60}),
|
||||
mixed: L.review(balanced, balanced, {"cpu.upper": 85, "ram.stop": 96, "disk.mayday": 99}),
|
||||
same: L.review(balanced, balanced, {"cpu.upper": 90}),
|
||||
above: L.review(balanced, balanced, {"cpu.upper": 96}),
|
||||
below: L.review(balanced, balanced, {"cpu.stop": 89}),
|
||||
neither: L.review(L.withValue(balanced, "swap", "upper", 10), balanced, {"cpu.lower": 60}),
|
||||
nan: L.review(balanced, balanced, {"psi.lower": NaN}).broken,
|
||||
first: L.review(balanced, null, {"cpu.upper": 85}).loose.length,
|
||||
untouched: balanced.cpu.upper,
|
||||
},
|
||||
shown: L.SHOWN,
|
||||
meanings: L.SHOWN.map(L.meaning),
|
||||
applied: L.applied(calm, {"cpu.upper": 65, "psi.mayday": 39}),
|
||||
}));
|
||||
"""
|
||||
|
||||
@@ -104,6 +121,46 @@ class TestLimitsPage(unittest.TestCase):
|
||||
self.assertEqual(self.data["profile"], ["calm", None, None])
|
||||
self.assertEqual(self.data["untouched"], 70)
|
||||
|
||||
def test_a_pixel_maps_to_its_whole_percent_and_back_and_clamps_at_the_edges(self):
|
||||
self.assertEqual(self.data["round"], [])
|
||||
top, bottom, middle, ninety = self.data["pixels"]
|
||||
self.assertEqual((top, bottom, middle), (6, 114, 60))
|
||||
self.assertAlmostEqual(ninety, 16.8)
|
||||
self.assertEqual(self.data["edges"], [100, 0, 100, 0, 85, 86])
|
||||
|
||||
def test_staged_changes_are_classified_tighter_or_looser_and_only_looser_ones_need_the_passkey(self):
|
||||
staged = self.data["staged"]
|
||||
tighter = staged["tighter"]
|
||||
self.assertEqual(tighter["changes"], [{"metric": "cpu", "level": "upper", "from": 90, "to": 85, "kind": "tighter"}, {"metric": "ram", "level": "lower", "from": 70, "to": 60, "kind": "tighter"}])
|
||||
self.assertEqual((tighter["loose"], tighter["broken"]), ([], None))
|
||||
self.assertEqual((tighter["next"]["cpu"]["upper"], tighter["next"]["ram"]["lower"], tighter["next"]["disk"]), (85, 60, BALANCED["disk"]))
|
||||
mixed = staged["mixed"]
|
||||
self.assertEqual([change["kind"] for change in mixed["changes"]], ["tighter", "looser", "looser"])
|
||||
self.assertEqual(mixed["loose"], [{"metric": "ram", "level": "stop", "from": 94, "to": 96}, {"metric": "disk", "level": "mayday", "from": 98, "to": 99}])
|
||||
self.assertIsNone(mixed["broken"])
|
||||
self.assertEqual((staged["same"]["changes"], staged["same"]["loose"]), ([], []))
|
||||
self.assertEqual(staged["first"], 20)
|
||||
self.assertEqual(staged["untouched"], 90)
|
||||
self.assertEqual(self.data["applied"], changed(changed(CALM, "cpu", "upper", 65), "psi", "mayday", 39))
|
||||
|
||||
def test_an_order_break_blocks_the_batch_and_names_the_moved_line(self):
|
||||
staged = self.data["staged"]
|
||||
order = "breaks lower < upper < STOP < MAYDAY"
|
||||
self.assertEqual(staged["above"]["broken"], {"metric": "cpu", "level": "upper", "words": f"CPU upper 96 % {order}: it must stay below STOP 95 %"})
|
||||
self.assertEqual(staged["above"]["loose"], [])
|
||||
self.assertEqual(staged["below"]["broken"], {"metric": "cpu", "level": "stop", "words": f"CPU STOP 89 % {order}: it must stay above upper 90 %"})
|
||||
self.assertEqual(staged["neither"]["broken"], {"metric": "swap", "level": "upper", "words": f"Swap upper 10 % {order}: it must stay above lower 20 %"})
|
||||
self.assertEqual(staged["nan"], {"metric": "psi", "level": "lower", "words": "PSI lower is no percent from 0 to 100"})
|
||||
|
||||
def test_every_level_and_the_target_has_a_meaning_led_by_its_name(self):
|
||||
self.assertEqual(self.data["shown"], ["lower", "upper", "stop", "mayday", "target"])
|
||||
names = ["lower", "upper", "STOP", "MAYDAY", "target"]
|
||||
for name, words in zip(names, self.data["meanings"], strict=True):
|
||||
with self.subTest(level=name):
|
||||
self.assertTrue(words.startswith(f"{name}: "), words)
|
||||
self.assertNotIn(chr(0x2014), words)
|
||||
self.assertIn("upper: the queue starts no job whose footprint would lift the load above it", self.data["meanings"][1])
|
||||
|
||||
|
||||
class TestHubLimits(HubCase):
|
||||
def setUp(self):
|
||||
@@ -184,6 +241,41 @@ class TestHubLimits(HubCase):
|
||||
self.assertEqual(status, 400, body)
|
||||
self.assertEqual(self.stored(), CALM)
|
||||
|
||||
def test_a_batch_of_tighter_staged_values_saves_in_one_request_without_a_signature(self):
|
||||
self.write_council({"limits.json": BALANCED})
|
||||
batch = changed(changed(changed(BALANCED, "cpu", "upper", 85), "ram", "lower", 60), "psi", "stop", 25)
|
||||
status, body = self.request(batch)
|
||||
self.assertEqual((status, json.loads(body)["payload"]), (200, None), body)
|
||||
status, body = self.save(batch, None)
|
||||
self.assertEqual((status, self.stored(), json.loads(body)["limits"]), (200, batch, batch), body)
|
||||
|
||||
def test_a_mixed_batch_needs_one_proof_over_the_whole_batch_and_is_refused_without_it(self):
|
||||
self.write_council({"limits.json": BALANCED})
|
||||
batch = changed(changed(changed(BALANCED, "cpu", "upper", 85), "ram", "stop", 96), "disk", "mayday", 99)
|
||||
self.assertEqual(self.save(batch, None), (400, b"not signed: no signature\n"))
|
||||
self.assertEqual(self.stored(), BALANCED)
|
||||
signer = self.pin()
|
||||
status, body = self.request(batch)
|
||||
self.assertEqual(status, 200, body)
|
||||
payload = json.loads(body)["payload"]
|
||||
self.assertEqual(payload["items"], [signing.item_hash(signing.limits_item(batch))])
|
||||
proof = signer.proof(payload, self.origin)
|
||||
wider = changed(batch, "swap", "upper", 61)
|
||||
self.assertEqual(self.save(wider, proof), (400, b"not signed: the signature does not list this item\n"))
|
||||
self.assertEqual(self.stored(), BALANCED)
|
||||
status, body = self.save(batch, proof)
|
||||
self.assertEqual((status, self.stored()), (200, batch), body)
|
||||
self.assertEqual(self.limits.read(self.council), (batch, None))
|
||||
|
||||
def test_a_batch_breaking_the_order_is_refused_whole_and_writes_nothing(self):
|
||||
self.write_council({"limits.json": BALANCED})
|
||||
batch = changed(changed(BALANCED, "cpu", "lower", 60), "cpu", "upper", 96)
|
||||
why = self.limits.problem(batch)
|
||||
self.assertIsNotNone(why)
|
||||
self.assertEqual(self.request(batch), (400, f"{why}\n".encode()))
|
||||
self.assertEqual(self.save(batch, None), (400, f"{why}\n".encode()))
|
||||
self.assertEqual(self.stored(), BALANCED)
|
||||
|
||||
def test_a_first_save_without_a_file_needs_the_passkey_even_for_calm(self):
|
||||
self.assertEqual(self.save(CALM, None), (400, b"not signed: no signature\n"))
|
||||
self.assertIsNone(self.stored())
|
||||
|
||||
Reference in new issue
Block a user