Skip to content

fix(styling): keep column identity outside styling, fall back to parent styling on failure (#966) - #968

Open
paddymul wants to merge 5 commits into
mainfrom
fix/styling-fallback-header-name
Open

paddymul wants to merge 5 commits into
mainfrom
fix/styling-fallback-header-name

Conversation

@paddymul

@paddymul paddymul commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes #966.

When style_column raised, style_columns fell back to default_styling(col), which passed the rewritten id as both col and orig_col_name. Every failed column showed a, b, ... as its header. A styling subclass that raised on every column made the table look like it had lost its column names.

Two changes:

Column identity is resolved outside styling. style_columns works out each column's header (or col_path) before any styling runs. It uses col_meta['orig_col_name'], falling back to the df's rewrite map, so no styling failure can change a header. A column with no orig_col_name, as in the instantiation pass, also no longer gets header_name: 'None' when styling succeeds.

A failing style_column falls back through the MRO. style_column_with_fallback tries each style_column in the MRO, most specific first. A subclass of DefaultMainStyling that raises, or returns something that isn't a column config, gets DefaultMainStyling's styling for that column instead of bare obj. An intermediate class like DiffStyling is kept too. A class that replaces StylingAnalysis directly instead of extending DefaultMainStyling only has obj to fall back on. Each attempt gets a shallow copy of col_meta, so a failing style_column that edits it doesn't affect the next attempt or the sd.

Each failure still logs a warning naming the class that raised. #971 tracks putting the error into the column config so it's visible without server logs. That matters more now, because a column that fell back to its parent looks almost right.

Commits: f8f23eff and cf519e13 add failing tests, which CI showed failing. d4bd8c00 was a first, narrower fix. e3af3083 replaces it.

🤖 Generated with Claude Code

#966)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8f23eff9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +423 to +425
assert dfvc['column_config'] == [
{'col_name': 'a', 'header_name': 'foo', 'displayer_args': {'displayer': 'obj'}},
{'col_name': 'b', 'header_name': 'bar', 'displayer_args': {'displayer': 'obj'}}]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Implement the fallback required by the new regression tests

When any style_column implementation raises, StylingAnalysis.style_columns still falls back via default_styling(col), which uses the rewritten IDs (a, b) as the header/original path. This commit changes only the tests, so these assertions (and the multi-index case below) fail while the advertised fix is not present; update the fallback to pass col_meta['orig_col_name'] when available.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

📦 TestPyPI package published

pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.15.6.dev35388730737

or with uv:

uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.15.6.dev35388730737

MCP server for Claude Code

claude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.15.6.dev35388730737" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table

📖 Docs preview

🎨 Storybook preview

default_styling now takes orig_col_name; style_columns passes it from col_meta
so a failing column keeps its header / col_path and only loses its styling.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…hout orig_col_name (#966)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ugh the MRO (#966)

Column identity (header_name / col_path) is now resolved by style_columns
before styling runs, from orig_col_name or the df's rewrite map, so no styling
failure can change a header and a missing orig_col_name no longer yields 'None'.

style_column_with_fallback tries each style_column in the MRO, most specific
first, so a failing subclass falls back to its parent's styling (e.g.
DefaultMainStyling) instead of bare obj. Each attempt gets its own copy of
col_meta. default_styling goes back to its original signature.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@paddymul paddymul changed the title fix(styling): keep real header name when style_column raises (#966) fix(styling): keep column identity outside styling, fall back to parent styling on failure (#966) Sep 18, 2026
…header-name

# Conflicts:
#	buckaroo/dataflow/styling_core.py
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.

styling: an exception in one column's style_column() corrupts headers for every column, not just the failing one

1 participant