Skip to content

AI CSV / Spreadsheet Insights Sidebar#477

Open
LukasHirt wants to merge 14 commits into
mainfrom
ext/2026-06-23-ai-data-insights-sidebar
Open

AI CSV / Spreadsheet Insights Sidebar#477
LukasHirt wants to merge 14 commits into
mainfrom
ext/2026-06-23-ai-data-insights-sidebar

Conversation

@LukasHirt

Copy link
Copy Markdown
Collaborator

AI-generated · OSPO-54 · Gate: ✅ 1.00

Problem

Data workers store CSV exports and data dumps in oCIS for team sharing, but the platform gives no quick insight layer — every analysis requires downloading the file and opening a spreadsheet app. Teams lose time cycling between tools just to answer "what's in this file?"

Solution

Selecting a CSV file shows an "Insights" tab in the right sidebar. The extension parses the file client-side (headers + first ~200 rows), then sends a structured preview to the configured LLM endpoint. The panel renders column types, value ranges, detected patterns (e.g. date trends, outliers), and 2–3 natural-language observations. Tier 1 (text completion): prose analysis split on section headers. Tier 2 (no LLM configured): panel is hidden.

Extension points

global.files.sidebar (sidebarPanel) · global.files.context-actions (action)

Why ship this now

oCIS is increasingly used as a team data hub; the CSV use-case is high-frequency and zero existing extension touches tabular files. Gives analysts an instant "first read" without leaving the browser.

What was built

web-app-ai-data-insights-sidebar registers two extension points: a sidebarPanel that appears as an "Insights" tab when a .csv or .tsv file is selected, and a context-action entry in the file list. Both are gated at registration time — the extension checks that an LLM endpoint is configured and that the selected file is a supported type, so neither entry point appears when neither condition is met. There is no Tier 2 fallback UI; when no LLM is configured the panel is simply absent.

The core data path lives in two composables. useInsights fetches the raw file text over WebDAV, runs it through a client-side RFC-4180 state-machine parser (csv-parse.ts) that handles quoted fields, embedded newlines, and CRLF, then derives column types (boolean / number / date / string), value ranges, and up to five representative samples per column. It caps output at 30 columns before sending the structured preview to the LLM endpoint as a json_object request. A same-origin check is enforced before the POST so credentials are never sent cross-origin. useLlm is a thin wrapper around the configured endpoint, following the pattern established in web-app-ai-doc-summary; the async keyword was removed from ensureReady to satisfy the require-await lint rule without changing behavior.

InsightsPanel.vue renders four distinct states driven by composable-exposed reactive refs: an "Analyzing…" placeholder while the request is in flight, a red alert banner on error, a column-types table with Range column plus an observation list on success, and an idle state with a primary "Analyze" button. A "Re-analyze" button is available once a result has been returned. All ODS utility classes and oc-button usage follow the patterns from SummaryPanel.vue and AltTextPanel.vue.

Unit test coverage spans the parser (including RFC-4180 edge cases), file-type detection, both composables (24 tests for useInsights covering the full HTTP error matrix and non-JSON graceful handling), and all four panel render states. The Playwright acceptance suite uploads a minimal sample.csv fixture, asserts that the "Insights" context-menu entry is visible for CSV and invisible for a JPEG, then confirms the sidebar panel mounts when the action is clicked. Analysing files larger than 200 rows or wider than 30 columns is explicitly out of scope; the parser truncates silently at those limits before the LLM call.

Gate

Check Result
Hygiene ✅ ok
Build ✅ ok
Lint ✅ ok
Unit tests ✅ ok
E2E tests ✅ ok
Score 1.00

Effort: S · 🤖 Generated by extctl

LukasHirt added 14 commits June 24, 2026 14:53
Signed-off-by: Lukas Hirt <info@hirt.cz>
…tils/csv-parse.ts` (RFC-4180 parser with TSV delimiter support), `src/utils/file-support.ts`, `src/composables/useLlm.ts` (verbatim copy), and `src/composables/useInsights.ts` (WebDAV fetch, column type inference, LLM POST with same-origin check and column cap). Update `src/index.ts` to register the `sidebarPanel` and `action` extensions with `isVisible` guards on `llmConfig` and supported extensions.

Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
…sightsPanel.vue` with the four render states (analyzing spinner, error banner, result table + observations, idle Analyze button) using `oc-button` and ODS utility classes. Wire `ensureReady` on `onMounted` and `triggerInsights` to the button actions.

Signed-off-by: Lukas Hirt <info@hirt.cz>
…t/csv-parse.spec.ts` (RFC-4180 edge cases including embedded newlines, CRLF, truncation), `tests/unit/file-support.spec.ts`, `tests/unit/useLlm.spec.ts`, `tests/unit/useInsights.spec.ts` (mocked WebDAV, fetch, same-origin check, error codes), and `tests/unit/InsightsPanel.spec.ts` (mocked `useInsights`, all render states, button callbacks).

Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
…ton in `tests/e2e/acceptance.spec.ts` with real Playwright tests covering: "Insights" context-menu entry visible for `.csv` and invisible for `.jpeg`; clicking the entry opens the Insights sidebar panel. Add the `tests/e2e/pages/aiDataInsightsSidebarPage.ts` page object and `tests/e2e/fixtures/sample.csv` fixture.

Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
…md if present) for the extension

Signed-off-by: Lukas Hirt <info@hirt.cz>
…CI matrix, and oCIS apps config

Signed-off-by: Lukas Hirt <info@hirt.cz>
@kw-security

kw-security commented Jun 24, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants