Wilfried Djata a8f4e7e1ec test(brand): decode subprocess output as UTF-8 and cover the error path
test_sync_brand_to_tokens.py drives sync-brand-to-tokens.cjs through
subprocess.run with text=True but no explicit encoding, so Python decodes the
pipe with the locale codec. Three of the script's messages carry emoji whose
UTF-8 bytes land on cp1252's undefined slots: 0x8F in the "no base hex found"
warning (sync-brand-to-tokens.cjs:132), 0x9D in the "brand guidelines not found"
error (:198), and 0x8F in the dry-run notice (:223). Decoding then raises inside
subprocess's reader thread, the stream comes back as None, and any assertion
against it fails with `TypeError: argument of type 'NoneType' is not a
container` -- which hides the real result behind an unrelated error.

The existing test passes today only because the bundled starter fixture happens
to take none of those three paths.

Pin the pipe to UTF-8, extracted into a shared _run helper to match the idiom in
design-system's test module, and add a regression test for the missing-guidelines
path -- the default state of any project that has not run the brand skill yet.
That test fails without the encoding fix (stderr is None) and passes with it.

Follow-up to #460

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 14:33:39 +00:00
..