Page MenuHomePhabricator

Auto-sequence suggestion: convert duplicate titles into a # numbered sequence (own files only) (!51)
Closed, ResolvedPublic

Description

When a user types (or has) a Title that already exists — either among other files in the current stash session or among the user's own previously published Commons files — offer to convert the colliding titles into a numbered sequence using a # placeholder. The user accepts the suggestion, and the tool resolves the actual numbers at publish time, continuing whatever sequence the user already owns.

Trigger:

  • Not driven by the user typing # themselves.
  • Driven by collision detection when a Title equals:
    • Another row's Title in the current stash (multiple files share the same base name), or
    • A Commons file that the current user previously published.
  • Detection happens during editing; the actual number assignment happens at publish time.

Suggestion behavior:

  • When a collision is detected, an inline suggestion appears: "Convert to sequence — add #".
  • Accepting the suggestion rewrites the Title of all stash rows sharing that base name to <basename> #.
  • The # is a placeholder that resolves to a concrete integer at publish time.

Publish-time resolution:

  • The tool queries Commons for the user's existing <basename> N files (own files only) and finds the highest N already used.
  • Each <basename> # in the stash is published as <basename> N+1, <basename> N+2, … continuing the sequence.
  • If no prior owned sequence exists, numbering starts at 1.
  • Sequence length is unbounded — detection doesn't care how long the existing sequence is.

When NOT to offer the suggestion:

  • If the base name is already used by someone else on Commons, do not offer the sequence suggestion. The user has to resolve the collision via standard title validation (covered by T425880).
  • "Used by someone else" = any file with that base name where the uploader is not the current user.

Out of scope:

  • Manually-typed # as a user-facing variable (this is suggestion-driven only).
  • Generic template variables — handled by T425887 (advanced title and description generation). This task and T425887 are related but standalone: T425887 is about user-authored templates with variables; this task is about a single, opinionated auto-suggestion for the sequence pattern.
  • Auto-suggesting alternate base names when the name is taken by someone else (intentionally not offered).

Acceptance:

  • Typing a Title that matches another stash row or one of the user's own published files surfaces the "Convert to sequence" suggestion.
  • Accepting rewrites all matching stash rows to <basename> #.
  • At publish time, the # placeholders resolve to consecutive integers continuing from the highest owned <basename> N on Commons (or starting at 1).
  • Suggestion does not appear when the base name is in use by another user.

Related: T425880 (title validation), T425887 (template-based title/description generation).

Source: User feedback session.

Event Timeline

Daanvr triaged this task as Medium priority.
Daanvr moved this task from To do to Doing on the Tool-upload-workbench board.
Daanvr renamed this task from Auto-sequence suggestion: convert duplicate titles into a # numbered sequence (own files only) to Auto-sequence suggestion: convert duplicate titles into a # numbered sequence (own files only) (!51).May 15 2026, 4:18 PM
Daanvr moved this task from Doing to Reviewing on the Tool-upload-workbench board.

I dont think the colisions are detected... i cant se the new ui elements at all.
I realised it should use chips in between the text (generally at the end) clciking on the chip gives more information about the other files in the sequence including the already published (by that user) files with the same name or the name minus the sequence number.

maybe part of the UI is hidden?

Screenshot 2026-05-15 at 19.04.34.png (1,524×530 px, 150 KB)

the big yello message is quite intense. it can simple suggest te chip inline just requiring a enter or click from hte user to confirm and a on hover tooltip to inform about the situation as the yello box does now. tooltip should ahve normal color.

Addressed feedback on !51:

  1. Dropped the yellow warn box for own-file collisions (it was reserved for things the user must act on; an own-file sequence collision isn't an error — it's the routine case). Other-user collisions still surface as a hard red error.
  2. Replaced the progressive-tinted suggestion strip with an inline ghost chip below the input: Add ' # ' [Enter]. Chip is neutral by default, blue (progressive) on hover/focus.
  3. Hover tooltip on the chip carries the same explanation the yellow box had ("You already published File:X. Click to convert this row to '<basename> #'. The publish step picks the next integer in your sequence …"). Native browser tooltip = normal color, per the request.
  4. Press Enter accepts the chip when present (unless the user has explicitly arrow-navigated into the autocomplete dropdown — a navRef flag tracks this so Enter on a highlighted recent-title still picks that title).
  5. Click the (i) button next to the chip opens an info popout listing:
    • The colliding stash rows (from the existing siblingCollisions)
    • The user's existing <basename> N files on Commons, with external links to each File: page (lazy-fetched on first open via a new findOwnedSequenceFiles helper extracted from the existing pagination loop)

The (i)-popout is position: absolute inside .title-sequence-chip-row (which is position: relative), so it doesn't grow the editor's height and doesn't push the autocomplete dropdown around. Opening it also closes the recent-titles autocomplete (their z-indexes would otherwise overlap).

Verification:

  • npm run build clean (undefined-identifier scanner OK).
  • Deployed bundle confirmed at https://upload-workbench.toolforge.org/mr-51/ (curl checks for title-sequence-chip, title-sequence-info, Convert to numbered sequence, Show files already in this sequence, Looking up your files, No prior all present; legacy title-validate--suggest class confirmed removed).
  • Couldn't end-to-end exercise in the browser from the subagent (no Commons auth in this environment) — please verify the chip actually displays + the (i) popout's allimages fetch behaves on a real own-file collision.

New commit pushed to feat/T425984-auto-sequence-titles; preview redeployed at /mr-51/.