Skip to content

fix(gravityforms): undo lying, ambiguous labels, hidden inactive/trashed in forms-list#21

Merged
oxyc merged 1 commit into
masterfrom
fix/v0.5.0-undo-and-list-filters
May 29, 2026
Merged

fix(gravityforms): undo lying, ambiguous labels, hidden inactive/trashed in forms-list#21
oxyc merged 1 commit into
masterfrom
fix/v0.5.0-undo-and-list-filters

Conversation

@oxyc

@oxyc oxyc commented May 29, 2026

Copy link
Copy Markdown
Member

Three bugs surfaced by a real gds-assistant v0.4.0 session.

1. Undo silently lied

`RestoreSnapshot::restoreForm` (and `restoreFeed`) checked `is_wp_error()` on the GFAPI return but not the literal `false` that `GFAPI::update_form` / `update_feed` produce on validation/save failure. The result: a failed restore flowed through to gds-assistant as success and the chat UI displayed "Undone" while the form stayed unchanged.

Both now treat `false` as an explicit failure with a meaningful error.

2. Two undo entries for the same form had identical labels

Both updates produced "Revert form 'X' to its previous state" — the user had no way to tell which undo button reverted which change. Audit labels now include a short delta:

  • `(fields: 10 → 5)` when the field count changed
  • `(changed: title, confirmations)` when only top-level metadata moved
  • `(saved 12:34:56 UTC)` as the last-resort fallback for shape-identical edits

3. `gds/forms-list` silently hid disabled / trashed forms

Two new optional input flags — `include_inactive` and `include_trashed` — let callers widen the listing when the user is hunting for a form they remember was there. Defaults preserved (active + non-trashed) for backward compat.

Companion to a gds-assistant prompt fix nudging the model to trust read results and consult the new filter flags before declaring an item gone.

Pint clean; existing GravityFormsAbility integration tests unaffected (only the audit label was extended, and tests don't pin it).

…o labels + filter inputs on forms-list

Three bugs surfaced from a v0.4.0 gds-assistant session:

1. Undo silently lied. RestoreSnapshot::restoreForm / restoreFeed
   only checked is_wp_error() on the GFAPI return — both
   GFAPI::update_form and GFAPI::update_feed return literal `false`
   on validation/save failure without raising a WP_Error. That meant
   a failed restore flowed through to gds-assistant as success and
   the chat UI displayed "Undone" while the form stayed unchanged.
   Now we treat `false` as an explicit failure with a "GFAPI returned
   false" error message.

2. Audit-log labels were ambiguous after multiple updates. Two
   consecutive updates on the same form both produced the snapshot
   label "Revert form 'X' to its previous state" so the user had no
   way to tell which undo button reverted which change. The label
   now includes a short delta summary — `(fields: 10 → 5)` when the
   field count changed, `(changed: title, confirmations)` when only
   top-level metadata moved, falling back to a UTC timestamp for
   shape-identical edits.

3. gds/forms-list silently hid disabled / trashed forms. The user
   said "find form 102" but the model only ever saw active +
   non-trashed forms and couldn't surface it. Two new optional
   input flags — include_inactive and include_trashed — let callers
   widen the listing; defaults remain unchanged for backward compat.
   Description updated to point the model at them.

Companion to a gds-assistant prompt fix that nudges the model to
trust read results and consult the new include flags before
declaring an item gone.

Lint clean (pint). Existing GravityFormsAbility integration tests
unchanged in shape — only the audit label was extended, which the
tests don't pin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@oxyc oxyc merged commit da387f7 into master May 29, 2026
2 checks passed
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