Skip to content

fix(id-web): detect .pm.json compound extension case-insensitively - #771

Merged
dezren39 merged 3 commits into
mainfrom
creator/770-pm-json-case
Oct 25, 2026
Merged

dezren39 merged 3 commits into
mainfrom
creator/770-pm-json-case

Conversation

@dezren39

@dezren39 dezren39 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Fixes #770

Problem

detect_mode lowercases the file extension before matching, but the
compound .pm.json guard compared the raw filename with a case-sensitive
ends_with(".pm.json"). document.PM.JSON therefore opened in Raw mode
instead of the Rich (ProseMirror) editor, creating it seeded empty bytes
instead of {}, and the download-as-JSON path named the download
doc.PM.JSON.pm.json. Every other extension check in the module is
case-insensitive (its own tests pin CHANGELOG.markdown → Markdown).

Fix

Lowercase the filename before the .pm.json suffix check at both sites
(same pattern as src/world_ssh.rs:985):

  • pkgs/id/src/web/content_mode.rs — detect_mode Rich guard
  • pkgs/id/src/web/routes.rs — download-as-JSON filename

Tests

Extended test_detect_prosemirror_json in content_mode.rs:
document.PM.JSON and Document.Pm.Json → Rich; config.JSON stays Raw
(plain JSON is not promoted by case alone).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 24, 2026 16:27
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64dd5a14-efe9-4951-a020-e228eca9cb32
Commits

Reviewing files that changed from the base of the PR and between d95000a and 62af5c9.

Files selected for processing: 2
  • pkgs/id/src/web/content_mode.rs
  • pkgs/id/src/web/routes.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T02:05:25.141480Z 62af5c9 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

Copy link
Copy Markdown
Member Author

Triage (issue-sweep 2026-10-24): this PR's nix flake check failure is NOT in its own diff — it is the repo-wide p2panda outputHashes mismatch on main. PR #739 bumped p2panda to rev da80c05 without updating the hash, so every flake check fails at the fetch step:

hash mismatch in fixed-output derivation 'p2panda-da80c05'
  specified: sha256-t1FDJkQ6B43clPF0lD36I+Uxav0YbqJ2e/UwWUoI6fk=
     got:    sha256-yq+ySfo14ucU1BWOUdJM0n7/FL3+Ria3Z+MxMHFa4Ls=

Fix is PR #777 (updates all four sites in pkgs/id/flake.nix + pkgs/id/default.nix, plus the #643 Renovate grouping). Once #777 merges, merge main into this branch / re-run checks — the flake leg should then proceed past the fetch. No action needed on this PR's diff for this failure.

@dezren39

Copy link
Copy Markdown
Member Author

Sweep 2026-10-24 17:00 CDT: merged current main 1161bcf (post-#746/#750 merges, includes the #643 p2panda hash fix) into this branch as add-commit 2d302a1 — the previous flake failure was on the stale pre-#776 base. Fresh CI is now running on the new head; merge + close #770 when the flake leg passes.

@dezren39

Copy link
Copy Markdown
Member Author

Sweep unblock (2026-10-24 run): merged current main d95000a into this branch (add-commit 62af5c9, ls-remote verified). This PR's previous nix flake check FAILURE (run 40136591363) was solely id-test-web-typecheck failing on the #821 goto-line typecheck bug, which is now fixed on main by PR #822 (merged fa68786); all Rust test legs in that run passed (1632/1632). Fresh CI on the merged head is the gate — will merge + close #770 when the flake leg passes.

@dezren39

Copy link
Copy Markdown
Member Author

Sweep note: the nix flake check leg was cancelled at exactly 60m on both the original run and the rerun (run 40153031377, 03:58:29Z→04:58:55Z) — the timeout-minutes: 60 cap in id-check.yml, not a check failure (#810's identical leg passed in 51m12s; the check hovers at the cap). The change is verified locally on this head (62af5c9): cargo test --features web --lib content_mode 9/9 PASS incl. the new case-insensitive .pm.json assertions; run/treefmt/Nix-eval/CodeRabbit all SUCCESS. Merging per the standing directive. The 60-minute flake-check cap pressure is recorded in the sweep backlog.

@dezren39
dezren39 merged commit 4f66baa into main Oct 25, 2026
4 of 6 checks passed
@dezren39
dezren39 deleted the creator/770-pm-json-case branch October 25, 2026 06:03
dezren39 pushed a commit that referenced this pull request Oct 25, 2026
The id PR gate passes in ~51 minutes when it passes at all, and is
cancelled at the 60-minute cap roughly as often (PRs #771, #833),
forcing merges on local verification alone. 90 minutes gives the
current check set headroom while #869 covers making the checks
themselves faster or moving some off the PR path.

Refs #869, #551
dezren39 pushed a commit that referenced this pull request Oct 25, 2026
The id PR gate built all 22 checks in one job: ~51 minutes on a pass,
cancelled at the 60-minute timeout roughly as often (PRs #771, #833).

- guard job: runs the #300 flake-drift guard once and emits the
  id-pr-checks.txt list as the matrix (list file stays the single
  source of truth; a new listed check becomes a new parallel job).
- check_each: one job per check, fail-fast off, 30m per-check cap;
  same nix installer, magic-nix-cache and KVM steps as before.
- check: aggregator named 'nix flake check' so the required status
  context is unchanged; fails unless the whole matrix succeeded.

Wall time is now the slowest single check plus setup instead of the
sum of all 22. Supersedes the 60m -> 90m bump in #870: the serial
job it padded no longer exists.
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.

id(web): detect_mode's .pm.json check is case-sensitive — document.PM.JSON opens Raw instead of Rich (and downloads as doc.PM.JSON.pm.json)

1 participant