Repository navigation
feat(viz): stat_count / stat_identity bar layout core (PLOT-GG-001 recut B2) - #7040
Merged
Merged
Conversation
First bars slice of the #6938 re-cut: BarRow, Position::{Identity, Stack, Fill}, apply and apply_panels, ported from ggplot2 4.0.3 PositionStack / PositionFill, plus unit tests whose expected values are ggplot_build() output from R 4.6.2 + ggplot2 4.0.3. Source: #6938 @ df9c227, crates/aprender-viz/src/grammar/position.rs. Kept byte-identical: source lines 11-17, 31-50, 58-71, 78-112, 117-119, 126-127, 134-152, 159-226. Dropped (position_dodge, later slice): 18-30, 51-57, 72-77, 113-116, 128-133, 153-158, 227-267. New in slice: the module doc (source 1-10), the apply_panels doc (source 120-125), the mod.rs pub use without Preserve, and the tests module. Refs #6909 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tests Review of #7021 at e86f931 (non-author) found the module diverging from ggplot2 4.0.3 on missing values, with tests that did not pin it: - PositionStack$setup_data's detect_missing step: a row with NaN in any of x, xmin, xmax, y now has all four set to NaN (R's NA) and stacks as a zero-height bar; a NaN ymin/ymax edge comes out NaN (max_is_lower is NA). Previously a NaN y became a finite zero-height bar at the column top. - has_repeated_x treats every NaN (either sign, any payload) as one value, as vctrs does, so x = (NaN, -NaN, 1) stacks. - pmin/pmax propagate NaN, so a fill whose total overflows to Inf gives NaN like R instead of 0. - apply() (re-exported as apply_position) now keeps the unique-x no-op that apply_panels had, so a negative bar over a unique x stays at y = -1. Tests (expected values from R 4.6.2 + ggplot2 4.0.3, LC_ALL=C): N_nan_y now checks all three rows; NaN / -NaN x; vjust = 2 on unique x (kills the vjust >= 1.0 mutant); Inf/Inf fill; interleaved x (kills deleting the xmin sort); crafted rows through PositionStack's own methods; the public single-panel entry point. Refs #6909 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…min NaN Second non-author review of #7021 (at cf96750) found four surviving mutants and one divergence on hand-built rows: - pos_stack now implements max_is_lower: a row given with ymax < ymin keeps its stacked edges swapped (R: ymin 3, ymax 2 on P2). The old comment claimed this never happens for rows built by this crate, but BarRow is public and the crate builds none itself. - Tests from R 4.6.2 + ggplot2 4.0.3 (PositionStack's own methods on hand-built rows): NaN xmin alone and NaN xmax alone blank the row (P10, P11); NaN ymin alone gives NA edges (P9); the swap (P2). - Module doc: vjust = NaN errors in R only when no x repeats. Refs #6909 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Third non-author review of #7021 (at c3d3576): a mutant that swaps the edges only when ymax >= 0 survived all 24 position tests. R 4.6.2 + ggplot2 4.0.3, running PositionStack's own methods on hand-built rows y = (-1, -2), ymin = (0, 0), ymax = (-1, -2), gives y = (-2, 0), ymin = (-2, 0), ymax = (-3, -2). This test pins that. No code change. Refs #6909 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fourth non-author review of #7021 (at 86174f3) found eight surviving mutants, each restricting the swap or the blanking to a sub-domain the tests never reached. Cases from R 4.6.2 + ggplot2 4.0.3, PositionStack's own methods on hand-built rows: - T1: an Inf y is present; row 1 gets y = NaN with Inf edges. - T4: vjust 0 keeps the negative-stack swap. - T5b: a -0 ymax counts as 0. - T12: position_fill(vjust = 0.5) keeps the swap. - T13: a row alone in its column with ymin Inf, ymax -Inf is swapped. - U1: a NaN-x row whose ymax is NaN gets NA edges. No code change. Refs #6909 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Second bars slice of the #6938 re-cut, stacked on B1 (position core). stat_count.rs is #6938 @ df9c227 except lines 13-16 of the module doc: the old note called the discrete-scales lane in flight and said GGPlot::layout() calls bar_layout_in; neither is true at this slice. Kept: BarSpec, BarStat, BarError, DiscreteAxis, BuiltBars, bar_layout, bar_layout_in, stat_count, discrete_axis and the extents. mod.rs adds the module and its pub use. Nothing in the grammar calls it yet. New in this slice: the doc lines above and a unit-test module whose expected values are ggplot_build() output from R 4.6.2 + ggplot2 4.0.3 (LC_COLLATE=C). Refs #6909 Refs #6938 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
§13.11 rung 1 — quorum shadow verdict Shadow mode: this records a verdict and merges nothing. A refusal |
Member
Author
Non-author review: PASS at 93d8a38Reviewer: Non-blocking follow-ups (all in
Not measured by the reviewer: build, tests and clippy (CI measures them). |
noahgift
enabled auto-merge (squash)
November 14, 2026 15:29
noahgift
added a commit
that referenced
this pull request
Nov 14, 2026
…s own files; cut-over tool; rollback without a train (#7001) Non-author review of 1b4c25f (Sonnet lane), two blockers: 1. Cut-over deadlock. infra#4369 (b993c94cb) now opens train PRs as the App with a train-members: body. The residual aprender side: the round-1 train rule wanted one ont-delta line per member, so a train mixing a sweep member and a code-only member was red although each member alone is green. check_pr_ont_delta.sh train mode now judges each member exactly as alone: ci/sections.yml fetches pulls/N/files per member (--list-train-members / --member-files), a sweep member needs a valid first ont-delta line in its own `member #N` block, a missing member file list fails. 16 train rows, 6 mutants all killed. Spec: the planted App-opened train read-back is the merge condition; rollback without a train is a plain revert PR (its own merge ref carries the reverted ci.yml). 2. Stale greens. scripts/ci_train_cutover.sh: every open PR whose head does not contain the cut-over commit gets gh pr update-branch (--apply); the read-back (no --apply, exit 0) also flags a required green off a train ref. 19-row case table with a fake gh, 8 mutants all killed. Read-only live run found #7040 green on all three names under the old workflow. Pmat-Ticket: #7001 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 14, 2026
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.
Second bars slice of the #6938 re-cut. It was cut on #7021 (B1, position core); #7021 has since merged to main as fe2fcb0, and main was merged into this branch (no rebase), so this PR targets
main.Provenance
crates/aprender-viz/src/grammar/stat_count.rsis feat(viz): ggplot2 parity bars and positions: stat_count/geom_bar, stat_identity/geom_col, position_stack/dodge/fill (PLOT-GG-001) #6938 @ df9c227, except module-doc lines 13-16. Kept unchanged:BarSpec(bar,col,fill,group_all,position,width,fill_first),BarStat,BarError,DiscreteAxis,BuiltBars,bar_layout,bar_layout_in,stat_count,discrete_axis, the extents and their helpers.crates/aprender-viz/src/grammar/mod.rs:mod stat_count;plus itspub use.#[cfg(test)] mod tests, against 5 doc lines removed. The diff against main is 2 files, +598 / -0.New in this slice
GGPlot::layout()callsbar_layout_in. At this slicescale_discreteis on main and nothing in the grammar calls the bar core, so the note now says that.ggplot_build()output from R 4.6.2 + ggplot2 4.0.3,LC_COLLATE=C. R ran on its own host, and no cargo ran there.bar_counts_each_level_in_c_order_with_prop_over_the_group:geom_bar(), one group.bar_with_fill_ranks_x_first_and_fills:aes(fill)+position_fill().bar_with_layer_fill_ranks_fill_first_and_counts_per_panel: fill on the layer, two facet panels.col_keeps_row_order_and_wide_bars_widen_the_x_range:geom_col(width = 1.4)with negative y.bad_columns_are_refused_naming_the_column: everyBarErrorvariant and its Display text.a_repeated_level_keeps_its_first_position_and_an_unknown_value_is_nan.Scope
The bar layout core only: no contract, fixture,
ggplot.rswiring or rendering. Nothing reachable fromGGPlotchanges. Wiring, contracts and fixtures come in the later bar/col slices.Review findings F4-F6 (#6938 round 5)
ggplot.rswiring, not in this slice. It goes with the wiring slice.position.rs, now on main.Gates (x86_64 build host, own clone at 93d8a38, origin/main = fe2fcb0; rc read from each command, never through a pipe)
cargo fmt --all -- --checkcargo clippy -p aprender-viz --lib --tests -- -D warningscargo test -p aprender-vizcargo nextest run --profile ci -p aprender-viz --lib --testscargo test -p aprender-contracts --libscripts/contracts_gate.shpython3 scripts/ci/fail_fast.py ids --base origin/maincheck_include_files.shcheck_tree_reader_tests.shcheck_complexity_ratchet.shcargo llvm-cov -p aprender-viz --libstat_count.rs: 370 lines, 0 missed; 57 functions, 0 missedpv validateMutants (in-diff:
cargo mutants -p aprender-viz -f crates/aprender-viz/src/grammar/stat_count.rs)rc 0. 81 tested: 68 caught, 0 missed, 0 timeout, 13 unviable. The 13 unviable mutants are all
Default::default()replacements, andBarSpec,BarRow,DiscreteAxisandBuiltBarshave noDefault.Known items
stat_count.rskeeps its own privateDISCRETE_EXPAND_ADD(0.6), which duplicatesscale_discrete::DISCRETE_EXPAND_ADD. It is kept so the code stays byte-identical to the source. Folding the two together is left to a later slice.Not done
Closes #6927becomesRefs #6927before ready unless this is the row-completing slice.degraded: same-family
Closes #6927
Refs #6928
Refs #6938
Refs #6909
keep-open: #6909 is the master ticket; rows remain
ont-delta: none
🤖 Generated with Claude Code