Skip to content

Format worker/main.ts and remove its prettier carve-out - #195

Merged
BigSimmo merged 1 commit into
mainfrom
fix/worker-main-format
Jul 2, 2026
Merged

Format worker/main.ts and remove its prettier carve-out#195
BigSimmo merged 1 commit into
mainfrom
fix/worker-main-format

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #180. That PR fixed the chronic format:check drift and added the required format gate, but it excluded worker/main.ts from prettier (.prettierignore) as a workaround: tests/worker-visual-capture.test.ts asserts on the file's exact source text, and prettier's line-wrapping broke one of those assertions.

This removes that permanent carve-out so worker/main.ts is covered by the format gate like every other source file:

  • De-pin worker/main.ts from .prettierignore and format it. Prettier is deterministic; only 3 lines actually reformat (two long calls wrap; one property access re-wraps) — behavior is unchanged.
  • Make the one affected source-guard assertion formatting-agnostic. The structuredProfile guard matched the whole wrapped line; it now matches two stable substrings (const structuredProfile = normalizeStructuredVisualProfile( and redactCaptionMetadataValue(metadata.structured_visual_profile)), which preserves the caption-redaction guarantee the test exists to protect while tolerating prettier's wrapping.

Only that one assertion needed loosening — the file's other ~25 source guards are on lines prettier doesn't touch, so they're unchanged.

Trade-off (reviewer's call)

This reverses #180's deliberate prettier-ignore on worker/main.ts. Upside: the file is now auto-formatted and gated. Residual: worker-visual-capture.test.ts still asserts exact source text elsewhere, so a future edit that grows an asserted line past 120 chars would trip the gate until that assertion is likewise loosened. If you'd rather keep #180's whole-file pin, that's a legitimate choice and this PR can simply be closed.

Verification

  • npm run format:check — green (worker/main.ts now conforms)
  • npm run typecheck — passes
  • tests/worker-visual-capture.test.ts — all 9 cases pass (including the previously-broken guard)

Clinical Governance Preflight

N/A — no behavior change. worker/main.ts changes are whitespace-only (prettier). The test edit keeps the same caption-redaction guard (normalizeStructuredVisualProfile wrapping redactCaptionMetadataValue(metadata.structured_visual_profile)), just formatting-tolerant. No ingestion, privacy, source-governance, or Supabase-target behavior changes.

🤖 Generated with Claude Code

#180 excluded worker/main.ts from prettier because
tests/worker-visual-capture.test.ts asserts on its exact source text, and
prettier line-wrapping broke one assertion. Instead of a permanent
carve-out, format the file and make that one assertion formatting-agnostic
(match two stable substrings), so worker/main.ts is covered by the format
gate like every other source file.

Only 3 lines reformat (prettier is deterministic, whitespace only); only
the structuredProfile source-guard assertion needed loosening. The file's
other source guards are unaffected. Full worker-visual-capture suite passes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo
BigSimmo merged commit f5f2392 into main Jul 2, 2026
4 checks passed
@BigSimmo
BigSimmo deleted the fix/worker-main-format branch July 5, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant