Skip to content

Stop the truncation doc asserting counts no test holds - #3233

Merged
erikdarlingdata merged 5 commits into
devfrom
fix/membermap-doc-counts
Sep 9, 2026
Merged

Stop the truncation doc asserting counts no test holds#3233
erikdarlingdata merged 5 commits into
devfrom
fix/membermap-doc-counts

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 9, 2026

Copy link
Copy Markdown
Owner

ShapeOf's doc asserted four counts as facts: 544 ranges stopping short, 34 by more than one character, 13 stranding a string literal, and 510 losing only a semicolon.

Two of them cannot be reproduced from the code they document. 544 and 510 were measured before StatementEnd trimmed trailing ; and whitespace. Run the shipped detector and you get neither number, so a reader checking the comment concludes the detector is broken rather than that the comment is old.

The other two were already wrong when they merged. #3227 rewrote ViewerDataService.Deadlock.cs LastTranStartedLocal onto FormatServerClock, into a shape the walk reads whole — so 34 became 33 and 13 became 12 about an hour after the sentence was written, from a PR that had nothing to do with this one. The same merge is why the shipped inventory is 30 rather than the 31 measured on the branch.

The counts are removed rather than corrected. TsqlConventionGuardTests.KnownTruncatedRanges is the live figure and a test holds it to the tree, so the comment points there instead. What stays is the ratio the argument actually needs — semicolon-only members outnumber the ones stranding real content by more than ten to one, which is why the trim exists — and it is stated as a ratio because that is what survives an edit to any one member.

KnownTruncatedRanges' own doc carried the same defect and is fixed in the same change: it said "Editing 31 member bodies", "the current 31" and "Thirteen of these strand a string literal", sitting directly on top of an array of 30. Recomputed against the shipped code rather than decremented — 30 in the swept trees, 12 stranding a literal, so "Thirteen" was wrong independently of the total.

That one is the sharpest instance: the array beside it is asserted at set equality, so the numeral in the prose is the one claim in the file that nothing can fail on. #3230's own argument is that a count "goes stale with no edit to any member" and belongs in a set — and the comment introducing that set violated it. Both figures are removed rather than corrected, and the comment now says why no count appears and tells the reader to count the entries.

Found by the CHANGELOG batch lane and github-03: the lane hit these numbers deciding what #3230's release note should say, and had to work out which of three disagreeing figures to believe. Both merged sources agreed on 31, which is why it did not look suspect.

Two more counts in the same file, found by review of this PR

A bot thread objected that the fix had replaced "Thirteen" with "Most of KnownTruncatedRanges strands a literal", and 12 of 30 is a minority. It was right, and it named a class the three prior sweeps over these two files could not see: a sweep for stale figures cannot find a stale quantifier, because a quantifier carries no numeral, no number-word and no currency word. Re-sweeping for quantifiers rather than digits found two more counts in TsqlConventionGuardTests.cs, both wrong, and one more bare quantifier.

The generic-constraint comment said nine members in the scanned trees carry a where-clause. Seventeen do, plus a type-level constraint on the SettingsObjectRead<T> record. The claim exists to argue the walker shape is worth arranging, so the wrong figure understated its own case.

The comment-filter note said six files carry a -- inside block-comment prose. Sixty do with a -- anywhere in a block comment, forty-eight on a non-asterisked continuation line — the line a prefix filter actually misreads, which is the scenario the note is about — and thirty-eight once files whose only hits are CLI flags come out. A second reader independently measured seventy, counting T-SQL block comments embedded in SQL literals as well; all fourteen of those extra matches sit inside verbatim @"..." strings, and on the words as written that reading is defensible too. They are also genuinely relevant to the guard — a -- inside a T-SQL /* */ must not be read as a line comment — just to its tokenizer rather than to its comment filter.

That spread is the finding, more than any one of the numbers. Five defensible answers — 70, 60, 48, 38, and the tokenizer's own view — against a sentence that named neither corpus nor predicate. It could not have been pinned even in principle, and there is no reading under which it is six.

Both sentences keep their universal and lose only the tally, which is this file's own stated doctrine: a universal quantifier names the one counter-example that would break it, while a count only tells you to count again. Neither "12 of these" nor "A minority" was substituted, because both would be true today and stale on the next merge that rewrites a listed member — which is exactly what #3227 did to "Thirteen".

Two other numerals in the file were checked and deliberately left, since removing a correct, held count would be the opposite lesson. The tenth-bullet reference is held by the disposition map's equality assertion against CONTRIBUTING.md, so it cannot drift without reddening first. The 101 figure is dated to when it landed, scoped to a retired SKU outside the scanned trees, and labelled as evidence for a past decision rather than a live figure. most/several/many elsewhere in both files were read individually and are qualitative claims about general behaviour, not counts of a tracked set.

