LintDrift
← Back to blog

Deterministic checks versus an AI documentation review

An AI documentation review can read a diff and write a plausible comment. That is a different product from a test. A test fails when a documented path is not the path in the route table, and it fails the same way on Tuesday as it did on Monday. That mismatch between the docs and the code has a name: API documentation drift.

What the model is good at

Once you already know the docs say GET /api/users/{id} and the code says GET /api/v2/users/{userId}, a model is useful for the sentences around that fact:

  • Why the mismatch happened, in the language of this pull request.
  • A rewritten line or example the author can apply.
  • A short summary of the documentation changes in the pull request.

Those are drafts. The author still merges them.

What the model should not decide

Asking a model whether the documentation is "accurate" produces comments that are hard to replay. The same page can draw a warning on one run and silence on the next. Reviewers learn to skip the bot. The check gets disabled, and the original problem is back.

A deterministic comparison does not have that failure mode. The route list, the OpenAPI operation, and the fenced path in Markdown either match or they do not. The finding cites the file and the line. If it is wrong, you can see which parser was wrong.

The same logic applies to prose tools. A grammar checker is deterministic too, but it measures the wrong thing, which is why spellcheck misses API contract changes.

The order that stays trustworthy

  1. Parse the code and the spec.
  2. Parse the docs.
  3. Emit a finding only when they disagree.
  4. Ask the model to explain that finding and propose a patch.

Skip step 4 and the check is still a check. Skip steps 1–3 and you have a reviewer with no ground truth.

LintDrift is built in that order on purpose. The pull request annotation is the mismatch. The suggested documentation is labeled as a suggestion based on that mismatch, not as a second opinion that might overrule it. For where that annotation lands in the review, see catch outdated API docs in the pull request.

LintDrift runs on GitHub for TypeScript/Node repositories with OpenAPI and Markdown or MDX docs. Findings are deterministic, and AI explanations and suggested fixes, on Pro and above, stay suggestions until someone accepts them. See plans and pricing or try it free on one repository.

Catch the next outdated endpoint before it merges.