Repository navigation
[AI-2748] Expose redaction members and kcap eval --baseline-out - #1054
Conversation
RedactValue is reused to scan multi-megabyte event bodies value-by-value, outside RedactLine's 64K line cap. The unanchored [A-Z_]* prefix rescanned a long delimiter-free run once per character (O(n^2)); the lookbehind starts the match only at a name boundary, finding the same matches.
The name-boundary lookbehind must exclude only [A-Za-z_], not digits: [A-Z_] stops at a digit, so a keyword run begins right after one, and the digit- inclusive form skipped that start, leaving OAUTH2_TOKEN=, S3_SECRET_KEY= and similar values unredacted. Still O(n) on a delimiter-free run.
…rver The observer's question and retrospective callbacks now carry per-call token usage, route and wall time; a --baseline-out decorator collects them into a machine-readable file. kcap eval without the flag is unchanged — same observer, no routing or judging change.
PR Summary by QodoAdd eval baseline output and expose scalable secret redaction APIs
AI Description
Diagram
High-Level Assessment
Files changed (26)
|
Code Review by Qodo
1. Server eval tests stop compiling
|
| /// unassessed outcome, which carries no score. <paramref name="route"/> is <c>text</c> or | ||
| /// <c>tools</c>; <paramref name="runnerInvocations"/> counts the runner calls behind this | ||
| /// result (retries included — 1 today).</summary> | ||
| void OnQuestionCompleted(int index, int total, EvalQuestionAssessment assessment, EvalUsage usage, string route, TimeSpan elapsed, int runnerInvocations); |
There was a problem hiding this comment.
2. Server eval tests stop compiling 🔗 Cross-repo conflict ≡ Correctness
IEvalObserver changes both completion callbacks to require usage and timing metadata, but kcap-server's two test observers retain the old signatures. When the server advances its referenced CLI submodule to this change, its evaluation test project reaches those implementations and cannot satisfy the interface.
Agent Prompt
## Issue description
The changed `IEvalObserver` completion signatures are not implemented by kcap-server's evaluation test observers, causing its integrated test project to stop compiling when the CLI submodule is advanced.
## Fix Focus Areas
- src/Capacitor.Cli.Core/Eval/IEvalObserver.cs[42-58]
- test/Capacitor.Server.Tests.Evals/CliCatalog/CliCatalogIntegrationTests.cs[70-80]
- test/Capacitor.Server.Tests.Evals/CliCatalog/AliasRawTextLiveTests.cs[59-69]
## Recommended Fix
Coordinate a kcap-server change that updates both `TestObserver` implementations to the new question and retrospective completion signatures, including `EvalUsage`, route, elapsed time, and invocation count parameters.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
A failed judge was dropped from --baseline-out entirely and a failed write still exited 0; the file now records each failed question and the run exits non-zero when it cannot be written. A value flag given with no value is rejected, not silently skipped.
AI-2748 (no kcap-cli GitHub issue — tracked in Linear)
What & why
Two additive changes the server's eval-baseline harness depends on. First,
SecretRedactor.IsSecretKey/RedactValuebecome public so the server's fixture redactor can reuse the CLI's production secret vocabulary, andEnvVarSecretRegexis anchored so redaction scales to multi-megabyte values without a quadratic blowup. Second,kcap eval --baseline-out <file>writes one machine-readable JSON record per question (route, usage, latency, runner invocations), plus the retrospective and run totals, so a baseline run captures per-question resource use.kcap evalwithout the flag is unchanged.Where to look
The
EnvVarSecretRegexanchoring is a change to a shipping redaction regex and must stay match-equivalent — a keyword that starts right after a digit (OAUTH2_TOKEN=) must still redact; pinning tests cover that and a 6 MB value.--baseline-outserializes through the source-genCapacitorJsonContextfor AOT.Verification
dotnet build0 errors; AOT Release publish no IL3050/IL2026. Focused tests green: Cli.Core eval namespace 142; SecretRedactorTests 138 (incl. digit-preceded keywords and the 6 MB value); EvalBaselineOutArgTests 4.🤖 Generated with Claude Code