Repository navigation
docs: tighten comments in the model and inference packages - #693
Merged
Merged
Conversation
Rewrite the comments in externagent, internal/inference, llm, localmodel, provider, internal/catalog, internal/huggingface, internal/hardware, usage and internal/gbnf. Each comment now states an invariant, a failure it guards against, an ordering reason, a unit, or a security or concurrency contract. Comments that restated the code, repeated an argument, or told the history of a change are removed or cut to the one line revive requires on an exported name. The change touches comments only: every file parses and prints identically to its previous version with comments stripped. Sixteen lines leave comment_baseline.txt because the comments they excused are fixed. Signed-off-by: Ion Alpha <contact@ionalpha.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This rewrites the comments in externagent, internal/inference, llm, localmodel, provider, internal/catalog, internal/huggingface, internal/hardware, usage and internal/gbnf so each one says something the code does not. Comment lines in these packages fall from 4,681 to 3,405. Sixteen lines leave
internal/rigor/testdata/comment_baseline.txtbecause the comments they excused are fixed.Why
Many comments restated the code, made the same argument twice, or told the history of a change. Every comment left states an invariant, the failure a line guards against, an ordering reason, a unit or range, or a security or concurrency contract. Doc links that resolve are kept.
How to verify
The diff is comments only. Each changed file was parsed with go/parser at the base commit and at the head, comments were stripped, and the go/printer output was compared: all 70 Go files are byte-identical.
go build ./...,go vetand./dev/teston the ten packages pass, as dogo test ./internal/rigor/...and./dev/lint. Adding a banned word back into a rewritten gbnf comment makesTestCommentsStayTersefail on that line.Notes for reviewers
Struct field docs and in-function comments that follow code were shortened rather than deleted. Deleting them would realign field columns or drop a blank line, which changes the printed code. The localmodel package doc stays at 40 lines, the package-comment limit, because it documents the trust model and the runtime and weights lifecycle that the rest of the package relies on.