[PR #4315] [CLOSED] [TUI] find the model folder when its name differs in case from the tag (Fix #3996) #5001

Closed
opened 2026-11-07 16:31:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4315
Author: @XiaoBinGan
Created: 10/27/2026
Status: ❌ Closed

Base: main ← Head: fix/model-folder-case


📝 Commits (1)

  • 0e37675 Fix #3996: find the model's folder when its name differs in case from the tag

📊 Changes

2 files changed (+57 additions, -1 deletions)

View changed files

📝 strata_cli/launch/modelstate.py (+22 -1)
📝 tests/terminal/test_tui2_023_plan.py (+35 -0)

📄 Description

Problem and result

On a case-sensitive filesystem, strata launch reports a fully downloaded model as not being on this
computer and offers the whole download again. setup.py writes the model's folder with the model
name's spelling (models/IQ3_S) while catalog.tag_of() lower-cases the same name (iq3_s), and
modelstate.assess() joined the lower-case tag straight onto models/, so the folder was never found.
After this change the model's folder is resolved by a case-insensitive match when the exact name is
absent, so the plan, the screens and the confirm dialog count the weights that are already there.

Related discussion: #3996 — the report, with the Omarchy/btrfs reproduction and the exact commands.

Approach

One resolver in strata_cli/launch/modelstate.py, used by the one place that read the folder this way:

def _model_folder(base: Path, tag: str) -> Path:
    parent = base / "models"
    exact = parent / tag
    if exact.is_dir():
        return exact
    try:
        for entry in parent.iterdir():
            if entry.name.lower() == tag.lower() and entry.is_dir():
                return entry
    except OSError:
        pass
    return exact
  • The folder as named wins, so nothing changes where the names already agree.
  • A folder written by strata launch itself (lower case) is still found: the exact path matches first.
  • When nothing matches, the lower-case path is returned, which the caller reports as absent, as before.
  • No download, run config or folder name is written differently; only the read changed.
  • Only modelstate.assess() needed it. runner.py's install path already joins the family tag with the
    model name in their own spelling (data_dir / "models" / (fam.get("tag", "") + s.model)), so it is
    untouched.

Validation

Passed — the fix on a case-sensitive filesystem, using the module itself (Python 3.12, Linux
container on this host). The script loads strata_cli/launch/modelstate.py with its two imported
constants stubbed, builds models/IQ3_S with a 4,096-byte shard, and asks the module's own resolver:

platform: linux | filesystem case-sensitive: True

before the fix (base / 'models' / catalog.tag_of(...)):
  the lower-case path exists on this filesystem                  NO  (/tmp/tmpbvxrxeuh/models/iq3_s)
  old lookup finds the weights                                   OK   got=0.0 want=0.0

after the fix (modelstate._model_folder):
  resolver returns the folder as it is spelled                   OK   got='IQ3_S' want='IQ3_S'
  the weights in it are counted                                  OK   got=4.096e-06 want=4.096e-06
  a lower-case folder is still found                             OK   got='iq3_s' want='iq3_s'
  an absent folder is reported as the lower-case path            OK   got='iq3_s' want='iq3_s'

RESULT: PASS

Passed — python -m pytest tests/terminal/test_tui2_023_plan.py -q (Python 3.11.16, from a source
checkout): 12 passed, including the three new cases in ModelFolderCase. They assert on the
resolver's returned folder name, so they mean something on a case-insensitive filesystem too (NTFS
matches iq3_s to IQ3_S, which is why the whole-disk byte count alone cannot show the bug there).

Passed — no regression in the neighbouring plan tests: with strata_cli/launch/modelstate.py
reverted, tests/terminal/test_flow2_022.py is 3 failed, 24 passed, 3 skipped; with the change it
is 3 failed, 24 passed, 3 skipped. The same three (and 22 in tests/terminal/test_discovery.py,
counted the same way before and after) fail on this Windows checkout without the change as well, so
they are environmental, not caused by it.

Failed — none of the four ModelFolderCase cases.

Not run — the real strata launch --plan on a Linux btrfs install, which is what #3996 reported. The
verification above exercises the same resolver and the same byte count with the module loaded directly;
I did not repeat the reporter's whole flow, and I am not claiming I did.

