Skip to content

Fix repo-wide prettier format:check drift on main - #177

Closed
BigSimmo wants to merge 4 commits into
mainfrom
fix/format-check-prettier-drift
Closed

Fix repo-wide prettier format:check drift on main#177
BigSimmo wants to merge 4 commits into
mainfrom
fix/format-check-prettier-drift

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

npm run format:check (prettier --check .) was failing repo-wide on main, so the PR-template format:check box failed for every PR regardless of that PR's own diff. This restores a green check.

The failing set is churn from recent merges landing code that was not prettier-clean. Rebased onto current main and split into two commits:

  • chore(format) — untrack + ignore .impeccable/, a machine-local tooling hook cache (session ids, timestamps, local absolute paths) that was git-tracked by mistake and fails prettier --check. Added to .prettierignore and .gitignore. (database.types.ts is already handled by .prettierignore on main, so it needs no change here.)
  • style — mechanical prettier --write . of the 17 tracked files that were not prettier-clean on current main. Formatting only, no logic changes.

Verification

  • npm run format:check — green (All matched files use Prettier code style!)
  • npm run typecheck — passes
  • npm run verify:ui / verify:release / check:production-readiness / check:deployment-readiness — N/A (no UI, runtime, env, or deploy behavior changed)

Clinical Governance Preflight

