Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Trim the library's comments to contracts and invariants - #53

Merged
floatdrop merged 2 commits into
mainfrom
trim-comments
Sep 13, 2026
Merged

Trim the library's comments to contracts and invariants#53
floatdrop merged 2 commits into
mainfrom
trim-comments

Conversation

@floatdrop

@floatdrop floatdrop commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Comments only, no code change: each file was printed with its comments stripped and diffed against main, and every file matches. Library files go from 1263 comment lines to 1019, test files from 1261 to 944.

The rule applied: an exported doc comment states the contract, not the mechanism; an unexported comment keeps only the invariant or the reason for a non-obvious choice. Cut: history ("used to", "the first version"), second phrasings, derivable consequences, benchmark figures, and arguments CLAUDE.md and DESIGN.md already make. Kept: every lock and ordering statement, and every reason that guards a regression.

In the tests, every oracle (C1 to C11), invariant (I1 to I8) and model rule (M1 to M6) keeps its statement and the reason its exemption is safe, and every test keeps its provenance tag and the sentence naming the rule it pins. The five regression files shared one identical ten-line explanation of the tags; it now lives once in fixtures_test.go, with every commit hash.

Library file Before After
lifecycle.go 309 216
binding.go 230 186
resolve.go 175 137
di.go 159 154
explain.go 115 95
state.go 76 62
validate.go 70 63
dihttp/dihttp.go 47 39
dislog/dislog.go 44 38
run.go 38 29
Test file Before After
concurrent_test.go 368 257
machine_test.go 167 130
lifecyclemodel_test.go 106 78
drain_test.go 95 61
teardown_test.go 94 67
wiring_test.go 71 51
worker_test.go 55 35
cycles_test.go 48 32
eleven smaller files 257 233

The package doc in di.go keeps every section and example. No CHANGELOG entry, since behaviour is unchanged.

🤖 Generated with Claude Code

floatdrop and others added 2 commits September 14, 2026 02:43
Comments only; no code line changes, checked by printing each file
with comments stripped and diffing against HEAD. 1263 comment lines
become 1019 across the ten library files.

The rule: an exported doc comment states the contract, not the
mechanism. An unexported comment keeps the invariant, or the reason for
a non-obvious choice. Gone are history ("used to", "the first version"),
second phrasings of one point, consequences the reader can derive,
benchmark figures, and arguments CLAUDE.md and DESIGN.md already make at
length. Every "guarded by", lock-order and "called with X held"
statement stays, and so does every reason that guards a regression:
the finished-node rule, the wait-for index's superset argument, the
warm path's ready condition, the Dekker pair, register's init-before-
queue order, the retire and release rule.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Comments only, checked as before. 1261 comment lines become 944 across
eighteen test files. The five regression files carried one identical
ten-line explanation of the provenance tags; it now lives once in
fixtures_test.go, with every commit hash, and each file's header is its
subject line. Every oracle (C1 to C11), invariant (I1 to I8) and model
rule (M1 to M6) keeps its statement and the reason its exemption is
safe; every test keeps its provenance tag and the sentence naming the
rule it pins. Gone is the narration of how each check came to exist.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@floatdrop
floatdrop merged commit fe4bbe8 into main Sep 13, 2026
3 checks passed
@floatdrop
floatdrop deleted the trim-comments branch September 13, 2026 21:51
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