Skip to content

Refresh cell validation after programmatic changes#310

Open
wieslawsoltes wants to merge 13 commits into
masterfrom
agent/issue-287-programmatic-validation
Open

Refresh cell validation after programmatic changes#310
wieslawsoltes wants to merge 13 commits into
masterfrom
agent/issue-287-programmatic-validation

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Refresh realized DataGrid cell validation immediately when an item raises INotifyDataErrorInfo.ErrorsChanged after a programmatic property change.

Fixes #287.

Problem

The collection-level ErrorsChanged handler recomputed grid validity but did not restore validation on realized cells. Visible severity, pseudo-classes, and DataValidationErrors could therefore remain stale until another grid interaction.

Changes

  • Refresh realized rows for the item that raised ErrorsChanged.
  • Reuse the row-validation restoration path for consistent bound-column lookup, severity, pseudo-classes, and displayed errors.
  • Refresh non-edited cells on the active editing row while leaving the editor-owned column untouched.
  • Track INDEI-owned displayed errors separately from independent binding/setter errors.
  • Expose source-write validation provenance to public custom ICellEditBinding implementations with a compatibility-preserving default.
  • Derive edit acceptance and cell/row/grid severity from the final merged binding, preserved, and INDEI error set.
  • Release per-cell ownership at the common cell-removal boundary used by dynamic column removal and cell rebuilds.
  • Add Avalonia Headless and Release leak regressions for programmatic transitions, mixed validation sources, edit ownership, custom bindings, merged severity, and removed-cell collection.

User impact

ViewModel and service-driven changes now surface or clear visible validation immediately. Clearing a model error no longer removes an independent warning on the same cell, even when it has the same message and severity, and this behavior also applies to custom edit bindings that declare source-write provenance. Edit validity consistently reflects the most severe displayed error. Dynamic column/cell rebuilds do not retain detached validated cells.

Review hardening

Follow-up fixes:

  • preserve unrelated and same-cell binding validation during INDEI refresh;
  • refresh sibling cells on an editing row without disturbing the editor;
  • transfer ownership when edit mode hides or replaces a cell error;
  • claim INDEI warnings introduced by an edit;
  • partition mixed edit aggregates by provenance;
  • retain setter/binding errors that have the same message and severity as an INDEI error by using the binding engine source-write result;
  • expose the provenance marker through the public edit-binding contract for third-party columns;
  • cover default-mode bindings after DataGrid normalizes them to two-way editing;
  • merge binding, preserved, and INDEI severities before deciding edit acceptance and visual validity;
  • evict ownership when a cell leaves its row, preventing the grid dictionary from retaining removed cells.

Validation

  • DataGridValidationTests: 28 passed, 0 failed.
  • Full Avalonia.Controls.DataGrid.UnitTests: 2,261 passed, 0 failed.
  • Release leak suite: 35 passed, 0 failed.
  • git diff --check: clean.
  • All review threads resolved.

@wieslawsoltes

Copy link
Copy Markdown
Owner Author

Self-review completed. I reviewed the validation refresh path and its regression coverage; no additional actionable findings were found. All six CI checks are successful, the branch is synchronized, and git diff --check is clean. This PR is ready for review.

@wieslawsoltes wieslawsoltes marked this pull request as ready for review July 15, 2026 00:23

@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: 6176f595c1

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs Outdated
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 15, 2026

@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: 7725e9db76

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs

@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: 061ec3849f

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs Outdated

@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: c3e71a5b74

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs Outdated

@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: 496f4e8c3c

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs

@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: 8eb61ab8e7

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Editing.cs Outdated

@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: c32849572e

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Editing.cs Outdated

@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: 149af8748a

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs

@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: f14046cb9a

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Validation.cs

@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: 35f64b27d1

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Editing.cs Outdated

@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: c8c520cac7

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/Utils/CellEditBinding.cs

@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: 36843ba84e

ℹ️ 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 thread src/Avalonia.Controls.DataGrid/DataGrid.Editing.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty Title programming can not trigger Validation Error immediately

1 participant