Skip to content

Workflow can't set boolean field#2928

Merged
squigglybob merged 45 commits into
DiscipleTools:developfrom
cairocoder01:agent/5-workflow-can-t-set-boolean-field
Jul 15, 2026
Merged

Workflow can't set boolean field#2928
squigglybob merged 45 commits into
DiscipleTools:developfrom
cairocoder01:agent/5-workflow-can-t-set-boolean-field

Conversation

@cairocoder01

Copy link
Copy Markdown
Collaborator

Workflows were not properly setting a true value for boolean fields. This is a fix with a test to confirm.

Written by bot: cairocoder01#6

I pulled the change and confirmed on a local dev site.

DT Loop Engineer added 27 commits July 10, 2026 11:15
Automated implementation by DT Loop Engineer.
Loop iterations: 1
Closes #5

Co-authored-by: loop-engineer[bot] <loop-engineer[bot]@disciple.tools>
Automated implementation by DT Loop Engineer.
Loop iterations: 1
Closes #5

Co-authored-by: loop-engineer[bot] <loop-engineer[bot]@disciple.tools>
Automated implementation by DT Loop Engineer.
Loop iterations: 1
Closes #5

Co-authored-by: loop-engineer[bot] <loop-engineer[bot]@disciple.tools>
Automated implementation by DT Loop Engineer.
Loop iterations: 1
Closes #5

Co-authored-by: loop-engineer[bot] <loop-engineer[bot]@disciple.tools>
Automated implementation by DT Loop Engineer.
Loop iterations: 4
Closes #5

Co-authored-by: loop-engineer[bot] <loop-engineer[bot]@disciple.tools>
@github-actions

Copy link
Copy Markdown

Code Review

Summary of change: action_update() now coerces the incoming boolean field value with filter_var(..., FILTER_VALIDATE_BOOLEAN) instead of passing the raw value straight through, so string values like "false" (truthy in PHP) are correctly converted to false before being handed to DT_Posts::update_post(). This matches the boolean-coercion convention already used elsewhere (e.g. dt-posts/posts.php:2899), and the added unit test covers both "true"/"false" cases.

