Add parseOk status to contribution evaluation parsing (#22)#31
Open
arkh-node wants to merge 1 commit into
Open
Add parseOk status to contribution evaluation parsing (#22)#31arkh-node wants to merge 1 commit into
arkh-node wants to merge 1 commit into
Conversation
Extract the evaluator-output parsing from routes.ts into a testable module (server/evaluationParse.ts) and add a parseOk flag, so a parse *failure* is visible instead of being silently scored as 1. - evaluateContribution now warns when the model output isn't valid JSON with a numeric score. Previously that case was indistinguishable from a genuine score of 1; a string-typed score (e.g. "8") also silently fell to 1. - Adds server/evaluationParse.test.ts (vitest, 10 cases): valid/fenced JSON, prose, string score, missing score, clamping, float rounding, empty, oversized, fence stripping. Score/summary behaviour is unchanged; this only surfaces parse failures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the #22 question — "have we tested the text insertion of benchmarks / related parsing?"
Fetch side is solid (no change):
fetchAndExtractTextalready guards well — SSRF check (assertPublicUrl), 10s timeout, redirect cap, content-type allowlist, 40k size cap.The gap (evaluateContribution): the evaluator model's JSON was parsed in a try/catch, and on any parse failure the score silently defaulted to
1and the summary became the raw model output — so a format failure was indistinguishable from a genuine score of 1. A string-typed score (e.g."8") also silently fell to 1.This PR:
server/evaluationParse.ts(parseEvaluation+stripJsonFence) with aparseOkflag.evaluateContributionnowconsole.warns when the output isn't valid JSON with a numeric score — visible/retriable instead of buried as a 1.server/evaluationParse.test.ts(vitest, 10 cases): valid/fenced JSON, prose, string score, missing score, clamping, float rounding, empty, oversized, fence stripping.Possible follow-ups (separate): a retry / provider JSON-mode to enforce format, and persisting the parse status alongside the score.
Tested locally:
vitest run→ 44 passed | 11 skipped | 0 failed (the new suite is green).Minor, flagging while here:
npm test(vitest) picks up 8 test files, but a couple ofnode:test-style suites (metrics.test.ts,modelTier.test.ts) appear to fall outside vitest's include glob — so they may not run undernpm test. Might be worth consolidating on one framework so a single command covers everything; happy to do that in a follow-up.Addresses #22.