fix(visualization): parse origins array for event highlighting - #7
Open
MsfPablo wants to merge 1 commit into
Open
fix(visualization): parse origins array for event highlighting#7MsfPablo wants to merge 1 commit into
MsfPablo wants to merge 1 commit into
Conversation
eventOriginFromSummary regexed "origin":"..." (singular) but
formatWindowCommitMessage writes JSON.stringify({ origins: [...] })
with the plural "origins" array of EditOrigin values, so the regex
never matched and every commit fell back to "unknown".
Parse the "origins":[...] array and map each EditOrigin value to
its EventOriginKind (assistant-inline-completion -> inline-completion,
assistant-agent-chat/assistant-tool-edit -> agent-edit, mixed -> mixed,
everything else -> unknown). Preserves the existing "unknown"
fallback when the field is absent and the "mixed" result when
multiple distinct kinds are present.
Adds test/coloring.test.ts covering each mapping and the
multi-kind collapse/mixed cases.
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.
Root cause
eventOriginFromSummaryinsrc/visualization/coloring.tsscanned the commit body for/"origin"\s*:\s*"([^"]+)"/g— a singular"origin"string field accepting only"agent-edit"or"inline-completion".But
formatWindowCommitMessageinsrc/recording/staging-tracker.tswrites the assistant commit metadata as:commit.originsis the plural"origins"array ofEditOriginvalues ("assistant-inline-completion","assistant-agent-chat","assistant-tool-edit","mixed", …). The singular regex never matched, soorigins.size === 0and every commit was classified"unknown", breaking the "Event type" coloring mode entirely.Fix
Parse the
"origins":[...]array instead of the singular field, and map each serializedEditOriginvalue to itsEventOriginKind:assistant-inline-completion→inline-completionassistant-agent-chat/assistant-tool-edit→agent-editmixed→mixedassistant-unknown,human, …) →unknownThe existing contract is preserved:
"unknown"is still returned when the field is absent (e.g. human commits), and"mixed"is returned when the array contains more than one distinct kind (after mapping, so twoagent-editorigins collapse toagent-editrather thanmixed).Verification
npm run compile— clean (tsc -p .)npm run lint— 0 errors (13 pre-existing warnings insrc/utils/paths.ts, untouched by this change)npm run test:unit— 42/42 pass, including 8 new tests intest/coloring.test.tscovering each mapping, the same-kind collapse, the distinct-kindsmixedcase, and the absent-fieldunknownfallback.Closes #5