Skip to content

oxidizer: AIValidateResponseServerCommand → cognition/validate-response-decision (one PR)#1426

Merged
joelteply merged 2 commits into
canaryfrom
feat/oxidizer-validate-response-onepr
May 18, 2026
Merged

oxidizer: AIValidateResponseServerCommand → cognition/validate-response-decision (one PR)#1426
joelteply merged 2 commits into
canaryfrom
feat/oxidizer-validate-response-onepr

Conversation

@joelteply
Copy link
Copy Markdown
Contributor

Summary

Single-PR oxidizer per Joel directive 2026-05-18 19:44Z (zero users, full-blown Rust-driven dev, no migration ceremony). Adds Rust path + replaces TS parallel reimpl + deletes dead TS in one PR — no 4-PR cadence.

Renamed command + binding to cognition/validate-response-decision to avoid collision with the existing persona-validator surface (which already owns cognition/validate-response).

What this ships

Rust (cognition/validate_response.rs, ~380 LOC + 14 tests):

  • ValidateResponseRequest / ValidateResponseDecision / ResponseDecision (ts-rs)
  • ValidateResponseError typed enum (NoAdapter / Generation)
  • build_validate_prompt — pure, mirrors TS template byte-for-byte
  • parse_decision — pure one-word parser (SUBMIT/CLARIFY/SILENT), TS-parity precedence: CLARIFY > SILENT > Submit (fail-open default)
  • reason_for — canonical reason strings
  • evaluate_validate_response — async (Groq via existing registry; llama-3.1-8b-instant default; temp 0.1; max 10 tokens)

IPC: cognition/validate-response-decision command arm in CognitionModule.

TS mixin: new cognitionValidateResponseDecision(params) binding method.

TS command shim: AIValidateResponseServerCommand.ts now delegates. Deletes inline prompt template, parseDecision, getReasonForDecision, 3 unused imports.

Ratchet: ESLint baseline locked 5433 → 5432.

Discipline

  • One PR carries Rust + shim + dead-TS delete + baseline lock (zero-users mode).
  • All errors typed. No silent default-on-error.
  • Fail-open SUBMIT default in parser matches TS behavior (silence more user-hostile than off-topic).
  • Clippy held at 157 baseline (renamed colliding match arm fixed unreachable-pattern warning).

Verification

  • cargo test cognition::validate_response:: — 14/14 pass
  • npm run build:ts — clean
  • Clippy held at 157
  • ESLint baseline locked 5433 → 5432
  • Pre-push hook green
  • CI

Refs

🤖 Generated with Claude Code

Test and others added 2 commits May 18, 2026 15:05
…se-decision (one PR per zero-users directive)

Single-PR oxidizer per Joel 2026-05-18 19:44Z directive (zero users,
full-blown Rust-driven dev, no migration ceremony). Adds the Rust
cognition path AND replaces the TS parallel reimplementation in the
same commit — no 4-PR cadence.

Renamed command + binding from `cognition/validate-response` to
`cognition/validate-response-decision` to avoid collision with the
existing persona-validator surface (which already owns
`cognition/validate-response` in modules/cognition.rs:814).

## What this ships

Rust:
- `cognition/validate_response.rs` (~380 LOC + 14 tests):
  - `ValidateResponseRequest` / `ValidateResponseDecision` /
    `ResponseDecision` (ts-rs exported)
  - `ValidateResponseError` typed enum (NoAdapter / Generation)
  - `build_validate_prompt` — pure prompt builder (mirrors TS template
    byte-for-byte modulo substitutions)
  - `parse_decision` — pure one-word parser (SUBMIT/CLARIFY/SILENT)
    with TS-parity precedence: CLARIFY > SILENT > Submit (fail-open
    default)
  - `reason_for` — canonical reason strings
  - `evaluate_validate_response` — async orchestrator (Groq via
    existing registry, llama-3.1-8b-instant default, temp 0.1,
    max 10 tokens)
- `modules/cognition.rs`: `cognition/validate-response-decision` IPC arm
- ts-rs barrel adds 3 new types (cognition/{ResponseDecision,
  ValidateResponseDecision, ValidateResponseRequest}.ts)

TS:
- `bindings/modules/cognition.ts`: new
  `cognitionValidateResponseDecision` binding method.
- `commands/ai/validate-response/server/AIValidateResponseServerCommand.ts`:
  thin shim. Deletes inline prompt template, parseDecision,
  getReasonForDecision, AIProviderDaemon/TextGenerationRequest/
  LOCAL_MODELS imports.

## Discipline

- One PR carries Rust + TS shim + dead-TS delete (zero-users mode).
- All errors typed (NoAdapter, Generation). No silent default-on-error.
- Fail-open SUBMIT default in parser matches TS behavior (silence
  more user-hostile than off-topic).
- Clippy held at 157 baseline (resolved 1 new unreachable-pattern
  warning by renaming colliding match arm).

## Tests

- 14 logic + ts-rs tests pass (`cognition::validate_response::*`)
- npm run build:ts clean
- Clippy at baseline

## Refs

- Joel 2026-05-18 19:44Z: zero-users full-blown-Rust-dev mode →
  one PR per oxidizer
- Sibling: codex's #1383 + my #1402/#1421 pattern (one-PR delegation)
- #1248 umbrella

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joelteply joelteply merged commit 51ca168 into canary May 18, 2026
3 of 4 checks passed
@joelteply joelteply deleted the feat/oxidizer-validate-response-onepr branch May 18, 2026 20:15
joelteply added a commit that referenced this pull request May 25, 2026
…1438)

RAG-mode generation now delegates to Rust via AIDecisionService — the
same IPC seam PersonaUser's response path already uses. Rust owns
prompt assembly (system prompt + history + time prefixes + hour-gap
markers + identity reminder), provider routing, admission gating,
timeout, and token-usage stamping (build_response_messages +
build_response_generation_request in cognition/generate_response.rs).

Direct-message + preview modes stay TS-side:
- Direct mode is an introspection/test path that bypasses admission;
  Rust intentionally does not expose a "skip the gate" code path.
- Preview mode reconstructs the request Rust would build as a local
  mirror. Source of truth is the Rust path; if assembly drifts a
  `cognition/preview-request` IPC is the fix.

Mirrors the pattern from #1421 (should-respond) and #1426
(validate-response-decision). The 100-line of TS message-building
that duplicated build_response_messages now lives only in Rust.

Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant