Skip to content

styling: surface style_column exceptions in the column config instead of only in server logs #971

Description

@paddymul

Problem

When style_column raises, StylingAnalysis.style_columns (buckaroo/dataflow/styling_core.py:477-483) logs a warning and falls back to default_styling. The warning only goes to the Python logger (~/.buckaroo/logs/server.log for the server). Nothing in the column config sent to the frontend records that styling failed, so the browser UI, and callers that read initial_state off the websocket, can't tell a column that is plain obj on purpose from one whose styling code threw.

After #968 the failed column keeps its real header, so the table no longer looks broken, but the failure is now even easier to miss: one column quietly renders unstyled.

Suggested fix

Add an optional field to the column config, e.g. styling_error: str, set to f"{type(exc).__name__}: {exc}" in the except branch of style_columns. This needs:

  • Python: add it as NotRequired[str] to BaseColumnConfig / NormalColumnConfig / MultiIndexColumnConfig (styling_core.py:134-158).
  • TS: add styling_error?: string to BaseColumnConfig in packages/buckaroo-js-core/src/components/DFViewerParts/DFWhole.ts:176.
  • Frontend: show it somewhere visible, e.g. a warning marker plus tooltip on the header. Make sure the field isn't passed through into the AG-Grid colDef.

The empty-col_meta pass during instantiation (len(col_meta) == 0 and len(cls.requires_summary) > 0) swallows its exception on purpose and should not set the field.

Context

Split out from the second suggestion in #966. The header fix is in #968.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions