Skip to content

Always post a comment, even when there's nothing to do - #16

Merged
dakshcodez merged 2 commits into
mainfrom
fix-silent-success-comment
Aug 15, 2026
Merged

Always post a comment, even when there's nothing to do#16
dakshcodez merged 2 commits into
mainfrom
fix-silent-success-comment

Conversation

@dakshcodez

Copy link
Copy Markdown
Owner

Summary

Root-caused from a real user report: "workflow ran successfully but the README didn't change" against dakshcodez/gofiber-starter-project#1. That repo is 100% Go, and docmend only parses TypeScript/TSX/JavaScript/Python - parseCodebase() correctly found zero chunks, so the pipeline correctly found nothing stale, but never said so anywhere visible on the PR. Two early-return paths in index.ts's run() only logged via core.info (Action run logs only, not the PR) - from the PR's perspective: green checkmark, total silence, indistinguishable from "didn't run at all."

This also matches the original design brief, which specified a comment on every triggering PR, including the all-clear case.

What changed

Added postStatusComment (comment.ts) and restructured run() to always post something:

  • Zero parseable code in the whole repo -> names which languages are actually supported
  • No relevant file changes -> says so
  • Changes detected but nothing stale -> distinguishes "nothing here is linked to any doc" from "N sections checked, all accurate" (previously both silent)

Test plan

  • Reproduced the actual scenario: rebuilt a Go-only fixture matching the real repo's composition, confirmed parseCodebase() genuinely returns zero chunks for it
  • Confirmed postStatusComment() posts the correct, specific message through a mocked octokit
  • npm run lint / typecheck / build all pass

Not in scope here

Go (or any other language) support is a real feature gap, not something this PR addresses - would need a new tree-sitter grammar, WASM build, and extraction queries. Flagged separately for prioritization.

Root-caused a real user report ("workflow ran successfully but the
README didn't change") against a real PR: dakshcodez/gofiber-
starter-project#1. That repo is 100% Go, and docmend only parses
TypeScript/TSX/JavaScript/Python - parseCodebase() correctly found
zero chunks, so the pipeline correctly found nothing stale, but
never said so anywhere the PR author could see. Two early-return
paths in index.ts's run() only logged via core.info (visible in the
Action's own run logs, not on the PR) and exited silently - from the
PR's perspective: green checkmark, total silence, indistinguishable
from "didn't run at all."

This also directly matches the original design brief, which called
for a comment on every triggering PR, even the all-clear case
("3 sections verified accurate...") - not just when something needed
fixing.

Added postStatusComment (comment.ts) for the simple early-exit cases,
and restructured run() to always post something:
- Zero parseable code in the repo at all -> names which languages
  are actually supported, rather than looking identical to "your
  docs are fine."
- No relevant file changes (all excluded via .docmendignore) ->
  says so.
- Changes detected but nothing stale -> distinguishes "nothing here
  is linked to any doc" from "N sections checked, all still
  accurate" - meaningfully different situations that both used to
  produce identical silence.

Verified against the actual reported scenario, not a synthetic
stand-in: rebuilt a Go-only fixture matching the real PR's repo
composition, confirmed parseCodebase() genuinely returns zero chunks
for it (the real trigger condition), and confirmed
postStatusComment() posts the correct, specific message through a
mocked octokit.

Separately: Go support itself (or any language beyond the current
four) is a real feature gap, not something this commit addresses -
would need a new tree-sitter grammar, WASM build, and extraction
queries, comparable in scope to how TS/JS/Python were originally
added. Flagged for the user to prioritize separately.
- index.ts: moved the chunks.length === 0 check to right after
  parseCodebase(), before parseDocs()/buildLinkGraph() run at all.
  buildEmbeddingLinks() still calls llm.embed() once per doc section
  regardless of how many code chunks exist to link against - so the
  previous ordering meant every run of the exact scenario this PR
  targets (a repo docmend can't parse) burned N Gemini embedding
  calls before reporting "nothing to check." Checking first avoids
  that entirely.
- index.ts: reworded both "nothing to check" messages that implied
  a confident "your language isn't supported" diagnosis. Real gap
  found during review: packages/core/src/parsing/queries.ts only
  captures function_declaration/class_declaration/method_definition
  - not arrow functions. A fully-supported TS/JS/React repo written
  idiomatically (`const Foo = () => {...}`, extremely common for
  components and hooks) can legitimately produce zero chunks despite
  being a supported language, which would have made the original
  wording actively wrong, not just unhelpfully silent. Messages now
  acknowledge the ambiguity (unsupported language vs. a code pattern
  not yet recognized) instead of confidently blaming the language.

Found by a fresh subagent review spawned after PR #16 was opened.
Verified the reordering doesn't change any other behavior (full
lint/typecheck/build still pass; the early-return still fires on the
same chunks.length === 0 condition, just before the now-skipped
parseDocs/buildLinkGraph calls instead of after).

Not fixed here, flagged as a separate, likely higher-priority gap
than adding a new language: the underlying arrow-function parsing
gap itself. Any TS/JS/React codebase built primarily on arrow
functions is currently under-covered by docmend's own "supported"
languages, not just genuinely-unsupported ones like Go.
@dakshcodez
dakshcodez merged commit e397160 into main Aug 15, 2026
1 of 2 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