knowledge: aggregation-layer of a shared helper, position-partitioned generated-SQL assertions, retiring a provisional marker (3 verified; 1 candidate mechanism refuted and corrected) - #104
Conversation
- backend/common/change-impact/aggregation-layer-of-a-shared-helper (new) - testing/quality/generated-sql-property-assertions (new) - qa/document-verification/retiring-a-provisional-marker (new) Corrected three defects in the drafted candidates during verification: a mis-scoped PostgreSQL quote (ordered-set aggregates, not sum), an MDN paraphrase presented as verbatim, and the claim that top-level anchors catch every SQL refill (refuted by local reproduction: inner-position refills leave both anchors matching).
|
Cross-Check: 면제 (no independent reviewer ran) — every load-bearing claim in this body is instead re-derived from primary sources or reproduced locally in this session, and the reproduction is re-runnable. What that leaves unchecked is the summary layer of this PR body, so please read the three corrections below as author-verified rather than second-opinion-verified. The three drafts this flush started from were written by an earlier flush run that
Three of my own verification harnesses failed silently during this flush and were
Re-run the mutation matrix (needs no DB): Two housekeeping notes for the reviewer:
|
Knowledge flush — 3 insight(s)
Queue drained:
~/.dev-loop/queue/3591e35e-…jsonl(2 rows),d20b3451-…jsonl(1 row).A prior flush run had died after writing three draft pages but before committing —
they were present as untracked files in the checkout, with the queue rows still
pendingand noINGEST_REPORT.md. The drafts were treated as unaudited input, notas output: every citation was re-opened and every measurement re-run. Three defects
were found and fixed (two mis-quotations and one wrong mechanism, below).
Verified best-practice
1. A plan naming "the N call sites" can name sites in two aggregation layers
Claim. Before adopting a plan that unifies "the N call sites" of a helper named
by line number, open each and record which layer owns the reduction — a per-row SQL
projection feeding an in-language reduce greps identically to a set-level SQL
aggregate — then check whether the plan's grep-count acceptance criterion is
reachable on the route you take.
Sources checked.
sum"Computesthe sum of the non-null input values"; "except for
count, these functions returna null value when no rows are selected. In particular,
sumof no rows returnsnull, not zero as one might expect".
— "if
initialValueis provided but the array is empty, the solo value will bereturned without calling
callbackFn";TypeError"Thrown if the array containsno elements and
initialValueis not provided".-c"Writeonly a count of selected lines to standard output".
How verified. Measured on PostgreSQL 16.14 and 17.11 (both Docker):
sumover all-NULL →NULL, over zero rows →NULL, over[5, NULL]→5.Node v24.8.0: seeded reduce →
0on all-missing and empty; filter-then-reduce →null;[].reduce(f)→TypeError. Field side re-verified in the live worktree:sumVacancyAreaStrict(empty → null, any null → null) single-owns the rule, the sortSQL is its declared mirror (
CASE WHEN bool_or(v IS NULL) THEN NULL ELSE SUM(v) END),all three consumers are asserted to agree by
building-vacancy-path-parity.test.ts(15 tests passing), and
sumCountswas deliberately retained for theparking-count axis.
Two corrections to the draft. (a) It quoted "All these functions ignore null
values in their aggregated input" as a statement about
sum; extracting the pagetext shows that sentence belongs to Table 9.64, the ordered-set aggregates
(
mode,percentile_cont) — replaced withsum's own wording. (b) The MDNsentence was a paraphrase presented as a verbatim quote — replaced with the real
one. Also added the strict column to the boundary table: the draft's table only
diverged at empty/all-missing, but
[5, null]is the dangerous row — three of fourroutes return a partial sum that reads downstream as a measured total.
Confidence: verified.
2. Locking a missing-value property in generated SQL — defenses are position-partitioned
Claim (as corrected). Refills that defeat the property split by position, and
the assertion families are disjoint: top-level start/end anchors own a wrapper
placed outside the rendered expression; a function-name check owns named inner
wrappers; an occurrence count on the aggregate owns the nameless inner
CASErefill;a literal
THEN NULLowns a guard rewritten to yield0; a captured-alias bindingowns dead-column swaps. Build the coverage matrix and run rename + reflow controls.
Sources checked.
"NULL values in the argument list are ignored. The result will be NULL only if all
the expressions evaluate to NULL. (This is a deviation from the SQL standard…)".
GREATEST()returns
NULLif any argument isNULL" (the engine divergence, sourced on bothsides).
opened and enumerated: sixteen mutator groups, all replacing or removing nodes
("This mutant operator removes the content of every block statement"). Expression
wrapping is absent, so this mutant class is necessarily hand-seeded. Stated as a
closed-catalogue absence rather than a bare "no tool does this".
How verified — this refutes the draft's central claim. The draft asserted that
after adding start/end anchors, the
GREATESTand nameless-CASErefills "bothdied… the refill caught by the anchor alone". I extracted the real rendered
ORDER BYkey from rtb-unifiedbuildingListOrderBy('vacancyArea')viaPgDialectand ran six assertion families against six seeded mutants plus two
behaviour-preserving controls (Node v24.8.0):
COALESCE(<whole key>, 0)COALESCE(SUM(x),0)(inner)GREATEST(SUM(x),0)(inner)0(nameless)THEN NULLonlyCASErefill (nameless)0 AS z)s→xSo each mutant dies to exactly one family, both controls stay green across all
six, and top-level anchors are blind by construction to any inner-position
refill. Shipping the draft's guidance ("anchors primary, denylist secondary/
redundant") would have licensed dropping the family that is the only defense for two
of the mutants. I also confirmed the gap is live in the shipped repo test: its
single-evaluation fingerprint counts
total_vacancy_area_sqm/block_office, not theaggregate, so the nameless inner
CASErefill survives the real suite too.Confidence: verified (mechanism corrected and locally reproduced).
3. Retiring a provisional marker in a reviewed design document
Claim. Split the marker's hits into axes — body statement / review-checklist row
passed because the marker exists / round-history entry / convention legend — edit
only the first two, rewrite the checklist rows in the same commit as the body, annotate
history rather than rewording it, and report counts with the axis and command.
Sources checked.
-ccountsselected lines, so word mentions and multi-marker lines give different totals.
"'proposed' … or 'accepted' once it is agreed"; "may be marked as 'deprecated' or
'superseded' with a reference to its replacement"; and "If a decision is reversed,
we will keep the old one around, but mark it as superseded" (added this session — it
is the directly on-point quote for annotate-don't-reword).
text: "It is helpful for authors to clearly identify where text should be updated
to reflect the newly assigned values. For example, the use of 'TBD1', 'TBD2', etc.,
is recommended…".
How verified. All three quotes extracted from the fetched source text, not from a
summary. Field evidence is the NEWRTB-2435 ADR session: two
[추정]body linesconverted, two checklist rows (L858, L860) instantly stale, and three legitimate
counts over one file (19 / 17 / 11) that reconciled only once the axis was named.
No external source states the checklist-staleness mechanism.
Confidence: field-tested for the mechanism; the grep/ADR/RFC supports are
verified. Page frontmatter carriesverifiedon the strength of the three citedsources plus the reproduced count-axis split; the checklist-staleness step is the
field-observed part and is attributed as such in Field context.
Existing-layer check
Routed via
INDEX.md, then read each domain index and every page whose "load when"overlapped.
Pages read: qa-document-verification-editing-a-gated-document, qa-document-verification-spec-document-gates, backend-common-change-impact-call-site-enumeration, testing-quality-spec-artifact-checks, testing-quality-checks-that-cannot-pass, testing-quality-harness-reverse-controls, testing-quality-tests-that-cannot-fail, databases-schema-design-nullability-and-defaults
Overlaps and decisions:
editing-a-gated-documentwas the strongest merge candidate for insight 3: itsstep 1 anchor table, step 4 ("never a global count") and step 5 (baseline re-run)
neighbour the same territory. Kept separate because its subject is a machine
gate breaking on an edit, while insight 3's subject is the document's reference to
itself — a human checklist row whose evidence is the marker being deleted, which
no anchor kind in that table covers. The new page states the split explicitly in
both directions and links to it.
call-site-enumerationowns completeness of the site list ("did the searchmiss sites?"). Insight 1 is about sites the list already names being different
kinds of operation. Kept separate; the new page opens by pointing completeness
questions back to it, and it is in
related:.spec-artifact-checks/checks-that-cannot-passcover check construction andunreachable gates. Insight 2's subject (a semantic property of a generated string
vs. an open-ended wrapper class) is not covered;
checks-that-cannot-passislinked from insight 1 for the unreachable grep-count criterion.
harness-reverse-controlsowns the control-run principle; insight 2 cites itfor the rename/reflow controls rather than restating it.
nullability-and-defaultsowns the zero-vs-absent modelling decision; both newpages defer to it rather than re-arguing it.
except the three domain indexes (one new row each) and
log.md.Verification of this section: all 11 cross-referenced page ids were resolved against
the checkout's
wiki/with a bogus-id control proving the check can fail (a firstattempt using bash associative arrays reported every id "OK" vacuously on macOS bash
3.2 and was discarded).
scripts/wiki-lint-prohibitions.jsover the whole wiki:61 directives / 61 compliant / 0 violations, and a seeded bare prohibition in the
new testing page moved it to 62/61/1, proving the linter actually reads these files.
Open-PR check
Listed 28 open
knowledge/*PRs: #103 #101 #95 #92 #91 #86 #80 #79 #78 #76 #74 #73#72 #69 #68 #66 #64 #62 #61 #58 #57 #56 #55 #52 #51 #50 #49 #47.
Four head branches (#49, #52, #74, #76 among them) no longer exist as
origin/refs, so all 28 were fetched via
refs/pull/N/headand diffed againstorigin/main.A first sweep returned zero hits for all three candidates — treated as a harness
failure rather than a result, and a
knippositive control confirmed it:grep -qwas killing
git fetchwith SIGPIPE, so only 4 of 28 refs had actually beenfetched. Re-run with all 28 refs present and the control passing.
Per-candidate verdicts:
cross-module-consumer-census(same category, but "does anyone consume this?" ≠ "do these consumers do the same kind of thing?"); #49stale-artifact-baselinesmentions rollup rows excluded from a total — adjacent, different subjectsource-text-wiring-assertions(anchors, but binding an anchor to a site in hand-written source, not bracketing a generated expression against wrappers); #72 mentionsCOALESCEonce as a read-with-default exampleediting-a-gated-document(whitespace reflow breaking single-line substring anchors — different mechanism); #78 uses "provisional" for a data-derived ruleNo sibling duplicate PR is being opened. Two coordination notes for the reviewer:
wiki/qa/index.md(rewording theediting-a-gated-documentrow) while this PR adds a new row to the same table; knowledge: signed-link verification assertions, cross-module consumer census, defect-class re-sweep, synced-cluster pod triage, cloud CLI bounds (5 ingested, 1 dropped as dup of #52) #76/knowledge: headless UA bot-block probe, estimate-derived threshold re-anchoring, permanent-suite scope evidence, shallow-clone history guard (4 verified) #95/knowledge: python data-file packaging (new backend/python/packaging), orchestrator-injected env in test suites, reflow vs substring anchors (3 verified, mechanism corrected, 1 half folded into #47) #103 also touch
wiki/backend/index.md. These are adjacent-line index edits, not contentconflicts — whichever merges second may need a one-line table rebase.
rules instead of a
[id]link, becausetesting-quality-source-text-wiring-assertionsexists only in unmerged knowledge: 4 verified insights — surviving-mutant triage, source-text wiring assertions, query state vs fetch state, python text-io encoding #52. Once knowledge: 4 verified insights — surviving-mutant triage, source-text wiring assertions, query state vs fetch state, python text-io encoding #52 lands, that sentence should become a link.
Routing decision
backend/common/change-impact/aggregation-layer-of-a-shared-helper.md(new page, existing category)change-impactalready holds the pre-change survey work; this completes the trio: completeness (call-site-enumeration), reachability (#76's census), operational kind (this). SQL/index mechanics stay indatabases, which the page links to.testing/quality/generated-sql-property-assertions.md(new page, existing category)testing/quality, alongsidetests-that-cannot-failandharness-reverse-controls. Notdatabases: the subject is the assertion, not the query.qa/document-verification/retiring-a-provisional-marker.md(new page, existing category)editing-a-gated-document(machine anchors) andspec-document-gates(verdict policy). This page owns the document's references to itself.No new category was created; all three fit existing ones. Indexes updated with one
"load when" row each (
wiki/backend/index.md,wiki/testing/index.md,wiki/qa/index.md) plus alog.mdentry recording the ingest and the threecorrections.