okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

albedocmake: strata_kernels links strata_kernels_cpu (iq_kernels.cu reads the latent colscale table from expert_layout.cpp; strata-q36ref failed to link)a4af4df61

main
1 folder20 files

files

golden/
README.md7.9 KiB
__init__.py0 B
allowlist.py2.5 KiB
app_driver.mjs8.2 KiB
control_shim.py1.3 KiB
driver.py10.3 KiB
generate.py1.6 KiB
matrix.py4.5 KiB
normalize.py2.6 KiB
report.py6.0 KiB
setup_driver.py8.4 KiB
test_auto_drafter_fresh_install.py15.2 KiB
test_config_snapshot.py4.6 KiB
test_drafting_chosen_holds.py9.4 KiB
test_drafting_round_trip.py8.3 KiB
test_drafting_word_restart.py4.6 KiB
test_entry_points_agree.py2.8 KiB
test_strix_app_reserve.py4.3 KiB
test_strix_reserve.py1.7 KiB
world.py14.0 KiB

Config snapshot

For every machine class x model set x entry point this records what the engine would be started with, and a test fails on any difference.

Nothing real is used: no GPU, no model file (the model files are empty), no engine (a text stub), no download (the drafter fetch is a recorder), no network, no real user folder (every run has its own scratch HOME, data folder and install folder, removed afterwards).

Run it

python -m pytest tests/snapshot -q -p no:cacheprovider      # the gate: about a minute; needs Python 3.11+ and Node 24
STRATA_SNAPSHOT_UPDATE=1 python -m pytest tests/snapshot     # after an intended change: rewrites golden/, then review the git diff of golden/
python -m tests.snapshot.generate --out DIR                  # write the snapshot of this tree somewhere else (to compare two branches)
python -m tests.snapshot.report --golden DIR_A --against DIR_B   # Markdown: where the entry points differ, what changed between A and B

STRATA_SNAPSHOT_SKIP_APP=1 skips the two app entry points by name when Node is not installed (the test prints what it skipped). The same command works on Windows, Linux and macOS; the golden files hold no path, user name or time of the machine that made them.

What is simulated

Entry points

entryhow it is drivenwhat is realwhat is replaced
launchstrata launch --model <set> --yes --no-tui through strata_cli.cli.mainthe whole command: settings, Runner.run(), the drafter step, config derivation and writingthe engine download, the model download (ensure_model returns the stand-in below), tuning, the server start, the drafter download
app_plainapps/host/server/native-control.mjs operation('load', {model}) in Node (app_driver.mjs)the host's whole Load code, and Control's drafting plan / drafting fetch (run through control_shim.py on the same simulated machine)the installer process (catalog, hardware), Control's model list / engine / profile save / start, the drafter download
app_modelsthe same with values: {drafting: 'auto'} (what the Models screen's Load passes)samesame
setupstrata_control.setup_config.config_for (qwen / unsloth), the moved last stretch of setup.py main(), called with inputs built by setup_driver.pythe whole run-config construction: engine arguments, speed switches, cards, vision sectionwhat setup.py decides before it (the cards and RAM come from the class, the context, budget, low-RAM, vision and resident choices from setup's own pure functions), the probes of the machine (ProbeLib), the model reader

For launch, app_plain and app_models the last step is the same code the server runs when it starts the engine: serve.server.engine_args(cfg, exe) and serve.server.child_env(cfg). The record has the run config the entry point left (config_file), the argument list (engine.argv), the variables the start adds to the environment (engine.env_set), the notes the start prints, the drafter downloads that were asked for (fetches) and, for the app, the calls the host made to Control.

The setup entry point and the stand-in

setup.py main() is one long function that probes the GPU, resolves or builds an engine, downloads and hashes the model and packs it. Its last stretch (from the engine arguments to just before write_setup_config()) is now strata_control/setup_config.py: config_for(SetupInputs, lib) for Qwen and Unsloth. It is the same lines, moved (CLEAN-1A, item 1a.7); setup.py builds the inputs and calls it. lib is the module that holds the helper functions (setup.py today; they move into strata_control in step 5.1). The snapshot passes ProbeLib, setup.py with the functions that look at the machine (nvidia-smi, the disk kind, the compute mode, a saved calibration, the image setup) answered by the simulated class.

The record of setup has inputs (what was assumed, so a reviewer sees it), config_file (what config_for returns, before write_setup_config() merges an earlier config), engine (engine_args / child_env of that config, as for the other entry points) and setup_says (the notes setup prints on the way). The classes whose setup is another script (Intel Arc: sycl/setup_intel.py; Mac: metal/setup_mac.py) are not_driven with the reason.

The launch and app entry points still start from World.base_config, a hand-built stand-in for setup's output, not from config_for. It differs from what config_for makes (it has no --vision, --kv-resident, --ple-io ram, --reserve-mib ...). Differences between launch / app_plain / app_models can never come from it (all three start from the same file), but the setup record is the one that shows what a real install writes. Replacing the stand-in by config_for's output changes the launch and app goldens and is a separate decision.

The gate: one launch policy (CLEAN-1A)

In every machine class x model set, strata launch, the app's plain Load and the app's Models-screen Load start the engine with the same arguments and the same environment, and ask for the same drafter downloads. test_entry_points_agree.py applies the allow-list in allowlist.py to the golden files; the list is the only place a difference is allowed, and each entry has its reason. Today:

differencewherewhy
api_key, aliases, port (18500 / 8080), fit_max_tokens, mcpapp vs launchthe app's own serving settings
logapp vs launchthe app's install folder, the Terminal's launch folder
engine_ready_sapp vs launchthe app's wait for the engine; the Terminal derives its own
args_derived, args_writtenlaunch onlylaunch's bookkeeping copies of args
drafting: autoModels-screen Load only (intended)that Load saves the person's Drafting choice

Request slots. On NVIDIA 72 GB the plain Load used to write parallel: 3 and start --batch 3 --batch-mtp; that was only because it ran the MTP (no drafter had been fetched). Following Auto it runs DFlash2, which answers one request at a time, so the app writes no parallel there, as the Models-screen Load always did. The golden files pin it: no app entry writes parallel or --batch-mtp in any cell. The app's own default of several request slots (apps/host/server/native-parallel.mjs) is for runs that are not DFlash2 and is not reached in this matrix.

Adding a class or a set

Add a row to matrix.py, run the update command, review the new golden file. A golden file for something not in the matrix, or a matrix cell without one, fails test_every_golden_file_belongs_to_the_matrix.

CI

No workflow is added in step 0 (step 2.5/2.7). A job needs actions/setup-python (3.11+, pip install -r requirements.txt) and actions/setup-node (24), then python -m pytest tests/snapshot -q.

Known limits