Repository navigation
fix(initial-setup): apply falsy field edits when syncing flows from disk - #15227
tarciorodrigues merged 2 commits into
Conversation
sync_flows_from_fs guarded every copied field with a truthiness check, so setting `locked` to false or clearing `description` in the flow file was silently skipped while truthy edits propagated. Compare against None instead so both directions of an edit reach the database.
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
ChangesFilesystem flow synchronization
Priority: Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Pre-merge checks:
|
291c085
Changes
sync_flows_from_fspolls the flow JSON files on disk and copiesname,description,dataandlockedinto the database row. The copy was guarded by a truthiness check on the incoming value:so an edit that sets
lockedtofalse, or clearsdescription, was silently skipped — while an edit that sets those to truthy values propagated. The watcher re-reads the file every polling cycle and still applied nothing, so the row stayed permanently out of sync with the file.Switching the guard to
is not Nonemakes both directions symmetric and leaves the "key absent from the file" case exactly as it was (Noneis still skipped).Fixes #15226
How was this tested?
Added
test_sync_flows_from_fs_applies_falsy_valuestosrc/backend/tests/unit/test_initial_setup.py. It reuses the module's existingset_fs_flows_polling_intervalfixture (100 ms polling) and the same API-plus-file flow as the existingtest_sync_flows_from_fs: create a flow withlocked: trueand a non-emptydescription, rewrite the on-disk file withlocked: falseanddescription: "", then read the row back throughGET /api/v1/flows/{id}.Against
main@5621dcfdwith only the new test added, the test fails:With the one-line change in place, the whole module runs as:
The single failure is
test_load_bundles_from_urls, which is unrelated to this diff and is a pre-existing Windows-only assertion:src/backend/tests/unit/test_initial_setup.py:407looks for a/-joined substring in a backslash-joined path.ruff format --checkandruff checkboth pass on the two changed files.How can this PR be tested?
uv run --no-sync python -m pytest src/backend/tests/unit/test_initial_setup.py -k sync_flows -q— covers both the new falsy case and the existing truthy case.Checklist
Lesereingrape; these changes were produced by an automated contributor and have not been read line-by-line by a human, so the reviewer box in the contributing guide is deliberately left unticked.