Finding a thing that does not use your words
Three pieces, and the first one is that they are all optional. Extraction stops being constants. Upload size, image edge, JPEG quality, PDF pages, extracted characters, orphan age and the text-extension list are settings now, read through a process-level snapshot rather than a session -- `prepare` and everything under it are called from routes, tool runners and the startup sweep, and several of those have no session in hand. Two things deliberately stayed constants: the decompression-bomb guard, which is a guard and not a preference, and ORPHAN_AGE, which would have been evaluated at import if it stayed in the signature and pinned the shipped 24 hours whatever anybody set. An embedding model is picked from the models an administrator flagged for it, and one that has since lost its flag is *named* rather than dropped from the picker: a setting that vanishes is one nobody can tell from a setting never made. Nothing here is required. Choosing none means no chunk rows, no requests, and retrieval.search returning exactly what fts.search_ids returns in exactly that order -- asserted, because it is what makes this safe to land on an instance that never asked for it. The two rankings are fused by reciprocal rank fusion: ranks and not scores, because bm25 is a corpus-dependent negative and cosine is 0..1, and normalising them onto one scale means picking a constant nobody can tune without a labelled set they do not have. RRF's one constant is famously insensitive and degrades to whichever list is non-empty -- which is what turns "no embedding model" into a branch that does not exist. A record scores as its best chunk rather than its average, or a long document about something else outranks a short one that says the thing. Width and model are stored beside every vector and a mismatch is skipped, because vectors from two spaces score against each other perfectly happily and mean nothing -- a search that works and is wrong is the worst failure this can have, and a model change now leaves stale rows ignored rather than trusted. Indexing is fired and forgotten, and how a change is noticed is a session event rather than a call in each of the ten library writers. That is a departure from this codebase's taste for explicit seams, for the reason tool_label is a Jinja global: a step every writer has to remember is one that gets forgotten, and here forgetting is silent -- the record saves, keyword search still finds it, and only its recall goes stale. Chunks are embedded before anything is deleted, so a failure leaves the old index rather than half a new one. Also: `embeddings` joins the model capabilities, and the three tool flags that had shipped with no checkbox -- canvas, scheduling and helpers -- have one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
-7
@@ -72,19 +72,22 @@ def fresh_database(tmp_path: Path) -> Iterator[None]:
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def fresh_branding() -> Iterator[None]:
|
||||
"""Drop the branding snapshot between tests.
|
||||
def fresh_snapshots() -> Iterator[None]:
|
||||
"""Drop the process-level snapshots between tests.
|
||||
|
||||
It is a process-level cache read by a Jinja global, so without this the
|
||||
first test to render a page pins one instance's name, logo and themes for
|
||||
every test after it -- against a database that has since been thrown away.
|
||||
The same shape as the registries below, and the reason each of them exists.
|
||||
Two of them now, and both are read once per process against a database this
|
||||
fixture throws away between tests -- so without this, the first test to
|
||||
render a page pins one instance's name and themes for every test after it,
|
||||
and the first to save an upload limit pins that too. The same shape as the
|
||||
registries below, and the reason each of them exists.
|
||||
"""
|
||||
from lembas.services import branding
|
||||
from lembas.services import branding, files
|
||||
|
||||
branding.forget()
|
||||
files.forget()
|
||||
yield
|
||||
branding.forget()
|
||||
files.forget()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
||||
Reference in New Issue
Block a user