Repository navigation
[Other] refactor model configuration and per-model storage layout out of root - #279
Open
berkkarahan wants to merge 1 commit into
Open
berkkarahan wants to merge 1 commit into
berkkarahan wants to merge 1 commit into
Conversation
Contributor
Author
|
@VecSzn file/folder structure overhaul |
Collaborator
|
too much to take in one PR, the new layout, migration, MCP changes and 5 tiers of e2e tests are all in 79 files. can you split it: the new layout first, then migration, MCP and the e2e tests in separate PRs? thanks for the work on this |
Contributor
Author
|
@VecSzn 👋🏻 file/folder structure changes are better off merged in a single PR. It is a big change but please take a look |
Contributor
Author
|
I intend to build a simple gui for configuring the models after this PR |
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.
Problem and result
Running setup and launching models previously wrote per-model generated artifacts directly into the install/repository root (
strata-*.json,strata-*.shared-settings.json,strata-*.json.bak,strata-*.log,run-*.bat/run-*.sh,*.warm-start*,*.tool-media), accumulating root clutter as additional models were configured.After this change:
<home>(configs/,logs/,scripts/), keeping the repository and install root clean as multiple models are installed and run.<home>/scripts/(with--no-scriptsopt-out interminal/setup.pyandengine/metal/setup_mac.py), alongside unified launch commands (python terminal/polystrata.py start <name>,strata run <model>,strata serve --model <model>).models.jsonoverlays, and profile references can be migrated idempotently (setup.py --migrate,strata models migrate,layout.migrate_legacy_layout()), while unmigrated legacy installs remain discoverable read-only and--config <path>remains compatible.Related discussion
none (searched open and closed issues and pull requests on
simplexai-labs/PolyStratafor config, sqlite, folder, layout, and clutter; no existing thread covered this refactor)Approach
Storage format evaluation (SQLite vs. structured JSON files)
We evaluated SQLite against structured JSON files in dedicated subdirectories across setup, CLI, discovery/control, server, and MCP components, and kept structured JSON files under
<home>/configs/via a shared layout module (terminal/strata_control/layout.py):setup.py:carry_over()), human-editableutf-8-sigJSON files, anduser_argsdiffing without schema migrations.--config PATHcontract, per-filesource_sha256attestation (<= 1 MiBnon-symlink regular file),mtime-based MRU ordering, atomic.bakbackups with single-model corruption isolation, zero-write read-only discovery (discovery.py,models.py), and stdlib-only operation fortools/strata_mcp.py.Implementation summary
terminal/strata_control/layout.py): Centralizesconfigs/,logs/, andscripts/path resolution, strict tag validation, precedence-ordered read-only config iteration (configs/before legacy flat root), atomic JSON writes/backups, and idempotent/collision-safe/symlink-safemigrate_legacy_layout().terminal/setup.py(includingpoly_setup),terminal/strata_control/(setup_config.py,discovery.py,models.py,models_move.py,tune_apply.py),terminal/serve/(server.py,models.py,runconfig.py,appendlog.py,server_parts/http_api.py),terminal/strata_cli/(cli.py,ram_budget_move.py,launch/catalog.py,launch/runner.py),engine/metal/setup_mac.py,engine/sycl/setup_intel.py,terminal/tools/(strata_mcp.py,strata_bench.py,calibrate.py),tools/docker/entrypoint.sh, andterminal/polystrata.py.run-*.bat/run-*.shintoscripts/, added--no-scripts, added unified CLI entry points (polystrata.py start <name>,strata run <model>,strata serve --model <model>), preserved--config <path>andmodels.jsonoverlays, and updated 15 config snapshot golden files (log path<REPO>/strata-*.log-><REPO>/logs/strata-*.logonly)..gitignorefor the new layout directories, updated 6 docs (AI_SETUP.md,DETAILS.md,INSTALL.md,MCP_SERVER.md,TERMINAL.md,TROUBLESHOOTING.md), and isolated setup/unit/E2E tests into temporary directories so repository roots remain untouched.Validation
Environment: Windows 11, branch
bka/refactor-model-config-storage(81a8a4780, rebased onupstream/main1a41ff673),.venvPython 3.13.15.Passed:
cd terminal && ..\.venv\Scripts\python.exe -B -m unittest tests.terminal.test_layout_storage tests.terminal.test_m2_writers_and_runtime tests.terminal.test_m3_migration tests.terminal.test_discovery tests.terminal.test_profiles tests.terminal.test_models_move tests.terminal.test_migration tests.terminal.test_intel_app_install tests.terminal.test_model_id_dot tests.terminal.test_file_in_use serve.test_runconfig.Apply serve.test_models.Registry serve.test_models.Start -vin isolated temp home/appdata env, run after final edit at81a8a4780):Ran 183 tests in 35.963s — OK (skipped=2)..venv\Scripts\python.exe -B -m unittest discover -s terminal/tests/e2e -p "test_*.py" -v, run before the 3-linecwd=str(base)test-probe edit intest_m2_writers_and_runtime.pyandtest_m3_migration.py; no production/E2E files changed since):Ran 70 tests in 17.373s — OKfrom repo root, andRan 70 tests in 16.164s — OKfromterminal/.cd terminal && ..\.venv\Scripts\python.exe -B -m unittest tests.snapshot.test_config_snapshot tests.snapshot.test_strix_reserve tests.snapshot.test_drafting_word_restart -v, run before the 3-line test-probe edit):Ran 31 tests in 162.450s — OK.cd terminal && ..\.venv\Scripts\python.exe -B -m unittest tools.test_setup_layout_move_over tools.test_setup_choices tools.test_setup_golden tools.test_setup_mac tools.test_setup_sycl tools.test_setup_run_script_newlines tools.test_calibrate, run before the 3-line test-probe edit):Ran 203 tests in 8.258s — OK (skipped=2)..venv\Scripts\python.exe -B tools/check --only docs:docs passed(6 passed, 0 failed, 0 skipped)..venv\Scripts\python.exe -B tools/test_dropped_paths.py -v:Ran 2 tests in 0.049s — OK..venv\Scripts\python.exe -B tools/test_check_links.py -v:Ran 4 tests in 1.199s — OK..venv\Scripts\python.exe -B tools/test_path_length.py -v:Ran 1 test in 0.040s — OK.polystrata_names.pydelta check vsupstream/mainon all modified/new eligible files:0new hits.Failed:
Not run:
python -m pytest terminal/tests/terminalandpython tools/check --only py-tools:pytest,textual, andrichare not installed in the local.venv(unittestwas used for runnable suites; GitHub Actions CI will run the pytest steps).terminal/tools/test_strata_mcp.py: blocked in the local Windows sandbox (CreatePipe WinError 5, loopback socket restrictions).setup_mac.py), Linux Intel SYCL (setup_intel.py), and Docker (tools/docker/entrypoint.sh) runtime execution: executed on a Windows host without macOS/Intel SYCL/Docker hardware (covered via unit mocks and static inspection; no C++/CUDA/HIP/SYCL/Metal engine binaries were modified).Limits
.venvwithoutpytest/textual/richinstalled and without macOS, Intel SYCL, or Docker runtime execution; full CI workflows (check.yml,snapshot.yml,docs.yml,terminal-minimal-server.yml) will validate Linux/Windows/macOS runners.polystrata_names.py --checkhits onupstream/mainremain unchanged (0new hits added by this branch).setup.py --migrateorstrata models migrate.