Medium

  • dt-workflows/workflows-execution-handler.php:151-178 (condition_equals / condition_not_equals) have the same underlying bug this PR fixes, and it isn't addressed here. Both still compare boolean fields with boolval( $field ) === boolval( $value ). Since $value for a boolean condition/action comes from the same JSON-decoded workflow config as the $value fixed in action_update(), a string "false" will make boolval( $value ) evaluate to true (any non-empty PHP string is truthy), not false.
    This directly affects the reliability of the fix in this PR: already_executed_actions() (line 454) calls condition_equals( 'boolean', $field, $action->value ) to decide whether an update action has already been applied. If a workflow's action value is the string "false" and the field is currently true, condition_equals returns boolval(true) === boolval("false") -> true === true -> true, so the action is treated as "already executed" and exec_actions() (line 495, ! in_array( false, $already_executed )) skips calling action_update() entirely - the boolean field is never actually flipped to false. The same issue applies to any user-configured workflow condition of the form "boolean field equals false" (process_condition(), line 114).
    Worth confirming whether this is in scope for this PR (it's the same root cause - string "false" being truthy), since otherwise the newly-fixed action_update() may not get invoked in the exact scenario it was meant to fix.

Looks close to ready - the direct fix in action_update() is correct and well-tested, but the sibling condition_equals/condition_not_equals logic likely needs the same treatment for the fix to be reliable end-to-end in real workflows.

Automated implementation by DT Loop Engineer.
Loop iterations: 3
Closes #5

Co-authored-by: loop-engineer[bot] <loop-engineer[bot]@disciple.tools>
@github-actions

Copy link
Copy Markdown

Code Review

Summary of change: Fixes boolean field handling across the workflow engine. action_update() now casts $value via filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of passing the raw string through (so "false" no longer evaluates as truthy before hitting DT_Posts::update_post()), and condition_equals() / condition_not_equals() for the boolean case now use the same filter_var coercion instead of boolval(). This second part addresses the already_executed_actions() short-circuit issue flagged in the prior review round (a string "false" action value being treated as truthy via boolval() would make condition_equals() wrongly report the action as "already executed," so action_update() never actually got invoked). Verified against dt-workflows/workflows-execution-handler.php:157,172,543 — that fix is present in the current diff.

I traced the read/write path in dt-posts/posts.php (e.g. line 2900, $fields[$key] = $value[0]['value'] === '1') to confirm boolean fields are read back as real PHP bool, so filter_var() on either a bool or a "true"/"false" string produces consistent results in condition_equals/condition_not_equals. No new correctness issues found in the core fix.

I don't see any new High or Medium issues beyond what's already been raised in this PR's review history.

Not re-raising, but still outstanding: BLUEPRINT.md, PROGRESS.md, REQUESTED_CHANGES.md, and VERIFY_ERRORS.md at the repo root (agent-loop scaffolding artifacts) are still present in the current diff, as already flagged twice in this PR's review comments. These should still be dropped before merge.


The core fix (action_update + condition_equals/condition_not_equals) is correct and resolves the previously-flagged already_executed_actions() concern. Pending removal of the four non-source scaffolding files, this looks ready to merge.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: action_update() now correctly coerces boolean field values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of passing the raw "true"/"false" string through, and condition_equals()/condition_not_equals() (workflows-execution-handler.php:148-165) get the equivalent fix — this resolves the already_executed_actions() follow-up issue raised in earlier review rounds. Verified against DT_Posts::update_post() (dt-posts/posts.php:3545) which accepts a raw PHP bool for boolean-type fields, so the fix is consistent with how the rest of the CRUD layer treats this field type. The stray root-level scratch files (BLUEPRINT.md, PROGRESS.md, etc.) flagged in prior review rounds are no longer present in the diff.

Medium

  • Unrelated, large-scale formatting churn throughout the file, contrary to the file's own established style. The diff converts virtually every array literal in workflows-execution-handler.php from short syntax ([]) to long syntax (array()), realigns unrelated assignment operators, and changes else if to elseif, none of which relate to the boolean-field fix. This file previously used short array syntax exclusively (15 occurrences), and the codebase as a whole overwhelmingly favors it (e.g. dt-posts/posts.php uses [] 61 times vs array() once), and PHPCS explicitly allows short syntax (phpcs.xml:151 excludes Universal.Arrays.DisallowShortArraySyntax). This churn roughly 10x's the diff size, obscures the actual functional change during review, and increases the chance of conflicts with any other in-flight work touching this file. Recommend reverting the unrelated formatting changes and keeping only the boolean case fix.

The core fix (filter_var(..., FILTER_VALIDATE_BOOLEAN) in action_update(), condition_equals(), and condition_not_equals()) is correct, well-tested for the action_update() path, and consistent with existing boolean-coercion conventions elsewhere in the codebase. The only outstanding concern is the unrelated formatting churn across the file — worth trimming before merge to keep the diff focused, but not a functional blocker.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix is correct — action_update() now casts boolean action values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of passing the raw "true"/"false" string through (previously both were truthy via boolval()), and condition_equals()/condition_not_equals() get the equivalent fix, which resolves the already_executed_actions() short-circuit issue raised in earlier review rounds. $post[$field_id] for boolean fields is a real PHP bool by the time it reaches these methods (dt-posts/posts.php:3104-3109), so casting through filter_var on both sides is safe. The new test file (tests/dt-workflows/unit-test-boolean-update.php) now also covers condition_equals/condition_not_equals, addressing that earlier gap. The stray root-level scratch files (BLUEPRINT.md, etc.) flagged in prior review rounds are no longer present in this diff.

Medium

  • Unrelated, repo-convention-violating reformatting bundled into a small bug fixdt-workflows/workflows-execution-handler.php (whole file). Of the ~115 added / 69 removed lines in this diff, only about a dozen represent the actual boolean-handling fix; the rest is a mechanical rewrite of every array literal in the file from short syntax ([]) to long syntax (array(...)), plus incidental else ifelseif and alignment/spacing churn. This isn't enforced by the project's own linter — phpcs.xml explicitly excludes Universal.Arrays.DisallowShortArraySyntax, so both styles pass PHPCS — and it goes against this codebase's dominant convention (short array syntax outnumbers long array syntax by roughly 5:1 repo-wide, e.g. dt-posts/posts.php alone uses [] 61 times vs array() once). Bundling a full-file style rewrite with a targeted bug fix makes the actual change harder to review/audit, and increases the chance of merge conflicts with any other in-flight PR touching this file. Recommend reverting the unrelated array-syntax/formatting changes and keeping the diff scoped to the boolean-coercion fix.

The core boolean-coercion fix (action_update + condition_equals/condition_not_equals) is correct, consistent with the existing filter_var boolean-coercion pattern used elsewhere (e.g. dt-posts/posts.php:2899), and is now backed by tests covering both code paths. The only remaining concern is the large amount of unrelated formatting churn mixed into the diff — worth trimming before merge, but not functionally blocking.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The core fix is unchanged from prior review rounds and remains correct — action_update(), condition_equals(), and condition_not_equals() now coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly handling the "false" string case. The previously-flagged scratch files (BLUEPRINT.md, etc.) are no longer present in this diff.

Not re-raising the formatting-churn (short []array()) and WP_UnitTestCase-convention points already covered extensively in earlier review rounds on this PR, since they remain unaddressed but unchanged from prior comments.

Medium

  • tests/dt-workflows/test-boolean-fix.php is fully redundant with tests/dt-workflows/unit-test-boolean-update.php. Both files add a test class that reflects into action_update() and asserts the exact same 'boolean' / 'true'true and 'boolean' / 'false'false behavior (test-boolean-fix.php:5-14 vs. unit-test-boolean-update.php:5-14). unit-test-boolean-update.php is a strict superset — it covers the same action_update() case plus condition_equals/condition_not_equals. These look like leftover artifacts from separate iterations of the same automated fix rather than intentional additional coverage. Recommend deleting test-boolean-fix.php and keeping only unit-test-boolean-update.php.

No new correctness or security issues found beyond what's already been raised in this PR's review history. The functional fix is sound; the only new item is the redundant test file, which is a minor cleanup rather than a merge blocker.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The core fix remains unchanged from prior review rounds and is correct — action_update(), condition_equals(), and condition_not_equals() (dt-workflows/workflows-execution-handler.php:157-172, 543-546) coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly handling the "false"-string-is-truthy bug. tests/dt-workflows/unit-test-boolean-update.php exercises both action_update() and the condition_equals/condition_not_equals paths. Not re-raising the previously-flagged, still-unaddressed items: the unrelated []array() / else ifelseif formatting churn throughout the file, and tests/dt-workflows/test-boolean-fix.php being redundant with unit-test-boolean-update.php.

High

  • Four stray debug scratch files committed at the repo root: test_action_update.php, test_action_update_bool.php, test_filter.php, test_filter_null.php. These are new since the last review round (the previously-flagged BLUEPRINT.md/PROGRESS.md/etc. scaffolding files were removed, but these ad-hoc debug scripts were added instead). They're not part of the test suite (wrong location/naming — PHPUnit only picks up unit-test-*.php under ./tests/, per phpunit.xml), serve no purpose in the shipped product, and test_action_update.php/test_action_update_bool.php hard-code an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php';) that doesn't exist outside the agent's environment and would fatal-error if anyone tried to run them. These should be removed before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php never runs under CI. Beyond being redundant with unit-test-boolean-update.php (flagged in the prior review round), it also doesn't match the unit-test-*.php prefix that phpunit.xml's <testsuite> requires, so it's dead code in addition to being a duplicate — another reason to just delete it.

