Skip to content

test(mt#1263): Add runReview sanitize wiring integration tests#774

Open
minsky-ai[bot] wants to merge 1 commit into
mainfrom
task/mt-1263
Open

test(mt#1263): Add runReview sanitize wiring integration tests#774
minsky-ai[bot] wants to merge 1 commit into
mainfrom
task/mt-1263

Conversation

@minsky-ai
Copy link
Copy Markdown
Contributor

@minsky-ai minsky-ai Bot commented Apr 24, 2026

Summary

Adds integration tests for the runReview sanitize wiring from mt#1212 / PR #758. Four end-to-end test cases cover the three SanitizeResult.action values through mock.module() stubs.

Key Changes

  • services/reviewer/src/review-worker.test.ts: new describe block with 4 cases (stripped, errored, errored-failure-path, passthrough)
  • eslint.config.js: allowInFiles exception for reviewer test file for no-global-module-mocks rule

Testing

50/50 tests pass. Mutation test confirmed: replacing sanitized.body with output.text caused cases 1 and 2 to fail. Mutation reverted before commit.

Had Claude implement this; AI-authored code.

Three end-to-end tests exercise runReview with mocked dependencies via
mock.module() and a stub-container indirection pattern (property reassignment
on const stubs object avoids both no-const-assign and no-jest-patterns lint):

1. stripped: submitReview receives sanitized.body not raw output.text;
   event parsed from stripped body; reason contains [cot-leakage: stripped]
2. errored: submitReview receives error-notice body; event forced to COMMENT;
   status=error with no review field; submitReview failure does not propagate
3. passthrough: submitReview receives raw output.text; no cot_leak_detected
   console.log emitted

Mutation-test: replacing sanitized.body with output.text in review-worker.ts
caused cases 1 and 2 to fail. Passthrough passes correctly because output.text
IS the passthrough body. Mutation reverted before commit.

Also adds allowInFiles exception for review-worker.test.ts in the
no-global-module-mocks ESLint rule, since the reviewer service has no DI
infrastructure and mock.module() is the only available test seam for runReview.
@minsky-ai minsky-ai Bot added the authorship/co-authored Co-authored by human and AI agent label Apr 24, 2026
Copy link
Copy Markdown

@minsky-reviewer minsky-reviewer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent adversarial review (Chinese-wall)
Reviewer: minsky-reviewer[bot] via openai:gpt-5
Tier: unknown


reviewer-service error: chain-of-thought leakage detected

The upstream model emitted raw internal reasoning into the review body. The reviewer service sanitised the output but could not locate a valid Findings section to preserve, so the leaked content was discarded. The PR will receive a fresh review on the next commit. See docs/architecture/critic-constitution-reliability.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

authorship/co-authored Co-authored by human and AI agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant