Repository navigation
Conversation
Launcher-style launches (Start Menu, pinned taskbar, .desktop entries) run with an uninformative CWD — System32, the home folder, or an install/runtime directory — and used to propose creating .profiles in that system directory, with a starter scanning it. New profiles.core.paths module is the single source of truth: - user_data_dir() / user_config_path(): ~/.profiles shared by logs and the per-user default config (default_log_path now delegates). - find_user_config(): canonical names at depth 0 in the data dir. - is_uninformative_directory(): None, filesystem roots, home itself, sys.prefix, the executable's directory, and %SystemRoot%/%windir% / %ProgramFiles% when set (env-driven so tests are portable). - default_config_path(): uninformative start or a directory collision (CWD == home vs the ~/.profiles log dir) falls back to the per-user path; informative starts propose in place. - default_search_directory(): home for launcher starts, never System32. Wiring: launch resolution skips the CWD tree search for uninformative directories and falls back to the user config; app startup binds the defaults AppConfig to the policy-chosen path; load_config() and propose_config_creation() follow the same policy; ServerState .active_config_path() never returns an existing directory; the server's create/template endpoints and empty-config first paint use default_search_directory. STARTER_CONFIG_TEMPLATE discovery comment documents the new order. Closes #191
) With no active configuration, the editor's "Load config file…" and the file list's "Choose configuration" buttons opened the picker in Create mode: App kept a single showConfigPicker boolean with no record of why the picker opened, and LoadConfigModal inferred its mode from the global config state (configExists === false), so every entry point rendered Create whenever the session had no config. App now carries the intent explicitly: configPickerMode is "load" | "create" | null (null = closed). The first-run auto-prompt (initializeFromConfig) is the only entry point that opens "create"; both explicit actions open "load". LoadConfigModal takes that mode as a prop and stops consulting configExists; title, banner and primary button follow it. No server/API change; onLoaded/onClose behavior unchanged (editor reload key still bumps on pick, issue #101). Closes #192
Fresh vite build (tsc -b && vite build) serving the Load-mode picker fix; regenerated PWA precache hashes. The minified bundle crossed the pre-commit large-file line (1 MB), so check-added-large-files now exempts the tracked dist/ build output — it is a generated artifact, not hand-edited source.
CI's pyright flagged Path|None operand/return types in default_config_path/default_search_directory: the CWD fallback hid the None case from the type checker. A shared _effective_start() helper resolves the start (or CWD) once, and the explicit None checks narrow before use. Behavior unchanged.
macOS user report on this branch: launching the packaged app from a mounted DMG proposed creating the configuration in /Volumes/ProFiles <version> — the DMG volume root leaked through as an informative launch folder. Two mechanisms deliver it, both fixed: - The macOS Finder probe mirrors the FRONT FINDER WINDOW, which for a GUI launch is often the folder the user launched FROM (the DMG folder, /Applications, a portable-apps folder). The probe result now passes the same uninformative-directory policy as a CWD before being trusted; a rejected probe falls back to the plain CWD. - is_uninformative_directory() gains two rules: volume mount points (device id differs from parent — a DMG, USB stick or network share top-level is never a project location, consistent with drive roots), and any directory hosting the running packaged app bundle (Something.app/Contents on macOS). Dev runs are exempt: plain-venv interpreter paths carry no .app/Contents component, so a repo hosting .venv stays a legitimate project folder. A DMG launch now falls back to the per-user proposal (~/.profiles/.profiles) and scans the home folder, matching the launcher rows of the issue #191 behaviour matrix.
|
Follow-up fix pushed (fcfe5aa) for a macOS DMG launch report on this branch's build ( Two mechanisms delivered that path, both now fixed:
A DMG launch now falls back to the per-user proposal ( |
Finder and Dock launches on macOS inherit no working directory, so ProFiles adopts the front Finder window's folder as the launch folder: a project window proposes its .profiles, while an unrelated ordinary window (e.g. the folder holding the DMG installer) is proposed instead. Documented the behavior and the practical escape hatches (close the window, or use the picker's Home button) in both configuration-profile guides, both installation guides, and both READMEs; the FR install guide also gains the per-user first-launch paragraph it was missing.
|
I installed the msi program on windows, then launched the app. Traceback (most recent call last): |
Summary
One PR closing two related configuration-startup issues:
.desktop, any process whose CWD is System32, the home folder, or an install/runtime directory) no longer propose creating.profilesin a system directory. The proposal targets~/.profiles/.profiles(next toprofiles.log), later launches load that per-user default automatically, and terminal/project launches keep their exact current behavior.Per-user config path policy (#191)
New
profiles.core.pathsmodule — single source of truth for user-level locations:user_data_dir()/user_config_path()~/.profilesand~/.profiles/.profiles;default_log_path()now delegates so logs and config can't driftfind_user_config().profiles,.profiles.yaml,.profiles.yml) at depth 0 in the data diris_uninformative_directory()None, drive roots, home itself,sys.prefix, the executable's dir,%SystemRoot%/%windir%/%ProgramFiles%when set (env-driven, so tests are portable)default_config_path(start)start/.profiles, unless that candidate is an existing directory (theCWD == homelog-dir collision)default_search_directory(start)Wiring:
launch/resolution.py: CWD tree search is skipped for uninformative directories (no walking System32 / the whole home profile); per-user config is the final fallback (behaviour matrix from the issue, incl. intentional row 6: terminal launch in a project without a project config loads the user default).app.py:_resolve_startup_config()returns the launch-default target too;_load_configuration()binds the defaultsAppConfigto it, so the UI pre-fills~/.profilesfor launcher starts with no server-specific override.core/config/loader.py:load_config()follows the same policy;propose_config_creation()targets the policy default (and creates the data dir first — a bug the new tests caught).launch/creation.py:propose_creation(target, search_dir=...)— creating inside~/.profilesdrafts a starter scanning the home folder, not the data dir.server/state.py:active_config_path()keeps the CWD probe, falls back todefault_config_path(), and never returns an existing directory as the config file.server/routes/config.py:/createpasses the session's search dir (or the policy default),/templateand the empty-config first-paint fallback usedefault_search_directory()instead of the raw CWD.STARTER_CONFIG_TEMPLATEDISCOVERY comment documents the new order.Config picker mode (#192)
App.tsxreplaces theshowConfigPickerboolean withconfigPickerMode: "load" | "create" | null(null = closed). The caller owns the intent:config_exists: false)LoadConfigModaltakes an explicitmodeprop (ConfigPickerMode) and stops inferring fromconfigExists; title, banner and primary button all follow it.onLoaded/onClosebehavior unchanged (editor reload key still bumps, issue #101). No server/API change.Verification
pytest1626 passed, 1 skipped; coverage 88.6% (≥ 85 gate);pylint9.88/10;ruff check+ruff format --checkclean.tests/core/test_paths.py(29 tests); extensions totests/launch/{test_context,test_resolution,test_creation}.py,tests/core/config/test_loader.py,tests/server/routes/test_config*.py,tests/test_app_launch_resolution.py— incl. the simulated Start-Menu repro (monkeypatch.chdirto a fake%SystemRoot%\System32,Path.home()→ temp): resolution proposes~/.profiles/.profiles, nothing is written under System32, relaunch loads the user config.vitest393 passed (32 files) — newLoadConfigModal.test.tsxunit suite (mode prop both ways, disabled-until-selected, create/load actions) + twoApp.configEditor.test.tsxintegration regressions (first-run Create → close → editor entry opens Load; FileList entry opens Load);tsc -bclean;npm run buildregenerateddist/(committed).Notes / decisions
check-added-large-filesline (1 MB), so the hook now exempts the trackedsrc/profiles/web/dist/build output (generated artifact, not hand-edited source).docs/configuration-profile.{en,fr}.md,docs/installation-guide.en.md(first-launch paragraph),README.md/README.fr.mdconfig sections,CHANGELOG.md, plus theAGENTS.md/core/AGENTS.md/tests/AGENTS.mdtrees for the new module.