The functional fix (filter_var(..., FILTER_VALIDATE_BOOLEAN) in action_update, condition_equals, condition_not_equals) is correct and well-tested. Blocking issue is hygiene: the newly-added root-level scratch/debug files (one referencing a broken hardcoded path) need to be stripped from the PR before merge, along with the still-pending removal of the redundant test-boolean-fix.php.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix remains correct and unchanged from prior rounds — action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly handling the "false"-string-is-truthy bug (and the follow-on already_executed_actions() short-circuit). tests/dt-workflows/unit-test-boolean-update.php exercises both paths.

This PR has been reviewed many times already; the same hygiene issues keep getting raised and are still unresolved (in fact, worse) in the current diff.

High

  • Repo root is cluttered with 7 debug/scratch PHP files that don't belong in the shipped codebase: test_action_update.php, test_action_update_bool.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_reproduce_bug.php, verify.php. This is more than the 4 flagged in the previous review round (test_action_update.php, test_action_update_bool.php, test_filter.php, test_filter_null.php) — new ones (test_new_logic.php, test_reproduce_bug.php, verify.php) have since been added instead of removing the old ones. Two of them (test_action_update.php, test_action_update_bool.php) hardcode an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php';) that doesn't exist outside the agent's environment and would fatal if run. None of these match the unit-test-*.php prefix PHPUnit picks up (phpunit.xml.dist's <testsuite> uses prefix="unit-test-" over ./tests/), so they're dead weight, not real coverage. All 7 should be deleted before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php still doesn't run under CI and is still redundant. phpunit.xml.dist only picks up files with the unit-test- prefix under ./tests/, so test-boolean-fix.php (missing that prefix) never executes in CI — it's dead code. It's also a strict subset of tests/dt-workflows/unit-test-boolean-update.php (same action_update() assertions), which was already flagged in an earlier review round and still hasn't been removed.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php is still present. The diff still converts short array syntax ([]) to array() file-wide, plus else ifelseif and alignment changes, none related to the boolean fix. This isn't required by PHPCS (phpcs.xml excludes Universal.Arrays.DisallowShortArraySyntax) and goes against the file's/codebase's dominant short-array convention. This was flagged in two prior review rounds and remains unaddressed, unnecessarily inflating the diff.

The core boolean-coercion fix is correct and adequately tested. The PR is not ready to merge as-is: it still needs the root-level scratch files removed (now more of them than before), the redundant/dead test-boolean-fix.php deleted, and ideally the unrelated array-syntax formatting churn reverted to keep the diff scoped to the actual fix.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix remains correct and unchanged from prior rounds — action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly handling the "false"-string-is-truthy bug that previously made already_executed_actions() short-circuit incorrectly. This is consistent with the boolean-coercion convention used elsewhere in the codebase.

This PR has been through many review rounds already, and the same hygiene issues remain unresolved (verified against the current diff, not just prior comments):

High

  • Repo root still contains 7 debug/scratch PHP files: test_action_update.php, test_action_update_bool.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_reproduce_bug.php, verify.php. Two of these (test_action_update.php, test_action_update_bool.php) hardcode an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php';) that doesn't exist outside the agent's environment and would fatal if executed. None of these are picked up by PHPUnit (phpunit.xml.dist only scans ./tests/ for files with the unit-test- prefix), so they provide zero real coverage while permanently cluttering the repo root if merged. All 7 should be deleted.

Medium

  • tests/dt-workflows/test-boolean-fix.php is dead code and redundant. phpunit.xml.dist:14 restricts test discovery to files matching unit-test-*.php under ./tests/, so this file (wrong prefix) never runs in CI. It's also a strict subset of tests/dt-workflows/unit-test-boolean-update.php, which covers the same action_update() assertions plus condition_equals/condition_not_equals. Recommend deleting it.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php. The diff converts essentially every array literal in the file from short syntax ([]) to array(), plus else ifelseif and alignment/spacing realignment — none of which relate to the boolean fix. This isn't required by the project's linter (phpcs.xml:151 explicitly excludes Universal.Arrays.DisallowShortArraySyntax), goes against the file's/codebase's dominant short-array convention, and roughly 10x's the diff size, making the actual functional change harder to review and more prone to merge conflicts.
  • tests/dt-workflows/unit-test-boolean-update.php doesn't follow the project's test base class convention. Every other test under tests/ extends WP_UnitTestCase (e.g. tests/unit-test-sample.php), giving it the full WP bootstrap. This test extends PHPUnit\Framework\TestCase directly and reflects into private methods instead, which is a narrower/lower-fidelity form of coverage than the rest of the suite uses (not a blocker, but worth aligning if this file is kept long-term).

The core boolean-coercion fix (action_update, condition_equals, condition_not_equals) is correct and adequately tested. Not merge-ready as-is: the repo-root scratch/debug files (with a hardcoded sandbox path that would fatal if run) must be removed, the redundant dead-code test file should be deleted, and the unrelated array-syntax formatting churn should ideally be reverted to keep the diff scoped to the actual fix.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix is unchanged from prior rounds and remains correct — action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly resolving the "false"-string-is-truthy bug (and the follow-on already_executed_actions() short-circuit flagged in earlier rounds). No new correctness issues found in the core logic.

This PR has been reviewed many times already. The functional fix keeps passing review, but the repo-hygiene problems raised repeatedly are unresolved and have gotten worse, not better, since the last round.

High

  • Repo root now contains 14 debug/scratch PHP files, up from 7 in the previous review round: run_test.php, test_action_update.php, test_action_update_bool.php, test_bool.php, test_bool_2.php, test_bool_3.php, test_bool_4.php, test_bool_5.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_reproduce_bug.php, verify.php, verify_fix.php. New files added since the last round include test_bool.php through test_bool_5.php, run_test.php, and verify_fix.php — none of the previously-flagged files were removed, and more were added instead. Several hardcode an absolute sandbox path (e.g. test_action_update.php, test_action_update_bool.php: require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php') that doesn't exist outside the agent's environment and would fatal if executed. None match the unit-test- prefix that phpunit.xml.dist requires for test discovery under ./tests/, so they provide zero real coverage — they're pure clutter if merged into the theme's repo root. All 14 should be deleted before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php is still dead code and still redundant with tests/dt-workflows/unit-test-boolean-update.php (flagged in at least two prior rounds, still present). phpunit.xml.dist only discovers unit-test-*.php under ./tests/, so this file never runs in CI, and its assertions are a strict subset of unit-test-boolean-update.php. Recommend deleting it.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php remains unaddressed — the diff still converts virtually every array literal from short syntax ([]) to array(), plus else ifelseif and alignment/spacing changes, none related to the boolean fix. This isn't required by PHPCS (phpcs.xml excludes Universal.Arrays.DisallowShortArraySyntax) and goes against the file's/codebase's dominant short-array convention (e.g. dt-posts/posts.php uses [] 61 times vs array() once), inflating the diff roughly 10x beyond the actual fix and making review/audit harder.
  • tests/dt-workflows/unit-test-boolean-update.php doesn't follow this repo's test convention — every other file under tests/ extends WP_UnitTestCase with a full WP bootstrap (e.g. tests/unit-test-sample.php); this one extends PHPUnit\Framework\TestCase directly and reflects into a private method. Not a functional blocker, but worth aligning if this test is kept long-term.

The core boolean-coercion fix (action_update, condition_equals, condition_not_equals) is correct and adequately tested. Not merge-ready as-is: the repo-root scratch/debug files must be removed (there are now more of them than in the last review, including hardcoded sandbox paths that would fatal if run), the redundant dead-code test file should be deleted, and the unrelated array-syntax formatting churn should ideally be reverted to keep the diff scoped to the actual fix.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix remains unchanged from prior rounds and is still correct — action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php (lines ~157, 172, 543-546) coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly fixing the "false"-string-is-truthy bug and the follow-on already_executed_actions() short-circuit flagged in earlier review rounds. No new correctness issues found in the core logic.

This PR has been through many review rounds already. The diff is byte-for-byte unchanged from the immediately preceding round — none of the previously-flagged hygiene issues have been addressed.

High

  • Repo root still contains 14 debug/scratch PHP files that don't belong in the shipped codebase: run_test.php, test_action_update.php, test_action_update_bool.php, test_bool.php, test_bool_2.php, test_bool_3.php, test_bool_4.php, test_bool_5.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_reproduce_bug.php, verify.php, verify_fix.php. Two of these (test_action_update.php, test_action_update_bool.php) hardcode an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php') that doesn't exist outside the agent's environment and would fatal if run. None match the unit-test- prefix phpunit.xml.dist requires for discovery under ./tests/, so they provide zero real coverage and would permanently clutter the theme's repo root if merged. All 14 should be deleted before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php is still dead code and still redundant with tests/dt-workflows/unit-test-boolean-update.php (flagged in multiple prior rounds, still unaddressed). phpunit.xml.dist only discovers unit-test-*.php under ./tests/, so this file never runs in CI, and its assertions are a strict subset of unit-test-boolean-update.php. Recommend deleting it.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php remains unaddressed — the diff still converts virtually every array literal from short syntax ([]) to array(), plus else ifelseif and alignment/spacing changes, none related to the boolean fix. This isn't required by PHPCS (phpcs.xml excludes Universal.Arrays.DisallowShortArraySyntax) and goes against the file's/codebase's dominant short-array convention (e.g. dt-posts/posts.php uses [] 61 times vs array() once), inflating the diff roughly 10x beyond the actual fix and making review/audit harder.
  • tests/dt-workflows/unit-test-boolean-update.php doesn't follow this repo's test convention — every other file under tests/ extends WP_UnitTestCase with a full WP bootstrap (e.g. tests/unit-test-sample.php); this one extends PHPUnit\Framework\TestCase directly and reflects into a private method. Not a functional blocker, but worth aligning if this test is kept long-term.

The core boolean-coercion fix (action_update, condition_equals, condition_not_equals) is correct and adequately tested. Not merge-ready as-is: the 14 repo-root scratch/debug files must be removed (including two with hardcoded sandbox paths that would fatal if run), the redundant dead-code test file should be deleted, and the unrelated array-syntax formatting churn should ideally be reverted to keep the diff scoped to the actual fix.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix remains correct and unchanged from prior rounds — action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php (lines ~157, 172, 534-537) coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly fixing the "false"-string-is-truthy bug and the follow-on already_executed_actions() short-circuit flagged in earlier review rounds. No new correctness issues found in the core logic.

This PR has been through many review rounds already, and the repo-hygiene issues raised repeatedly remain unresolved — and have gotten worse, not better, since the last round.

High

  • Repo root now contains 15 debug/scratch PHP files, up from 14 in the previous round: run_test.php, test_action_update.php, test_action_update_bool.php, test_bool.php, test_bool_2.php, test_bool_3.php, test_bool_4.php, test_bool_5.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_repro.php, test_reproduce_bug.php, verify.php, verify_fix.php. test_repro.php is new since the last round; none of the previously-flagged files were removed. Two of them (test_action_update.php, test_action_update_bool.php) hardcode an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php';) that doesn't exist outside the agent's environment and would fatal if run. None match the unit-test- prefix that phpunit.xml.dist:14 requires for discovery under ./tests/, so they provide zero real coverage — pure clutter if merged into the theme's repo root. All 15 should be deleted before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php is still dead code and still redundant with tests/dt-workflows/unit-test-boolean-update.php (flagged in multiple prior rounds, still unaddressed). phpunit.xml.dist:14 only discovers unit-test-*.php under ./tests/, so this file never runs in CI, and its single test is a strict subset of unit-test-boolean-update.php's test_action_update_boolean. Recommend deleting it.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php remains unaddressed — the diff still converts virtually every array literal from short syntax ([]) to array(), plus else ifelseif and alignment/spacing changes, none related to the boolean fix. This isn't required by PHPCS (phpcs.xml excludes Universal.Arrays.DisallowShortArraySyntax) and goes against the file's/codebase's dominant short-array convention (e.g. dt-posts/posts.php uses [] far more than array()), inflating the diff well beyond the actual ~10-line fix and making review/audit harder.
  • tests/dt-workflows/unit-test-boolean-update.php doesn't follow this repo's test convention — every other file under tests/ extends WP_UnitTestCase with a full WP bootstrap (e.g. tests/unit-test-sample.php); this one extends PHPUnit\Framework\TestCase directly and reflects into private methods. Not a functional blocker, but worth aligning if this test is kept long-term.

The core boolean-coercion fix (action_update, condition_equals, condition_not_equals) is correct and adequately tested via unit-test-boolean-update.php. Not merge-ready as-is: the repo-root scratch/debug files must be removed (now 15, including two with hardcoded sandbox paths that would fatal if run), the redundant dead-code test file should be deleted, and the unrelated array-syntax formatting churn should ideally be reverted to keep the diff scoped to the actual fix.

@github-actions

Copy link
Copy Markdown

Code Review

Summary: The functional fix is unchanged from prior rounds and remains correct — action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly resolving the "false"-string-is-truthy bug and the follow-on already_executed_actions() short-circuit flagged in earlier rounds. No new correctness issues in the core logic.

This PR has been through many review rounds. The repo-hygiene issues raised repeatedly are still unresolved in the current diff.

High

  • Repo root still contains 15 debug/scratch PHP files that don't belong in the shipped codebase: run_test.php, test_action_update.php, test_action_update_bool.php, test_bool.php, test_bool_2.php, test_bool_3.php, test_bool_4.php, test_bool_5.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_repro.php, test_reproduce_bug.php, verify.php, verify_fix.php. Two of these (test_action_update.php, test_action_update_bool.php) hardcode an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php';) that doesn't exist outside the agent's environment and would fatal if run. Verified against phpunit.xml.dist:14 — test discovery is restricted to unit-test-*.php under ./tests/, so none of these provide real coverage; they're pure clutter if merged into the theme's repo root. All 15 should be deleted before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php is dead code and redundant with tests/dt-workflows/unit-test-boolean-update.php. Confirmed phpunit.xml.dist only discovers the unit-test- prefix, so this file never runs in CI, and its single assertion set is a strict subset of unit-test-boolean-update.php's test_action_update_boolean. Recommend deleting it.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php remains unaddressed — the diff converts virtually every array literal from short syntax ([]) to array(), plus else ifelseif and alignment/spacing changes, none related to the boolean fix. Confirmed phpcs.xml:151 explicitly excludes Universal.Arrays.DisallowShortArraySyntax, so this isn't linter-required, and it goes against the file's/codebase's dominant short-array convention, inflating the diff well beyond the actual ~10-line fix.
  • tests/dt-workflows/unit-test-boolean-update.php doesn't follow this repo's test convention — other files under tests/ extend WP_UnitTestCase with a full WP bootstrap (e.g. tests/unit-test-sample.php); this one extends PHPUnit\Framework\TestCase directly and reflects into private methods. Not a functional blocker, but worth aligning if this test is kept long-term.

