SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Icon tools: hashes and palette revisions ignore CRLF checkouts, text I/O is UTF-8 (#1930) (#1931)
HiroKenEz45d0b6053bf1
diff --git a/assets/icons/ui/design/tools/icon_palette.py b/assets/icons/ui/design/tools/icon_palette.pyindex c399cc7fac..0410d1f8e8 100644--- a/assets/icons/ui/design/tools/icon_palette.py+++ b/assets/icons/ui/design/tools/icon_palette.py@@ -113,7 +113,8 @@ def palette_css(palette):def revision(path):- with open(path, 'rb') as source: return hashlib.sha256(source.read()).hexdigest()+ # As save_colours reads it: text, so a CRLF checkout's line endings read as LF.+ with open(path, encoding='utf-8') as source: return hashlib.sha256(source.read().encode()).hexdigest()def save_colours(path, base_revision, changes):diff --git a/assets/icons/ui/design/tools/icon_status.py b/assets/icons/ui/design/tools/icon_status.pyindex 2f2446f32a..b692756547 100644--- a/assets/icons/ui/design/tools/icon_status.py+++ b/assets/icons/ui/design/tools/icon_status.py@@ -82,7 +82,7 @@ def scan():for f in glob.glob(ROOT + '/crates/ui-egui/src/**/*.rs', recursive=True):t = open(f, encoding='utf-8').read()for name in ui_icon_names(t):- uses[name].append('ui:' + os.path.relpath(f, ROOT + '/crates/ui-egui/src'))+ uses[name].append('ui:' + os.path.relpath(f, ROOT + '/crates/ui-egui/src').replace(os.sep, '/'))mk = ROOT + '/assets/icons/ui/source/markers.rs'if os.path.exists(mk):for name in re.findall(r'=> "(c_[a-z_]+)"', open(mk, encoding='utf-8').read()): uses[name].append('ui:sketch constraint glyph')@@ -284,7 +284,7 @@ if '--serve' in args:request_id = uuid.uuid4().hexpath = os.path.join(REQUESTS, request_id + '.json')# Publish a complete snapshot atomically so the chat never reads half a request.- with open(path + '.tmp', 'w') as f:+ with open(path + '.tmp', 'w', encoding='utf-8') as f:json.dump({'version': 1, 'id': request_id,'created_at': datetime.datetime.now(datetime.timezone.utc).isoformat(),'notes': {i: r['notes'][i] for i in todo}}, f, indent=1)diff --git a/assets/icons/ui/design/tools/lint_icons.py b/assets/icons/ui/design/tools/lint_icons.pyindex c8bce5ae9c..6c7fe532cd 100644--- a/assets/icons/ui/design/tools/lint_icons.py+++ b/assets/icons/ui/design/tools/lint_icons.py@@ -80,16 +80,14 @@ if os.path.exists(references):for message in icon_palette.validation_errors(pal, names | set(al)):err(d + '/palette.toml', message)# an icon accepted as final on the review page must not change (un-accept it there to work on it again)-import json, hashlib+import json, review_staterp = d + '/review.json'if os.path.exists(rp):- fin = json.load(open(rp)).get('final', {})+ fin = json.load(open(rp, encoding='utf-8')).get('final', {})for iid, want in (fin.items() if isinstance(fin, dict) else []):v = al.get(iid, iid); m = v.get('master') if isinstance(v, dict) else vif not want: continue- h = hashlib.sha256()- for f in sorted(glob.glob(d + '/svg/*/' + m + '.svg')):- h.update(os.path.relpath(f, d).replace(os.sep, '/').encode()); h.update(open(f, 'rb').read())- if h.hexdigest() != want: err(rp, 'final icon %s changed (master %s): un-accept it on the review page before editing it' % (iid, m))+ # The review page's own hash, so the two can't disagree.+ if review_state.master_hash(m, d) != want: err(rp, 'final icon %s changed (master %s): un-accept it on the review page before editing it' % (iid, m))print('\n'.join(bad) if bad else 'icons: %d masters, palette, naming and element rules ok' % len(files))sys.exit(1 if bad else 0)diff --git a/assets/icons/ui/design/tools/preview.py b/assets/icons/ui/design/tools/preview.pyindex 69bf160db0..400fe8df1b 100644--- a/assets/icons/ui/design/tools/preview.py+++ b/assets/icons/ui/design/tools/preview.py@@ -14,9 +14,9 @@ for theme in ('light', 'dark'):for fam in sorted(os.listdir(d + '/svg')):h += '<div class="p %s"><h3>%s - %s</h3>' % (theme, fam, theme)for f in sorted(glob.glob('%s/svg/%s/*.svg' % (d, fam))):- svg, icon = open(f).read(), os.path.basename(f)[:-4]+ svg, icon = open(f, encoding='utf-8').read(), os.path.basename(f)[:-4]h += '<div class=c>'h += '<div style="width:64px;height:64px;margin:auto">%s</div>' % themed(svg, theme, icon, fam, 64).replace('<svg ', '<svg width=64 height=64 ', 1)h += '<div class=s>' + ''.join('<span style="width:%dpx;height:%dpx;display:inline-block">%s</span>' % (s, s, themed(svg, theme, icon, fam, s).replace('<svg ', '<svg width=%d height=%d ' % (s, s), 1)) for s in (16, 20, 26)) + '</div>' + icon + '</div>'h += '</div>'-open(out, 'w').write(h)+open(out, 'w', encoding='utf-8').write(h)diff --git a/assets/icons/ui/design/tools/review_state.py b/assets/icons/ui/design/tools/review_state.pyindex 2b78ae2a99..e313276f81 100644--- a/assets/icons/ui/design/tools/review_state.py+++ b/assets/icons/ui/design/tools/review_state.py@@ -16,10 +16,14 @@ def aliases():def master_of(icon_id, al=None):v = (aliases() if al is None else al).get(icon_id)return (v['master'] if isinstance(v, dict) else v) if v else icon_id-def master_hash(master):+def lf(data):+ """Text as committed: a checkout with CRLF line endings (Git for Windows' default) hashes as LF."""+ return data.replace(b'\r\n', b'\n')+def master_hash(master, design=None):+ d = D if design is None else designh = hashlib.sha256()- for f in sorted(glob.glob(D + '/svg/*/' + master + '.svg')):- h.update(os.path.relpath(f, D).replace(os.sep, '/').encode()); h.update(open(f, 'rb').read())+ for f in sorted(glob.glob(d + '/svg/*/' + master + '.svg')):+ h.update(os.path.relpath(f, d).replace(os.sep, '/').encode()); h.update(lf(open(f, 'rb').read()))return h.hexdigest()def load():try: r = json.load(open(REVIEW, encoding='utf-8'))diff --git a/tests/tools/test_icon_export.py b/tests/tools/test_icon_export.pyindex 1e6d977afc..bbc8f85fa0 100644--- a/tests/tools/test_icon_export.py+++ b/tests/tools/test_icon_export.py@@ -24,31 +24,31 @@ class IconExportTest(unittest.TestCase):for name in ('icon_status.py', 'review_state.py', 'icon_palette.py'):shutil.copy(source / name, tools / name)shutil.copytree(source / 'review', tools / 'review')- (design / 'palette.toml').write_text('[roles.line]\nlight="#000000"\ndark="#ffffff"\n')+ (design / 'palette.toml').write_text('[roles.line]\nlight="#000000"\ndark="#ffffff"\n', encoding='utf-8')for name in ('aliases.toml',):- (design / name).write_text('')+ (design / name).write_text('', encoding='utf-8')svg = design / 'svg/model'svg.mkdir(parents=True)for name in ('agent_chat', 'pattern_flip', 'normal', 'infinite', 'trace'):- (svg / (name + '.svg')).write_text('<svg viewBox="0 0 64 64"></svg>')+ (svg / (name + '.svg')).write_text('<svg viewBox="0 0 64 64"></svg>', encoding='utf-8')ui = root / 'crates/ui-egui/src'(ui / 'agent_chat').mkdir(parents=True)- (ui / 'agent_chat/panel.rs').write_text('icons::paint(p, r, "agent_chat", ink, fill, a);')- (ui / 'dialogs.rs').write_text('pattern_toggle(ui, alignment_label, "Flip direction", "pattern_flip", reversed);')+ (ui / 'agent_chat/panel.rs').write_text('icons::paint(p, r, "agent_chat", ink, fill, a);', encoding='utf-8')+ (ui / 'dialogs.rs').write_text('pattern_toggle(ui, alignment_label, "Flip direction", "pattern_flip", reversed);', encoding='utf-8')(ui / 'sketch_palette.rs').write_text('''for (i, (label, icon, tip)) in [("—", "normal", "Normal"),("↔", "infinite", "Infinite"),].iter().enumerate() { icons::paint(p, r, icon, ink, fill, a); }- ''')+ ''', encoding='utf-8')engine = root / 'crates/engine/src/cmd'engine.mkdir(parents=True)# A long builder must not lose its icon after the first fourteen lines.(engine / 'motion.rs').write_text('CommandSpec::new("motion.trace", "Trace", trace)\n'- + '\n' * 16 + '.icon("trace").params("doc");')+ + '\n' * 16 + '.icon("trace").params("doc");', encoding='utf-8')subprocess.run([sys.executable, '-B', str(tools / 'icon_status.py'), '--csv'],check=True, capture_output=True, text=True)- with open(root / 'target/icon-inventory.csv') as f:+ with open(root / 'target/icon-inventory.csv', encoding='utf-8') as f:rows = {r['icon']: r for r in csv.DictReader(f)}self.assertEqual(set(rows), {'agent_chat', 'pattern_flip', 'normal', 'infinite', 'trace'})self.assertIn('agent_chat/panel.rs', rows['agent_chat']['used_by_ui'])@@ -68,15 +68,15 @@ class IconExportTest(unittest.TestCase):shutil.copy(source / name, tools / name)shutil.copytree(source / 'review', tools / 'review')for name in ('palette.toml', 'aliases.toml'):- (design / name).write_text('')- (design / 'palette.toml').write_text('[roles.line]\nlight="#000000"\ndark="#ffffff"\n')+ (design / name).write_text('', encoding='utf-8')+ (design / 'palette.toml').write_text('[roles.line]\nlight="#000000"\ndark="#ffffff"\n', encoding='utf-8')svg = design / 'svg/model'svg.mkdir(parents=True)for name in ('box', 'joint'):- (svg / (name + '.svg')).write_text('<svg viewBox="0 0 64 64"></svg>')+ (svg / (name + '.svg')).write_text('<svg viewBox="0 0 64 64"></svg>', encoding='utf-8')# An accepted icon's note must never be exported, even if it still has text.original = {'final': {'box': ''}, 'notes': {'box': 'Keep it', 'joint': 'Round the corners\nUse related icons'}}- (design / 'review.json').write_text(json.dumps(original))+ (design / 'review.json').write_text(json.dumps(original), encoding='utf-8')with socket.socket() as port_socket:port_socket.bind(('127.0.0.1', 0))port = port_socket.getsockname()[1]@@ -112,7 +112,7 @@ class IconExportTest(unittest.TestCase):self.assertEqual(result['sent'], 1)requests = list(inbox.glob('*.json'))self.assertEqual(len(requests), 1)- request = json.loads(requests[0].read_text())+ request = json.loads(requests[0].read_text(encoding='utf-8'))self.assertEqual(request['id'], result['request_id'])self.assertEqual(request['notes'], {'joint': original['notes']['joint']})self.assertFalse(list(inbox.glob('*.tmp')))@@ -123,14 +123,14 @@ class IconExportTest(unittest.TestCase):self.assertNotIn('Claude', page)self.assertIn('location.reload()', page)# Existing tabs also reload when the server's page implementation changes.- with open(tools / 'icon_status.py', 'a') as f:+ with open(tools / 'icon_status.py', 'a', encoding='utf-8') as f:f.write('\n# page update\n')with urllib.request.urlopen(url + '/api/review', timeout=2) as response:self.assertNotEqual(json.load(response)['rev'], base['rev'])# A note resolved on disk cannot be resurrected by an unchanged stale page.- saved = json.loads((design / 'review.json').read_text())+ saved = json.loads((design / 'review.json').read_text(encoding='utf-8'))saved['notes'] = {'box': 'Keep it'}- (design / 'review.json').write_text(json.dumps(saved))+ (design / 'review.json').write_text(json.dumps(saved), encoding='utf-8')empty = post('/api/export', state)self.assertEqual(empty['sent'], 0)self.assertEqual(len(list(inbox.glob('*.json'))), 1)diff --git a/tests/tools/test_icon_line_endings.py b/tests/tools/test_icon_line_endings.pynew file mode 100644index 0000000000..52bd405888--- /dev/null+++ b/tests/tools/test_icon_line_endings.py@@ -0,0 +1,39 @@+"""The icon tools read a checkout with CRLF line endings (Git for Windows' default) as the LF text committed (#1930)."""+from pathlib import Path+import sys+import tempfile+import unittest++TOOLS = Path(__file__).resolve().parents[2] / 'assets/icons/ui/design/tools'+sys.path.insert(0, str(TOOLS))+import icon_palette # noqa: E402+import review_state # noqa: E402++SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">\n<circle cx="32" cy="32" r="20"/>\n</svg>\n'+++class LineEndingTest(unittest.TestCase):+ def test_an_accepted_icon_hashes_the_same_checked_out_with_crlf(self):+ with tempfile.TemporaryDirectory() as temporary:+ hashes = []+ for newline in (b'\n', b'\r\n'):+ design = Path(temporary) / ('crlf' if newline == b'\r\n' else 'lf')+ (design / 'svg/model').mkdir(parents=True)+ (design / 'svg/model/box.svg').write_bytes(SVG.encode().replace(b'\n', newline))+ hashes.append(review_state.master_hash('box', str(design)))+ self.assertEqual(hashes[0], hashes[1])++ def test_a_palette_checked_out_with_crlf_takes_a_save_at_its_own_revision(self):+ palette = '# roles\n[roles.ink]\nlight = "#111111"\ndark = "#eeeeee"\n'+ with tempfile.TemporaryDirectory() as temporary:+ path = Path(temporary) / 'palette.toml'+ path.write_bytes(palette.encode().replace(b'\n', b'\r\n'))+ lf = Path(temporary) / 'lf.toml'+ lf.write_bytes(palette.encode())+ self.assertEqual(icon_palette.revision(path), icon_palette.revision(lf))+ icon_palette.save_colours(path, icon_palette.revision(path), {'roles.ink': {'light': '#222222', 'dark': '#dddddd'}})+ self.assertIn('dark = "#dddddd"', path.read_text(encoding='utf-8'))+++if __name__ == '__main__':+ unittest.main()diff --git a/tests/tools/test_icon_review.py b/tests/tools/test_icon_review.pyindex a61d8b34bf..bcdf256d83 100644--- a/tests/tools/test_icon_review.py+++ b/tests/tools/test_icon_review.py@@ -26,11 +26,11 @@ def review_fixture():design = root / 'assets/icons/ui/design'shutil.copytree(TOOLS, design / 'tools')(design / 'svg/model').mkdir(parents=True)- (design / 'svg/model/box.svg').write_text(SVG)+ (design / 'svg/model/box.svg').write_text(SVG, encoding='utf-8')shutil.copy2(TOOLS.parent / 'palette.toml', design / 'palette.toml')- (design / 'references.toml').write_text('[category.model]\nlabel="Model"\nrule="Standard projection"\nicons=["box"]\n')- (design / 'aliases.toml').write_text('[alias]\nbox_alias="box"\n')- (design / 'review.json').write_text(json.dumps({'final': {'box': ''}, 'notes': {}}))+ (design / 'references.toml').write_text('[category.model]\nlabel="Model"\nrule="Standard projection"\nicons=["box"]\n', encoding='utf-8')+ (design / 'aliases.toml').write_text('[alias]\nbox_alias="box"\n', encoding='utf-8')+ (design / 'review.json').write_text(json.dumps({'final': {'box': ''}, 'notes': {}}), encoding='utf-8')with socket.socket() as available:available.bind(('127.0.0.1', 0))port = available.getsockname()[1]@@ -99,7 +99,7 @@ class IconReviewTest(unittest.TestCase):def test_live_palette_tokens_save_only_display_colours_and_reject_stale_or_invalid_changes(self):with review_fixture() as (root, design, get, post):palette_path = design / 'palette.toml'- original = palette_path.read_text()+ original = palette_path.read_text(encoding='utf-8')palette = tomllib.loads(original)state = json.loads(get('/api/palette'))tokens = {token['id']: token for token in state['tokens']}@@ -125,9 +125,9 @@ class IconReviewTest(unittest.TestCase):target = expectedfor part in key.split('.'): target = target[part]target.update(colours)- self.assertEqual(tomllib.loads(palette_path.read_text()), expected)- self.assertIn('# Icon colour roles.', palette_path.read_text(), 'comments remain intact')- self.assertEqual(tomllib.loads(palette_path.read_text())['roles']['ink']['source'], palette['roles']['ink']['source'])+ self.assertEqual(tomllib.loads(palette_path.read_text(encoding='utf-8')), expected)+ self.assertIn('# Icon colour roles.', palette_path.read_text(encoding='utf-8'), 'comments remain intact')+ self.assertEqual(tomllib.loads(palette_path.read_text(encoding='utf-8'))['roles']['ink']['source'], palette['roles']['ink']['source'])for revision, changes in [(state['revision'], {'roles.ink': paints}),(saved['revision'], {'roles.ink.source': paints}),@@ -152,7 +152,7 @@ class IconReviewTest(unittest.TestCase):with review_fixture() as (root, design, get, post):source = '''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><defs><clipPath id="left"><path d="M0 0L32 0L32 64L0 64Z"/></clipPath></defs><circle id="base" cx="32" cy="32" r="28" fill="#8e9faf"/><g clip-path="url(#left)"><circle cx="32" cy="32" r="12" fill="#ffffff"/></g><circle id="foreground" cx="32" cy="32" r="3" fill="#236ead"/></svg>'''path = design / 'svg/model/cutout.svg'- path.write_text(source)+ path.write_text(source, encoding='utf-8')accepted = (design / 'review.json').read_bytes()page = get('/')fragments = [svg for svg in re.findall(r'<svg\b.*?</svg>', page, re.S) if '-base"' in svg]@@ -172,17 +172,17 @@ class IconReviewTest(unittest.TestCase):self.assertTrue(foreground.get('id').endswith('-foreground'))self.assertIsNone(foreground.get('mask'))self.assertNotIn('roles-gap-', svg)- self.assertEqual(path.read_text(), source)+ self.assertEqual(path.read_text(encoding='utf-8'), source)self.assertEqual((design / 'review.json').read_bytes(), accepted)def test_semantic_colours_reload_from_one_palette_without_changing_acceptance(self):with review_fixture() as (root, design, get, post):palette = design / 'palette.toml'- colours = tomllib.loads(palette.read_text())+ colours = tomllib.loads(palette.read_text(encoding='utf-8'))source = colours['roles']['active-3'].get('source', colours['roles']['active-3']['light'])art = SVG.replace('currentColor', source)for name in ('line', 'c_fix'):- (design / f'svg/model/{name}.svg').write_text(art)+ (design / f'svg/model/{name}.svg').write_text(art, encoding='utf-8')with (design / 'aliases.toml').open('a') as aliases:aliases.write('ground="c_fix"\nsurface_line={master="line",accent="surface"}\n')state, accepted = get('/api/review'), (design / 'review.json').read_bytes()@@ -198,13 +198,13 @@ class IconReviewTest(unittest.TestCase):self.assertIn(colours['accents']['surface']['active-3']['light'], card(page, 'surface_line'),'explicit alias accent wins over the Sketch master')def set_light(section, colour):- lines, current = palette.read_text().splitlines(), ''+ lines, current = palette.read_text(encoding='utf-8').splitlines(), ''for index, line in enumerate(lines):if line.strip().startswith('['):current = line.strip().split(']', 1)[0] + ']'elif current == '[' + section + ']' and line.split('=', 1)[0].strip() == 'light':lines[index] = 'light = ' + json.dumps(colour)- palette.write_text('\n'.join(lines) + '\n')+ palette.write_text('\n'.join(lines) + '\n', encoding='utf-8')returnself.fail('missing palette section ' + section)replacement = '#123456' if colours['accents']['sketch']['active-3']['light'] != '#123456' else '#654321'@@ -215,7 +215,7 @@ class IconReviewTest(unittest.TestCase):set_light('roles.active-3', base)self.assertIn(base, card(get('/'), 'ground'), 'source identifiers survive changing the base display palette too')self.assertEqual((design / 'review.json').read_bytes(), accepted)- self.assertEqual((design / 'svg/model/line.svg').read_text(), art)+ self.assertEqual((design / 'svg/model/line.svg').read_text(encoding='utf-8'), art)def test_new_unused_masters_and_alias_targets_are_never_hidden(self):with review_fixture() as (root, design, get, post):@@ -223,7 +223,7 @@ class IconReviewTest(unittest.TestCase):page = get('/')self.assertIn('data-id="box"', page, 'unused alias target must still have a card')self.assertIn('data-id="box_alias"', page)- (design / 'svg/model/brand_new.svg').write_text(SVG)+ (design / 'svg/model/brand_new.svg').write_text(SVG, encoding='utf-8')current = get('/api/review')self.assertNotEqual(original['rev'], current['rev'])self.assertNotIn('brand_new', current['final'])@@ -241,25 +241,25 @@ class IconReviewTest(unittest.TestCase):with review_fixture() as (root, design, get, post):initial = get('/api/review')self.assertIn('box', initial['final'])- old_hash = json.loads((design / 'review.json').read_text())['final']['box']- (design / 'svg/model/box.svg').write_text(SVG.replace('r="20"', 'r="18"'))+ old_hash = json.loads((design / 'review.json').read_text(encoding='utf-8'))['final']['box']+ (design / 'svg/model/box.svg').write_text(SVG.replace('r="20"', 'r="18"'), encoding='utf-8')changed = get('/api/review')self.assertNotIn('box', changed['final'])self.assertIn('changed since acceptance', get('/'))- self.assertEqual(old_hash, json.loads((design / 'review.json').read_text())['final']['box'])- (design / 'svg/model/box.svg').write_text(SVG.replace('r="20"', 'r="17"'))+ self.assertEqual(old_hash, json.loads((design / 'review.json').read_text(encoding='utf-8'))['final']['box'])+ (design / 'svg/model/box.svg').write_text(SVG.replace('r="20"', 'r="17"'), encoding='utf-8')with self.assertRaises(urllib.error.HTTPError) as error:post(changed, final=['box'])self.assertEqual(error.exception.code, 400)post(get('/api/review'), final=['box'])self.assertIn('box', get('/api/review')['final'])- self.assertNotEqual(old_hash, json.loads((design / 'review.json').read_text())['final']['box'])+ self.assertNotEqual(old_hash, json.loads((design / 'review.json').read_text(encoding='utf-8'))['final']['box'])def test_missing_art_is_visible_but_cannot_be_accepted(self):with review_fixture() as (root, design, get, post):commands = root / 'crates/engine/src/cmd'commands.mkdir(parents=True)- (commands / 'example.rs').write_text('CommandSpec::new("example.action", "Example", run).icon("missing");')+ (commands / 'example.rs').write_text('CommandSpec::new("example.action", "Example", run).icon("missing");', encoding='utf-8')page = get('/')self.assertIn('data-id="missing"', page)self.assertIn('aria-label="Accept missing as final" disabled', page)@@ -275,16 +275,16 @@ class IconReviewTest(unittest.TestCase):state = get('/api/review')self.assertEqual(post(state, endpoint='/api/export')['sent'], 0)# A stale page changes another note; it must not resurrect replaced feedback.- saved = json.loads((design / 'review.json').read_text())+ saved = json.loads((design / 'review.json').read_text(encoding='utf-8'))saved['notes']['box'] = 'Newer feedback'- (design / 'review.json').write_text(json.dumps(saved))+ (design / 'review.json').write_text(json.dumps(saved), encoding='utf-8')post(state, notes={**state['notes'], 'box_alias': 'Another note'})self.assertEqual(get('/api/review')['notes']['box'], 'Newer feedback')self.assertFalse(list(design.glob('*.tmp')))def test_export_resolution_preserves_notes_added_since_the_snapshot(self):with review_fixture() as (root, design, get, post):- (design / 'svg/model/fresh.svg').write_text(SVG)+ (design / 'svg/model/fresh.svg').write_text(SVG, encoding='utf-8')state = get('/api/review')post(state, notes={'fresh': 'Newer feedback'})script = """@@ -312,14 +312,14 @@ assert review_state.load()['notes'] == {}with review_fixture() as (root, design, get, post):# The fixture's palette is intentionally minimal; the scaffold uses# the real helper constants and emits an editable starter SVG.- (root / 'ATTRIBUTION.md').write_text('# Attribution\n')+ (root / 'ATTRIBUTION.md').write_text('# Attribution\n', encoding='utf-8')command = [sys.executable, '-B', str(design / 'tools/author/new_icon.py')]first = subprocess.run(command + ['fresh_shape', '--base', 'cube'], capture_output=True, text=True)self.assertEqual(first.returncode, 0, first.stderr)artwork = design / 'svg/model/fresh_shape.svg'self.assertTrue(artwork.exists())self.assertNotIn('fresh_shape', get('/api/review')['final'])- self.assertIn('fresh_shape.svg', (root / 'ATTRIBUTION.md').read_text())+ self.assertIn('fresh_shape.svg', (root / 'ATTRIBUTION.md').read_text(encoding='utf-8'))before = artwork.read_bytes()again = subprocess.run(command + ['fresh_shape'], capture_output=True, text=True)self.assertNotEqual(again.returncode, 0)