VersionControl:PRs/magenta/448
From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
| State | 🟣 merged 2026-11-09 15:27:23 |
|---|---|
| Worked on by | magent, justin |
| Moods | #ramp |
| Deploy | redeploy maybelle (memory-lane; two migrations, with #446's) |
| Branch | magent/work-pages → main, by magent-cryptograss
|
| Opened · last pushed | 2026-11-09 11:33:57 · 2026-11-09 15:17:26 |
Plan section 9. Justin, 9 Nov in #ramp: "do the discussion thing. Use the tidings interface."
**Stacked on #446, the 👍.** This branch contains #446's commit, so merging this one merges both.
**💬 on the ramp.** Each open row gets "💬 talk". Pressing it opens the work's page and takes you there. Once a page exists, the row shows "💬 N" (its comment count) and links to it.
**The page is a Tiding**, so everything Tidings already does works here: comments, replies to its line in the Mood, @asks that wake an emergent, and edit/delete.
- It hangs on a `work` event line in the work's Mood (the first Mood its card names, else #ramp): "💬 justin opened a page to talk about magenta#446: …".
- New model `WorkTiding`, table `ramp_work_tidings`, one per `repo:branch`, migration 0051. It's made the first time a signed-in person presses 💬. Emergents can't open one.
- Work pages are kept off Tidings' own list and its badges, because the ramp already lists the work.
**Above the comments, read from githouse's copy (read-only plumbing; nothing a pusher wrote is run):**
- The state, the ref (linked to the PR), the title, the tests badge, the 👍 and Merge…, who worked on it, the Moods, the size and the deploy line.
- The description. PR cards now keep it, escaped, in a `<pre class="pr-body">` after the `{{PR}}` call, and the page draws it as the Mood draws words. Cards pick it up at their next rewrite.
- The commits, each with its full message.
- The files, each with +/−. A file's diff, or the whole file at the head, loads when you ask for it.
**Link-to-line.** Every line has an address: `#D:<path>:<n>` in a diff (`-n` for a removed line), `#L:<path>:<n>` in a whole file. Clicking a line number lights the line and copies its link. Opening the page at an address opens that file and lights the line.
**Endpoints:**
- `POST /api/ramp/work/` opens a work's page.
- `GET /api/ramp/diff/` and `GET /api/ramp/file/` return fragments. Commits must be full hashes githouse has; paths can't start with `-` or `/` or contain `..`. Responses are cached for an hour (by commit, so they never change). Diffs are cut at 400k characters, files at 1M.
**Syntax colours (Pygments, added 9 Nov at Justin's ask, 3547f52).** Each side's whole file is coloured once, and each diff line takes its colours from its own side's file. So a line inside a long string or comment is coloured as what it's in. Every line keeps its address. A file is shown plain if Pygments has no lexer for its name, it's binary, it's over 300k characters, or the colours don't line up with git's lines. The light style is Pygments' default, with github-dark under `prefers-color-scheme: dark`; Pygments' red error boxes are left out. `Pygments>=2.17,<3` is added to requirements.txt.
**re's review (9 Nov 15:09Z): nothing blocks; one bug, fixed in acec0dd.** "Whole file" on a binary file was a 500: `_git` decodes as text before the binary check could look. Diffs, files, commit messages and file names now read git's bytes raw and decode with replacement. A binary file says so and offers no "whole file". New tests: a PNG, a Latin-1 file, and `<script>`/`<img onerror>` in a `.py` file, which come out coloured and escaped.
**Not yet:** comments attached to a line (for now, paste a line's link into a comment).
Tests: `test_work_pages.py`, 19 of them. The full suite passes: 1829 tests OK. Branch test #9 passed. Checked in Playwright on a local memory-lane reading githouse's real copy, signed in as a test device: 💬 on magenta#446 made the page and opened it in Tidings; a file's diff drew with line numbers; `#L:…/thumbs.py:30` opened the file with line 30 lit; a comment posted.
Deploy: redeploy maybelle (memory-lane; two migrations, with #446's)
Worked on by: magent, justin, in #ramp