The core boolean-coercion fix (action_update, condition_equals, condition_not_equals) is correct and adequately tested via unit-test-boolean-update.php. Not merge-ready as-is: the 15 repo-root scratch/debug files must be removed (two contain hardcoded sandbox paths that would fatal if run), the redundant dead-code test file should be deleted, and the unrelated array-syntax formatting churn should be reverted to keep the diff scoped to the actual fix.

@github-actions

Copy link
Copy Markdown

Code Review

No changes since the last review round — the diff is byte-for-byte identical to what was already reviewed. All previously-flagged issues remain unresolved.

Summary: The functional fix is correct: action_update(), condition_equals(), and condition_not_equals() in dt-workflows/workflows-execution-handler.php coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(), correctly resolving the "false"-string-is-truthy bug and the already_executed_actions() short-circuit it caused. tests/dt-workflows/unit-test-boolean-update.php covers both action_update() and the condition_equals/condition_not_equals paths.

High

  • Repo root still contains 15 debug/scratch PHP files that don't belong in the shipped codebase: run_test.php, test_action_update.php, test_action_update_bool.php, test_bool.php, test_bool_2.php, test_bool_3.php, test_bool_4.php, test_bool_5.php, test_filter.php, test_filter_null.php, test_new_logic.php, test_repro.php, test_reproduce_bug.php, verify.php, verify_fix.php. Two of these (test_action_update.php, test_action_update_bool.php) hardcode an absolute sandbox path (require_once '/workspace/repo/dt-workflows/workflows-execution-handler.php';) that doesn't exist outside the agent's environment and would fatal if run. phpunit.xml.dist only discovers unit-test-*.php under ./tests/, so none of these provide real coverage — they're pure clutter if merged into the theme's repo root. All 15 should be deleted before merge.

