Skip to content

Add an artifact-type suffix (_Talk / _Poster) to standardized filenames (#1404) - #1430

Merged
jonfroehlich merged 2 commits into
masterfrom
1404-artifact-type-filename-suffix
Jul 28, 2026
Merged

Add an artifact-type suffix (_Talk / _Poster) to standardized filenames (#1404)#1430
jonfroehlich merged 2 commits into
masterfrom
1404-artifact-type-filename-suffix

Conversation

@jonfroehlich

Copy link
Copy Markdown
Member

Closes #1404.

What & why

A downloaded artifact file should say what it is. Today a talk's exported slides, the paper, and the poster all generate the same basename, so Froehlich_MakingInTheHCIL_CHI2024.pdf in a Downloads folder doesn't reveal which one it is (and two of them collide into … (1).pdf).

Talks now end in _Talk, posters in _Poster. Publications and grants stay unsuffixed — a bare paper PDF is the default expectation, and that same generated name is the .bib download name (get_pub_filename).

Froehlich_MakingInTheHCIL_CHI2024.pdf         <- publication (unchanged)
Froehlich_MakingInTheHCIL_CHI2024_Talk.pdf    <- talk slides
Froehlich_MakingInTheHCIL_CHI2024_Poster.pdf  <- poster

The four decisions from the issue

  1. Worth doing? Yes, scoped to the ambiguous types only.
  2. Types + label: static Talk / Poster, from a FILENAME_TYPE_SUFFIX class attribute — not derived from talk_type. Poster has no type field, and talk_type is nullable and editor-editable, so a data-derived label would rename files on a metadata-only edit.
  3. Placement: trailing. Everything before the segment stays byte-identical to the old scheme, so a paper and its talk still sort adjacently, and the -<timestamp> uniquifier appends cleanly after it. (The existing mid-name suffix slot is left alone.)
  4. Retroactive, via restandardize_artifact_filenames — already an idempotent every-container-start step.

The subtle part: command ordering

backfill_original_filenames runs at entrypoint step 4.7b, before the re-standardization at 4.10b. Its "is this already standardized?" guard is what stops it recording a renamed file's current name as its Originally uploaded as provenance. The moment generate_filename changed, every already-renamed talk and poster would have failed that guard and had its old standardized name written in as a fake original — corpus-wide, on the very next deploy. The guard now accepts both schemes (generate_filename(..., include_type_suffix=False) yields the pre-#1404 name).

Also extracted: the name == base or name.startswith(base + "-") comparison that three commands had each copy-pasted is now one tested helper, matches_standardized_basename. And repair_diverged_artifact_filenames now also scans for orphans under the pre-#1404 base (that bug predates this scheme change).

Accepted tradeoff (verified against prod)

/media/publications/Bogus.pdf -> 404 from Django (serve_pdf: exact -> original_pdf_filename -> fuzzy)
/media/talks/Bogus.pdf        -> 404 from Apache  (never reaches Django)
/media/posters/Bogus.pdf      -> 404 from Apache

So external/indexed links to renamed talk and poster PDFs cannot be redirected from this repo. Publications are excluded from the suffix, so the most link-exposed, most-indexed subtree doesn't move at all. A follow-up issue asks UW CSE IT to let /media/talks/ and /media/posters/ fall through to Django; after that, a redirect is easy — the pre-#1404 name is still derivable from metadata, so nothing needs storing now.

Rollout — this PR is stage 1 of 3

Step 4.10b runs live on every container start, so without a gate the whole corpus would be renamed unattended on the next deploy.

  1. This PR ships 4.10b with --dry-run. On -test, confirm debug.log lists only Talk/Poster rows and zero Publications.
  2. Follow-up commit removes --dry-run -> -test performs the rename; verify a talk in /admin (pdf + raw + thumbnail suffixed, provenance row intact) and the public talk page's PDF link.
  3. Tag 2.29.0 -> prod performs the one-time rename.

Verification

  • Full suite: 661 OK (8 skipped).
  • New tests: trailing segment placement, per-class labels (Talk/Poster suffixed; Publication/Grant not), matches_standardized_basename including that the two schemes don't match each other, retroactive rename of a pre-Discuss: add an artifact-type suffix (Talk/Poster/Demo) to standardized filenames #1404 talk (pdf + raw + thumbnail) plus idempotency on re-run, publications not churning, and the backfill guard for both a legacy name and its -<timestamp> variant.
  • Real-data dry-run diff against the local dev DB (291 artifacts), old code vs. new: the rename set grows from 122 to 133 rows, and the delta is exactly 10 talks + 1 poster — the already-standardized ones — with no publications added and nothing dropped.

No model changes, no migration. No UI surface changes (all links render from pdf_file.url, so they self-heal), so no Pa11y run needed.

🤖 Generated with Claude Code

jonfroehlich and others added 2 commits July 27, 2026 18:21
Standardized artifact filenames gain a trailing type segment for the two
types whose file is ambiguous once downloaded: a talk's exported slides
and a poster generate the same Author_TitleInTitleCase_VenueYear name as
the paper itself. Talks now end in "_Talk", posters in "_Poster";
publications and grants stay unsuffixed (a bare paper PDF is the default
expectation, and that name is also the .bib download name).

Trailing rather than the existing mid-name suffix slot, so everything
before it stays byte-identical to the old scheme and the "-<timestamp>"
uniquifier still appends cleanly. The label comes from a class attribute
(FILENAME_TYPE_SUFFIX), not from data -- Poster has no type field and
Talk.talk_type is nullable and editor-editable, so deriving it would
rename files on a metadata-only edit.

Applied retroactively via restandardize_artifact_filenames, which is
already an idempotent every-container-start step. It ships here with
--dry-run so the scope is reviewable in the logs before any file moves.

The load-bearing subtlety is ordering: backfill_original_filenames runs
BEFORE that step, and its "already standardized?" guard is what stops it
recording a renamed file's current name as its "Originally uploaded as"
provenance. The moment the scheme changed, every already-renamed talk and
poster would have failed that guard and had its old standardized name
written in as a fake original -- so the guard now accepts both schemes.

Also extracts the uniquifier-tolerant name comparison that three commands
had each copy-pasted into one tested helper (matches_standardized_basename),
and teaches repair_diverged_artifact_filenames to look for orphans under
the pre-#1404 base too (that bug predates the scheme change).

Known and accepted: /media/talks/ and /media/posters/ 404s are answered by
Apache and never reach Django, so unlike publications (which serve_pdf can
redirect via the recorded original filename) external links to renamed
talk/poster PDFs cannot be rescued from this repo. Tracked separately.

Tests: 661 OK. New coverage for the trailing segment, per-class labels,
the shared matcher, the retroactive rename of a pre-#1404 talk (pdf + raw
+ thumbnail) and its idempotency, publications not churning, and the
backfill guard for both a legacy name and its uniquified variant.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ion note

Two items from the PR review:

1. Test the legacy-base branch of repair_diverged_artifact_filenames —
   the one changed path with no test. An orphan left on disk under the
   pre-#1404 base (plain and "-<timestamp>"-uniquified) is found and
   repaired forward to the new-scheme name; without these, dropping the
   legacy_base half of the scan would silently strand old orphans.

2. The 2.29.0 version description now says this is the dry-run stage
   (renames inventoried in debug.log, not performed), so the admin
   dashboard doesn't claim a rename that hasn't happened. The stage-2
   commit that removes --dry-run should restore the final wording.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jonfroehlich
jonfroehlich force-pushed the 1404-artifact-type-filename-suffix branch from e66d10e to e290502 Compare July 28, 2026 01:22
@jonfroehlich
jonfroehlich merged commit 37cb4e1 into master Jul 28, 2026
3 checks passed
@jonfroehlich
jonfroehlich deleted the 1404-artifact-type-filename-suffix branch July 28, 2026 03:54
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.

Discuss: add an artifact-type suffix (Talk/Poster/Demo) to standardized filenames

1 participant