Repository navigation
Description
Editing a Knowledge entry can silently lose unsaved text when the list refreshes after another writer publishes a new version of the same entry.
Severity: P2 (unsaved work lost without a discard decision).
Source: 9ea59724df24d62729a9360f3902d964dab39b3e.
Reproduction
- Open an existing Knowledge entry from its table row, then choose Edit.
- Change Content to a distinct unsaved draft; do not save or cancel it.
- In another local session, publish changed content for the same entry. When the first session's list next successfully refreshes, the active row has a new version ID and the same document ID.
- The first editor immediately disappears. Reopening the entry shows the other writer's content; the unsaved draft is gone.
Expected: keep the editor and draft stable, explain that a newer version exists, and let the user reconcile or explicitly discard their changes.
Actual in the closed component replay: replacing entry-version-1 with entry-version-2 on document-chain-1 unmounts both dialogs, removes Unsaved local work, and exposes the other writer's content. No update mutation was invoked by the draft owner. Reopening contains only the new published text. A control that refetches a fresh object with the same version ID preserves the dirty editor.
Root cause
KnowledgeEntriesTabletracks its viewed row withuseViewedRecordand mountsKnowledgeEntryViewDialogonly while that row is present (services/platform/app/features/knowledge-entries/components/knowledge-entries-table.tsx:42-46,121-129).useViewedRecordidentifies records solely by_id; a missing ID immediately returnsrecord: null, then clears the viewed ID after a settled read (services/platform/app/hooks/use-viewed-record.ts:22-35).- Knowledge IDs identify versions, not the enduring entry.
updateKnowledgeEntryinserts a new active row, supersedes the old row and keepsdocumentId(services/platform/backend/domains/knowledge_entries/service.ts:549-577). The active-list reader excludes the superseded version. - The edit dialog lives inside the view dialog, so losing the old table version unmounts the dirty form even though the underlying entry still exists.
Use the entry's enduring identity for view lifecycle, and preserve the editing session independently of live table membership. Handle true deletion/access loss explicitly as well; retaining stale write access is not required to retain the draft.
Validation and boundaries
Local component replay at the source SHA above: 2/2 tests passed, with the actual table, useViewedRecord, view dialog and edit dialog. Only query/mutation boundaries, ability/org fixtures and indexing badge were replaced. The tests assert both the failure and same-version refetch control. Native source inspection establishes that the substituted list update is the shape produced by a changed-content save. This is not a claim that a full two-session native-backend browser round was executed.
Retained audit evidence: knowledge-functional-next/version-refresh-draft.probe.test.tsx and version-refresh-draft.replay.log. No production testing or writes.
Dedup: distinct from #3602 (backend concurrent writes leave multiple active facts) and #3777 (failed reads masquerade as empty/history missing). This report concerns a successful version replacement unmounting an unrelated unsaved editor. One lifecycle issue, not separate findings for every field.
Activity
yannickmonney commentedon Sep 29, 2026
Current-main revalidation — b7f8ca0
Source:
b7f8ca02ec249c004652b1ee52e112d9cdfa53ea. The coordinator independently reran two Chromium cases against actual current Knowledge components: unchanged entry identity preserves the dirty draft; another published version changes the viewed record identity and silently removes the editor/draft. Controlled reads/mutations, no real database. A scratch cleanup omission in the initial combined run was corrected, with that initial log retained; the final focused replay passes 2/2.Evidence:
/Users/yannick/.codex/notes/tale-1000-additional/current-main-reconciliation/components/knowledge-replay.log. Installed external dependencies are reused; app/UI/shared source points at the isolated current tree. Browser runs retain the runner/browser version warning. These revalidations add no findings and include no production testing.yannickmonney commentedon Oct 5, 2026
Independent exact-head review receipt for PR #4337 / TALE-322: ACCEPT at
fe94746961e4d1d4e0110ee3865d048f5aa836d7. Focused hook regression passed 4/4 with one worker; the same test overlaid onorigin/mainfailed 1/4 as expected. Exact-head CI was read once and all required checks passed (expected skips plus neutral Trivy). PR #4337 was squash-merged with merge commitbfb045985cf4b37f1b0d8ff0fa246aa1a85f0315.