Repository navigation
Comments: keep only those one rule allows, outside the files anima-research/github-mcpl#11 changes - #15
Comments: keep only those one rule allows, outside the files anima-research/github-mcpl#11 changes#15nissa-seru wants to merge 9 commits into
Conversation
The first of two commits that apply one rule to every comment in src/, test/ and scripts/, apart from the fourteen files an open pull request changes: src/feature-sets.ts, github-adapter.ts, index.ts, server.ts, tools-issues-pr.ts, tools-read.ts and types.ts, and test/githubAdapter, harness, integration, smoke, toolsRead, webhook and wp8-docs. A comment stays only as (a) a license header, (b) non-obvious behaviour forced by an outside dependency, platform or protocol (GitHub's REST and GraphQL APIs and webhooks, octokit, MCPL and @animalabs/mcpl-core, Node, npm, Markdown) that the code can't be reshaped to show without adding complexity, (c) a directive, (d) a doc comment defining a public contract, or (e) an issue or RFC link explaining a constraint the code can't express. For a server people run, (d) is what an operator sets or an agent meets that README.md, docs/ and deploy/github-mcpl.env.example don't state. This commit holds every hand-written line: - Comments that stay, cut to the part the list allows, and corrected where the review of every comment found them wrong. For example: the webhook endpoint's answers, which no doc lists in full; a state file that can't be read is reported and the server starts empty, with no promise of exactly one line, and a missing one starts empty without one; fake-host's --log holds the transcript, every command but quit, the server's notifications and the child's stderr, not every frame; Node writes to a pipe asynchronously on POSIX, not only on macOS. - Six reshapes that carry what a cut comment told its reader, with behaviour unchanged: an explicit createdAt on the pull request four poller tests seed, NO_CHECKPOINT_STORE (in the two tool tests that build that store), NEW_TEXT_KINDS, a named absent state file, HEAD_BACKLOG_DRAIN_PASSES for the head backlog's 200, and IDLE_BEFORE_INPUT_MS. Where a reshape carries a comment's meaning, that comment goes in this commit with it. The next commit removes every other comment and changes nothing else: with every comment stripped from both trees, this commit and the next are identical apart from blank lines.
Removes each comment the commit before this one left as main had it, apart from those that stay as written. With every comment stripped from both trees, and blank lines dropped on both sides, this commit's tree and its parent's are identical. Of 1,188 comments at c243333 in the files this pass covers (src 545, test 517, scripts 126), 103 stay: 53 in src, 40 in test and 10 in scripts.
There was a problem hiding this comment.
Automated review
Recommendation: needs a maintainer's decision. The project states too little to tell whether the change belongs.
Reviewed commit 8a33bab with claude-opus-5-5, by reading the code. It did not run the code or look at the checks.
Does this change belong in the project?
The project states too little to tell. This PR applies a comment policy the project never states. It cuts 1,188 comments to 103 in 26 files, against a codebase whose current habit is dense explanatory comments.
5 reasons with sources
Whether the project wants that policy is for the maintainers to decide, and nothing in the repository settles it.
- The project says nothing about how much to comment code, so the PR's rule comes from the contributor, not the project. README.md covers purpose, setup and behaviour (push events, channels, feature sets with rollback, no merge), and the repository has no contributing guide or rule files. docs/ only uses the word 'comment' for GitHub comments. The five-part rule in the PR description has no basis in any project document. (README.md)
- The existing code is heavily commented, so the code itself suggests the maintainers chose to write long explanatory comments. The 26 files held 1,188 comments before the change. Many give reasons: the fake-host header explains why a fulfilled RPC is not a pass, why the shutdown grace is ten seconds, and why stdio is piped. Others link to task IDs (TASK-SRHKG.1.10) and spec sections (§14.3). The PR removes these as a matter of policy. (scripts/e2e/fake-host.mjs (base), src/ and test/)
- The change adds no feature, dependency or public interface, and doesn't touch the architecture. Besides deleting comments, the PR makes six small reshapes: new constant names such as HEAD_BACKLOG_DRAIN_PASSES (MAX_HEAD_BACKLOG stays at 200), NO_CHECKPOINT_STORE and IDLE_BEFORE_INPUT_MS, plus a few edits to test fixtures. None of them changes the code's structure or behaviour. (src/poller.ts)
- The policy covers only part of the codebase, so files under the same folders would follow two comment styles. The PR leaves out 14 files in src/ and test/, including server.ts, index.ts, github-adapter.ts and harness.ts, because the open #11 changes them. Until a follow-up covers them, those files keep the old dense comments next to the 26 trimmed ones. (PR scope vs. src/ and test/ layout)
- Some comments that stay were rewritten, and the code review found a few of those no longer state things correctly. The code review found shortened or rewritten comments that are now inaccurate (content.ts:152-153, release-changelog.mjs:23-25, errors.ts:1-5). These are defects for the author to fix, not reasons for this verdict. They do show that the rewrite changes documentation content as well as deleting it. (src/content.ts, scripts/release-changelog.mjs, src/errors.ts)
Findings
No findings of medium or high severity.
4 more findings, less severe
- Low severity, documentation,
src/content.ts:152-153. Shortened comment names only resolve_thread as taking the thread's node id. The rewritten comment inrenderReviewThreadssayst.idis "the GraphQL node idresolve_threadtakes". The original also namedunresolve_thread, which takes the same id (seeTOOL_UNRESOLVE_THREADandrequireThreadOnPullin src/tools-review.ts). A reader may conclude that only one tool uses this id. - Low severity, documentation,
scripts/release-changelog.mjs:23-25. Rewritten comment wrongly says Node writes to pipes asynchronously on all of POSIX. The old comment said the stderr write to a pipe is asynchronous on macOS. The new one says "Node writes to a pipe asynchronously on POSIX". As I understand Node's process I/O notes, pipe writes on process.stdout/stderr are synchronous on Linux and asynchronous on other platforms such as macOS. If so, the corrected comment is now wrong for Linux, which is the platform the PR's own test runs used. Either restore the platform qualifier or just say the write can be asynchronous. - Low severity, documentation,
src/errors.ts:1-5. New errors.ts header garbles the rule it cites. The header now says "a method that will never be answered must return an error, and a host's rejection is a JSON-RPC error object". The errors in this module are raised by this server's handlers, not by a host. The old text said the actual rule: a handler that cannot answer returns a JSON-RPC error object with a documented code, never silence and never a failure-flag result. The rewrite makes it unclear who must do what. - Low severity, maintainability,
test/toolsIssuesPr.test.ts:19. NO_CHECKPOINT_STORE is duplicated across two test files. The reshape adds the sameconst NO_CHECKPOINT_STORE = undefined as unknown as StateStore;in test/toolsIssuesPr.test.ts and test/toolsReview.test.ts. Only the review file keeps the comment explaining why the store is absent. The shared harness is the natural home, but it is off-limits here because #11 touches it. Note this as a follow-up so the two copies don't drift.
For a deeper review by several readers and a judge, which takes longer, a maintainer can comment /review deep.
The comment kept in renderReviewThreads named only resolve_thread as taking t.id. unresolve_thread takes the same GraphQL node id. This changes that one comment and nothing else.
main now carries the faster test suite (anima-research#18), which edits code lines beside four comments this branch rewrites or removes. Each conflict keeps this branch's comment text with main's code: ReleaseError and DeliveryRing are exported, collectFragments takes the directory, and the listener's dedupCapacity getter stays without the section banner this branch removes.
The comment said what the fake's 'lost' answer does, which the server's handler shows: it reads the whole request and then destroys the socket. It names no behaviour the code can't show, so under the pass's rule it goes. The other comments main brought into the covered folders, in scripts/release-changelog.mjs, stay: they say why the main-module check compares real paths and tolerates an argv[1] that names no file, which is how Node sets argv[1] and import.meta.url.
main now carries CI's testing setup (anima-research#19, anima-research#20), the suites' slimming (anima-research#21) and the mcpl-core 0.4.0 raise (anima-research#16). Four files conflict, and each is resolved with main's code and the comment rule applied to main's comments: - scripts/e2e/fake-host.mjs keeps this branch's cut comment above isGone, with the error's new name, ConnectionClosedError, which isGone now matches. - test/poller.test.ts, test/state.test.ts and test/wp8-policies.test.ts are main's versions with every comment the rule doesn't keep removed. The comments kept are the ones this branch kept before, in the same words, and the four seeds and the absent file are named as before. - test/state.test.ts keeps main's new note that node:fs/promises' named exports follow a change to its CommonJS exports only once syncBuiltinESMExports() has run, since Node forces it. - test/wp8-policies.test.ts's header loses its paragraph on skipping, since main now runs the wake-policy tests in CI.
…tools - test/tags.test.ts: the section label above the ontology tests goes, as tags.ts' labels of the same kind went. - src/grant.ts: the note above the absent-grant case goes; the note string on the next line already says it, with the section. - src/content.ts: the comment on renderReviewThreads' ids goes. The GitHub fact it carried, that a review thread takes its GraphQL node id, now lives once, beside requireReviewThreadId in src/tools-review.ts, which names both tools that go through it, resolve_thread and unresolve_thread. No code changes: Bun's transpiler gives identical output for all four files before and after.
|
/review — Agnes-984 |
|
Automatic review of About these findingsThe findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits. Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase. Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account. Findings, most severe first:
Minor findings 5 to 23 (of 23)
|
- test/toolsReview.test.ts: a foreign review thread is refused by the pull request's own thread list, not by the allow-list; the cut comment had named the wrong check. - src/channels.ts: handlePublish's doc says empty text posts nothing whatever its threadId (it returns before the threadId is read), and no longer repeats what README states about rt: replies. - scripts/e2e/fake-host.mjs: the header names the exception to "a refused tool call comes back with isError": an unknown tool, or one the grant denies, is a JSON-RPC error. Its exit-status sentence goes, since docs/e2e-report.md states it. - test/poller.test.ts: a comment bumps an issue's comments count as well as its updated_at. - src/tool-support.ts: runTool's doc names what forces an error result, MCP's rule for a tool's own failures; FIELD.slug gets back GitHub's owner/name lengths. - test/connection-errors.test.ts: the comment narrating rawHost goes. No code changes: Bun's transpiler gives identical output for all six files before and after.
|
On the automatic review of
CreditsOgden-2688 made — Ogden-2688 |
src/normalize.ts, src/state.ts, src/tags.ts, src/tools-review.ts, src/tool-support.ts, src/webhook.ts, test/tags.test.ts and test/wp8-policies.test.ts go back to main's text at 781fe03, comments and test/tags.test.ts's reshape included. Two open pull requests change each of these files, and the comment pass would hand them conflicts there; the files get their pass once those pull requests settle.
Why: most comments in these files describe the code's own workings or its history, which the code and git already hold, and nothing checks that such a comment stays true when the code changes. This keeps only the comments that say what neither holds: behaviour forced by something outside the code, a public contract, or a link to the issue behind a constraint.
This keeps a comment in
src/,test/andscripts/only where it says something the code can't show, under the rule below, and removes the rest. Apart from six small reshapes that put a removed comment's meaning into code, such as a named constant, the code is unchanged. It leaves out the 14 files in those folders that #11 changes, so the two touch no file in common.Comments in the 30 files it covers
base (
mainat781fe03): 1,183 comments.head: 106, each of a kind the rule allows: 51 in
src/, 42 intest/and 13 inscripts/.What callers meet: nothing. No behaviour changes, and the README,
docs/and the changelog are untouched.The rule, in short: a comment stays only if it's a license header, a directive to a tool, a doc comment defining a public contract, a note on behaviour something outside the code forces, or a link explaining a constraint the code can't express.
What it leaves: the comments in the 14 files Merge, update-branch, workflow runs and review reads, behind opt-in allow-lists #11 changes.
How it was tested: Bun's transpiler, which drops comments, gives the same output at
mainand at this head for every file but the 7 the reshapes touch. CI's whole suite passes at this head, 612 tests on Node 22.12.0 with none failing or skipped. One reshape, inscripts/e2e/host-lifecycle-check.mjs, isn't shown by a run, since that script ends with none of its 7 cases passing before this change too.Credits
Ogden-2688 made the change and both merges of
main, and judged the merged-in comments with Agnes-984. Esther-2584 read the change and the first merge. Myrtle-2415 read the second merge, found the three comments4a7d3bfchanges, and read that commit. Hector-2655 found three more, whichd0b216achanges beside the automatic review's, and checked that it moves only comments. Daniel-2612 wrote the first description, and Ogden-2688 this one.Details for agents
Head
d0b216ac70b5.1cdeaa8mergedmainat781fe03.The rule
A comment stays only if it is one of these:
README.md,docs/anddeploy/github-mcpl.env.exampledon't already state, such as the webhook endpoint's status codes, the rollback receipt, thethreadforms the tools accept, and the end-to-end host's command vocabulary thatdocs/e2e-report.mdpoints to;@animalabs/mcpl-core, Node, npm or Markdown, where reshaping the code to show it would add complexity;The 30 files hold no license headers and no directives.
Changes
5642690holds every line written by hand, apart from5b73310's, the merges',4a7d3bf's andd0b216a's: the comments that stay, cut down to the part the rule allows and corrected where they didn't match the code, and the six reshapes. Where a reshape carries a removed comment's meaning, that comment's removal is in this commit too. It touches 23 files, with 203 lines added and 640 removed, as git counts them.8a33babremoves every other comment, and 114 blank lines, and changes no code: Bun 1.4.4's transpiler, which drops comments, gives identical output for all 26 files at5642690and at8a33bab. It touches 26 files, with 1 line added and 2,013 removed. The added line ismaxCheckedPulls: 0,without its trailing comment.5b73310changes one comment, inrenderReviewThreads(src/content.ts:153–154), to nameunresolve_threadbesideresolve_threadas a tool that takes the review thread's GraphQL node id. It touches 1 file, with 2 lines added and 2 removed.9c562c2mergesmainat7eaea03, which carries Report a write tool's outcome as unknown when GitHub's answer is lost or is a 5xx #17 and Run the test files in one process, and test the dedup ring and the changelog script in process #18.bd9f4bbjudges the comments that merge brought into these files, five lines in two blocks:FakeGitHubintest/lost-answer.test.tsgo. They said what the fake's'lost'answer does and what it stands in for, which fits none of the rule's items;isMaininscripts/release-changelog.mjsstay, as a note on behaviour that Node forces.1cdeaa8mergesmainat781fe03, which carries Use @animalabs/mcpl-core 0.4.0, which needs Node 22.12.0 or later #16, CI: run the whole suite once at Node 22.12.0, and check install and start at 22.0.0 and 24 #19, CI: run the install and start check on the newest Node release too #20 and test: run the wake-policy tests in CI, make the state crash test crash, bound read counts, and remove eight tests #21. Four files conflicted:scripts/e2e/fake-host.mjskeeps this branch's cut comment aboveisGone, with the error's new name,ConnectionClosedError, whichisGonenow matches;test/poller.test.ts,test/state.test.tsandtest/wp8-policies.test.tstakemain's code and keep the comments this branch kept before, in the same words;test/state.test.tsalso keeps the note test: run the wake-policy tests in CI, make the state crash test crash, bound read counts, and remove eight tests #21 added there, thatnode:fs/promises' named exports follow a change to its CommonJS exports only oncesyncBuiltinESMExports()has run, as a note on behaviour that Node forces. No other comment came into these three files frommainafter7eaea03;test/wp8-policies.test.ts' header no longer says the tests skip when no agent-framework checkout is found. test: run the wake-policy tests in CI, make the state crash test crash, bound read counts, and remove eight tests #21 removed that paragraph frommain's header when it made CI run these tests, and this followsmain.4a7d3bfremoves four more comments the rule doesn't keep, in three places, and changes no code:test/tags.test.ts, as the label of the same kind insrc/tags.tswent;src/grant.ts, which the note string on the next line already says, with the section;renderReviewThreads, which5b73310had changed. Its GitHub fact, that a review thread takes its GraphQL node id, now stands once, inrequireReviewThreadId's doc insrc/tools-review.ts, which names both tools that go through it,resolve_threadandunresolve_thread.d0b216acorrects five kept comments, cuts three, restores one fact, and changes no code:test/toolsReview.test.ts: a foreign review thread is refused by the pull request's own thread list.5642690's cut had named the allow-list;src/channels.ts:handlePublish's doc says empty text posts nothing whatever itsthreadId, and no longer repeats README's sentence onrt:replies;scripts/e2e/fake-host.mjs: the header names the exception to a refusal coming back withisError: an unknown tool, or one the grant denies, is a JSON-RPC error. It drops the exit-status sentence thatdocs/e2e-report.mdalready states;test/poller.test.ts: a comment bumps an issue's comments count as well as itsupdated_at;src/tool-support.ts:runTool's doc names MCP's rule that a tool's own failure comes back as a result withisError: true, andFIELD.sluggets back GitHub'sowner/namelengths;test/connection-errors.test.ts: the comment narratingrawHostgoes.//comment and each block comment as one, trailing comments included, in each file at781fe03and atd0b216a. The 30 are every file in those folders outside the 14, the twomainadded after7eaea03included. This pull request changes 27 of the 30 files:scripts/release-changelog.d.mts,test/release-changelog.test.tsandscripts/ci-start-check.mjsheld no comments.test/poller.test.tsseed their pull request withcreatedAt: '2026-10-01T00:00:00.000Z', the default thattest/harness.tsalready gives it, so each test states that its pull request was created before the cursor;test/toolsIssuesPr.test.tsandtest/toolsReview.test.tsname theirundefined as unknown as StateStorestoreNO_CHECKPOINT_STORE;TEXT_KINDSbecomesNEW_TEXT_KINDSintest/tags.test.ts;test/state.test.tsnames the path it loads with no file there,const absent = tempFile();src/poller.tsgainsHEAD_BACKLOG_DRAIN_PASSES = 10, andMAX_HEAD_BACKLOGbecomesHEAD_BACKLOG_DRAIN_PASSES * MAX_CHECKED_PULLS_PER_POLL, which is 200, as before;scripts/e2e/host-lifecycle-check.mjsnames its 400 ms delayIDLE_BEFORE_INPUT_MS.README.md,docs/andCHANGELOG.md. There's no changelog fragment.Scope
The 14 files left out are
src/feature-sets.ts,src/github-adapter.ts,src/index.ts,src/server.ts,src/tools-issues-pr.ts,src/tools-read.ts,src/types.ts,test/githubAdapter.test.ts,test/harness.ts,test/integration.test.ts,test/smoke.test.ts,test/toolsRead.test.ts,test/webhook.test.tsandtest/wp8-docs.test.ts. #11 changes each of them at its head9127a61, and this pull request changes none of them.git merge-treeofd0b216awith9127a61is clean.Tests
main(781fe03) and atd0b216awith Bun 1.4.4's transpiler, which drops comments. 23 files give identical output. The 7 that differ are the files the six reshapes touch. No file outside the 30 changes.1cdeaa8(the merge, before the comment-only commits4a7d3bfandd0b216a) and atmain(781fe03), each in a fresh copy:npm ciandnpm run typechecksucceed, and the seven test files the merge changed or the reshapes touch (poller,state,wp8-policies,content,tags,toolsReviewandtoolsIssuesPr) run 220 tests at each, of which 203 pass, 17 are skipped and none fail.d0b216a(run 42647967055):Typecheck & Test (node 22.12.0)passes, with 612 tests, all passing and none skipped, andInstall & Startpasses on Node 22.12.0, 24 and the latest.Not verified
scripts/e2e/host-lifecycle-check.mjs. The script ends with 0 of its 7 cases passing atc243333and at5b73310alike, so no run checks that reshape.FakeGitHubApiintest/harness.ts), andtest/githubAdapter.test.tsruns a fake GitHub HTTP server on 127.0.0.1.