Skip to content

[GUI][rc12 candidate] Loaded YAML does not refresh existing form controls #51

Description

@YaoxiangLi

Summary

On the generic bulk-footprinting page, Load YAML from path updates st.session_state.current_config and the runnable YAML preview, but the visible form controls retain their previous widget-state values. The page therefore displays two conflicting configurations at once.

The loaded workflow can run successfully if the user ignores the form. However, clicking Update page config after loading silently replaces the loaded paths/options with the stale visible defaults, making this a data-loss/incorrect-run hazard.

Tested candidate

  • PR: Fix match-motifs logging and native desktop apps #49
  • Candidate source commit: dfd283e9a1d64f5728b310af6e0b2c373337de5a
  • Windows workflow run: 32452692335
  • Artifact ID: 9436464405
  • Executable SHA-256: c8cfbd635a2835980f69fa45ed8cb03787ffa2069706a174b91e811a742c389d
  • UI version: 0.2.0rc12
  • OS: Windows x64
  • Browser: Chrome 1920 x 911, normal zoom

Reproduction

  1. Launch the frozen Windows GUI and open bulk-footprinting.
  2. Expand Load bulk-footprinting config.
  3. Enter a valid YAML path and click Load YAML from path.
  4. Observe the success message Current config updated. and the enabled Start run button.
  5. Expand Preview runnable YAML.
  6. Compare that YAML with the form fields above it.

Test YAML contained:

sample_table: C:/fp-tools-win-test/pr49/test-output/bulk-fixture/samples.tsv
comparison_table: C:/fp-tools-win-test/pr49/test-output/bulk-fixture/comparisons.tsv
genome: C:/fp-tools-win-test/pr49/test-output/bulk-fixture/genome.fa
outdir: C:/fp-tools-win-test/pr49/test-output/bulk-project-gui
cores: 2
normalization: sample-quantile
plot_aggregate: top
review_format: bundle
motifs:
  - C:/fp-tools-win-test/pr49/source/test_data/individual_motifs/MA0139.1.jaspar

Actual result

The runnable preview correctly showed all loaded values, while the form still displayed the old defaults:

Field Visible form Runnable YAML
Sample Table samples.tsv absolute fixture TSV path
Comparison Table comparisons.tsv absolute fixture TSV path
Genome genome.fa.gz absolute genome.fa path
Outdir results/bulk_footprinting .../bulk-project-gui
Cores 4 2
Plot Aggregate all top
Review Format auto bundle

The newly introduced Normalization and Motifs fields did reflect loaded values because those widget keys did not exist before the load. Fields whose keys were already instantiated stayed stale.

Despite the visual mismatch, clicking Start run executed the loaded YAML and completed successfully: exit code 0, 10,261 project files, corrected bigWigs, footprint bigWigs, per-sample motif results, a 1,020-row differential result, interactive HTML, and combined review report.

Expected

After any of these actions:

  • Load example
  • Apply uploaded YAML
  • Load YAML from path

all visible controls on that page should immediately reflect the active current_config. The form, validation card, YAML preview, and eventual command must describe one configuration.

Likely cause

_render_page_loader() calls _set_config(), which currently only assigns:

st.session_state.current_config = normalize_config(config)

The generic fields use persistent explicit widget keys such as bulk-footprinting_sample_table, bulk-footprinting_genome, etc. Streamlit gives existing widget state precedence over a newly supplied value=, so _current_single_params(tool) changes but already-created widgets retain old values.

_set_config() neither clears/reseeds page widget keys nor forces a rerun after synchronizing them.

Risk

This is not only cosmetic. A user can inspect the loaded YAML, edit one visible field, and click Update page config, unintentionally replacing every loaded field with stale defaults. The resulting command may fail validation or write to an unintended output directory.

Suggested implementation

Create a single config-to-widget synchronization path used by all loaders. Before rerunning:

  1. Normalize and store the config.
  2. Determine the relevant tool/page.
  3. Clear or explicitly reseed every widget key owned by that page, including select boxes, numeric inputs, list text areas, and extra args.
  4. Call st.rerun() only after state is consistent.

Avoid clearing unrelated navigation/run-history state. A generation/version suffix on form keys is another safe approach if comprehensive key cleanup is difficult.

Regression tests

Add a Streamlit/AppTest or frozen browser test that:

  1. Opens bulk-footprinting with defaults.
  2. Loads a YAML where every field differs from the default.
  3. Asserts every visible control equals the loaded YAML.
  4. Asserts preview YAML equals the same values.
  5. Changes exactly one field and clicks Update page config.
  6. Asserts only that field changed and all other loaded values were preserved.
  7. Repeat via example loading and file upload, and cover at least one specialized page (diff-footprints) plus one other generic page.

Acceptance checklist

  • All visible controls refresh after YAML/example/upload loading.
  • No stale values survive from the pre-load page state.
  • Form, validation, preview, and launched command remain identical.
  • Editing one field after load preserves all other loaded values.
  • Windows paths, list fields, booleans, select boxes, and numeric inputs round-trip correctly.
  • Frozen Windows regression covers the workflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions