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.
…pply macOS also delivers the opened folder — or any non-config document — as an odoc AppleEvent. The running-window applier (_make_document_applier) fed every delivered path into apply_config_from_disk, which rejects non-whitelisted names with 400 'Not a ProFiles configuration file', turning a normal folder open into a spurious 'Could not apply ...' failure toast (issue #193) — while launch resolution had already correctly resolved the folder via its documented wildcard fallback (a.profiles-style configs). The applier now skips non-config-named paths exactly like resolve_config_path skips them, logging at DEBUG instead of toasting. The shared, case-insensitive predicate (is_config_file_name) moves to the core next to CONFIG_FILE_NAMES so the guard can never drift from what the apply endpoints accept (issue #95 wave case handling). Config-named but missing/invalid files keep their failure toast. Closes #193
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #193.
Root cause recap
macOS delivers the opened folder as an odoc AppleEvent. The startup path handles that gracefully —
resolve_config_pathskips non-config documents and falls back to the directory search (documented wildcard fallback picksa.profiles) — but the running-window applier (_make_document_applier, added by #188) fed every delivered path intoapply_config_from_disk, which rejects non-whitelisted names with400 Not a ProFiles configuration file→ spuriousCould not apply '<folder>': …toast, even though the launch had already resolved the folder's config correctly.Change
_make_document_applier(desktop/launcher.py) — skips non-config-named documents with a DEBUG log, exactly mirroring launch resolution's skip. Config-named files keep the existing semantics: applied →config_handofftoast; missing/invalid →config_handoff_failedtoast.is_config_file_name(core yaml_io) — the case-insensitive name predicate extracted next toCONFIG_FILE_NAMESso the applier's guard can never drift from what the apply endpoints accept (_is_config_pathin routes/config.py now delegates to it; behavior unchanged, incl. the issue Web UI: YAML config editor (view/test/apply/save the active .profiles) #95 wave case handling).test_rejects_and_reports_a_non_config_filepinned the buggy semantics (junk.txt → failure toast); it now pins the skip. New regression test for the exact desktop: opening a folder with ProFiles launches its a.profiles config correctly but raises a spurious "Could not apply …: Not a ProFiles configuration file" toast (odoc folder apply is unguarded) #193 repro (folder containinga.profiles→ no events, no state change), plus a case-variant test (ConfigB.PROFILESstill applies).Not changed on purpose: the launch-time wildcard fallback itself (documented, deliberate) and launch resolution's case-sensitive document matching — out of scope here.
Verification
uv run pytest -q: 1628 passed, 1 skipped, coverage 88.64% (≥ 85% gate)ruff format --check+ruff check: cleanpylint src/profiles: 9.88/10 (unchanged baseline)