Medium

  • tests/dt-workflows/test-boolean-fix.php is dead code and redundant with tests/dt-workflows/unit-test-boolean-update.php. It doesn't match the unit-test- prefix phpunit.xml.dist requires for discovery, so it never runs in CI, and its assertions are a strict subset of unit-test-boolean-update.php's test_action_update_boolean. Delete it.
  • Unrelated formatting churn throughout dt-workflows/workflows-execution-handler.php — the diff converts virtually every array literal from short syntax ([]) to array(), plus else ifelseif and alignment/spacing changes, none related to the boolean fix. phpcs.xml explicitly excludes Universal.Arrays.DisallowShortArraySyntax, so this isn't linter-required, and it goes against the file's/codebase's dominant short-array convention, inflating the diff well beyond the actual ~10-line fix.
  • tests/dt-workflows/unit-test-boolean-update.php doesn't follow this repo's test convention — other files under tests/ extend WP_UnitTestCase with a full WP bootstrap (e.g. tests/unit-test-sample.php); this one extends PHPUnit\Framework\TestCase directly and reflects into private methods. Not a functional blocker, but worth aligning if this test is kept long-term.

The core boolean-coercion fix (action_update, condition_equals, condition_not_equals) is correct and adequately tested via unit-test-boolean-update.php. Still not merge-ready: the 15 repo-root scratch/debug files must be removed (two contain hardcoded sandbox paths that would fatal if run), the redundant dead-code test file should be deleted, and the unrelated array-syntax formatting churn should be reverted to keep the diff scoped to the actual fix. None of this has changed since the prior review pass — please address the hygiene items before requesting another review.

