knowledge: import-time test coupling, empty-data surveys, call-site census, shell off-switches - #25
Open
choiyounggi wants to merge 1 commit into
Open
knowledge: import-time test coupling, empty-data surveys, call-site census, shell off-switches#25choiyounggi wants to merge 1 commit into
choiyounggi wants to merge 1 commit into
Conversation
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.
Knowledge flush — 4 insight(s)
Drained from
~/.dev-loop/queue/(4 pending rows across 3 sessions / 3 repos:chungyak-alimi,track-b-ranking,linkly). Four pages created, one newcategory, twelve existing pages back-linked. No page overwritten, no conflict found.
Verified best-practice
1. Import-time I/O makes a "pure function" unit test infrastructure-bound
Claim — a pure function reached by importing a module whose top level runs
init_db()/connect is not DB-free; a module-levelpytestmark = pytest.mark.skipif(...)cannot prevent it, because collection imports the module body top-to-bottom and the
app import above that line has already run.
Sources checked
escape hatches:
pytest.importorskipat module level,pytest.skip(reason, allow_module_level=True), andpytestmark = pytest.mark.skipif(...)for a module.(Read from the upstream doc source
doc/en/how-to/skipping.rstonpytest-dev/pytest@mainafter docs.pytest.org returned HTTP 429.)collect_ignore/collect_ignore_glob; states pytest imports files matching the discovery patterns,which breaks on files that raise on import. This is the mechanism the insight names.
How verified — official docs plus a local reproduction (2026-08-05): a module
whose first line prints a side effect still prints it when only its pure function is
imported (
from modside import pure_fn→ side effect printed, thenpure_fn(2) == 4).Refinement made during verification — the queued directive said skipif markers are
"무력" (powerless). That holds for the ordering reason only; the docs show that an
allow_module_levelskip placed above the import,importorskip, andcollect_ignoreall do work. The page states the ordering rule ("place the guard abovethe import it protects") rather than the blanket claim.
Confidence: verified
2. Confirm volume before reading a distribution query
Claim —
GROUP BY/DISTINCTover an empty table return zero rows without error,which reads as "no values to normalize";
count(*)returns a row containing0and isthe only unambiguous shape. When the count is 0, derive the rule from the writers and
fixtures instead, and record the substitution in the artifact.
Sources checked
count, these functions return a null value when no rows are selected. Inparticular,
sumof no rows returns null, not zero as one might expect, andarray_aggreturns null rather than an empty array".as a first-class data-quality dimension; undetected volume anomalies "skew analyses
and lead to flawed decision-making". Supports "check volume first" as established
practice rather than a local habit.
not state the empty-input behaviour; it is therefore not cited.
How verified — reproduced 2026-08-05 in
sqlite3 :memory:over an empty table:SELECT area_nm, count(*) … GROUP BY area_nm→ 0 rows;SELECT count(*)→ one row0;SELECT max(area_nm)→ one rowNULL. Matches the PostgreSQL-documentedsemantics, so the page is written engine-neutral.
Confidence: verified
3. Enumerate call sites by call target, not by parameter name
Claim — grepping
param=cannot find callers that pass the argument positionally,so a keyword-based census silently under-reports; test helpers compound this by
reproducing the old shape at many sites while appearing once in a call-target search.
Sources checked
positional arguments, they are placed in the first N slots"; keyword arguments are
matched by identifier. This is the mechanism: a positional call site contains no
parameter name, so no keyword pattern can match it.
refactor that can be applied to a codebase of arbitrary size"; CST transforms match
call nodes rather than text. (Definition confirmed via the upstream
docs/source/codemods.rst; readthedocs returned HTTP 429.) The page cites LibCSTonly for the tool-choice row. A widely-repeated "regex is insufficient for call-site
refactors" line traces to a Medium post I could not fetch, so that wording is not
asserted anywhere in the page.
repo_rows=census reported 13 hits,the real run was
Ran 472 tests / FAILED (failures=11), all intest_backend.py,plus a
rows_for()helper feeding 5 further sites.How verified — language-reference semantics (positional binding by position) plus
the reproduced failure above. The mechanism generalizes to any language with positional
calls, so
applies_to: [general].Confidence: verified
4.
${VAR:-default}discards an empty overrideClaim — passing
VAR=to turn a feature off is silently ignored when the scriptreads
${VAR:-default}, because the colon form substitutes the default for null andunset. Pass a sentinel the script's own validation rejects, or change the read to
${VAR-default}.Sources checked
2.6.2) — "use of the <colon> in the format shall result in a test for a parameter
that is unset or null; omission of the <colon> shall result in a test for a parameter
that is only unset", with the full four-operator behaviour table.
"Omitting the colon results in a test only for a parameter that is unset."
How verified — reproduced 2026-08-05 in
bash: withv="",${v:-tmux}→tmuxwhile
${v-tmux}→ empty; withvunset both →tmux.Confidence: verified
Existing-layer check
Pages read in full before writing —
AGENTS.md,INDEX.md, thetesting,databases,platforms,debugging,qaandbackend/pythondomain indexes,testing/strategy/test-level-choice,testing/data/test-data-and-isolation,databases/query-optimization/existence-and-count-checks,databases/schema-design/requirements-to-tables,qa/process/regression-scope,platforms/shells/portable-shell-scripts, plus the full 135-page inventory.Overlaps found, and what was done
testing/strategy/test-level-choiceimportorskip/ module-level skip /collect_ignore). Cross-linked both waystesting/data/test-data-and-isolationdatabases/query-optimization/existence-and-count-checkscount(*)count(*)-first rule is about evidence, not cost. Cross-linkeddatabases/schema-design/requirements-to-tablesqa/process/regression-scopeplatforms/shells/portable-shell-scripts"${OPT:-}"once, as aset -uworkaroundset -uedge case defers to it. Cross-linkedplatforms/environment/unicode-text-matchingConflicts flagged: none. No existing directive is contradicted by any of the four.
Related-links added (both ways): 12 existing pages gained the new ids —
testing/strategy/test-level-choice,testing/data/test-data-and-isolation,backend/python/language/mutable-state-traps,databases/query-optimization/existence-and-count-checks,databases/schema-design/requirements-to-tables,databases/schema-design/nullability-and-defaults,qa/process/regression-scope,testing/quality/checks-that-cannot-pass,debugging/methodology/verify-the-fix,platforms/shells/portable-shell-scripts,platforms/environment/path-resolution,platforms/processes/non-interactive-cli-invocation.Routing decision
testing / strategy / import-time-side-effectsdatabases / data-survey / surveying-live-data-for-a-ruledata-surveyqa / process / enumerating-call-sites-of-a-changed-signatureplatforms / shells / disabling-a-feature-through-an-environment-variable1 — testing/strategy. The decision this page forces is structural: what level the
test really sits at, and whether the function moves or the whole module gets gated.
strategyowns level/structure decisions;dataowns fixtures and state, which is notthe question.
2 — databases/data-survey (new category). Existing categories are
indexing,query-optimization,schema-design,operations,sqlite,transactions. Nonecovers reading live data as evidence for a decision:
query-optimizationis aboutcost,
schema-designderives structure from requirements rather than from rows. Eachwas re-checked under its alternative reading before creating the category, per
wiki-ingest step 3.
databasesis the right domain because the artifact queried andmisread is the database. Root
INDEX.mdand the domain index were widened to route in.3 — qa/process. The one judgement call worth your attention. The queue's own
hint was
domain: testingand the observed failure was 11 broken tests — but thepage's subject is enumerating what a change touches, which is
qa/process/regression-scope's question one level lower (a code-level census feedingits Integration ring). Alternatives considered and rejected:
testing/*(the practicegoverns production call sites too, not test authoring);
testing/quality(sibling tothe grep-gate pages, but those are about checks, not censuses);
debugging(nothingis being diagnosed);
backend/common(the practice is language- and tier-agnostic).If you prefer it under
testing, this is the page to move — say so on review and itmoves with its links.
4 — platforms/shells. Category already exists and the case is squarely shell
semantics. Folding it into
portable-shell-scriptsas an edge-case row was consideredand rejected: that page's trigger is "runs on machine A, fails on machine B", which
does not match "my override was ignored", and one-case-per-page applies.
Verification of the wiki edit itself
related:ids across all 135 pages resolve; all inline[page-id]refs resolve.INDEX.mdand domain-index links resolve to existing files.log.mdcarries the## [2026-08-05] ingest | …entry.