Skip to content

Preserve declared contents: order in listings; Q1-parity sort semantics (bd-listing-declared-order-3ixcvc4o) - #479

Merged
cscheid merged 7 commits into
mainfrom
bugfix/bd-listing-declared-order-3ixcvc4o
Aug 9, 2026
Merged

Preserve declared contents: order in listings; Q1-parity sort semantics (bd-listing-declared-order-3ixcvc4o)#479
cscheid merged 7 commits into
mainfrom
bugfix/bd-listing-declared-order-3ixcvc4o

Conversation

@cscheid

@cscheid cscheid commented Aug 9, 2026

Copy link
Copy Markdown
Member

Fixes bd-listing-declared-order-3ixcvc4o: a listing whose contents: is a curated list of explicit paths rendered items in project-index (path-alphabetical) order regardless of declaration order. All 15 Posit Connect cookbook listing pages rely on declared order; Q1 preserves it.

Changes

  • Declared-order item collection: ListingGenerateTransform tags each item with the index of the first contents: pattern that matches it and stable-sorts by that index — Q1's glob-major semantics, for literal and wildcard patterns alike. Exclusions (!) stay global; the Q-12-19 matched-nothing diagnostic now credits every pattern an item matches (pinned by a regression test), and its per-item pattern recompiles are gone.
  • sort: true = default sort (Q1 parity): previously fell into the malformed-value branch; parse_sort now returns Option<Vec<ListingSort>> (None = use default, Some([]) = sort: false = no sorting).
  • Default sort is Q1's order asc, title asc for all listing types, replacing the date-desc default and the table no-default special case. Top-level order: front matter (already extracted into DocumentProfile) now flows into ListingItem, sorts numerically as a known field, and is exposed to custom templates as order. The old behavior stays reachable per-listing via sort: date desc.
  • Q-12-3 false positive fixed: a custom-field sort that works via listing-item: extra: no longer warns; the warning fires only when the field is unknown and no item defines it. Error docs page updated.
  • Latent bug fixed: descending sorts floated missing-value items to the top — the direction flip was applied to the missing-value rule instead of only the value-to-value comparison.

Snapshot changes (3 files)

integration__listing_pipeline__snapshot_builtin_default_with_categories_{default,cloud,unnumbered}_mode.snap: pure item reordering from the default-sort change (old date-desc Third/Second/First → new title-asc First/Second/Third) plus insta refreshing a stale source: header path. No markup changes.

Verification

  • TDD: 11 failing tests written and verified failing before implementation (commit-separated).
  • Full workspace suite: 11,166/11,166 passed; full cargo xtask verify (Rust + WASM + hub-client legs) green; cargo xtask lint clean.
  • End-to-end: the minimal repro (committed under claude-notes/plans/listing-declared-order-investigation/repro/) renders declared order through the real q2 render binary; output inspected.

Plan: claude-notes/plans/2026-08-09-listing-declared-order.md

🤖 Generated with Claude Code

cscheid and others added 7 commits August 9, 2026 15:58
…d contents: order

Plan skeleton + minimal repro (confirmed end-to-end at HEAD: declared
bravo-first order renders alpha-first). Q1 semantics pinned from source:
glob-major iteration with first-occurrence dedup = order by
first-matching-pattern index; sort:false preserves it. Also notes Q1's
absent-sort default is 'order asc, title asc', not q2's 'date desc'.
… any-item suppression; Q3 per-listing sort suffices as the configurability escape hatch)
…ion notes

Key pre-work findings: profile already extracts top-level order: (no
version bump needed); Q1's default sort applies to all built-in types
(table included); sort: true needs Q1-parity handling in parse_sort.
11 new/updated tests, all verified failing for the intended reason:
declared contents: order under sort:false, first-matching-pattern-index
ordering, multi-pattern dedup, sort:true, default sort order-asc/title-asc
(all types incl. table), Q-12-3 any-item suppression, end-to-end pipeline
declared-order, plus a latent bug pinned: Desc sorts float missing-value
items to the top (compare_items reverses the missing-last rule).
Q-12-19 credit-all-patterns guard passes today and pins semantics.
…cs (bd-listing-declared-order-3ixcvc4o)

Phases 1+2:
- Item collection orders by first-matching-pattern index (Q1's
  glob-major semantics); exclusions stay global; Q-12-19 credits every
  matching pattern via matched_any instead of per-item recompiles.
- parse_sort returns Option<Vec<ListingSort>>: sort: true now means
  'default sort' (Q1 parity) instead of misparsing; false still
  disables sorting, which now preserves declared order.
- Default sort is Q1's 'order asc, title asc' for ALL listing types,
  replacing date-desc and the table no-default special case.
  ListingItem gains order (from DocumentProfile.order, no profile
  version bump needed), exposed to templates as 'order' and sortable
  as a known field.
- Q-12-3 fires only when the sort field is unknown AND no item defines
  it — working listing-item.extra custom-field sorts no longer warn.
- Fixed latent bug: Desc sorts floated missing-value items to the top;
  the direction flip now applies only to value-to-value comparisons.

Snapshot changes (3 files, reported per policy):
integration__listing_pipeline__snapshot_builtin_default_with_categories_
{default,cloud,unnumbered}_mode.snap — pure item reordering from the
default-sort change (old date-desc Third/Second/First -> new title-asc
First/Second/Third) plus insta refreshing a stale source: header path.
No markup changes.

End-to-end verified: repro fixture renders declared order (see plan).
Full workspace suite: 11,166/11,166 passed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@posit-snyk-bot

posit-snyk-bot commented Aug 9, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cscheid
cscheid merged commit f91dcbb into main Aug 9, 2026
10 of 11 checks passed
@cscheid
cscheid deleted the bugfix/bd-listing-declared-order-3ixcvc4o branch August 9, 2026 22:28
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.

2 participants