cairocoder01 and others added 3 commits July 15, 2026 12:34
Revert the file-wide [] -> array() / else if -> elseif / alignment churn
in workflows-execution-handler.php so the diff is scoped to just the
boolean-coercion fix (condition_equals, condition_not_equals,
action_update). Switch the boolean test to extend WP_UnitTestCase like
the rest of the suite and drop the manual require_once.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Code Review

Summary: The current diff is minimal and scoped to the fix — 2 files changed:

  • dt-workflows/workflows-execution-handler.php: condition_equals(), condition_not_equals(), and action_update() now coerce boolean values with filter_var( $value, FILTER_VALIDATE_BOOLEAN ) instead of boolval(). This correctly fixes the "false"-string-is-truthy bug (boolval("false") === true in PHP), matching the same coercion pattern already used elsewhere in the codebase (dt-core/admin/multi-role/inc/functions.php:23).
  • tests/dt-workflows/unit-test-boolean-update.php: new WP_UnitTestCase-based test covering action_update(), condition_equals(), and condition_not_equals() for both "true"/"false" values, consistent with this repo's existing test conventions and file layout (e.g. tests/dt-posts/dt-posts/).

I verified via gh pr diff/gh pr view --json files that the PR currently touches only these two files — no repo-root scratch/debug files, no dead duplicate test file, and no unrelated formatting churn (short-array syntax and else if are preserved, matching phpcs.xml's excluded-rule and the file's dominant style).

