Repository navigation
Conversation
…nit behind Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
2 of 3 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two fixes from the CLI contract's G1 survey (patch).
The service's log is rotated (cli-contract SPEC §7).
<data>/logs/service.logwas never rotated.server/contract/rotate.tsis cli-contract'sreference/service/rotate.ts(401fba2) @ 0.2, copied with the standard header and no local changes, and its test istest/contract-rotate.test.ts.servestarts it at boot on<data>/logs/service.log, then every 15 minutes on an unref'd timer: past 8 MB the log is copied toservice.log.1and truncated in place (launchd and systemd hold an append descriptor on it), older copies shift down, three are kept. A foreground run has no such file, so it does nothing.npm run devskips it.contract/rotate.tsonerm, onerename, onecopyand onetruncate, and a new test pins each to the file and its numbered copies, and pinsserveto passing it onlylogs/service.log.A first
service installthe manager refuses leaves no unit behind (cli-contract d5ddc0e, in Local Review's own service code).installwrote the unit, then reloaded, enabled and started it. If systemd refused any of those, or launchd refused the bootstrap, the unit stayed.service statusthen said "installed, not running" (3), and the next login tried it again. Nowinstallnotes whether the file existed beforewrite. If it didn't, a refusal calls the manager's newdiscard(). On systemd that's a best-effortdisable, removing the file throughremoveServiceFile, anddaemon-reload. On launchd it's removing the plist. Then the error is rethrown (exit 1, as before). A refused reinstall keeps its unit.Testing
npm test: 504 passed, 0 failed, 3 skipped. One of the skips is rotate's "unwritable folder" case, which skips as root (this box) and runs on CI.npm run typecheckis clean.npm run smoke:packis ok. The docs site builds, andcheck-linksreports 3267 internal links OK.New tests, with a control:
start→ no unit, anddisableanddaemon-reloadwere called, andstatusexits 4;daemon-reloadorenable→ no unit;bootstrap→ no plist;Without the fix in
index.ts, the three refusal tests fail and the control passes.test/cli.test.tschecks thatserverotates a held-open 8 MB+1 log at boot, that the inode is unchanged and the next append lands at 0, that a log under the limit is left alone, and that a foreground run with no log makes none.Real use: the packed tarball, in a throwaway npm prefix and
HOME, against the published 0.16.0 as the "before". A stand-insystemctlloads units and refusesstart.service installexited 1 and leftlocal-review-server.service, andstatusthen exited 3.start,disable --quiet,daemon-reload), andstatusexited 4.servefrom the tarball ran underpmwith a 9 MBservice.logand an existingservice.log.1. At boot, the 9 MB went to.1, the old.1to.2, andservice.logwent to 0 bytes./api/healthanswered 0.16.0 from that process; its environment showed the throwawayHOME.Checklist
🤖 Generated with Claude Code