Skip to content

chore: comment and test cleanup against the new rules - #18

Merged
ipfizz merged 20 commits into
mainfrom
chore/comment-and-test-cleanup
Aug 31, 2026
Merged

ipfizz merged 20 commits into
mainfrom
chore/comment-and-test-cleanup

Conversation

@ipfizz

@ipfizz ipfizz commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Applies the rewritten comment and test rules from .admin/CONTRIBUTING.md across the tree. No behaviour change.

Comments

docs: correct the comments that describe behaviour the code no longer has fixes ~24 sites where the prose was wrong, not just verbose. The Windows backend landed after most api/ headers were written, so a dozen files described a two-platform world while importing a windows*Backend at the top of the same file. Also: exec-wrapper said "both backends" on line 4 and "all three" on line 24; window-controls promised "up to three things" and listed two; native-image listed getAspectRatio as deferred 112 lines above its implementation; auto-updater promised a detached install helper that does not exist; build-windows carried a dangling No from a copy-paste; (D30) should have been (D030) and was invisible to any decision sweep.

docs: cut narration comments across src then does the volume pass.

before after
comment lines 6,887 5,255
share of src 23% 18%
blocks > 4 lines 477 359
files opening with a header essay 184 / 189 158 / 189

Net −1,607 lines across 173 files.

Verification: every file was transpiled with comments stripped and code-hashed before and after. All 189 hashes match, so the diff is provably comment-only. The verifier was itself checked both ways — a comment-only edit reports zero drift, a one-line code change is caught.

Kept deliberately: the GTK clipboard deadlock rule, the Carbon EventHotKeyID struct-by-value derivation, every "never close a JSCallback inside its own invocation" note, the setReleasedWhenClosed:NO use-after-free note, ordering rules, security arguments, all 92 D0xx citations, and every C prototype above an FFI table — FFIType.u64 does not tell you which pointer is the out-param.

Tests

Removes change-detector tests: 12 Linux *-ffi.test.ts files (114 it() cases) that read a FFIType literal out of the source and assert it equals the same literal five lines away. Replaced by one linux-ffi-abi.test.ts keeping only assertions that encode a real C gotcha — gboolean is i32 not bool, a getter returns pointer not cstring so NULL is guardable, a variadic pinned to one arity, the finite DBUS_CALL_TIMEOUT_MS that is the four-hour-CI-hang scar.

Also: four platform-guard files merged into one table-driven platform-guards.test.ts; cocoa-msgsend-variants.test.ts collapsed from 24 near-identical cases to one; entry-barrel.test.ts rewritten to cover strictly more — it now loops IMPLEMENTED_MODULES and asserts every claimed module is really exported, which nothing checked before and which src/electron.ts depends on.

Two guards got stronger, not just smaller: the 14 Linux loader guards used to execute zero assertions on the Linux runner via an early return, and now report honestly as skips.

Deleted as dead: src/main/platform/windows/win32-window.ts (266 lines, imported by nothing in src/, kept alive only by its own test) and the unused has/clear on the Cocoa class and selector caches.

before after
darwin 1615 pass / 79 skip / 0 fail 1502 pass / 74 skip / 0 fail
test files 239 223

Net −1,514 lines. The darwin budget is ratcheted to the measured number (1400/90); linux and win32 keep the loose floor until their real counts can be read off a green CI run, since a guessed bound would false-fail.

bun run validate EXIT=0 locally on macOS at every commit.

@ipfizz
ipfizz merged commit 584b2fc into main Aug 31, 2026
3 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