Skip to content

docs(gfql): comment diet installment 2 — _residual_polars_expr 66 → 27 lines - #1864

Merged
lmeyerov merged 2 commits into
masterfrom
docs/gfql-comment-diet-2
Aug 10, 2026
Merged

docs(gfql): comment diet installment 2 — _residual_polars_expr 66 → 27 lines#1864
lmeyerov merged 2 commits into
masterfrom
docs/gfql-comment-diet-2

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Second installment. Same standard: a comment earns its place only by stating something a name or a test cannot. bin/ci_docs_only_check.py proves no code changed — AST identical to base.

Kept (underivable)

  • expr is a string by contract, and why — the feat(gfql): plan connected join predicate pushdown #1729 lowering serializes residuals to text.
  • Parity by construction: this calls the same parser and same lower_expr as the fallback, over a bijection of the same frame, so the row lowering's guards are inherited and must not be duplicated here. Without that sentence a maintainer reasonably re-implements them.
  • The columns_nan_free opt-out: why this lane may skip the NaN mask (ingest already ran _pl_nan_to_null; projection cannot introduce NaN), and why a computed operand and the general lowering both keep it.
  • The not-reachable set, so nobody adds dead code for STARTS WITH and friends.

Dropped (tests already assert it)

The exhaustive covered-vocabulary list, the itemized decline enumeration, the escaped-literal note — pinned in test_lowering.py, which the docstring now points at rather than restating. Also the q7 timing claim: a receipt, and receipts belong in pyg-bench.

Next: lazy/engine/polars/row_pipeline.py (668 comment+doc lines) and expr_const_fold.py's design-doc headers, where the (P)/(A)/(E) criterion and the #1802 engine-divergence constraint stay.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi

lmeyerov and others added 2 commits August 9, 2026 16:34
… 27 lines

Kept, because neither a name nor a test can express it:
- expr is a string BY CONTRACT, and why (the #1729 lowering serializes text).
- PARITY BY CONSTRUCTION: same parser, same lower_expr, bijection over the same
  frame, so the row lowering's guards are INHERITED and must NOT be duplicated
  here. Without this a maintainer reasonably re-implements them.
- columns_nan_free opt-out: why THIS lane may skip the NaN mask (ingest already
  ran _pl_nan_to_null and no projection can introduce NaN), and why a computed
  operand and the general lowering both keep it.
- The NOT-reachable set, so nobody adds dead code for STARTS WITH and friends.

Dropped, because tests already assert it: the exhaustive covered-vocabulary
list, the itemized decline enumeration, the escaped-literal note -- pointed at
test_lowering.py instead. Also dropped the q7 timing claim; receipts live in
pyg-bench.

bin/ci_docs_only_check.py: AST identical, no code changed. Suite: 0 non-cudf
failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
Reviewer was right that tests handle most of it. test_residual_polars_native.py
has 69 tests whose NAMES are the spec -- fast_lane_matches_chain_fallback and
value_semantics_match_fallback ARE the parity argument;
no_such_residual_ever_reaches_the_translator IS the not-reachable paragraph;
escaped_literal / dtype_mismatch / declines_and_fallback_raises_designed_error
are the decline enumeration. All of that is now a pointer.

66 -> 27 -> 15 lines. What survives is only what a passing test cannot convey:
that guards are INHERITED so duplicating one here is invisible to tests, and the
columns_nan_free safety argument, whose failure mode is silently wrong answers.

Method correction: I should have read the test file BEFORE deciding what was
underivable. 'Can a test express this?' is not answerable from the docstring.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
@lmeyerov
lmeyerov merged commit bccd4fa into master Aug 10, 2026
69 checks passed
pull Bot pushed a commit to admariner/pygraphistry that referenced this pull request Aug 11, 2026
… two docstrings

Applying the settled rule to row_pipeline.py, largest remaining prose file.

Coverage check first (the lesson from graphistry#1864): _order_keys_hold_list_like_values
has 18 tests, so its trigger enumeration is already specified -- it becomes a
pointer. _single_alias_cache_key had ONE, about clearing rather than keying, so
its two real claims were unpinned. A wrong cache key serves a stale expression:
a silent wrong answer no existing test would catch.

Added test_single_alias_cache_key.py: dtype must be in the key (names alone would
serve a float expression for a string column), parameterized dtypes must not
collide -- with  asserted so the hazard is visible
rather than described -- plus expr/alias/nan_free/schema-order, hashability.

Both docstrings then drop to ~11 lines, keeping only what tests cannot say: the
str(dtype) rationale, why parser availability is deliberately unkeyed, and the
directive not to tighten an intentionally-broad decline (over-declining costs a
fallback, under-declining returns a wrong ORDER).

Registered in POLARS_TEST_FILES and guarded with importorskip -- both halves of
yesterday's lane lesson.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF7uRZLKZaD6Q9FGWSmyXi
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.

1 participant