Repository navigation
Fix chat attachment state and duplicate table rendering - #314
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two user-facing chat issues in Von’s web UI: (1) attachment/upload UI state incorrectly leaking across conversations and rewriting prompt drafts, and (2) Markdown-derived tables being rendered twice due to unclear ownership between the Markdown renderer and the display-elements renderer.
Changes:
- Introduces conversation-scoped upload state and a persistent attachment/progress status region in the chat composer.
- Adds
presentation.mode(notablyinline_primary) and source-span metadata for Markdown-derived tables, plus renderer-side suppression logic to prevent duplicate table rendering while failing open when ownership can’t be proven. - Expands frontend and backend test coverage around attachment binding, upload coalescing, and display-element table ownership/validation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/frontend/chatTabMarkdownRender.test.js | Ensures Markdown tables don’t duplicate when display_elements includes inline-primary tables. |
| tests/frontend/chatDisplayElementOwnership.test.js | Adds coverage for table ownership suppression vs augment rendering and raw-view fidelity. |
| tests/frontend/chatAttachmentWorkflowInput.test.js | Adds tests for persistent attachment status, upload coalescing, and per-conversation upload isolation. |
| tests/backend/test_display_elements_service.py | Adds backend tests for source-span correctness and validation around table presentation metadata. |
| src/frontend/web/von_interface/templates/chat_tab.html | Adds a dedicated attachment status region in the composer and moves status output into it. |
| src/frontend/web/von_interface/static/styles.css | Styles the new attachment status region and pending-attachment “pill” UI. |
| src/frontend/web/von_interface/static/js/chatTab.js | Implements table presentation normalisation/suppression and conversation-scoped upload state + UI rendering. |
| src/backend/services/display_elements_service.py | Preserves fence line positions for source spans and adds table presentation validation + emission. |
Comment on lines
+3765
to
+3773
| "presentation": { | ||
| "mode": "inline_primary", | ||
| "source_element_id": "screen_text", | ||
| "source_span": ( | ||
| dict(source_span) | ||
| if isinstance(source_span, Mapping) | ||
| else {} | ||
| ), | ||
| }, |
Comment on lines
+12701
to
+12707
| const inlinePrimaryIds = new Set(inlinePrimaryCandidates); | ||
| return { | ||
| inlinePrimaryTableElements: inlinePrimaryCandidates, | ||
| appendedTableElements: tableElements.filter( | ||
| (tableElement) => !inlinePrimaryIds.has(tableElement) | ||
| ) | ||
| }; |
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.
What changed
inline_primary, with an explicit source element and line span.Root cause
Upload UI state was page-global even though durable attachment bindings were conversation-scoped. Separately, the display contract did not identify which renderer owned a table derived from inline response content, so both the Markdown renderer and display-element renderer presented it.
User impact
Uploads no longer rewrite the prompt draft, repeat actions no longer duplicate work, conversation switches cannot leak upload state into another chat, and Markdown tables appear once while genuinely explicit structured tables remain available.
Validation
57 passed:tests/backend/test_display_elements_service.py19 passed: attachment binding, display ownership, and Markdown rendering Jest suitesgit diff --check