Skip to content

docs(redis): replace line-number citations with names - #604

Merged
cevheri merged 2 commits into
libredb:mainfrom
be-student:codex/586-redis-named-citations
Sep 7, 2026
Merged

docs(redis): replace line-number citations with names#604
cevheri merged 2 commits into
libredb:mainfrom
be-student:codex/586-redis-named-citations

Conversation

@be-student

Copy link
Copy Markdown
Contributor

Closes #586

Replaces all 13 Redis provider source coordinates with declaration names and adds the document to the shared named-citation guard. The guard also verifies the cited factory entry point.

Validation:

  • bun test tests/unit/provider-docs-monitoring-citations.test.ts (23 passed)
  • format, lint, typecheck, repository policy checks, and production build passed
  • full suite: 10,669 passed; 5 unrelated local platform failures require 7z or node:sqlite

Assisted-by: OpenAI Codex

@cevheri

cevheri commented Sep 6, 2026

Copy link
Copy Markdown
Member

Verified, and close. All 11 names are declared in redis.ts in the visibility-prefixed form the guard's declarationLine() looks for, no .ts:<line> survives anywhere in the file, and the attributions you moved are right where you put them: client.call is inside runCommand(), the SCAN ... COUNT 100 is inside getSchema(), executeRedisCommand() really does dispatch on the first character, getKeyPrefix() really appends :* and leaves a colon-free key alone, and calculateHitRatio() returns exactly the "100.0" the doc claims for no traffic. Three mutations bite: a reintroduced redis.ts:375, a renamed calculateHitRatio in the source, and a broken factory citation each turn the file red. 23 pass, as you reported.

Generalising the factory assertion was the right instinct, and it is a follow-up I had already written down for myself. One thing left to finish it: the loop is a hand-listed pair and the population is four. mongodb.md (#581) and mysql.md (#582) both cite createDatabaseProvider() with the same link and are not covered, so the test's new plural name promises more than it measures.

Deriving the list closes that in one line:

for (const { doc } of NAMED_CITATIONS.filter((c) => read(c.doc).includes("`createDatabaseProvider()`"))) {

I ran it: still 23 pass, and putting factory.ts:63 back into mysql.md now fails, which the hand-listed pair does not catch. Filter on that phrase rather than on factory.ts, or oracle.md joins the list and fails immediately: its line 78 names the file without naming the entry point.

The rest is ready to merge as it stands.

@cevheri cevheri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cevheri cevheri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The derived list is right, and it measures strictly more than the pair did. Checked on f9e3c293:

  • baseline: 23 pass, 207 assertions
  • factory.ts:63 reintroduced into mysql.md: red
  • the same into mongodb.md: red

Neither was visible to the hand-listed pair, so the test's plural name now covers the population it promises.

Selecting on the phrase rather than on factory.ts is the detail that makes it correct, and worth spelling out because it is easy to get backwards. Fourteen provider docs link that file. oracle.md:78 links it as "Loaded on demand by the factory" and never names the entry point, so a link-based filter would have failed a doc that is already fine. You picked the narrower signal, which is the difference between a guard that measures a policy and one that dictates a sentence.

One thing I found while probing, and it is mine rather than yours: the one-liner I handed you can derive to nothing. Rename the cited name in all four docs and the loop runs zero times, so 23 still pass and the only trace is the assertion count falling from 207 to 203. Filed as #620 with the fix, which is not pinning the count (that would be one more hand-copied number in a test whose subject is hand-copied numbers) but deriving the population from the filesystem. It is the same lesson as this PR, one level up: a hand-written list rots whether it holds line numbers or filenames.

Thank you for both rounds, and for reporting your numbers each time. That is what made this quick to verify rather than quick to argue about. Merging.

@cevheri cevheri added the hacktoberfest-accepted Merged Hacktoberfest PR; counts for the participant label Sep 7, 2026
@cevheri
cevheri merged commit 91e1e59 into libredb:main Sep 7, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted Merged Hacktoberfest PR; counts for the participant

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs/providers/redis.md: replace 13 stale line-number citations with named citations

2 participants