Preserve declared contents: order in listings; Q1-parity sort semantics (bd-listing-declared-order-3ixcvc4o) - #479
Merged
Conversation
…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'.
…/Q5 decided; Q3/Q4 pending)
… 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>
…een, awaiting push approval
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ListingGenerateTransformtags each item with the index of the firstcontents: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_sortnow returnsOption<Vec<ListingSort>>(None= use default,Some([])=sort: false= no sorting).order asc, title ascfor all listing types, replacing the date-desc default and the table no-default special case. Top-levelorder:front matter (already extracted intoDocumentProfile) now flows intoListingItem, sorts numerically as a known field, and is exposed to custom templates asorder. The old behavior stays reachable per-listing viasort: date desc.listing-item: extra:no longer warns; the warning fires only when the field is unknown and no item defines it. Error docs page updated.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 stalesource:header path. No markup changes.Verification
cargo xtask verify(Rust + WASM + hub-client legs) green;cargo xtask lintclean.claude-notes/plans/listing-declared-order-investigation/repro/) renders declared order through the realq2 renderbinary; output inspected.Plan:
claude-notes/plans/2026-08-09-listing-declared-order.md🤖 Generated with Claude Code