feat(pivot): roll-forward preferred-label bindings - #25
Merged
Merged
Conversation
…balances) periodStart*/periodEnd* preferred-label roles carry a binding semantic, not just a label: the same concept appears under two presentation arcs (beginning balance at the top of the network, ending at the bottom), and the beginning row binds the INSTANT fact at each duration column's start date — dated the day before the start per the XBRL/SEC convention, with the exact start date as fallback. The presentation tree now carries arcs (child + label + binding + negation) instead of bare child ids, the walk dedups per (element, binding) so both roll-forward rows emit in arc order, and cell/combo lookups are binding-aware. Standalone opening-instant columns are suppressed in roll-forward sections — their data renders as the beginning-balance row inside the duration columns (previously openings were dropped as sparse noise and only ending balances survived). The per-arc label plumbing (0.3.2's first-arc-wins map) is subsumed by the arc-carrying tree, which also fixes labels when one concept has different labels under different arcs. Verified on the NVDA 10-K equity statement: beginning balances 22,101 / 42,978 / 79,327 chain into ending 42,978 / 79,327 / 157,293 across FY24-FY26, with component sub-rows and negated withholding rows matching the as-filed statement.
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.
Summary
Implement the deferred half of preferred-label support: roll-forward bindings.
periodStartLabel/periodEndLabelroles aren't just label text — the same concept appears under two presentation arcs (beginning balance at the top of the network, ending balance at the bottom), and the beginning row must bind the instant fact at each duration column's start date (dated the day before the start, per the XBRL/SEC convention). Previously the tree dedup silently dropped the second arc, opening balances were pruned as sparse noise columns, and equity statements showed only ending balances.No converter or SEC-adapter changes needed — both already deliver the roles and strings (xbrl-holon#8, report-components#24); this is pivot-only.
Changes
src/pivot.tsPresentationTree.childrenOfnow carries arcs (child+label+binding+negated) instead of bare child ids;arcRefclassifiesperiodStart*→'start',periodEnd*→'end'.'start'rows read the instant atdayBefore(column.startDate)(exact start date as fallback);'end'/default rows read the column end as before. A start/end row with no bindable fact anywhere doesn't render.rf:start/rf:endvariant suffix so React keys and cell selection stay unique.Testing
npm run test:all— green, exit 0 (109 tests across 13 files; the full prior suite passes unchanged through the tree refactor).test/rollforward.test.ts: beginning/ending rows for the same concept in arc order, opening-instant binding (start − 1 day) into the duration column with the fact identity asserted, standalone opening-column suppression, and row-key uniqueness.Notes
Association.preferred_labelroles flow through the 0.3.3 adapter into the same pivot path.