Skip to content

feat: add adversarial editing pass to revision pipeline - #26

Merged
rjwalters merged 2 commits into
mainfrom
feature/issue-5
Apr 14, 2026
Merged

feat: add adversarial editing pass to revision pipeline#26
rjwalters merged 2 commits into
mainfrom
feature/issue-5

Conversation

@rjwalters

Copy link
Copy Markdown
Owner

Closes #5

Note: Builder completed changes but exited before creating a PR. PR created via direct completion.

Changes

package.json                                    |  57 +----
 src/pipeline/__tests__/adversarial-edit.test.ts | 298 ++++++++++++++++++++++++
 src/pipeline/adversarial-edit.ts                | 262 +++++++++++++++++++++
 src/pipeline/index.ts                           |  28 +++
 src/pipeline/types.ts                           |  66 ++++++
 tsconfig.json                                   |  24 +-
 6 files changed, 670 insertions(+), 65 deletions(-)

Commits

  • 40606b7 feat: add adversarial editing pass with typed cut classifications

Test plan

  • Verify changes match issue requirements
  • Confirm tests pass

@rjwalters rjwalters added loom:review-requested PR ready for Judge to review loom:reviewing Judge is actively reviewing this PR labels Apr 14, 2026
Implement the adversarial edit module for the revision pipeline that asks
the LLM to identify passages to remove rather than improve. Each proposed
cut is classified (OVER-EXPLAIN, REDUNDANT, FAT, TELL, STRUCTURAL, GENERIC)
and presented as a reviewable suggestion with accept/reject status.

Includes response parser, cut distribution tracker, cut application logic,
markdown report formatter, and 21 unit tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rjwalters

Copy link
Copy Markdown
Owner Author

🔀 Automatically rebased branch to resolve merge conflicts in package.json. Proceeding with code evaluation.

@rjwalters

Copy link
Copy Markdown
Owner Author

Changes Requested

Summary

The new pipeline code (adversarial-edit.ts, types.ts, index.ts) and tests are well-written and faithfully implement the acceptance criteria from issue #5. However, the tsconfig.json changes break the entire existing webapp.

Blocking Issue

tsconfig.json rewrite is destructive

The PR replaces the existing React/Vite webapp tsconfig with a library-style config. This removes:

  • "jsx": "react-jsx"breaks all .tsx files (100+ errors: Cannot use JSX unless the '--jsx' flag is provided)
  • "lib": ["ES2022", "DOM", "DOM.Iterable"] — removes DOM type definitions
  • "paths": { "@/*": ["./src/*"] }breaks all @/ imports (Cannot find module '@/components/Layout')
  • "allowImportingTsExtensions": true — needed for Vite
  • "resolveJsonModule": true, "isolatedModules": true — needed by the build
  • "noEmit": true — replaced with "outDir": "dist" which conflicts with Vite's build
  • "references": [{ "path": "./tsconfig.node.json" }] — drops Vite node config
  • "include": ["src", "workers"]["src/**/*"] — drops workers/ directory

Result: tsc --noEmit produces 100+ errors, and check:ci fails completely.

Fix

The tsconfig.json should not be modified. The new pipeline code is pure TypeScript (no JSX, no DOM) and works fine under the existing tsconfig. Simply revert tsconfig.json to its original state.

Code Quality (Pipeline Code)

The new code is solid:

  • Clean parser with proper regex-based extraction
  • Good edge case handling (missing WORDS field, malformed blocks, invalid types)
  • Well-structured types with clear separation
  • Comprehensive test coverage (21 tests, all passing)
  • applyCuts sorts by passage length to avoid offset issues — nice touch

Test Execution

  • npx vitest run src/pipeline/__tests__/adversarial-edit.test.ts — ✅ 21/21 tests pass
  • tsc --noEmit — ❌ Fails with 100+ errors due to tsconfig changes

Action Required

Revert tsconfig.json to the original version. The pipeline code itself needs no changes.

@rjwalters rjwalters added loom:changes-requested PR requires changes before re-review (Judge requested modifications) loom:treating Doctor is fixing this bug or addressing PR feedback and removed loom:reviewing Judge is actively reviewing this PR loom:review-requested PR ready for Judge to review labels Apr 14, 2026
The pipeline code (pure TS, no JSX/DOM) works fine under the existing
tsconfig. The library-style rewrite broke all .tsx files, @/ imports,
and Vite build configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rjwalters rjwalters added loom:reviewing Judge is actively reviewing this PR loom:review-requested PR ready for Judge to review and removed loom:treating Doctor is fixing this bug or addressing PR feedback loom:changes-requested PR requires changes before re-review (Judge requested modifications) labels Apr 14, 2026
@rjwalters

Copy link
Copy Markdown
Owner Author

✅ Review feedback addressed:

  • Reverted tsconfig.json to the original webapp configuration (restored JSX, DOM libs, @/ path aliases, Vite settings)
  • Pipeline tests confirmed passing (21/21) under the original tsconfig

The pipeline code is pure TypeScript and requires no special tsconfig changes.

Ready for re-review!

@rjwalters

Copy link
Copy Markdown
Owner Author

Approved!

Clean implementation of the adversarial editing technique from autonovel. All 6 acceptance criteria from issue #5 are satisfied.

Code Quality

  • Parser (parseAdversarialResponse): Robust regex-based parsing with graceful handling of malformed blocks, invalid types, and missing fields. Falls back to word counting from passage text when WORDS field is missing.
  • Types (types.ts): Well-defined interfaces with appropriate use of union types for CutType and ProposedCut.status.
  • applyCuts: Smart approach sorting by passage length descending to avoid offset issues with nested removals.
  • formatReport: Clean markdown generation with percentage distribution.
  • callClaude: Direct fetch-based API call — appropriate for this stage of the project.
  • Barrel export (index.ts): Clean re-exports establishing the pipeline module boundary.

Test Execution

Strategy: vitest run (scoped to PR test file)
Result: 21 tests, all passed

Test plan from PR description:

  1. Verify changes match issue requirements — ✅ All 6 acceptance criteria satisfied
  2. Confirm tests pass — ✅ 21/21 tests pass

Notes

  • No CI checks are configured for this repository yet — evaluation based on local test execution.
  • Pre-existing test failures in packages/styleguide and packages/review-panel (empty test suites) are unrelated to this PR.

@rjwalters rjwalters added loom:pr PR approved by Judge, ready for human to merge and removed loom:reviewing Judge is actively reviewing this PR loom:review-requested PR ready for Judge to review labels Apr 14, 2026
@rjwalters
rjwalters merged commit 238a835 into main Apr 14, 2026
@rjwalters
rjwalters deleted the feature/issue-5 branch April 14, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

loom:pr PR approved by Judge, ready for human to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add adversarial editing pass to revision pipeline

1 participant