Skip to content

app/vmui: improve stream context modal#1439

Open
Loori-R wants to merge 2 commits into
masterfrom
vmui/stream-context-improvements
Open

app/vmui: improve stream context modal#1439
Loori-R wants to merge 2 commits into
masterfrom
vmui/stream-context-improvements

Conversation

@Loori-R
Copy link
Copy Markdown
Contributor

@Loori-R Loori-R commented May 20, 2026

Describe Your Changes

  • change log ordering in the Log context modal: previous logs are shown above the target log, next logs are shown below it
  • replace manual Load more controls and the logs-per-load selector with top/bottom infinite scroll
  • load context with an adaptive stream_context time_window: start from 1m, expand exponentially when fewer logs than requested are returned, and stop at 7d. Related issue: app/vmui: allow configuring stream_context time_window in Log Context #1397
  • detect logs with identical _time values, show a warning, and highlight their timestamp values
image Screen Recording 2026-05-20 at 18 06 39

- warn and highlight logs with identical timestamps
- show older logs above and newer logs below the target log
- replace load control buttons with infinite scroll
- expand stream_context time_window from 1m to 7d while loading context
@Loori-R Loori-R added the web-ui Issues related to the user interface: layout, styling, usability, or UI-specific bugs. label May 20, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/vmui/packages/vmui/src/pages/StreamContext/helpers.ts">

<violation number="1" location="app/vmui/packages/vmui/src/pages/StreamContext/helpers.ts:74">
P2: Removing by `_stream_id` + `_time` drops all same-timestamp logs in a stream, so valid context entries can disappear when timestamps are duplicated.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread app/vmui/packages/vmui/src/pages/StreamContext/StreamContextList.tsx Outdated
/** Merges fetched logs and removes the target log. */
export const mergeContextLogs = (dir: Direction, setter: Dispatch<SetStateAction<Logs[]>>) =>
(fetched: Logs[], target: Logs) => {
const filtered = removeLogsByKeys(fetched, target, ["_stream_id", "_time"]);
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Removing by _stream_id + _time drops all same-timestamp logs in a stream, so valid context entries can disappear when timestamps are duplicated.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/vmui/packages/vmui/src/pages/StreamContext/helpers.ts, line 74:

<comment>Removing by `_stream_id` + `_time` drops all same-timestamp logs in a stream, so valid context entries can disappear when timestamps are duplicated.</comment>

<file context>
@@ -0,0 +1,86 @@
+/** Merges fetched logs and removes the target log. */
+export const mergeContextLogs = (dir: Direction, setter: Dispatch<SetStateAction<Logs[]>>) =>
+  (fetched: Logs[], target: Logs) => {
+    const filtered = removeLogsByKeys(fetched, target, ["_stream_id", "_time"]);
+    setter(prev => dir === "after" ? prev.concat(filtered) : filtered.concat(prev));
+  };
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The context query anchors on _stream_id and _time, while the original row may contain query-time transformed fields, so matching by the full row or _msg is unreliable. For duplicate timestamps within the same stream we prefer removing all ambiguous anchor candidates instead of risking rendering the target log twice. The duplicate timestamp warning still applies to duplicate timestamps that remain in the loaded context.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I've saved this as a new learning to improve future reviews.

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Signed-off-by: Yury Moladau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

web-ui Issues related to the user interface: layout, styling, usability, or UI-specific bugs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

app/vmui: allow configuring stream_context time_window in Log Context

1 participant