LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-ada
createdAtOct 20, 2026, 1:12 PM
updatedAtOct 20, 2026, 2:41 PM
githubUrlhttps://github.com/neomjs/neo/issues/19900
authorneo-opus-ada
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 20, 2026, 2:41 PM

A #N inside a Markdown link opens the tickets view, which then loads every ticket chunk

neo-opus-ada
neo-opus-ada commented on Oct 20, 2026, 1:12 PM

Context

Found in team:engine release testing of the Portal (apps/portal), 2026-10-20, in headless Chrome against the dev server on origin/dev 4844087a77. In learn/blog/the-organism-already-existed.md, the link [… Discussion #14422](https://github.com/orgs/neomjs/discussions/14422) renders as two links. The second, #14422, opens #/news/tickets/14422. That view then fetched 47 ticket chunks one after another in 25 s and showed nothing; it was still fetching when the run stopped. A known ticket such as #10074 takes 3 requests. Reproduced 2/2.

The Problem

Two defects meet on one click:

  1. The ticket autolink rewrites ids inside links that already exist. It counts 18 such links in 5 files, 16 of which point at PRs or Discussions, so the rewritten link opens the wrong view.
  2. An id the tickets index lacks makes the view walk every chunk folder. There are about 1,061, which is roughly nine minutes at the rate observed. The same happens for any unknown id typed into the URL.

The Architectural Reality

  • src/component/Markdown.mjs: regexTicketId = /(^|[\s(])#(\d+)\b/g is replaced in the raw Markdown before it renders (step 3 of the content pass). Fenced and inline code are protected first, but existing links are not, so [PR #14458](url) becomes [PR <a href="…/14458">#14458</a>](url).
  • apps/portal/view/news/tickets/MainContainerController.mjs#ensureRecordLoaded: when the id map names a chunk, one targeted load happens. When it doesn't, the method falls back to for (…folders) await tree.onFolderItemClick(folder) across every unloaded folder.
  • Design authority: ensureRecordLoaded's own comment says the build-emitted id map "names the chunk folder containing the item, so one targeted load replaces the sequential scan". An id absent from a loaded id map is therefore not a ticket. The sequential scan remains only for a missing map.

The Fix

  • Markdown.mjs: protect Markdown links ([text](url)) the way inline code is protected before the ticket replacement, so an id inside a link's text or URL stays as written.
  • ensureRecordLoaded: when the id map loaded and has no entry for the id, return null without scanning. Keep the sequential scan only for when the map is unavailable.

Acceptance Criteria

  • AC-1 (unit): Markdown with [PR #14458](https://example.com/14458) renders exactly one anchor, and its href is the original URL. A bare #14458 in prose still becomes a ticket link.
  • AC-2 (unit): ensureRecordLoaded for an id absent from a loaded id map loads no folder and returns null. An id present in the map still loads its one chunk.
  • AC-3: on the Portal, clicking a #N link that points at a PR or Discussion opens that URL, and #/news/tickets/<unknown id> settles to the view's empty state without fetching chunks.

Out of Scope

  • Making the tickets view say "not found" in words. The empty state is enough for this ticket.
  • The blog's relative links, filed separately.

Related

  • #8398 (the ticket mirroring epic), and learn/blog/the-organism-already-existed.md (the reproducer).

Live latest-open sweep: checked the latest 20 open issues at 2026-10-20T11:12Z, and open-issue searches for "ticket id markdown link" and "tickets chunk load unknown id": no equivalent. MC sweep: one query on these nouns, 6 results, no prior decision. Clio's 10-16 note on the dark sitemap routes concerns deploying, not this. Own-assignment sweep: none overlapping.

Origin Session ID: ad84dc14-8baf-4f95-a7dd-a9e224f51c31 Retrieval Hint: "Portal tickets view loads every chunk for an unknown id; Markdown ticket autolink inside link text"

tobiu referenced in commit 617684f - "fix(portal): a #N inside a Markdown link stays the link's, and an unknown ticket id loads no chunks (#19900) (#19912) on Oct 20, 2026, 2:41 PM
tobiu closed this issue on Oct 20, 2026, 2:41 PM