* build(workspace): vendor the approved concept stylesheet with a drift check * refactor(workspace): adopt the concept stylesheet as the workspace base * feat(workspace): concept sidebar with real navigation counts * feat(workspace): concept topbar with Theme and ComfyUI link * refactor(workspace): one concept heading and footer for every route * fix(workspace): keep the canvas link on the proxy mount A resolver failure no longer stops the shell from mounting: the ComfyUI link falls back to the root read from the page's own mount path (never another origin). Tests cover a non-standard /ComfyBackendDirect mount, including that no request escapes it. * test(workspace): concept fixture and shell comparison * test(workspace): concept fixture carries the concept inspector facts * fix(workspace): match the concept brand name and compare shell hover states * test(workspace): shell comparison mutation check and docs Add mutate() to the shared concept inventory and a shell mutation check: a nav-row min-height rule and a removed .breadcrumbs each make the comparison fail with the changed path. Harden the resolver-failure guard test with an injection count, make the overlay lint fail when workspace.css is missing, mark the library.css .row-actions leftovers for PR E, and document the concept CSS base, the overlay lint, the comparison method and the recorded shell deviations in TESTING.md. * fix(workspace): focus the page title on a route change A sidebar or history navigation now focuses #page-title, as the concept does on every hashchange (app.js 1168), so a screen reader announces the page heading instead of the main region. The first render leaves focus alone and the skip link still focuses main. The heading module's comment now describes what the shell does. * fix(workspace): give the Overview nav entry its own home glyph Overview reused the concept's Activity pulse byte for byte, so once the Activity row lands two entries would share one icon. Overview now has an outline home glyph. The shell comparison takes it from the D28 ruling instead of the concept's activity path, and the icon test checks that every approved glyph is distinct. * test(workspace): accept only #249 decision markers and state the lint scope The overlay lint accepted any D-number, so another issue's ruling such as "D5 (#245)" could mark a concept override. A marker now has to be a D-number with no other issue cited; the vocabulary rule that cited #245 reads "#245 decision 5". TESTING.md now states that the lint covers workspace.css only, lists the unmarked overrides still in images.css, and says PRs C and D run the lint over each page sheet they keep. * perf(workspace): re-read only Library and Tags counts after a Library write A confirmed Library or vocabulary write cannot change the Images count, but it re-read all three, including the Images output listing. It now re-reads only the Library and Tags counts. Each count has its own read, so a write never cancels an Images read that is still in flight.
85 lines
3.5 KiB
Python
85 lines
3.5 KiB
Python
"""The concept fixture files carry the concept inspector facts (app.js:400-414)."""
|
|
|
|
import json
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from PIL import Image
|
|
|
|
try:
|
|
from tests.open_handles import assert_closed
|
|
except ImportError: # discovered with tests/ as the top-level directory
|
|
from open_handles import assert_closed
|
|
|
|
from tests.browser.workspace_concept_fixture import (
|
|
CONCEPT_MODEL,
|
|
CONCEPT_PROMPTS,
|
|
write_concept_png,
|
|
)
|
|
from utils.prompt_inspector import inspect_prompt_evidence, read_inspection_file
|
|
|
|
|
|
class TestWorkspaceConceptFixture(unittest.TestCase):
|
|
def setUp(self):
|
|
self.tmp = tempfile.TemporaryDirectory()
|
|
self.addCleanup(self.tmp.cleanup)
|
|
self.addCleanup(assert_closed, self, self.tmp.name)
|
|
|
|
def write(self, prompt_index, round_index):
|
|
prompt = CONCEPT_PROMPTS[prompt_index]
|
|
path = Path(self.tmp.name) / f"{prompt.id}_{round_index + 1:05}.png"
|
|
image = write_concept_png(path, prompt_index, round_index)
|
|
return path, image
|
|
|
|
def test_each_image_carries_execution_evidence_and_the_concept_facts(self):
|
|
for prompt_index, round_index in ((0, 0), (0, 2), (3, 1), (5, 3)):
|
|
with self.subTest(prompt=prompt_index, round=round_index):
|
|
prompt = CONCEPT_PROMPTS[prompt_index]
|
|
path, image = self.write(prompt_index, round_index)
|
|
negative = prompt.negatives[round_index % len(prompt.negatives)][1]
|
|
inspection = read_inspection_file(path)
|
|
evidence = inspect_prompt_evidence(inspection.metadata)
|
|
# D21: "execution" is the source the panel badges "Execution recorded".
|
|
self.assertEqual(
|
|
evidence["prompts"]["positive"],
|
|
{
|
|
"status": "resolved",
|
|
"text": prompt.positive,
|
|
"source": "execution",
|
|
},
|
|
)
|
|
self.assertEqual(evidence["prompts"]["negative"]["text"], negative)
|
|
self.assertEqual(evidence["prompts"]["negative"]["source"], "execution")
|
|
graph = json.loads(inspection.metadata["prompt"])
|
|
sampler = next(
|
|
node["inputs"]
|
|
for node in graph.values()
|
|
if node["class_type"] == "KSampler"
|
|
)
|
|
self.assertEqual(
|
|
sampler["seed"], 42001 + prompt_index * 100 + round_index
|
|
)
|
|
self.assertEqual(sampler["seed"], image["seed"])
|
|
self.assertEqual(
|
|
(sampler["sampler_name"], sampler["scheduler"]),
|
|
("dpmpp_2m", "karras"),
|
|
)
|
|
self.assertEqual((sampler["steps"], sampler["cfg"]), (28, 6.5))
|
|
loader = graph[sampler["model"][0]]
|
|
self.assertEqual(loader["class_type"], "CheckpointLoaderSimple")
|
|
self.assertEqual(loader["inputs"]["ckpt_name"], CONCEPT_MODEL)
|
|
self.assertEqual(CONCEPT_MODEL, "illustrative-model.safetensors")
|
|
with Image.open(path) as source:
|
|
self.assertEqual(source.size, (image["width"], image["height"]))
|
|
|
|
def test_concept_dimensions_follow_the_prompt_index(self):
|
|
expected = [(1536, 1152), (1024, 1536), (1280, 1280)]
|
|
for prompt_index, size in enumerate(expected):
|
|
_, image = self.write(prompt_index, 1)
|
|
self.assertEqual((image["width"], image["height"]), size)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|