feat: app.py checks wizard_complete flag to gate main app
This commit is contained in:
parent
dbe05e7c2d
commit
7fa3aa3848
2 changed files with 23 additions and 1 deletions
|
|
@ -65,7 +65,11 @@ _startup()
|
||||||
from scripts.user_profile import UserProfile as _UserProfile
|
from scripts.user_profile import UserProfile as _UserProfile
|
||||||
_USER_YAML = Path(__file__).parent.parent / "config" / "user.yaml"
|
_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="👋")
|
_setup_page = st.Page("pages/0_Setup.py", title="Setup", icon="👋")
|
||||||
st.navigation({"": [_setup_page]}).run()
|
st.navigation({"": [_setup_page]}).run()
|
||||||
st.stop()
|
st.stop()
|
||||||
|
|
@ -114,6 +118,8 @@ def _task_indicator():
|
||||||
label = "Enriching"
|
label = "Enriching"
|
||||||
elif task_type == "scrape_url":
|
elif task_type == "scrape_url":
|
||||||
label = "Scraping URL"
|
label = "Scraping URL"
|
||||||
|
elif task_type == "wizard_generate":
|
||||||
|
label = "Wizard generation"
|
||||||
elif task_type == "enrich_craigslist":
|
elif task_type == "enrich_craigslist":
|
||||||
label = "Enriching listing"
|
label = "Enriching listing"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -21,3 +21,19 @@ def test_wizard_gating_empty_file_still_exists(tmp_path):
|
||||||
p = tmp_path / "user.yaml"
|
p = tmp_path / "user.yaml"
|
||||||
p.write_text("")
|
p.write_text("")
|
||||||
assert UserProfile.exists(p)
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue