Skip to content

Show the PDF on a deposit request, not a preview site - #10

Merged
lmoresi merged 4 commits into
mainfrom
feature/deposit-pdf-artifact
Aug 13, 2026
Merged

lmoresi merged 4 commits into
mainfrom
feature/deposit-pdf-artifact

Conversation

@lmoresi

@lmoresi lmoresi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Louis's call and the right one: a Deposit: <slug> pull request asks whether a note should get a DOI, and the archival PDF answers that. Building a whole preview site for a one-line change to deposit-queue.txt costs minutes and still leaves you clicking through a page to reach the download.

What changes

  • preview.yml gains paths-ignore: ['deposit-queue.txt'], so a deposit branch no longer publishes a preview site.
  • New deposit-pdf.yml builds the PDF for the slugs this pull request adds to the queue — entries already present have been deposited, so rebuilding them says nothing — and uploads it as a run artifact, with a comment saying where to find it.
  • The preview comment on note branches now links the built PDF directly alongside the page.

Two deliberate properties

It fails if no PDF was produced. MyST can drop a figure, or an entire export, and still exit zero — which is how UWTN 2026-011 nearly shipped without one. An empty artifact that reads as a passing check is worse than a failed run.

It has no FIGSHARE_TOKEN and no --live, asserted by test. It shows you a PDF and nothing else; merging remains the only thing that mints an identifier.

One caveat worth knowing: the artifact's title page has no DOI on it, because the DOI does not exist until the deposit run reserves it. Everything else is the copy that gets uploaded.

Underworld development team with AI support from Claude Code

A "Deposit: <slug>" pull request asks one question -- should this note have a
DOI minted against it -- and the thing that answers it is the archival PDF.
Publishing a whole preview site to answer that costs minutes and still leaves
you clicking through a page to reach the download.

So deposit-queue branches no longer trigger the preview, and deposit-pdf.yml
builds the PDF for the slugs THIS pull request adds to the queue and uploads
it as a run artifact, with a comment saying where to find it. Entries already
in the queue are skipped: they have been deposited, and rebuilding their PDFs
says nothing about the decision in hand.

Two things it deliberately does. It fails if no PDF was produced, because MyST
can drop a figure or a whole export and still exit zero -- which is how UWTN
2026-011 nearly shipped without one -- and an empty artifact that reads as a
passing check is worse than a failed run. And it carries no Figshare token and
no --live, so it can show you a PDF and nothing else.

Also, since the preview stays for note branches: its comment now links the
built PDF directly alongside the page, rather than making a reviewer open the
note and hunt for the download.

Underworld development team with AI support from Claude Code
Louis: 'if there is no doi added, the deposit should not really be creating
that artefact'. The overclaim was mine -- I called it the copy that gets
deposited and it cannot be. TWO title-page fields differ, not one: the DOI,
and archived_at, which is stamped immediately before the rebuild and also
prints. Both are written by the deposit run itself, so neither can exist in a
PDF built before that run.

It is still worth having, but for the reason that is true: the body is what
gets archived, and the body is where figures, maths, references and layout can
actually be wrong. The two fields that differ are machine-written and cannot
be wrong in an interesting way. The workflow and its comment now say that
instead of claiming equivalence.

Underworld development team with AI support from Claude Code
The previous commit corrected the wording the reviewer sees but left the
comment above the build step still claiming the artifact is what gets
uploaded. Same correction, same reason.

Underworld development team with AI support from Claude Code
@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview: https://underworld-technical-notes.github.io/underworldcode.org-preview/cfe41783d4/

No article changed on this branch. Built from befa939. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version.

Louis asked what happens if a run aborts after reserving the DOI. That case is
benign: a reserved Figshare DOI is not registered until publish, so an abort
before publish leaves an inert draft that --delete-draft removes, and a re-run
resumes because run() reads archive_doi and repository_record_id back out of
metadata.yml instead of reserving again.