CommentFilterAdoptionTests already holds prose counts against computed ones via VerifySummaryCounts, non-vacuously in both directions. That is the right tool for a count that is derivable and stable; neither of these two is, which is why both are removed rather than pinned.

CHANGELOG entry text

  • The truncation detector's doc no longer asserts member counts that no test holds ([Stop the truncation doc asserting counts no test holds #3233]) - it stated four figures as facts; two described a state before the content trim existed and cannot be reproduced from the shipped code at all, and the other two went stale within an hour when an unrelated PR rewrote one of the members. KnownTruncatedRanges is the live figure and a test holds it to the tree, so the comment points there and keeps only the ratio the argument needs. Review of the change found two more counts in the same file — nine where-clause members against seventeen, and six block-comment files against sixty — both removed the same way, and two correct held numerals left in place.

The comment stated 544, 34, 13 and 510 as facts. Two of them describe a
state before the content trim existed, so the shipped detector cannot
reproduce them at all; the other two moved when #3227 rewrote one of the
members, within an hour of the comment being written. The live figure is
KnownTruncatedRanges, which a test holds to the tree, so the comment
points there and keeps only the ratio that carries the argument.
It said 31 member bodies, the current 31, and Thirteen stranding a
literal, sitting on top of an array of 30. Recomputed against the
shipped code rather than decremented: 30 in the swept trees, 12
stranding a literal.

Both figures are removed rather than corrected. The array is asserted at
set equality, so a numeral in the prose beside it is the one claim in
the file nothing can fail on, which is the defect this file exists to
report.
@erikdarlingdata
erikdarlingdata force-pushed the fix/membermap-doc-counts branch from fc3c9fa to 75145fc Compare September 9, 2026 20:16
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewed. This is a doc-comment-only change in Darling/Darling.Tests/CSharpMemberMap.cs (no T-SQL, no runtime logic), so the T-SQL style conventions don't apply here, and there's no Lite counterpart to this file (it's Darling-specific reflection test infra), so no parity drift.

The rewrite itself checks out:

  • The reference to TsqlConventionGuardTests.KnownTruncatedRanges is valid — that field exists and is exactly the live-figure test the new prose points to.
  • The two "unreproducible" counts (544, 510) are correctly replaced with a description of why a number would go stale, rather than a new number that will just go stale again.
  • The <para> tags are balanced and the XML doc escaping is consistent with the surrounding style.

One observation, not a blocker since it's outside this diff: TsqlConventionGuardTests.cs (lines ~1402 and ~1409) still asserts "31" member bodies in prose ("Editing 31 member bodies...", "how the current 31 were found"), but KnownTruncatedRanges currently has 30 entries. That's the exact same disease this PR is curing — a count in prose that a test doesn't hold — one file over. Your PR description already notes the shipped inventory is 30 vs. the 31 measured on the branch, so you're clearly aware; might be worth folding into this PR or filing as an immediate follow-up so the fix doesn't stop one file short.

@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewed. This is a comment-only change in Darling/Darling.Tests/CSharpMemberMap.cs and TsqlConventionGuardTests.cs — no T-SQL, no production code, no behavior change, so the T-SQL style conventions and Lite/Darling collector parity concerns don't apply here (these files have no Lite counterpart; they're Darling-only test tooling).

Verified the specific claims:

  • KnownTruncatedRanges currently holds exactly 30 entries, matching the '30' figure the PR description and new comment text rely on.
  • No leftover references to the removed stale counts (544, 34, 13, 510, 31, "Thirteen") remain elsewhere in the tree tied to this doc.
  • XML doc <para>/<see cref> tags stay balanced and valid across both edited hunks.

No correctness, security, or performance concerns. LGTM.

TheMemberScan_ReadsEveryDeclarationWhole's own summary said Thirteen
members strand a literal today. Measured against the shipped code it is
twelve, and today asserts currency, so a reader has no cue to read it as
historical.

