compound-engineering-plugin icon indicating copy to clipboard operation
compound-engineering-plugin copied to clipboard

ce-code-review: send deleted files as a deletion manifest instead of full preimages, and stop them from forcing the full spine

Open ernest0vm opened this issue 1 month ago • 1 comments

Problem

ce-code-review handles deleted files as if they were added code. In a dead-code pruning PR this sends the review down the full path. Every persona then reads the body of every deleted file, and none of the findings come from those bodies.

The review does need to know what is being deleted. A pruning change is correct only if each deleted file was dead, and its usual defects are orphans left behind in the files that survive. Neither question needs nine reviewers to read the deleted source.

Observed behavior (v3.27.0; review-scope.py and references/scope.md are unchanged in v3.30.3)

  • review-scope.py adds deleted lines to exec_nontest_lines (total = int(added) + int(deleted)), so a pruning PR reaches FULL_EXEC_LINE_MIN = 200 and size_band: large on deletions alone. That is a floor: the gate cannot choose lite or focused.

  • The shared diff is git diff -U10 $BASE, which includes the full preimage of each deleted file. Every persona receives it.

  • Two rounds on a private React Native repo:

    PR Lines Deleted files full.diff Agents Findings
    Dead-code pruning +495 / −5193 74 (46% of diff bytes) 312 KB 9 (5 personas + merge, validator, report) 7
    Payment-path pruning +1510 / −3869 38 372 KB 9 (6 personas + 3 leaves) 4
  • None of the 11 findings is on a deleted file. All of them are orphans in surviving files: unused locals and props, styles, feature flags and assets with no reader left.

  • Mid-tier personas read the staged diff in chunks: maintainability used 5–10 Read calls and project-standards 4–5 per round. One session spent 46 diff reads on a single round.

  • Dropping the deleted-file bodies alone shrinks the first diff from 312 KB to 183 KB.

Expected behavior

  1. Deletion is a first-class signal, not a line count. The scope helper reports deleted files separately (for example deleted_files and deleted_lines). Every reviewer receives a deletion manifest: each deleted path with what it exported, and whether it has import-time side effects (registrations, config plugins, top-level calls).
  2. Bodies stay out of the shared diff. Build the shared diff with git diff -U10 --irreversible-delete $BASE. Git keeps the deleted file mode header and the path, and omits the preimage. Personas that need a body read it on demand with git show <base>:<path>, which dispatch-reviewers.md already allows.
  3. Correctness and adversarial ask whether each deleted file was dead. That means checking what static imports miss: references by string (assets, config plugins), routes resolved from file names (for example expo-router, Next.js), import-time registration, and deleted tests whose subject still ships. Other personas look for orphans in the surviving files.
  4. Deleted files alone do not force the full spine. Whole-file deletions count toward a separate band. That band can move a change from lite to focused, but it is not a floor for full. Modified lines in files that survive keep counting as they do today.

Acceptance criteria

  1. A PR whose changed lines are mostly whole-file deletions, with fewer than 200 executable added or modified lines, takes focused rather than full.
  2. The shared diff carries no preimage for deleted files, and every reviewer prompt includes the deletion manifest.
  3. A deleted file that is still referenced by string or by file-based routing produces a correctness or adversarial finding. Add a regression fixture for this.
  4. On a fixture with about 70 deleted files, the run makes fewer than half the diff Read calls it makes today.

ernest0vm avatar Oct 05 '26 11:10 ernest0vm

Triage: leaving open — valid review-scope / diff-cost bug.

On current main, skills/ce-code-review/scripts/review-scope.py still counts added + deleted into exec_nontest_lines, so a deletion-heavy prune PR can hit FULL_EXEC_LINE_MIN and force the full spine on deleted volume alone. The shared git diff -U10 preimage then gets inlined for every persona.

Worth fixing at the scope + shared-diff layer (deletion manifest / exclude full preimages from persona payloads; stop deletions from dominating the size band). No community PR yet.

tmchow avatar Oct 16 '26 15:10 tmchow