From 7fa3aa38482690f462f5f8511206c92df5b7d076 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Wed, 25 Feb 2026 09:43:53 -0800 Subject: [PATCH] feat: app.py checks wizard_complete flag to gate main app --- app/app.py | 8 +++++++- tests/test_app_gating.py | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/app.py b/app/app.py index e6b3152..9c9e789 100644 --- a/app/app.py +++ b/app/app.py @@ -65,7 +65,11 @@ _startup() from scripts.user_profile import UserProfile as _UserProfile _USER_YAML = Path(__file__).parent.parent / "config" / "user.yaml" -if not _UserProfile.exists(_USER_YAML): +_show_wizard = ( + not _UserProfile.exists(_USER_YAML) + or not _UserProfile(_USER_YAML).wizard_complete +) +if _show_wizard: _setup_page = st.Page("pages/0_Setup.py", title="Setup", icon="👋") st.navigation({"": [_setup_page]}).run() st.stop() @@ -114,6 +118,8 @@ def _task_indicator(): label = "Enriching" elif task_type == "scrape_url": label = "Scraping URL" + elif task_type == "wizard_generate": + label = "Wizard generation" elif task_type == "enrich_craigslist": label = "Enriching listing" else: diff --git a/tests/test_app_gating.py b/tests/test_app_gating.py index 7f53401..796960f 100644 --- a/tests/test_app_gating.py +++ b/tests/test_app_gating.py @@ -21,3 +21,19 @@ def test_wizard_gating_empty_file_still_exists(tmp_path): p = tmp_path / "user.yaml" p.write_text("") assert UserProfile.exists(p) + + +def test_wizard_incomplete_triggers_wizard(tmp_path): + """wizard_complete: false should be treated as 'wizard not done'.""" + p = tmp_path / "user.yaml" + p.write_text("name: T\nemail: t@t.com\ncareer_summary: x\nwizard_complete: false\n") + from scripts.user_profile import UserProfile + u = UserProfile(p) + assert u.wizard_complete is False + +def test_wizard_complete_does_not_trigger(tmp_path): + p = tmp_path / "user.yaml" + p.write_text("name: T\nemail: t@t.com\ncareer_summary: x\nwizard_complete: true\n") + from scripts.user_profile import UserProfile + u = UserProfile(p) + assert u.wizard_complete is True