Limits

  • The match is by name, not by walking the tree: only entries directly under models/ are compared.
    That is where both writers put the folder.
  • A machine with two folders that differ only in case keeps using the exact one and ignores the other,
    as before.
  • _has_reader() already looked at models/ and Models/; this change does not touch it.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4315 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/model-folder-case` --- ### 📝 Commits (1) - [`0e37675`](https://github.com/Niko1221/Strata/commit/0e376753b28388a7bab59cfd4038b05bbc360047) Fix #3996: find the model's folder when its name differs in case from the tag ### 📊 Changes **2 files changed** (+57 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `strata_cli/launch/modelstate.py` (+22 -1) 📝 `tests/terminal/test_tui2_023_plan.py` (+35 -0) </details> ### 📄 Description Problem and result On a case-sensitive filesystem, `strata launch` reports a fully downloaded model as not being on this computer and offers the whole download again. `setup.py` writes the model's folder with the model name's spelling (`models/IQ3_S`) while `catalog.tag_of()` lower-cases the same name (`iq3_s`), and `modelstate.assess()` joined the lower-case tag straight onto `models/`, so the folder was never found. After this change the model's folder is resolved by a case-insensitive match when the exact name is absent, so the plan, the screens and the confirm dialog count the weights that are already there. Related discussion: #3996 — the report, with the Omarchy/btrfs reproduction and the exact commands. Approach One resolver in `strata_cli/launch/modelstate.py`, used by the one place that read the folder this way: ```python def _model_folder(base: Path, tag: str) -> Path: parent = base / "models" exact = parent / tag if exact.is_dir(): return exact try: for entry in parent.iterdir(): if entry.name.lower() == tag.lower() and entry.is_dir(): return entry except OSError: pass return exact ``` - The folder as named wins, so nothing changes where the names already agree. - A folder written by `strata launch` itself (lower case) is still found: the exact path matches first. - When nothing matches, the lower-case path is returned, which the caller reports as absent, as before. - No download, run config or folder name is written differently; only the read changed. - Only `modelstate.assess()` needed it. `runner.py`'s install path already joins the family tag with the model name in their own spelling (`data_dir / "models" / (fam.get("tag", "") + s.model)`), so it is untouched. Validation Passed — the fix on a **case-sensitive filesystem**, using the module itself (Python 3.12, Linux container on this host). The script loads `strata_cli/launch/modelstate.py` with its two imported constants stubbed, builds `models/IQ3_S` with a 4,096-byte shard, and asks the module's own resolver: ```text platform: linux | filesystem case-sensitive: True before the fix (base / 'models' / catalog.tag_of(...)): the lower-case path exists on this filesystem NO (/tmp/tmpbvxrxeuh/models/iq3_s) old lookup finds the weights OK got=0.0 want=0.0 after the fix (modelstate._model_folder): resolver returns the folder as it is spelled OK got='IQ3_S' want='IQ3_S' the weights in it are counted OK got=4.096e-06 want=4.096e-06 a lower-case folder is still found OK got='iq3_s' want='iq3_s' an absent folder is reported as the lower-case path OK got='iq3_s' want='iq3_s' RESULT: PASS ``` Passed — `python -m pytest tests/terminal/test_tui2_023_plan.py -q` (Python 3.11.16, from a source checkout): **12 passed**, including the three new cases in `ModelFolderCase`. They assert on the resolver's returned folder **name**, so they mean something on a case-insensitive filesystem too (NTFS matches `iq3_s` to `IQ3_S`, which is why the whole-disk byte count alone cannot show the bug there). Passed — no regression in the neighbouring plan tests: with `strata_cli/launch/modelstate.py` reverted, `tests/terminal/test_flow2_022.py` is **3 failed, 24 passed, 3 skipped**; with the change it is **3 failed, 24 passed, 3 skipped**. The same three (and 22 in `tests/terminal/test_discovery.py`, counted the same way before and after) fail on this Windows checkout without the change as well, so they are environmental, not caused by it. Failed — none of the four `ModelFolderCase` cases. Not run — the real `strata launch --plan` on a Linux btrfs install, which is what #3996 reported. The verification above exercises the same resolver and the same byte count with the module loaded directly; I did not repeat the reporter's whole flow, and I am not claiming I did. Limits - The match is by name, not by walking the tree: only entries directly under `models/` are compared. That is where both writers put the folder. - A machine with two folders that differ only in case keeps using the exact one and ignores the other, as before. - `_has_reader()` already looked at `models/` and `Models/`; this change does not touch it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:31:55 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5001
No description provided.