Skip to content

slack: validate data_visualization against Slack's per-chart caps - #36

Open
josephschorr wants to merge 1 commit into
mainfrom
slack-data-viz-validation-limits
Open

josephschorr wants to merge 1 commit into
mainfrom
slack-data-viz-validation-limits

Conversation

@josephschorr

@josephschorr josephschorr commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Problem

A time-series answer ("p95 over the last 3 hours") rendered via the data_visualization Block Kit component produced a chart with far more than Slack's 20 points/categories (and >20-char timestamp labels). Slack rejected the whole message with invalid_blocks, and sender.go degraded it to plain text — so the chart silently vanished while the agent believed respond_to_user succeeded.

Root cause: validateVizSeries only checked that series and axis_config.categories were non-empty. It did not model the per-chart limits Slack actually enforces (documented in slack-go's block_data_visualization.go, verified against the live API):

  • Data must be 1–20 points, exactly one per axis_config.categories entry
  • 1–6 series (bar/area/line), unique names
  • all category/series/point labels ≤20 chars; pie 1–6 segments

A fine-grained time series blows straight past the 20-point/category cap (and 20-char timestamp labels), passes local validation, and only fails at post time — where the failure is invisible because the degrade log records just the bare invalid_blocks code.

Fix

  1. Harden validateVizSeries / validateDataViz to enforce Slack's documented caps, so an over-dense or misaligned chart becomes a precise, model-facing, correctable error (same philosophy the file already states) instead of a silent post-time degrade.
  2. Surface ResponseMetadata.Messages (Slack's per-block json-pointer reason) at all three blocks rejected degrade log sites — SlackErrorResponse.Error() returns only the bare code, so the actionable detail was being discarded.
  3. Teach the model the caps up front in the respond_to_user authoring instructions (bucket long time ranges into ≤20 points, short labels, etc.).

Tests

TDD: added failing cases to TestValidateComponents (series/category/point caps, one-point-per-category alignment, label lengths, unique series names, pie segment cap/labels — plus boundary-accept cases at 20 points / 6 series) and a unit test for the new blocksRejectionDetail helper. go test ./pkg/channels/... and go vet pass.

@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openagentprimitives Error Error Oct 19, 2026 11:41pm UTC

Request Review

A time-series answer (e.g. "p95 over the last 3 hours") produces a
data_visualization chart with far more than Slack's 20 points/categories,
and/or >20-char timestamp labels. validateVizSeries only checked that series
and axis_config.categories were non-empty, so such a chart passed local
validation, reached chat.postMessage, and was rejected whole as
invalid_blocks — which the sender degrades to plain text, dropping the chart
silently. The agent sees its respond_to_user succeed and believes it posted a
chart that never rendered.

Enforce the limits slack-go's block_data_visualization.go documents (verified
against the live API) so an over-dense/misaligned chart becomes a precise,
model-facing, correctable error instead of a post-time silent degrade:
- bar/area/line: 1–6 series, unique names; 1–20 x-axis categories; exactly one
  data point per category; category/series/point labels ≤20 chars; axis
  x_label/y_label ≤50 chars.
- pie: 1–6 segments; segment labels ≤20 chars.

Also surface Slack's ResponseMetadata.Messages (the per-block json-pointer
reason) at the three blocks-rejected degrade log sites — SlackErrorResponse's
Error() returns only the bare code, so the actionable detail was being
discarded — and teach the model the caps up front in the respond_to_user
authoring instructions.

This branch had an error being deployed

1 failed deployment
Preview — 9f23380a Deployed Oct 19, 2026 by vercel[bot]
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.

1 participant