fix(viewers): GitHub-style threads, one-unit authors, shared slots and tabs, gist formats

Review threads: one container in the code column with comments divided by
rules; replies keep the first comment's indent (no nested cards). The
Conversation tab uses the same thread.

A fully redacted author renders as its slot alone, centred with the avatar
and date. Slots outside rendered Markdown use the explorer's .redact-slot
at the running-text alignment (.04em). PR and gist tabs drop the 2px
transparent border so the shared #949 line spans the label and count and
sits on the bar's rule.

Gists: each file renders with the explorer's viewers (Markdown, code,
notebook, CSV/TSV table, image, SVG, PDF, video, audio, binary and
too-large states), with a Preview/Source toggle where they differ and
Raw, copy and download. Binary gist files are now stored as base64 and
passed through unchanged; images follow the "Display images" option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-29 09:13:08 +00:00
1 parent 176bc857a1
commit 98bf382fa8
18 files changed
+541 -162

No files matched your search

+37
View File
@@ -1532,6 +1532,43 @@ const gistContent = {
app.get(`/api/gist/${GIST_ID}/options`, (req, res) => res.json({ url: null, lastUpdateDate: ago(2), isAdmin: false, isOwner: false }));
app.get(`/api/gist/${GIST_ID}/content`, (req, res) => res.json(gistContent));
// A gist with every format the explorer renders, for the per-file viewers and the
// Rendered/Raw toggle. Binary files are base64, as the gist content route returns them.
const FORMATS_GIST_ID = "replication-gist-formats-5B71";
const b64 = (buf) => Buffer.from(buf).toString("base64");
const toneWav = (() => {
const rate = 8000, n = rate; // one second, 440 Hz
const data = Buffer.alloc(n * 2);
for (let i = 0; i < n; i++) data.writeInt16LE(Math.round(Math.sin((2 * Math.PI * 440 * i) / rate) * 8000), i * 2);
const head = Buffer.alloc(44);
head.write("RIFF", 0); head.writeUInt32LE(36 + data.length, 4); head.write("WAVE", 8); head.write("fmt ", 12);
head.writeUInt32LE(16, 16); head.writeUInt16LE(1, 20); head.writeUInt16LE(1, 22); head.writeUInt32LE(rate, 24);
head.writeUInt32LE(rate * 2, 28); head.writeUInt16LE(2, 32); head.writeUInt16LE(16, 34); head.write("data", 36); head.writeUInt32LE(data.length, 40);
return Buffer.concat([head, data]);
})();
const galleryBytes = (name) => fs.readFileSync(path.join(GALLERY_DIR, name));
const formatsGist = {
anonymizeDate: ago(2), isPublic: true, description: "Replication files for the XXXX-1 artifact, one of each format",
ownerLogin: "XXXX-3", creationDate: ago(12), updatedDate: ago(2),
files: [
{ filename: "README.md", language: "Markdown", type: "text/markdown", size: 320, content: "# Replication files\n\nOne file of each kind the reviewer page renders, prepared by XXXX-1.\n\n## Contents\n\n- `results.csv`: the per-seed table\n- `analysis.ipynb`: the notebook behind Figure 1\n\n## Contact\n\nThrough the conference system.\n" },
{ filename: "results.csv", language: "CSV", type: "text/csv", size: galleryText["results.csv"].length, content: galleryText["results.csv"].replace("Baseline,1", "XXXX-2 baseline,1") },
{ filename: "analysis.ipynb", language: "Jupyter Notebook", type: "application/x-ipynb+json", size: galleryNotebook.length, content: galleryNotebook },
{ filename: "train.py", language: "Python", type: "application/x-python", size: 160, content: "# Copyright 2026 XXXX-1\nimport argparse\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--seed\", type=int, default=1)\n print(parser.parse_args())\n" },
{ filename: "pipeline.svg", language: "SVG", type: "image/svg+xml", size: galleryText["figures/pipeline.svg"].length, content: galleryText["figures/pipeline.svg"] },
{ filename: "accuracy.png", type: "image/png", size: galleryPng.length, encoding: "base64", content: b64(galleryPng) },
{ filename: "paper.pdf", type: "application/pdf", size: galleryBytes("paper.pdf").length, encoding: "base64", content: b64(galleryBytes("paper.pdf")) },
{ filename: "demo.mp4", type: "video/mp4", size: galleryBytes("demo/demo.mp4").length, encoding: "base64", content: b64(galleryBytes("demo/demo.mp4")) },
{ filename: "tone.wav", type: "audio/wav", size: toneWav.length, encoding: "base64", content: b64(toneWav) },
{ filename: "checkpoint.bin", type: "application/octet-stream", size: galleryCheckpoint.length, encoding: "base64", content: b64(galleryCheckpoint) },
{ filename: "train.parquet", type: "application/octet-stream", size: 312 * 1024 * 1024, encoding: "base64", tooLarge: true },
],
comments: [],
};
app.get(`/api/gist/${FORMATS_GIST_ID}/options`, (req, res) => res.json({ url: null, lastUpdateDate: ago(2), isAdmin: false, isOwner: false }));
app.get(`/api/gist/${FORMATS_GIST_ID}/content`, (req, res) => res.json(formatsGist));
app.all("/api/{*rest}", (req, res) => res.status(404).json({ error: "not mocked: " + req.path }));
app.use((req, res, next) => {