The dangerous window is one step later. A run that PUBLISHES and then dies
before its identifiers pull request is merged leaves the DOI live and citable
while this repository has no record of it. pending() selects on
archive_published_at, so the note still looks undeposited and the next run
would mint a SECOND live identifier for it. Two citable DOIs for one note is
the only outcome in this design that cannot be undone -- a published DOI is
superseded, never withdrawn.

An open deposit/identifiers-* pull request is precisely that state, sitting in
plain sight, so the deposit now refuses to start while one exists and says to
merge it first. Nothing previously stopped someone re-running past it; the
data supported the guard but only a human remembering enforced it.

dry-run and delete-draft are exempt. Neither can publish, and cleaning up a
stray draft is a reasonable thing to want while the pull request is open.

The test asserts the guard runs BEFORE the first --live step, since a check
that fires after the deposit has already talked to Figshare guards nothing.
Negative-controlled.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Added the guard discussed: the deposit now refuses to start while an open deposit/identifiers-* pull request exists.

Why that window and not the one it looks like. An abort after reserving is benign — a reserved Figshare DOI is not registered until publish, so it leaves an inert draft that --delete-draft removes, and a re-run resumes because run() reads archive_doi and repository_record_id back out of metadata.yml rather than reserving again.

The dangerous window is one step later. A run that publishes and then dies before its identifiers pull request merges leaves the DOI live and citable while the repository has no record of it. pending() selects on archive_published_at, so the note still looks undeposited and the next run would mint a second live identifier for it. Two citable DOIs for one note is the only outcome in this design that cannot be undone.

An open identifiers pull request is exactly that state, in plain sight — so the workflow stops and says to merge it first. dry-run and delete-draft are exempt, since neither can publish and clearing a stray draft is reasonable while the pull request is open.

The test asserts the guard runs before the first --live step; a check that fires after the deposit has already talked to Figshare guards nothing. Negative-controlled.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit 1196d2b into main Aug 13, 2026
2 checks passed
@lmoresi

lmoresi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Added the preview-link work discussed.

The notification is the preview. The directory is a hash of the branch name and nothing links to it, so a missing comment is a missing preview — which is what happened to UWTN 2026-012, recovered only by computing the URL by hand.

Two defects, both fixed here.

preview.yml comments on push, and only if a pull request already exists. Push then open the PR — the natural order, and what the worktree flow encourages — and the comment step correctly finds nothing and exits. New preview-link.yml fires on pull_request: [opened, reopened] and comments the link without rebuilding: it reads the same URL, confirms it is really serving, and stays silent if it is not, leaving the push run to comment when its build lands. It imports preview_mark.preview_path rather than reimplementing the hash, and reads head.ref rather than GITHUB_REF_NAME — on a pull_request event the latter is <number>/merge, which would key the URL to the wrong directory.

The dedupe never worked. It matched **Preview:** while the variant carrying links starts **Preview with no colon, so every push appended a new comment instead of updating one. PR #7 has thirteen of them. Both workflows now match the prefix the two variants share.

Underworld development team with AI support from Claude Code

lmoresi added a commit that referenced this pull request Aug 13, 2026
The paths filter added in #10 did not stop #8 previewing. GitHub evaluates a
paths filter against the files changed IN THE PUSH, and "Update branch" merges
main into the branch -- so the merge commit touches articles and the filter
matches, even though the branch's net difference from main is still one line of
deposit-queue.txt. Since a strict-protection repo REQUIRES that update before
merging, every deposit request would have previewed at exactly the point it was
about to be merged.

branches-ignore now carries 'deposit/**', which says what was meant: a deposit
branch never wants a preview, whatever a merge dragged onto it. The question it
asks is answered by deposit-pdf.yml.

Also fixed a test that pinned the literal string "branches-ignore: [main]" and
so failed the moment another branch was added to that list -- the second time
today a guard has broken on a change that strengthened what it guards. It now
checks that main is in the list, however the list is written.

Underworld development team with AI support from Claude Code
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.

1 participant