The earlier sweep missed it because it was bounded by passages I
authored, and this numeral sits in a paragraph I only partly edited. A
sweep scoped by authorship cannot see a stale figure in a paragraph
someone else wrote; re-swept by pattern over both whole files instead.
Comment thread Darling/Darling.Tests/TsqlConventionGuardTests.cs Outdated
Comment thread Darling/Darling.Tests/TsqlConventionGuardTests.cs Outdated
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewed. This is a doc-comment-only change confined to two Darling test files (CSharpMemberMap.cs, TsqlConventionGuardTests.cs) — no functional/production code, no T-SQL, no schema changes. Verified the array KnownTruncatedRanges currently has exactly 30 entries, matching the "30 in the swept trees" figure in the commit messages, so the core motivation (removing stale/unreproducible counts) checks out.

  • Lite/Darling parity: N/A — these test files have no Lite counterpart (find confirms CSharpMemberMap.cs/TsqlConventionGuardTests.cs only exist under Darling/Darling.Tests/), so there's nothing to keep in sync.
  • T-SQL style: N/A — no T-SQL touched.
  • Security/perf: N/A — comment-only diff, no behavioral change.
  • Correctness: left two inline comments — both remaining "Most of ... strand a string literal" claims (lines 1247 and 1404) don't match this PR's own commit-message math (12 of 30 = 40%, not "most"). Ironic given the PR's purpose is eliminating unsupported numeric claims; worth a quick fix before merge.

🤖 Generated with Claude Code

Most was false: twelve of thirty is a minority. Removing a numeral is
not removing a claim, and a quantifier is worse in one way - nothing
greps for a word, so Thirteen at least invited the suspicion that found
it.

The argument needs no quantity. A literal contained by nothing is
labelled Unknown, which is only loud if some census looks for a site of
that kind, and that holds for one entry or for all of them. Both
occurrences now say the same thing and assert nothing that can rot,
including the out-of-scope note that said a few.
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewed. This is a comment-only change confined to Darling/Darling.Tests (CSharpMemberMap.cs, TsqlConventionGuardTests.cs) — no T-SQL, no production code, no runtime behavior touched.

Verified the claims the PR makes:

  • KnownTruncatedRanges currently holds exactly 30 entries, matching the "30 in the swept trees" figure cited in the PR body and the doc's new "count the entries" pointer.
  • The doc's scope note ("Lite.Tests are outside it") is accurate — Lite.Tests isn't part of ScannedTrees, so there's no Lite/Darling parity concern with this change; nothing in Lite.Tests needs a matching edit.
  • The stale-count removal doesn't touch the actual test logic (arrived/left diffing against KnownTruncatedRanges, asserted at set equality) — only the prose around it.

No correctness, security, or performance issues found. LGTM.

Both are the same defect as the truncation doc: a quantity in prose beside a
population nothing asserts, wrong now and with no way to fail when it drifts.

The where-clause count read nine; the scanned trees carry seventeen members
with a constraint clause, plus a type-level one on a record. The block-comment
count read six files; the corpus carries sixty with a `--` anywhere in a block
comment, forty-eight on a non-asterisked continuation line -- the line a prefix
filter actually misreads -- and thirty-eight once files whose only hits are
CLI flags come out. That spread is the sharper point: the claim never said
which corpus or which predicate, so it could not have been pinned even in
principle, only removed.

Both sentences keep their universal and lose only the tally, which is this
file's own stated doctrine: a universal quantifier names the one
counter-example that would break it, while a count only tells you to count
again.

Two other numerals in the file were checked and left. The tenth-bullet
reference is held by the disposition map's equality assertion against
CONTRIBUTING.md, so it cannot drift without reddening first. The 101 figure is
explicitly dated to when it landed, scoped to a retired SKU outside the
scanned trees, and labelled as evidence for a decision rather than a live
figure.
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewed. This PR only touches XML//* */ doc comments in Darling/Darling.Tests/CSharpMemberMap.cs and Darling/Darling.Tests/TsqlConventionGuardTests.cs — no test logic, assertions, or the KnownTruncatedRanges array itself change, and no T-SQL/app code is touched.

  • Correctness: verified each removed numeral (544, 34, 13, 510, "31"/"the current 31", "Nine", "Thirteen", "Six files") isn't referenced anywhere else in the repo, so nothing is left dangling or inconsistent after their removal.
  • Lite/Darling parity: N/A — this convention-guard tooling (CSharpMemberMap/TsqlConventionGuardTests) only exists under Darling.Tests; there's no Lite.Tests counterpart to drift out of sync.
  • Security/Performance: N/A — comment-only change, no runtime code paths affected.
  • Style: new prose reads consistently with the surrounding doc voice and correctly points readers to the live, test-held source of truth (KnownTruncatedRanges, asserted at set equality) instead of a numeral that goes stale on unrelated edits.

No issues found.

@erikdarlingdata
erikdarlingdata merged commit 75daead into dev Sep 9, 2026
12 checks passed
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