Forgejo PR diffs: native Pierre bridge #23

Closed
opened 2026-05-09 03:28:01 +00:00 by barrettruth · 1 comment
Owner

Build the required PR-diff path for the local Forgejo customization.

Core decision: PR Files Changed is a review surface, not just a rendered diff. Do not replace it wholesale with Pierre FileDiff unless we intentionally reimplement Forgejo review behavior. The durable path is a native-DOM-preserving bridge: keep Forgejo's PR table, line metadata, review forms, conversations, viewed-file state, load-more behavior, and folding; upgrade the code/diff painting layer to the Pierre/midnight visual model.

Known evidence:

  • pkgs/forgejo-custom/templates/repo/diff/box.tmpl intentionally excludes PR files from Pierre with $.PageIsDiff and not $.PageIsPullFiles.
  • pkgs/forgejo-custom/frontend/src/pierre/diff-view.js currently only discovers /commit/<sha>.diff.
  • Forgejo exposes raw PR diffs at /pulls/<index>.diff, but that raw text does not include review comments, pending review state, viewed files, or commentability metadata.

Topological issue set:

  1. #24 - PR diffs 1: lock down native review DOM contract
  2. #25 - PR diffs 2: add fixtures and measurements for review pages
  3. #26 - PR diffs 3: generalize diff source discovery for PR and compare surfaces
  4. #27 - PR diffs 4: prototype read-only Pierre rendering where safe
  5. #28 - PR diffs 5: implement native PR code-content repaint bridge
  6. #29 - PR diffs 6: preserve review comments and viewed-file workflows
  7. #30 - PR diffs 7: handle load-more, folding, Turbo, and viewport repaint
  8. #31 - PR diffs 8: performance pass and deployment verification

Dependency order:

Acceptance:

  • PR Files Changed visually matches the custom commit-diff experience.
  • Line comments, pending reviews, existing conversations, viewed-file checkboxes, file tree, split/unified mode, whitespace mode, load-more, folding, and permalinks keep working.
  • Native Forgejo fallback remains available for unsupported states.
Build the required PR-diff path for the local Forgejo customization. Core decision: PR Files Changed is a review surface, not just a rendered diff. Do not replace it wholesale with Pierre `FileDiff` unless we intentionally reimplement Forgejo review behavior. The durable path is a native-DOM-preserving bridge: keep Forgejo's PR table, line metadata, review forms, conversations, viewed-file state, load-more behavior, and folding; upgrade the code/diff painting layer to the Pierre/midnight visual model. Known evidence: - `pkgs/forgejo-custom/templates/repo/diff/box.tmpl` intentionally excludes PR files from Pierre with `$.PageIsDiff` and `not $.PageIsPullFiles`. - `pkgs/forgejo-custom/frontend/src/pierre/diff-view.js` currently only discovers `/commit/<sha>.diff`. - Forgejo exposes raw PR diffs at `/pulls/<index>.diff`, but that raw text does not include review comments, pending review state, viewed files, or commentability metadata. Topological issue set: 1. #24 - PR diffs 1: lock down native review DOM contract 2. #25 - PR diffs 2: add fixtures and measurements for review pages 3. #26 - PR diffs 3: generalize diff source discovery for PR and compare surfaces 4. #27 - PR diffs 4: prototype read-only Pierre rendering where safe 5. #28 - PR diffs 5: implement native PR code-content repaint bridge 6. #29 - PR diffs 6: preserve review comments and viewed-file workflows 7. #30 - PR diffs 7: handle load-more, folding, Turbo, and viewport repaint 8. #31 - PR diffs 8: performance pass and deployment verification Dependency order: - #24 and #25 are roots. - #26 depends on #24. - #27 depends on #26 and #25. - #28 depends on #24 and #25. - #29 and #30 depend on #28. - #31 depends on #29 and #30. Acceptance: - PR Files Changed visually matches the custom commit-diff experience. - Line comments, pending reviews, existing conversations, viewed-file checkboxes, file tree, split/unified mode, whitespace mode, load-more, folding, and permalinks keep working. - Native Forgejo fallback remains available for unsupported states.
Author
Owner

Implemented and deployed in 30367db.

What landed:

  • Native PR Files Changed bridge: preserves Forgejo's review table/comment DOM and progressively marks/repaints PR diff rows instead of replacing them with FileDiff.
  • Custom PR diff CSS: PR rows now use the same midnight/Pierre diff variables used by the custom commit diff path.
  • Dynamic repaint hook: MutationObserver + viewport-first scheduling covers load-more files and hunk/row insertion without double-painting.
  • Compare diff support: non-review compare pages can now use the existing Pierre placeholder path through .diff source discovery.

Verified:

  • nix develop .#ci --command just format
  • nix develop .#ci --command just lint
  • targeted biome check
  • node --check on touched frontend modules
  • custom frontend Nix build
  • custom assets Nix build
  • nix build .#nixosConfigurations.vps.config.system.build.toplevel
  • pushed main to Forgejo
  • deployed with nixos-rebuild switch --flake .#vps --build-host vps --target-host vps
  • live /run/current-system is /nix/store/hlblirwc4kd1sclvkhdcgsb6va7h6qgj-nixos-system-vps-26.05.20260504.afc5551
  • live forgejo and nginx are active
  • served barrett-forgejo.js and barrett-forgejo.css contain the PR bridge/CSS

Note: Chromium headless on the laptop timed out dumping the live HTTPS page even with JS disabled, so final browser-level proof used curl/static asset checks plus service state. The bridge is intentionally native-DOM preserving so review behavior remains Forgejo-owned.

Implemented and deployed in `30367db`. What landed: - Native PR Files Changed bridge: preserves Forgejo's review table/comment DOM and progressively marks/repaints PR diff rows instead of replacing them with `FileDiff`. - Custom PR diff CSS: PR rows now use the same midnight/Pierre diff variables used by the custom commit diff path. - Dynamic repaint hook: MutationObserver + viewport-first scheduling covers load-more files and hunk/row insertion without double-painting. - Compare diff support: non-review compare pages can now use the existing Pierre placeholder path through `.diff` source discovery. Verified: - `nix develop .#ci --command just format` - `nix develop .#ci --command just lint` - targeted `biome check` - `node --check` on touched frontend modules - custom frontend Nix build - custom assets Nix build - `nix build .#nixosConfigurations.vps.config.system.build.toplevel` - pushed `main` to Forgejo - deployed with `nixos-rebuild switch --flake .#vps --build-host vps --target-host vps` - live `/run/current-system` is `/nix/store/hlblirwc4kd1sclvkhdcgsb6va7h6qgj-nixos-system-vps-26.05.20260504.afc5551` - live `forgejo` and `nginx` are active - served `barrett-forgejo.js` and `barrett-forgejo.css` contain the PR bridge/CSS Note: Chromium headless on the laptop timed out dumping the live HTTPS page even with JS disabled, so final browser-level proof used curl/static asset checks plus service state. The bridge is intentionally native-DOM preserving so review behavior remains Forgejo-owned.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
barrettruth/nix#23
No description provided.