Repository navigation
fix(process): accept a trace identifier the comparison result can represent - #2488
Merged
morluto merged 1 commit intoOct 13, 2026
Merged
Conversation
…resent The trace specification owns the declared identifier vocabulary and the comparison result echoes those identifiers verbatim into raw_trace[].event_id, matched_variant and diagnostic event_ids. The result module restated the shared IDENTIFIER_PATTERN by hand with a 64-character cap, so a specification with a longer identifier validated and then its own comparison result failed to parse: compareProcessTraces threw a raw ZodError at the caller instead of returning a comparison. Export the identifier schema from the specification as the single owner and reuse it in the evaluation module, removing the capped copy. IDENTIFIER_PATTERN has no length bound and every other consumer uses it unbounded, so the duplicate was the outlier. Removing the bound rather than adding one keeps the advertised trace_spec input contract unchanged; identifiers of 64 characters or fewer behave exactly as before. Verified with 48 process tests, 24 boundary CLI/MCP trace tests, check:fast and verify:test-discovery on macOS arm64. The regression test failed with the ZodError before the change and passes after it.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Owner
|
@greptileai review |
Contributor
|
3 tasks done
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.
The specification owns the declared trace, event and variant identifier vocabulary, and the comparison result echoes those identifiers verbatim into
raw_trace[].event_id,matched_variantand diagnosticevent_ids. Both modules must therefore accept the same values.Summary
processTraceSpecificationaccepts a trace identifier with the sharedIDENTIFIER_PATTERN, which has no length bound.processTraceEvaluationrestated that pattern by hand as/^[A-Za-z][A-Za-z0-9._\x2d]{0,63}$/u, silently adding a 64-character cap. A specification whose identifier is longer than 64 characters therefore validates, and then the result of comparing it fails its own schema, socompareProcessTracesthrows a rawZodErrorat the caller instead of returning a comparison or a modeled failure.IDENTIFIER_PATTERNis the repository's identifier owner and is used unbounded by every other consumer (evidenceCompletionLedger,completionLedgerGeneration,reconstructionVerificationSchemas,browserScenarioValues,conformancePackage,adbDeviceAnalysis). The capped copy in the evaluation module is the outlier, not the contract.Problem and expected behavior
With
compareProcessTracesfrom the built tree:Expected: a specification that the advertised
trace_speccontract accepts produces a comparison result, never an escaping schema error.Change and scope
processTraceSpecificationexports its identifier schema asprocessTraceIdentifierSchema, documented as the owner of the declared identifier vocabulary. The module-local name is the exported one; no alias is kept.processTraceEvaluationimports that schema and deletes the hand-written capped pattern. Its three uses (event_id,matched_variant,event_ids) now reference the single owner, so the specification and its result cannot drift apart again.Direction of the fix: the specification is the input contract advertised to callers, and identifiers are caller vocabulary that the result merely echoes, so the bound is removed rather than added. Adding a 64-character limit to the specification instead would reject input the contract accepted today and would be a breaking change to an advertised tool input. No separate representation, alias or wrapper remains.
Contract and boundary impact
trace_specgains no new accepted shape; the only difference is that an identifier longer than 64 characters now produces a result instead of an escapingZodError. Inputs of 64 characters or fewer behave exactly as before, so no advertised schema narrows.Evidence and regression coverage
A new case in
processTraceComparison.test.ts, "compares a declared identifier the comparison result can represent", declares a 65-character event id, asserts the specification schema accepts it, and asserts the comparison returnsverdict: "equivalent"withmatched_variant: "only"andraw_trace: [{ event_id: <the 65-character id> }].Before the change the same test failed with the
ZodErrorquoted above; the existing six cases in that file passed throughout, which is why the case was uncovered. Verification on macOS 26.5.1 arm64 with Node.js 24.18.0 and npm 11.16.0, based onbb54082:npm run test:focusedover the comparison, specification, adapters, capture-comparison, capture-validation and scenario suites: 48 passed, 0 failed.npm run test:focusedover the three boundary suites that drive traces through the CLI/MCP adapters (processTraceAdaptersParity,processComparisonDiagnosticsMcp,processTruncationAdapters): 24 passed, 0 failed.npm run check:fast: passed.npm run verify:test-discovery: all 1015 test files discovered exactly once.Unavailable coverage: no Windows or Linux run. The change does not touch platform-conditional code.