Repository navigation
Adopt the canonical pm-ops docstring gate and document all source declarations - #58
Conversation
…larations Wire the fleet's canonical pm-ops/docstrings analyzer (pm-ops@^2026.8.8) into pm-linear as a mandatory release gate via a thin scripts/docstring-gate.ts launcher that imports analyzeDocstringCoverage, rather than copying a weaker fork. Document every declaration the analyzer requires, driving violations from 34 to 0 (37 declarations -> 42 across 4 files). - scripts/docstring-gate.ts + scripts/script-launcher.ts: copied from pm-rl's adoption (a pure runGate + a main that sets process.exitCode, never exits) - pm-ops added to devDependencies; the `docstring` script is wired into both release:check and ci.yml (after Build, before the coverage gate) - test/docstring-gate.test.ts: covers the clean path, the violation path, and the main/isMainInvocation entry points Closes pm-linear-085x
|
Warning Review limit reached
Next review available in: 7 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 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThe change adds a ChangesDocstring coverage enforcement
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Reviewer's GuideThis PR introduces a canonical docstring coverage gate based on pm-ops/docstrings, wires it into CI and release checks, and adds JSDoc documentation for all required source declarations, along with tests and shared script-launcher utilities for gate scripts. Sequence diagram for the new docstring gate script invocationsequenceDiagram
actor Developer
participant Npm as npm_script_docstring
participant Node as node_docstring_gate_ts
participant Gate as runGate
participant Analyzer as analyzeDocstringCoverage
Developer->>Npm: npm run docstring
Npm->>Node: node scripts/docstring-gate.ts
Node->>Node: runIfMain(process.argv, import.meta.url, main, repoRoot)
Node->>Node: isMainInvocation(process.argv, import.meta.url)
Node-->>Node: true
Node->>Gate: main(repoRoot)
Gate->>Analyzer: analyzeDocstringCoverage({ root })
Analyzer-->>Gate: report
alt violations_present
Gate-->>Node: GateResult{ exitCode:1, stderr:message }
else no_violations
Gate-->>Node: GateResult{ exitCode:0, stdout:summary }
end
Node->>Node: process.stdout.write(...)
Node->>Node: process.stderr.write(...)
Node->>Node: process.exitCode = exitCode
Flow diagram for updated release:check and CI gatesflowchart LR
A[typecheck] --> B[build]
B --> C[docstring]
C --> D[coverage]
D --> E[audit:prod]
E --> F[pack:dry-run]
F --> G[changelog:check]
subgraph CI_workflow
CI1[Type check] --> CI2[Build]
CI2 --> CI3[Verify complete docstring coverage]
CI3 --> CI4[Test with coverage gate]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Greptile SummaryThe PR adopts the canonical
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| scripts/docstring-gate.ts | Adds the canonical analyzer launcher; the follow-up correctly removes the unused local import without affecting the public re-export. |
| scripts/script-launcher.ts | Adds reusable main-invocation detection and gate-result output handling. |
| test/docstring-gate.test.ts | Tests clean and violating repositories plus launcher entry points, including the preserved isMainInvocation re-export. |
| package.json | Adds pm-ops and incorporates the docstring check into the release pipeline. |
| .github/workflows/ci.yml | Adds explicit build and docstring-coverage checks before test coverage. |
| index.ts | Adds documentation to declarations without changing their executable behavior. |
Reviews (3): Last reviewed commit: "fix: drop the unused isMainInvocation im..." | Re-trigger Greptile
|
@coderabbitai full review Verified independently of the implementing agent (which did not survive to run its own gates — its
Please focus review on one thing: whether any docstring is filler. The analyzer rejects a Context for future reviews of this fleet: this adopts the canonical @deepscan reports "1 new and 0 fixed issues" and its detail is behind a paywall, so I cannot |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Changed files =='
git diff --name-status "$(git merge-base HEAD origin/main)" HEAD 2>/dev/null || git diff --name-status HEAD~1 HEAD
echo
echo '== PR diff (no lockfiles) =='
git diff --unified=50 "$(git merge-base HEAD origin/main)" HEAD -- \
.github/workflows/ci.yml index.ts package.json scripts/docstring-gate.ts \
scripts/script-launcher.ts test/docstring-gate.test.ts \
':(exclude)package-lock.json' 2>/dev/null || \
git diff --unified=50 HEAD~1 HEAD -- \
.github/workflows/ci.yml index.ts package.json scripts/docstring-gate.ts \
scripts/script-launcher.ts test/docstring-gate.test.ts \
':(exclude)package-lock.json'
echo
echo '== Outlines of new scripts and tests =='
for file in scripts/docstring-gate.ts scripts/script-launcher.ts test/docstring-gate.test.ts; do
if [ -f "$file" ]; then
echo "--- $file"
ast-grep outline "$file" --items all --view expanded || true
fi
done
echo
echo '== Documentation comments added to index.ts =='
git diff --unified=8 "$(git merge-base HEAD origin/main)" HEAD -- index.ts 2>/dev/null || \
git diff --unified=8 HEAD~1 HEAD -- index.tsLength of output: 123357 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== TypeScript and package configuration =='
for file in package.json tsconfig.json tsconfig.test.json; do
if [ -f "$file" ]; then
echo "--- $file"
cat -n "$file"
fi
done
echo
echo '== Resolved pm-ops dependency records =='
rg -n -A25 -B3 '"node_modules/pm-ops"|pm-ops@|pm-ops/' package-lock.json 2>/dev/null || true
echo
echo '== pm-ops docstring analyzer public surface and implementation =='
if [ -d node_modules/pm-ops ]; then
fd -t f . node_modules/pm-ops | sort | sed -n '1,160p'
rg -n -A35 -B10 '\banalyzeDocstringCoverage\b|interface .*Docstring|type .*Docstring|files_scanned|declarations_checked' node_modules/pm-ops
fi
echo
echo '== Every JSDoc block added in index.ts, with the attached declaration =='
git diff -U0 "$(git merge-base HEAD origin/main)" HEAD -- index.ts 2>/dev/null \
|| git diff -U0 HEAD~1 HEAD -- index.ts
echo
echo '== Current scripts and test with line numbers =='
for file in scripts/docstring-gate.ts scripts/script-launcher.ts test/docstring-gate.test.ts; do
echo "--- $file"
cat -n "$file"
done
echo
echo '== Direct invocation patterns in existing operational scripts =='
rg -n -A12 -B8 'isMainInvocation|runIfMain|import\.meta\.url|process\.argv' scripts test --glob '*.ts'Length of output: 58185
I found one docstring that reads as filler.
The other added docstrings in I found no reproducible functional defect in ✏️ Learnings added
You are interacting with an AI system. |
The symbol was imported alongside GateResult and runIfMain but never referenced in the module body - the re-export on the last line is a separate `export ... from` that does not consume the import binding. Typecheck did not object because an unused import is not a type error, and none of CodeRabbit, Greptile, Hound or semgrep flagged it either. Identified by working backwards from DeepScan, which reported '1 new and 0 fixed issues' on this PR while main reports '0 new and 0 fixed'. Its detail is behind a paywall, so the finding was located by elimination over the only new code in the diff rather than read directly.
|
Found DeepScan's finding without being able to read it, and fixed it in Recording the method, because "a paywalled analyzer disagrees and we merged anyway" is a habit DeepScan reported 1 new and 0 fixed issues here while import { type GateResult, isMainInvocation, runIfMain } from "./script-launcher.ts";
…
export { isMainInvocation } from "./script-launcher.ts"; // ← separate re-export
What is notable is what didn't catch it: @coderabbitai @greptileai — worth adding to your models for this fleet: an Gates after the fix: docstring gate 4 files / 42 declarations / 0 violations, 69 tests pass, Please re-review — this is a one-line change to the import list. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Commit summary and focused diff =='
git show --stat --oneline --decorate --no-renames 911cc77
git show --format=fuller --unified=30 --no-ext-diff 911cc77 -- scripts/docstring-gate.ts scripts/script-launcher.ts
echo
echo '== Updated script outline =='
ast-grep outline scripts/docstring-gate.ts --items all --view expanded
echo
echo '== Import and re-export declarations =='
ast-grep run \
--pattern 'import { $$$IMPORTS } from "./script-launcher.ts"' \
--lang typescript \
scripts/docstring-gate.ts || true
ast-grep run \
--pattern 'export { $$$EXPORTS } from "./script-launcher.ts"' \
--lang typescript \
scripts/docstring-gate.ts || true
echo
echo '== Relevant current lines =='
rg -n -A3 -B3 'from "./script-launcher\.ts"' scripts/docstring-gate.tsLength of output: 5401
Commit I found no issue in this one-line change. 🐇 ✓ ✏️ Learnings added
|
|
Merging. DeepScan is now @coderabbitai — thank you for saving that as a learning, and the wording is precise. Worth What makes this one worth remembering is what missed it: What this PR ispm-linear had the fleet's worst docstring ratio — 34 violations of 37 declarations, 8% documented It adopts the canonical One inconsistency I am recording rather than quietly leaving: pm-changelog#131 pins |
|
Tip For best results, initiate chat on the files or code changes.
The fixed unused import confirms that independent analyzers can find defects that type checking and several source reviewers miss. The canonical analyzer adoption and mandatory gate establish a consistent baseline for this repository. The 🐇 ✓ ✏️ Learnings added
You are interacting with an AI system. |
Summary
Adopts the fleet's canonical
pm-ops/docstringsanalyzer (pm-ops@^2026.8.8) as a mandatory release gate, and documents every source declaration it requires. No docstring-gate fork is copied — the thin launcher importsanalyzeDocstringCoveragefrompm-ops/docstrings, so this repo shares the one lexer-backed policy instead of drifting another copy.Before / after (canonical analyzer)
npm run docstring→docstring-gate: 4 file(s), 42 declaration(s) documented.Changes
scripts/docstring-gate.ts+scripts/script-launcher.ts: copied frompm-rl's reference adoption — a purerunGate(root)returning{exitCode, stdout, stderr}(assertable from a test) and amain(root)that writes the streams and setsprocess.exitCode(neverprocess.exit).package.json:pm-ops@^2026.8.8added todevDependencies(build-time gate, not a runtime dependency); newdocstringscript inserted intorelease:check..github/workflows/ci.yml: aVerify complete docstring coveragestep (plus a standaloneBuildstep), placed before the coverage gate.test/docstring-gate.test.ts: covers the clean path (real repo), the violation path (undocumented source), and themain/isMainInvocation/runIfMainentry points.index.ts: meaningful JSDoc on all 34 previously-undocumented declarations (no identifier-restating filler).Why not a fork
pm-changelogandpm-vcseach ship a 500-linedocstring-gate.tsfork that pinstypescript5to dodge the TS7 scanner.pm-opsalready solved that (it rescans template-substitution}and only treats/as regex in regex context), so copying a fork into more repos just creates more drift. pm-changelog passes its own fork insiderelease:checkwhile the canonical analyzer finds 5 violations in it — a gate that passes while the stricter policy finds violations is not enforcing the policy it claims to.Gates
npm run release:checkis green end to end:typecheck→build→docstring→coverage(70/80/80 thresholds met) →audit:prod(0 vulns) →pack:dry-run→changelog:check.pm item
Summary by Sourcery
Adopt the shared pm-ops docstring coverage analyzer as a mandatory release gate and document all relevant source declarations to satisfy it.
New Features:
Enhancements:
Build:
CI:
Chores:
Summary by cubic
Adopted the canonical
pm-ops/docstringsanalyzer as a required release/CI gate and documented all source declarations, reducing violations from 34 to 0. This standardizes docstring policy across repos and blocks releases with missing docs.New Features
scripts/docstring-gate.ts+scripts/script-launcher.ts) that importsanalyzeDocstringCoveragefrompm-ops/docstrings.npm run docstring; wired intorelease:checkand CI (after Build, before coverage); addedpm-ops@^2026.8.8as a dev dependency.main/isMainInvocationentry points.index.ts; repo now reports full coverage.Bug Fixes
isMainInvocationimport in the gate script to clear a static analysis warning.Written for commit 911cc77. Summary will update on new commits.