Repository navigation
slack: validate data_visualization against Slack's per-chart caps - #36
josephschorr wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
cc01b9e to
9f23380
Compare
Review: data_visualization validation is missing some of Slack's rulesThe new checks in Rules Slack enforces that our checks miss
Recommendation: use slack-go's validatorslack-go v0.30.1 (already in Suggested change: call Smaller items
🤖 Generated with Claude Code |
The hand-rolled per-chart checks were a partial copy of slack-go's DataVisualizationBlock.Validate and missed rules Slack enforces: point labels must match a category, categories must be unique and non-empty, pie values must be > 0, and names/labels must be non-empty. Call Validate, wrap its error with the block location plus the full rule set, and keep only the whitespace-title check and the broadcast guard locally. State the label==category and unique-category rules in the model instructions, and fix test fixtures that were invalid to Slack.
|
Switched to |
Problem
A time-series answer ("p95 over the last 3 hours") rendered via the
data_visualizationBlock Kit component produced a chart with far more than Slack's 20 points/categories (and >20-char timestamp labels). Slack rejected the whole message withinvalid_blocks, andsender.godegraded it to plain text — so the chart silently vanished while the agent believedrespond_to_usersucceeded.Root cause:
validateVizSeriesonly checked thatseriesandaxis_config.categorieswere non-empty. It did not model the per-chart limits Slack actually enforces (documented in slack-go'sblock_data_visualization.go, verified against the live API):Datamust be 1–20 points, exactly one peraxis_config.categoriesentryA 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_blockscode.Fix
validateVizSeries/validateDataVizto 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.ResponseMetadata.Messages(Slack's per-block json-pointer reason) at all threeblocks rejecteddegrade log sites —SlackErrorResponse.Error()returns only the bare code, so the actionable detail was being discarded.respond_to_userauthoring 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 newblocksRejectionDetailhelper.go test ./pkg/channels/...andgo vetpass.