refactor(system-transforms): caveman-review cleanup + logging

- Remove dead setWordsForOp function (unused, acknowledged in comment)
- Remove unused obfuscateSensitiveWords import and re-export from systemTransforms
- Increase textarea rows cap from 20→40 for long CC-bridge pipelines (~100 lines JSON)
- Add [SystemTransforms] console.log at both call sites (cc-bridge step 5b + claude native path)

Tests: 58/58 green
This commit is contained in:
Mourad Maatoug
2026-05-15 17:57:40 +02:00
parent 634b4fe0ce
commit d0d8638a02
4 changed files with 19 additions and 23 deletions

View File

@@ -789,7 +789,14 @@ export class BaseExecutor {
// sensitive words). It deliberately does NOT include
// `inject_billing_header` — billing + sentinel are already
// prepended above. Users can extend the pipeline via Settings UI.
applySystemTransformPipeline(PROVIDER_CLAUDE, tb);
{
const transformResult = applySystemTransformPipeline(PROVIDER_CLAUDE, tb);
if (transformResult.appliedOpKinds.length > 0) {
console.log(
`[SystemTransforms] claude-native: ${transformResult.appliedOpKinds.join(", ")}`
);
}
}
if (!tb.metadata || typeof tb.metadata !== "object") tb.metadata = {};
(tb.metadata as Record<string, unknown>).user_id = buildUserIdJson({

View File

@@ -339,10 +339,15 @@ export async function buildAndSignClaudeCodeRequest(
// Routed via the generic per-provider DSL so the same pipeline shape covers
// the CC bridge, the native `claude` path, and any other configured
// provider. Idempotent on re-run.
applySystemTransformPipeline(
PROVIDER_CC_BRIDGE,
body as Parameters<typeof applySystemTransformPipeline>[1]
);
{
const transformResult = applySystemTransformPipeline(
PROVIDER_CC_BRIDGE,
body as Parameters<typeof applySystemTransformPipeline>[1]
);
if (transformResult.appliedOpKinds.length > 0) {
console.log(`[SystemTransforms] cc-bridge: ${transformResult.appliedOpKinds.join(", ")}`);
}
}
// Step 6: Obfuscation (optional, per-provider setting)
if (enableObfuscation) {

View File

@@ -23,7 +23,7 @@
*
* Reference: OmniRoute issue #2260 + comment 4459544580 (Open WebUI bypass).
*/
import { obfuscateSensitiveWords } from "./claudeCodeObfuscation.ts";
import {
applyCcBridgeTransformPipeline,
CLAUDE_AGENT_SDK_IDENTITY,
@@ -213,18 +213,6 @@ interface RequestBody {
// Op: obfuscate_words (the only op kind beyond the base set).
// ────────────────────────────────────────────────────────────────────────────
function setWordsForOp(words: string[]): void {
// Reuse the existing obfuscation engine — but it reads from its own module
// singleton. We swap the words for this op invocation; obfuscateSensitiveWords
// uses the module-level `sensitiveWords` array via setSensitiveWords.
// To keep this stateless across concurrent requests, we instead call
// obfuscateSensitiveWordsCustom (defined below) which takes the words list
// explicitly.
// — unused (intentional, see obfuscateWithList below).
void words;
}
void setWordsForOp;
function escapeRegex(str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
@@ -298,10 +286,6 @@ function applyObfuscateWords(body: RequestBody, op: ObfuscateWordsOp): void {
}
}
// Silence unused-import warning on obfuscateSensitiveWords — re-export for
// callers that want the global-singleton variant.
export { obfuscateSensitiveWords };
// ────────────────────────────────────────────────────────────────────────────
// Pipeline executor (delegates base ops to applyCcBridgeTransformPipeline).
// ────────────────────────────────────────────────────────────────────────────

View File

@@ -708,7 +708,7 @@ export default function RoutingTab() {
onChange={(e) =>
setJsonDrafts((prev) => ({ ...prev, [providerId]: e.target.value }))
}
rows={Math.min(20, Math.max(8, draft.split("\n").length))}
rows={Math.min(40, Math.max(8, draft.split("\n").length))}
disabled={loading}
spellCheck={false}
className="w-full rounded border border-border/50 bg-background/40 p-2 font-mono text-[11px] text-text resize-y"