No High or Medium issues found in the current diff.

Note for whoever's triaging this thread: several earlier automated review comments on this PR (2026-07-10 through 2026-07-14) flagged 15 root-level debug/scratch PHP files, a dead tests/dt-workflows/test-boolean-fix.php, and large array-syntax formatting churn as blockers. Those referred to intermediate commits from the automated implementation loop. The cleanup agent mess of files and chore(#5): drop unrelated formatting churn; align test base class commits (2026-07-15) already removed all of that — I confirmed the scratch files and dead test file are gone and the diff is now clean. Those comments no longer reflect the PR's current state and can be disregarded.

The boolean-coercion fix itself is correct, minimal, and adequately tested. This PR looks ready to merge.

@cairocoder01

Copy link
Copy Markdown
Collaborator Author

Sorry for the church on this PR as I tried to wrangle some various agents who all needed help. It should be good now and ready for review. @corsacca @squigglybob

@squigglybob
squigglybob merged commit 763b6b1 into DiscipleTools:develop Jul 15, 2026
3 checks passed
@squigglybob

Copy link
Copy Markdown
Collaborator

Thanks @cairocoder01 .
😆 yes that's a lot of churn for 3 sections changed.
No worries

@cairocoder01
cairocoder01 deleted the agent/5-workflow-can-t-set-boolean-field branch July 15, 2026 13:18
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.

2 participants