fix(gravityforms): undo lying, ambiguous labels, hidden inactive/trashed in forms-list#21
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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).