Skip to content

A rule needs something on both sides of it - #221

Merged
dmitrat merged 1 commit into
mainfrom
studio/menu-rules
Aug 19, 2026
Merged

dmitrat merged 1 commit into
mainfrom
studio/menu-rules

Conversation

@dmitrat

@dmitrat dmitrat commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Reported from a screenshot: the connection's own context menu drew Database…, Close database, a rule, Create ▸, then two rules with nothing between them, Refresh, and two more rules below it with nothing after them at all.

What it was

The other half of the change that gave each node its own menu (#219). Every item in that shared menu learned to hide itself where it does not apply; the five separators - the only elements with no condition on them - were left drawing the shape of a menu that is no longer there.

Measured over all fourteen kinds of node, and every one of them was wrong:

node drawn before
connection Database…, Close, ─, Create, ─, ─, Refresh, ─, ─
any folder ─, Create, ─, ─, Refresh, ─, ─
table ─, Create, ─, Select, Edit, Structure, Definition, ─, Refresh, ─, Rename, Empty, ─, Drop
sequence ─, ─, ─, Refresh, ─, ─, Drop
column ─, ─, ─, Refresh, ─, ─

Even the table - the node that has one of everything - opened with a stray line.

The fix

Each separator asks whether both sides of it are there. Refresh applies to every node, so anything above it always has something below - which is why the first three rules ask only about what precedes them.

The guard

ARuleHasSomethingOnBothSidesTests reads the real menu: the order and the conditions come from DatabaseExplorer.axaml, the answers from the real ViewModel, so it walks every node type and reports the sequence that would be drawn. It asserts the exact menu of a connection, a folder, a column and a table, and the general rule - no leading rule, no trailing rule, no two running together - over all fourteen.

  • Red before the fix on all fourteen node types.
  • Red again with each of the five conditions removed one at a time.
  • Driven afterwards against a fresh build: the connection, a folder and a table draw what the fixture says.

Studio: 1019 green.

🤖 Generated with Claude Code

Reported from a screenshot: the connection's own context menu drew Database...,
Close database, a rule, Create, then TWO rules with nothing between them, Refresh,
and two more rules below it with nothing after them at all.

The cause is the other half of the change that gave each node its own menu. Every
ITEM there learned to hide itself where it does not apply, and the five separators -
the only elements of that menu with no condition on them - were left drawing the
shape of a menu that is no longer there. Measured over all fourteen kinds of node:
every one of them was wrong. A folder's menu began with a rule, a column's menu was
one command wrapped in five, a sequence's was three rules, Refresh, two rules and
Drop, and even a table's - the node with one of everything - opened with a stray line.

Each separator now asks whether both sides of it are there. Refresh applies to every
node, so anything above it always has something below, which is why the first three
rules ask only about what precedes them.

The guard reads the real menu: the ORDER and the conditions come from the markup and
the answers from the real ViewModel, so it walks every node type and reports the
sequence it would draw. It went red on all fourteen before the fix, and red again
with each of the five conditions removed one at a time. Driven afterwards against a
fresh build - the connection, a folder and a table all draw what the fixture says.

Studio: 1019 green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dmitrat
dmitrat merged commit 42ed431 into main Aug 19, 2026
1 check passed
@dmitrat
dmitrat deleted the studio/menu-rules branch August 19, 2026 09:37
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