Skip to content

Whether a declaration is documented is decidable; the sentence is not - #42

Merged
HackingGate merged 1 commit into
mainfrom
test/documentation-is-decidable-the-sentence-is-not
Aug 15, 2026
Merged

Whether a declaration is documented is decidable; the sentence is not#42
HackingGate merged 1 commit into
mainfrom
test/documentation-is-decidable-the-sentence-is-not

Conversation

@HackingGate

Copy link
Copy Markdown
Owner

Answers the documentation deliverable of #13: AST-selected documentation, with generation deliberately outside the pass/fail path.

The rule

Every declaration one module offers another -- pub or pub(crate), at the top level of a file in src/ -- has a doc comment above it. Nothing here judges what the comment says.

rustc has a lint for this and it says nothing about this crate. missing_docs fires on items reachable from the crate root as public, and this is a binary: there is no public API, every shared item is pub(crate), and the lint reports zero over twenty-four shared declarations that carry no documentation at all. The compiler is asking about a published surface; the surface a reader of this crate meets is the one between its modules.

A list, not a ceiling

The tree does not comply. "No more than twenty-four" is satisfied by documenting one declaration while adding another, with the gate green through the swap, so KNOWN names them: a new one fails, and a stale entry fails too -- the way policy/hooks.toml refuses a waiver that matches nothing.

That half earned itself immediately. The list was assembled with a regex over the sources first, and the parser found it wrong in both directions: six shared declarations the regex missed because their signatures wrap, and seven it named that are documented -- including a prevent_unusual_unicode that exists twice, with only one of the two bare.

Where generation would start, and why it is not here

Selecting the material a writer needs is deterministic and cheap. The third test prints exactly that bundle and generates nothing:

subject: src/audit.rs line 588
kind: fn
module docstring: 42 line(s)
called from: src/main.rs
signature: pub(crate) fn for_publication(root: &Path, policy: &Policy) -> Result<Exit> {

What cannot be mechanized is the sentence, because the sentence is the reason the code is that way, which is not in the syntax tree. This repository already refuses that from the other side: no-trivial-comment reads doc comments too, so a /// Gets the name. inserted to satisfy this rule is refused by the content policy on the same commit. The two compose, and neither is a model deciding whether a declaration is adequately documented.

What the second structural rule cost

The reader moves to tests/support/syntax.rs. That is the measurement the structural-tier research wanted -- what does a second rule over a syntax tree cost once the first one's reader exists? A predicate and a list. The git-environment test keeps only what is about git, and gains the parse-failure guard by sharing it.

Checks

cargo test, cargo clippy --all-targets, cargo fmt --check, uphold scan and uphold check pass locally; the commit went through the installed hooks.

The second structural rule, and the boundary the documentation research asks
about. It refuses a declaration one module offers another -- `pub` or
`pub(crate)`, at the top level of a file in `src/` -- with no doc comment above
it. Nothing here judges what the comment says.

rustc has a lint for this and it says nothing about this crate. `missing_docs`
fires on items reachable from the crate root as PUBLIC, and this is a binary:
there is no public API, every shared item is `pub(crate)`, and the lint reports
zero over twenty-four shared declarations that carry no documentation at all.
The compiler is asking about a published surface; the surface a reader of this
crate meets is the one between its modules.

A list, not a ceiling. The tree does not comply, and "no more than
twenty-four" is satisfied by documenting one declaration while adding another,
with the gate green through the swap. Naming them means a new one fails -- and
a stale entry fails too, the way `policy/hooks.toml` refuses a waiver that
matches nothing. That half earned itself immediately: the list was assembled
with a regex over the sources first, and the parser found it wrong in BOTH
directions -- six shared declarations the regex missed because their signatures
wrap, and seven it named that are documented, including a
`prevent_unusual_unicode` that exists twice with only one of them bare.

Where generation would start, and why it is not here. Selecting the material a
writer needs is deterministic and cheap, and the third test prints exactly that
bundle -- signature, the module's own docstring, the calling modules -- and
generates nothing. What cannot be mechanized is the sentence, because the
sentence is the reason the code is that way, which is not in the syntax tree.
This repository already refuses the other half from the other side:
`no-trivial-comment` reads doc comments too, so a `/// Gets the name.` inserted
to satisfy this rule is refused by the content policy on the same commit. The
two compose, and neither is a model deciding whether a declaration is
adequately documented.

The reader moves to `tests/support/syntax.rs`, which is the measurement the
structural-tier research wanted: what does the second rule over a syntax tree
cost once the first one's reader exists? A predicate and a list. The
git-environment rule keeps only what is about git.
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@HackingGate, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 02f0c27c-ea75-4f2e-90d7-2fe3b21644b4

📥 Commits

Reviewing files that changed from the base of the PR and between b65773f and 88eb925.

📒 Files selected for processing (4)
  • tests/structural_documentation.rs
  • tests/structural_git_env.rs
  • tests/support/mod.rs
  • tests/support/syntax.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.44%. Comparing base (b65773f) to head (88eb925).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #42   +/-   ##
=======================================
  Coverage   89.44%   89.44%           
=======================================
  Files          31       31           
  Lines        9732     9732           
=======================================
  Hits         8705     8705           
  Misses       1027     1027           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HackingGate
HackingGate merged commit 6261903 into main Aug 15, 2026
12 checks passed
@HackingGate
HackingGate deleted the test/documentation-is-decidable-the-sentence-is-not branch August 15, 2026 05:05
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.

2 participants