Repository navigation
Limit cyclomatic complexity to 10 - #17
Merged
Merged
Conversation
turn_end checked Pi's raw token count, not the planned result, before shaking after a handoff. When pruning alone reached the target, the default methodOrder still elided old code blocks and broke the cache once more. The README said old file reads are still replaced with Pi's compaction off. Since edits happen only at the threshold, nothing changes then; the README now says so. Install dependencies without lifecycle scripts in CI and release: the release job can request an npm publish token, and no dependency needs its install script for the checks.
The turn_end handler had a complexity of 35, so a change to one strategy risked another, as the shake gate bug showed. The lint is pi-claude-pro's: ESLint's complexity rule on Node's type-stripped source, run by npm run check. The split keeps behavior. Three characterization tests pin paths no test covered, and each fails when its branch is removed, on the old code and on the new: waiting for a background note at an early threshold, starting a note only below the threshold, and not retrying a failed note at Pi's threshold. A focused /compact no longer cancels the background note itself, because handoff always cancels it before writing a new note. minimatch is overridden to 11 for ESLint, because every 10.x release has GHSA-g3hv-75wg-m249 and the lint does not depend on the differences.
# Conflicts: # README.md # extensions/index.ts # package-lock.json
…act cancel The split built the messages before the try, so an error there would stop turn_end instead of falling back to the next method. The new test pins that a focused /compact cancels an unfinished background note before it requests its own; it fails when handoff no longer cancels.
npm 10, shipped with Node 22, applies a nested override only to the package it names, so npm ci rejected the lockfile's minimatch 11 under @eslint/config-array.
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.
Why
The
turn_endhandler had a cyclomatic complexity of 35. A change to one strategy risked another, as the shake-gate bug fixed in #16 showed. This PR adds pi-claude-pro's complexity lint (ESLintcomplexityat most 10, run on Node's type-stripped source) tonpm run check, and splits the five functions above the limit.Changes
scripts/lint.ts,npm run lint, andchecknow runs the lint.tsconfig.jsonincludesscripts. CONTRIBUTING documents the rule.turn_endandsession_before_compactinextensions/index.ts,src/prune.ts,src/shake.ts,src/stale.ts.src/tool-calls.tsgets a sharednewestToolResultsgenerator.turn_endreturns early without a model, afterbackground.invalidate. Before, it computed a plan with no edits and returned nothing./compactno longer cancels the background note itself, becausehandoffcancels it before it requests a note. A new test pins this.eslintdevDependency with aminimatch^11 override: every minimatch 10.x has GHSA-g3hv-75wg-m249, and ESLint 10.14 pins ^10.2.6.npm auditreports 0 vulnerabilities. The lockfile adds 67 packages from registry.npmjs.org and removes none.Verification
npm run check: tsc, lint clean, 97 tests passed./compactcancel) pass on the code before the split. Each one fails when its branch is removed, in the old code and in the new.tryagain, and the focused-cancel test is added.