Skip to content

fix(#142): address Copilot post-merge review on #317#318

Merged
jqnatividad merged 1 commit into
mainfrom
fix-317-copilot-postmerge
May 19, 2026
Merged

fix(#142): address Copilot post-merge review on #317#318
jqnatividad merged 1 commit into
mainfrom
fix-317-copilot-postmerge

Conversation

@jqnatividad

@jqnatividad jqnatividad commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two correctness improvements caught by Copilot's review of #317 after it merged. Both replies were posted on the original PR.

  • IndexingStage.process: AUTO-INDEXING log and empty-range warning printed the raw conf.AUTO_INDEX_THRESHOLD. When the operator used the -1 sentinel ("no upper bound" → record_count), the log read [3, -1] and the warning could surface threshold (-1) — both misleading. Threshold resolution is now hoisted above the log; both lines use threshold_display, which shows the resolved value annotated with the raw sentinel when relevant (e.g. 12345 (-1 → record_count)).
  • config_declaration.yaml: the auto_index_threshold description inverted Postgres indexing wisdom — it implied high-cardinality columns are bad index candidates because the planner skips selective queries. Actually the opposite: high-cardinality columns are more selective and B-tree indexes help there; the planner avoids indexes for low-selectivity predicates. Reworded to explain the real reason DP+ limits auto-indexing (right index depends on query patterns; blind ingest-time indexing inflates storage, slows COPY, adds vacuum pressure).

Test plan

  • tests/test_issue_142_auto_index_threshold.py — all 8 tests pass; the warning-message assertion checks for min_threshold / threshold substrings, both still present
  • Spot-check the new log lines via the integration stack with AUTO_INDEX_THRESHOLD=-1 and a small-record dataset to confirm the rendered text

🤖 Generated with Claude Code

Two correctness improvements caught after #317 merged:

1. ``IndexingStage.process``: the AUTO-INDEXING startup log and the
   empty-range warning both printed the raw ``conf.AUTO_INDEX_THRESHOLD``,
   which is misleading when the operator set the sentinel ``-1`` (interpreted
   as ``record_count``). The log would say ``[3, -1]`` even though the
   effective upper bound was the row count, and the warning could read
   ``threshold (-1)`` when MIN exceeded the resolved-but-tiny record_count.

   Now both lines use a single ``threshold_display`` that shows the resolved
   value, annotated with the raw sentinel when relevant
   (e.g. ``12345 (-1 → record_count)``). Threshold resolution is hoisted
   above the log so operators see the effective range that will actually be
   applied.

2. ``config_declaration.yaml``: the ``auto_index_threshold`` description
   inverted Postgres indexing wisdom. It claimed "indexing higher-cardinality
   columns rarely helps because the Postgres planner won't pick the index
   over a sequential scan for selective queries" — but high-cardinality
   columns are *more* selective and B-tree indexes shine exactly there;
   the planner avoids indexes for *low*-selectivity predicates.

   Reworded to explain the real reason DP+ limits auto-indexing: the right
   high-cardinality index depends on actual query patterns, and blindly
   indexing every column on ingest inflates storage, slows COPY, and adds
   vacuum/bloat pressure for indexes the workload may never use.

Existing ``test_issue_142_auto_index_threshold.py`` suite (8 tests) still
passes — its warning-message assertion checks for the ``min_threshold`` /
``threshold`` substrings, both of which the updated message preserves.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jqnatividad jqnatividad merged commit bd8146d into main May 19, 2026
1 check passed
@jqnatividad jqnatividad deleted the fix-317-copilot-postmerge branch May 19, 2026 01:41
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