N/A — formatting-only change. Some reformatted files live under ingestion / privacy / auth / worker paths (src/lib/privacy.ts, src/lib/supabase/auth.ts, worker/main.ts, src/app/api/**), but only whitespace / line-wrapping / clarifying-parens changed — no logic, control flow, source-verification, privacy, Supabase target, service-role access, or SaMD-classification behavior was modified.

Notes

  • .impeccable/hook.cache.json contained machine-local absolute paths and session ids; untracking + gitignoring it removes per-machine churn from the repo.
  • Rebased onto current main (151e4e3f2); force-pushed with --force-with-lease.

🤖 Generated with Claude Code

@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 13:17
auto-merge was automatically disabled July 2, 2026 13:20

Head branch was pushed to by a user without write access

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Done. Merged origin/main into this branch, resolved the .prettierignore conflict (kept both the database.types.ts and .impeccable/ ignore entries), then ran prettier --write on the 13 files from the merged commits that weren't yet formatted. prettier --check . is green again.

BigSimmo and others added 2 commits July 2, 2026 21:23
`.impeccable/` is a tooling hook cache (session ids, timestamps, local
absolute paths) that was committed by mistake and fails `prettier --check`.
Add it to .prettierignore and .gitignore, and untrack the committed file.

(`database.types.ts` is already covered by .prettierignore on main.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mechanical `prettier --write .` of the tracked files that were not
prettier-clean on current main. Formatting only, no logic changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo
BigSimmo force-pushed the fix/format-check-prettier-drift branch from 39612bc to 8822c20 Compare July 2, 2026 13:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8822c2033e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/worker-visual-capture.test.ts Outdated
expect(workerSource).toContain("caption: classification.caption");
expect(workerSource).toContain(
'const structuredProfile = normalizeStructuredVisualProfile(redactCaptionMetadataValue(metadata.structured_visual_profile), {',
"const structuredProfile = normalizeStructuredVisualProfile(redactCaptionMetadataValue(metadata.structured_visual_profile), {",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update source-string assertion after formatting

When the test suite is run with dependencies installed, this assertion now searches for a one-line normalizeStructuredVisualProfile(redactCaptionMetadataValue(...), { call, but the same commit reformatted worker/main.ts so that call starts with normalizeStructuredVisualProfile( and puts redactCaptionMetadataValue(...) on the next line. The old substring is no longer present, so tests/worker-visual-capture.test.ts fails even though the intended behavior remains unchanged; update the assertion to match the multiline format or check for smaller stable substrings.

Useful? React with 👍 / 👎.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 13:39
BigSimmo added a commit that referenced this pull request Jul 2, 2026
…test)

tests/worker-visual-capture.test.ts asserts on the exact source text of
worker/main.ts (line-level guards on redaction/normalization order).
Prettier wraps a long line there, which broke the test's .toContain and
failed the new format gate's own verify run. Prettier-ignore the file and
restore it to main's layout so both the test and format:check pass. This
is the same wall the standalone cleanup in #177 hits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BigSimmo added a commit that referenced this pull request Jul 2, 2026
* ci: enforce prettier format:check + stop tracking hook cache

Root-cause fixes for chronic format drift on main:

- Add a "Format check" step to the CI verify job (a required status
  check), so unformatted code can no longer merge. Previously verify
  ran lint/typecheck/test/build but not format:check, letting drift
  accumulate every merge.
- Reformat the 17 files that had already drifted, so the new gate
  passes on a clean tree (whitespace only; prettier is deterministic
  so this is conflict-safe with the standalone cleanup in #177).
- Stop tracking .impeccable/hook.cache.json (a machine-local hook
  cache): gitignore the dir, add it to .prettierignore, and
  git rm --cached the file so it stops churning diffs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci: exclude worker/main.ts from prettier (pinned by source-assertion test)

tests/worker-visual-capture.test.ts asserts on the exact source text of
worker/main.ts (line-level guards on redaction/normalization order).
Prettier wraps a long line there, which broke the test's .toContain and
failed the new format gate's own verify run. Prettier-ignore the file and
restore it to main's layout so both the test and format:check pass. This
is the same wall the standalone cleanup in #177 hits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #180 (merged). #180 does the same repo-wide prettier cleanup and adds the durable fix this PR was missing: a Format check step in the CI verify job so drift can't re-accumulate. It also resolves the reason a format-only cleanup keeps failing verifytests/worker-visual-capture.test.ts asserts on the exact source text of worker/main.ts, which prettier rewraps; #180 carves that one file out of prettier. Closing as redundant. Thanks!

@BigSimmo BigSimmo closed this Jul 2, 2026
auto-merge was automatically disabled July 2, 2026 14:15

Pull request was closed

`prettier --write` wraps the long normalizeStructuredVisualProfile(...) call
in worker/main.ts across multiple lines, which broke the exact single-line
`toContain` assertion in worker-visual-capture.test.ts. Match two stable
substrings instead so the caption-redaction guard survives prettier
formatting.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo BigSimmo reopened this Jul 2, 2026
@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #180 (already merged to main), which enforces prettier --check as a required CI gate in the verify job, reformats the same files, and untracks .impeccable/hook.cache.json.

This standalone cleanup is now redundant and conflicts with main, so closing it. The format:check-on-main problem is already resolved on main, and the new required gate prevents recurrence.

@BigSimmo BigSimmo closed this Jul 2, 2026
@BigSimmo
BigSimmo deleted the fix/format-check-prettier-drift branch July 2, 2026 15:29
BigSimmo added a commit that referenced this pull request Aug 13, 2026
…#180) and serve aliases by rewrite (#177) (#1886)

* fix(therapies): stop the catalogue generator consuming its own output

build-therapies-index.mjs read public/therapy-compass-data/therapies.json as
its source and also wrote that same path as legacyFullTarget. Source and target
were one file, so every run consumed its own output.

That was not merely untidy. curatedFull nulls every tag-echo modality
(curatedModality), so the first run overwrote the author's raw modality values
with the scrubbed ones, and every later run re-read the scrubbed copy. It
survived only because the scrub happens to be idempotent — the raw input was
still destroyed, recoverable from git history alone.

Move the hand-edited catalogue to src/data/therapies-source.json, outside the
directory this generator writes, and read only from there. The file in
public/therapy-compass-data/ is now output, never input.

Also add the new path to .prettierignore. At its old path it was covered by the
public/therapy-compass-data/ entry; without an entry Prettier pretty-prints the
compact single-line catalogue into ~17k lines, which is the churn #179 fixed on
the generated side.

Verified: regenerated output is byte-identical to the previous alias (hashed
filenames unchanged), the source stays byte-identical to its original across
two further re-runs, check:therapy-data-index passes, and the 28 therapy
contract tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti

* perf(therapies): serve catalogue aliases by rewrite instead of duplicating bytes

public/therapy-compass-data/ shipped each catalogue twice: therapies.json,
therapies-index.json and therapies-home.json were written byte-identical to
their content-addressed twin. Git stores one blob per identical pair, so history
was unaffected, but the working tree and every Docker image carried both — 2.81
MB, and 5.34 MB while the one-deploy grace generation is retained.

The alias URLs themselves are load-bearing: useTherapyData falls back to them
when a bundle older than the grace generation names a hashed file that no longer
exists, so they cannot simply be dropped. Serve them from next.config.ts
rewrites onto the current hashed filename instead, and stop writing the files.

afterFiles rather than beforeFiles: no file exists at the alias paths now, so
the rewrite is reached once the static handler finds nothing, and nothing
legitimate is shadowed. build-therapies-index.mjs --check now fails if an alias
file reappears, since a real file would win over an afterFiles rewrite and then
go stale at the next regeneration.

The generator writes content-addressed assets directly from the generated bytes
rather than copying a just-written alias, so projectionBytes/fullCatalogueBytes
are now the single definition of each payload's exact bytes.

Verified against a running server: all three alias URLs return 200 with content
byte-identical to their hashed asset; aliases keep Cache-Control max-age=0,
must-revalidate while the hashed asset keeps max-age=31536000, immutable, so the
alias does not inherit the destination's immutable policy; the retained grace
generation still returns 200. Hashed filenames are unchanged by this refactor,
proving the direct-write path is byte-identical. public/therapy-compass-data/
drops from 8.0M to 5.3M. npm run build succeeds and the stray-alias guard fires.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti

* docs(issues): close #180 and #177, and correct the paths they moved

Both rows are resolved by the two preceding commits. Also corrects three rows
that cited the catalogue paths this work moved — docs:check-links caught them.

#175 mattered most: it instructed a future reader to curate modality values in
public/therapy-compass-data/therapies.json, which no longer exists. It now names
src/data/therapies-source.json, the only hand-edited catalogue file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti

* docs(ledger): record the review for this branch

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti

* fix: ship generated therapy assets with app runner

* test: cover every next config runner import

* fix(docs): update therapy catalogue references

* fix(ci): reconcile therapy docs with ledger inbox

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants