LearnNewsExamplesServices
Frontmatter
id12309
titlePortal chunked trees: chunk folders display out of sequence (sortDate sort vs positional labels)
stateClosed
labels
bugaibuild
assigneesneo-opus-ada, neo-gpt
createdAtJun 1, 2026, 5:40 PM
updatedAtJun 7, 2026, 7:17 PM
githubUrlhttps://github.com/neomjs/neo/issues/12309
authorneo-opus-ada
commentsCount2
parentIssue12204
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 1, 2026, 7:31 PM

Portal chunked trees: chunk folders display out of sequence (sortDate sort vs positional labels)

neo-opus-ada
neo-opus-ada commented on Jun 1, 2026, 5:40 PM

Context

Surfaced by @tobiu after #12304 (tickets chunked tree, PR #12306) merged + theme rebuild. The chunk folders in a group render with their positional range labels out of sequence:

Tickets 1501-1509
Tickets 1401-1500
Tickets 601-700
Tickets 1301-1400
Tickets 401-500
Tickets 501-600

Expected: a sequential order (e.g. 1501-1509, 1401-1500, 1301-1400, … or ascending 1-100, 101-200, …). The same range scheme is in pulls PR #12307 (still open at filing), so this affects both chunked views.

The Problem

buildChunkedIndex sorts the chunk-folder nodes within a group by sortDate (the chunk's max item date), while treeNodeName labels each chunk folder positionally by chunk-number ((chunk-N − 1) * 100 + 1). When a chunk's max-date is not monotonic with its chunk-number — which happens because issue/PR updates bump older chunks' sortDate — the sortDate order diverges from the chunk-number order, so the positional labels appear scrambled.

There is also a deeper coupling: a positional label (Tickets 1501-1509) is only meaningful when the chunk folders are displayed in chunk-number order (so chunk-N really is the N-th 100-block). Sorting by date breaks that invariant regardless of the visible scramble.

The Architectural Reality

  • buildScripts/docs/index/tickets.mjs (~line 185) and buildScripts/docs/index/pulls.mjs (~line 186): groupChunks ... .sort((a, b) => new Date(b.sortDate || 0) - new Date(a.sortDate || 0) || a.id.localeCompare(b.id)) — sorts chunk folders by sortDate desc.
  • apps/portal/model/Ticket.mjs + apps/portal/model/Pull.mjs treeNodeName.calculate: positional range label (chunk-N − 1) * 100 + 1 .. + childCount.
  • discussions.mjs shares the same sortDate chunk sort but apps/portal/model/Discussion.mjs labels chunk folders with the raw title (title || id), NOT positional ranges — so it has no label/order mismatch bug. Reconciling its sort is deferred to the operator's discussions folder-naming + open/closed brainstorm (see Scope Correction).

The Fix

Sort the chunk-folder nodes by chunk-number (numeric, extracted from the chunk id/title chunk-(\d+)) so the positional range labels are sequential and meaningful. Apply to tickets.mjs + pulls.mjs buildChunkedIndex. (discussions.mjs deferred — see Scope Correction.)

Acceptance Criteria

  • AC1 — Within each group, chunk folders display in chunk-number order so the positional range labels are sequential (no scramble).
  • AC2 — Fix applied consistently to tickets + pulls generators. (discussions deferred — see Scope Correction.)
  • AC3 — A generator unit test pins the chunk-folder order against chunk-number (not max-date).

Out of Scope (the cross-view chunk-folder UX brainstorm)

The direction (descending = newest 1501-… first, vs ascending = 1-100 first) and the broader label scheme (positional "1-100" vs the misreadable "Tickets " which looks like IDs; the open/closed-state indicator @tobiu raised for discussions) are the cross-view UX brainstorm to be decided + applied across tickets+pulls+discussions together. This ticket only fixes the out-of-sequence ordering bug. The implementation (PR #12310) picks descending for whole-tree newest-first consistency (release groups are semver-descending and leaves within a chunk are date/id-descending; descending chunk folders keep the whole tree newest-first) — a one-line reversal if the brainstorm prefers ascending.

Scope Correction (implemented in PR #12310)

  • discussions.mjs excluded. V-B-A of apps/portal/model/Discussion.mjs showed it labels chunk folders with the raw title (title || id), not positional ranges — so discussions has no label/order mismatch bug. Aligning its sort would change folder order for no fix benefit and pre-empt the operator's separate discussions folder-naming + open/closed brainstorm. AC2 + The Fix narrowed to tickets + pulls.
  • Direction = descending (was tentatively noted as "ascending" at filing). Chosen for whole-tree newest-first consistency; brainstorm-reversible.
  • Data not committed. Index JSON is regenerated by the data-sync pipeline (§critical_gate 3); PR #12310 ships generator code + regression tests only.

Related

  • Parent epic #12204 (Portal news — chunked lazy-load tree).
  • Regression from #12304 (PR #12306, merged) + present in #12305 (PR #12307, open) — both ship the sortDate-sorted positional labels.

Origin Session ID: da9a6007-1250-4363-8c15-dff69eccb3be Retrieval Hint: "portal chunked tree chunk folder order sortDate positional range label scramble"

tobiu closed this issue on Jun 1, 2026, 6:15 PM
tobiu referenced in commit f367c4c - "fix(build): order chunk folders by chunk-number not sortDate (#12309) (#12310) on Jun 1, 2026, 6:15 PM
tobiu referenced in commit eedae06 - "fix(portal): keep chunked index data fresh (#12309) (#12311) on Jun 1, 2026, 7:31 PM
tobiu closed this issue on Jun 1, 2026, 7:31 PM