Skip to content

The property before the text, which is the only order that works - #48

Merged
blessdyb merged 2 commits into
mainfrom
fix/the-property-before-the-text
Oct 1, 2026
Merged

blessdyb merged 2 commits into
mainfrom
fix/the-property-before-the-text

Conversation

@blessdyb

@blessdyb blessdyb commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Shipping as v0.5.13. v0.5.12 did not fix the bug it claimed to, and the check that shipped with it was satisfied by the broken code.

What was wrong with the fix

use_markup(false) on the builder does not work. A builder applies a row's title as the object is constructed and the property afterwards, whatever order the chain lists them in. So the title was still parsed as markup, the row still rendered empty — and the property still read false at the end, which is exactly why a check that asked the property passed.

Measured rather than reasoned about, in examples/markup.rs:

built with the builder:   uses markup: false   — and GTK logged "Failed to set text … from markup"
set after construction:   uses markup: false   — and said nothing at all

A test that cannot fail is not a test. The v0.5.12 check counted declarations: thirty-two rows, thirty-two use_markup(false), all present on code that did not work.

The fix

One helper that constructs the row, sets the property, and only then sets the text. All thirty-two call sites go through it. It lives in a small library beside the binary so the example exercises what the window uses rather than a copy of it that can drift.

Two checks, replacing the one that was wrong

  • Structural: no adw::ActionRow::builder() may appear in the window at all, because a builder cannot set the property first. That is an invariant about construction rather than a count of words.
  • Behavioural: the example runs under xvfb, installs a writer function — GTK 4 logs through g_log_structured, which is why a log handler saw nothing and the writer sees everything — and fails if any row's text could not be set.

The behavioural one was run against the construction it replaces, and it failed there, before it was trusted here:

GTK could not set a row's text: Failed to set text 'GET example.com/…?q=&providers=…' from markup …
FAIL: GTK refused to set a row's text 1 time(s).

G_DEBUG=fatal-warnings was the first idea and is too blunt — it also aborts on an unrelated missing gsettings schema, which says nothing about this.

🤖 Generated with Claude Code

blessdyb and others added 2 commits October 1, 2026 01:12
v0.5.12 did not fix this. It set `use-markup` on the builder, and a builder applies a row's title as the
object is constructed and the property afterwards, whatever order the chain lists them in — so the title
was still parsed as markup, the row still rendered empty, and the property still read `false` at the end.

That last part is why it passed. The check added with it counted declarations, and thirty-two
declarations were present on code that did not work. A test that cannot fail is not a test.

Measured instead, in `examples/markup.rs`:

    built with the builder:   uses markup: false   — and GTK logged "Failed to set text … from markup"
    set after construction:   uses markup: false   — and said nothing at all

So every row is now built by one helper that constructs the row, sets the property, and only then sets the
text. All thirty-two call sites go through it, and the helper lives in a small library beside the binary so
that the example exercises what the window uses rather than a copy that can drift.

Two checks replace the one that was wrong. The structural one refuses any `ActionRow::builder()` in the
window at all, because a builder cannot set the property first. The behavioural one runs the example under
`xvfb`, catches what GTK logs through `g_log_structured` — which is why a log handler saw nothing and the
writer function sees everything — and fails if a row's text could not be set. It was run against the
construction it replaces, and it failed there, before it was trusted here.

`G_DEBUG=fatal-warnings` was the first idea for that and is too blunt: it also aborts on an unrelated
missing gsettings schema, which says nothing about this.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`expect_used` is denied outside `#[test]` functions and an example is neither. Without a display there
is nothing for this to ask anyway, so it says that and stops rather than panicking with a backtrace in it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@blessdyb blessdyb closed this Oct 1, 2026
@blessdyb blessdyb reopened this Oct 1, 2026
@blessdyb
blessdyb merged commit 780a620 into main Oct 1, 2026
10 checks passed
@blessdyb
blessdyb deleted the fix/the-property-before-the-text branch October 1, 2026 08:36
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