Repository navigation
fix(panel): navigate and key context injections by group.id (#53) - #56
Merged
Merged
Conversation
Issue #53. After #52 two AI groups of one turn share turnIndex (compact or system boundaries tear a turn; aiCount fallback collides too), so the synthetic "ai-${turnIndex}" id collided: duplicate injection ids and wrong-group navigation. Trackers now carry the group's real id (= stable chunk id, unique across re-parses): - contextTracker: turnGroupId = aiGroup.id; injection id generators take the group id instead of turnIndex (tool-output-<id>, loop-<id>, wait-loop-<id>, thinking-text-<id>, task-coord-<id>, user-msg-<id>); reread id follows. - claudeMdTracker: same turnGroupId change; firstSeenTurnIndex (display-only "@turn N") added next to firstSeenInGroup. - ClaudeMdInjection gains firstSeenTurnIndex so labels survive real uuid ids. Red test (contextTracker.test.ts): two AI groups sharing turnIndex 0 must keep disjoint injection ids, their own aiGroupId, and claude-md display metadata — failed with 'ai-0' expected 'ai-xxx'. Co-Authored-By: Claude Code <noreply@anthropic.com>
Issue #53, panel half. SessionContextPanel callbacks (onNavigateToTurn / onNavigateToTool / onNavigateToUserGroup) take the AI group's id instead of turnIndex; ChatHistory resolves the target by group.id, so a click from the LATER group of a split turn lands in that group, not the first one sharing the index. - Sections/items pass injection.aiGroupId (or firstSeenInGroup for claude-md/mentioned-file); clickability gate is a non-empty id. - FlatInjectionList rows carry groupId; RankedInjectionList swaps getInjectionTurnIndex for getInjectionGroupId. - parseTurnIndex dropped; formatFirstSeen formats a turnIndex number — with uuid ids the "ai-N" parse was already unfixable. - DirectoryTree nodes carry firstSeenTurnIndex for the "@turn N" label. Burn-header nav tests now assert the callback receives the group id string; ClaudeMdItem test covers a click with a uuid id (previously not clickable: parseTurnIndex returned -1). Co-Authored-By: Claude Code <noreply@anthropic.com>
Pin poolOptions.threads (minThreads 1, maxThreads cpus-1) so worker count does not depend on vitest defaults and the suite cannot saturate the machine. Co-Authored-By: Claude Code <noreply@anthropic.com>
Follow-up to the #53 migration from /code-review on PR #56: - vitest.critical.config.ts: mirror the n-1 worker cap — test:coverage:critical would otherwise spawn uncapped workers, the exact load that hung the machine. - ClaudeMdItem: guard firstSeenTurnIndex with ?? -1 like DirectoryTreeNode — an injection without the field rendered "@turn NaN" instead of degrading. - createGlobalInjections: turnIndex becomes a required parameter (was `= 0`); both callers already pass aiGroup.turnIndex, the default silently mislabeled a future caller as "@turn 1". - Stale doc examples in contextInjection.ts: ids are now "<prefix>-<group id>" / real group ids, not "ai-0". - burnHeaderNav fixtures: injection ids follow the real scheme ("wait-loop-<group id>"), so an id-scheme regression can't keep them green. - formatFirstSeen moved into utils/formatting.ts; pathParsing.ts deleted — it parsed no paths after parseTurnIndex's removal. Co-Authored-By: Claude Code <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.
Проблема
После #52
turnIndexAI-группы = порядковый номер её user-сообщения, поэтому двеAI-группы одного хода (автокомпакт/system рвут ход на группы) получают одинаковый
turnIndex; aiCount-фолбэк тоже даёт дубли. На число были завязаны:
ChatHistoryискал цель черезfind(... turnIndex ===): клик поинъекции из поздней группы хода вёл в первую (до-компактную).
ai-${turnIndex}давал дубли id (React keys,lookup'ы), а
parseTurnIndexпо regex^ai-(\d+)$с uuid-id возвращал -1 —claude-md/mentioned-file пункты теряли кликабельность.
Closes #53.
Решение
Навигация и id инъекций — по стабильному
group.id(= chunk id =ai-<uuid>первого ответа, детерминирован при re-parse и в инкрементальных обновлениях).
turnIndexостаётся только отображаемой меткой «Turn N».d8ce1ec):turnGroupId = aiGroup.id; генераторы id принимаютgroup id (
tool-output-<id>,loop-<id>, …);ClaudeMdInjectionполучилfirstSeenTurnIndex(display-only), чтобы «@turn N» выживал с uuid-id.9bff19a): колбэкиonNavigateToTurn/onNavigateToTool/onNavigateToUserGroupпринимают
groupId: string; секции/items передаютaiGroupId(илиfirstSeenInGroupдля claude-md/mentioned-file);parseTurnIndexудалён,formatFirstSeenпринимает число.7c29518): vitest workers зафиксированы на n-1 (просьба владельца —машина висла на параллельном прогоне).
Доказательство (TDD)
Красные тесты до фикса:
contextTracker.test.ts«two AI groups of one turn keep distinct injection ids…»:expected 'ai-0' to be 'ai-xxx'— трекер клал синтетический id.burnHeaderNav.test.ts:received 0вместо'ai-11111111-uuid'— секции слали число.ClaudeMdItem:entry button not found: @Turn 4— с uuid-id пункт был некликабелен.После фикса: 934/934 теста,
pnpm check(typecheck + lint + test + build) зелёный.Прогон с новым пулом стал быстрее: 6.9s → 3.5s (env setup 20s → 12s).
Известные компромиссы
ai-empty-<Date.now()>фолбэк-id пустых AI-групп нестабилен между re-parse — кликпо такой инъекции даст no-op (не падение); случаев в живых данных не видно.
🤖 Generated with Claude Code