Files
softharbor/scripts
poli0981andClaude Opus 5 f46573c882 fix: CSP was silently dropping every inline style; repair CI workflows
The reported overlap - page content bleeding through the sticky header - was
not a layout bug. The header's computed background-color was rgba(0,0,0,0):
fully transparent, despite style="background: var(--sh-bg)" being present in
the emitted HTML.

Cause: CSP style-src governs inline style ATTRIBUTES, not just <style> blocks,
and hashes do not apply to attributes - only 'unsafe-hashes' or
'unsafe-inline' would permit them, and our policy (D20) has neither. So every
style="..." was being discarded by the browser. Nothing errored. The build
passed, the source read correctly, and the declaration simply was not applied.
49 of them had accumulated since P1, which is also why muted text was rendering
in --sh-ink and borders in the wrong token.

Verified by probe rather than inference: an element given
style="background: rgb(1,2,3)" computes to transparent in this page context.

Fix, not workaround: the design tokens are now Tailwind colours mapped to the
runtime custom properties, so every use is a utility (text-sh-muted,
bg-sh-surface, border-sh-border) and theming still switches on
html[data-theme]. Relaxing style-src to 'unsafe-inline' would have "fixed" the
symptom while giving up the policy.

Added scripts/check-no-inline-styles.mjs, run in CI after build: any style=
reaching dist/ fails. This class of bug is invisible - it deserves a permanent
check rather than vigilance. It immediately earned its place by catching a
dynamic style={`color: var(--sh-${...})`} that the literal-match conversion
could not see.

CI workflows, both of which failed at startup on every push:
- ci.yml is now self-contained. reusable-web-react.yml's Pages-deploy job
  declares pages: write and id-token: write; a caller cannot request less, so
  GitHub rejected the whole run before any step - even though that job is
  skipped by deploy-pages: false. Granting those would hand a Workers-deployed
  site the ability to mint OIDC tokens it never uses. Separately, that workflow
  runs lint/typecheck/test only "if the script exists", so a renamed script
  silently green-lights. This repo has already shipped four silent no-ops; a
  quietly-skipping CI is the wrong tool for it.
- codeql.yml passes languages as a JSON ARRAY STRING. The reusable workflow
  feeds it to fromJSON for its matrix, so a bare value throws at startup.

NOT fixed here, because it is not mine to fix: the deploy workflow fails with
Cloudflare "Authentication error [code: 10000]" on /workers/routes. The API
token needs Zone -> Workers Routes -> Edit and Zone -> DNS -> Edit. My local
deploys succeeded throughout because wrangler uses OAuth, which masked the gap
entirely.

Gate: lint, i18n:check, validate:data, 99 tests, astro check (0 errors), build,
check:styles, knip - all green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 15:01:53 +07:00
..