diff --git a/deploy/hyperdx_dashboards.md b/deploy/hyperdx_dashboards.md index dd1f1fc3597..b037e7cc24c 100644 --- a/deploy/hyperdx_dashboards.md +++ b/deploy/hyperdx_dashboards.md @@ -433,22 +433,21 @@ and use a time-series tile if you need rate. For a windowed count prefer the `increase` aggregation in a builder tile, which is reset-aware, over hand-rolled `max - min`. -Outcome is a five-value enum set in `memory/app/handlers._count_write`: - -| Outcome | Means | -| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `created` | first write to this `memory_key` — genuinely new knowledge | -| `updated` | a new version of a key that already existed | -| `merged` | canonical-form match — caller restated something Loom already knew, **no row inserted** | -| `duplicate` | very-high similarity but canonical mismatch; inserted with `status='duplicate'` | -| `conflicted` | close-but-different peers; inserted and both sides flagged | -| `rejected` | a pinned peer blocked the write (409 PINNED_CONFLICT) | -| `blacklisted` | value matched a blacklist pattern (422 BLACKLISTED) | -| `too_large` | value exceeded `char_limit` (422 CHAR_LIMIT_EXCEEDED) | -| `precondition_failed` | `if_match_sha256` did not match the live row (409) | -| `error` | any other `HTTPException` — a CH outage or a namespace-config bug, deliberately NOT labelled `rejected` so an infrastructure failure is not read as a policy refusal | -| `unchanged` | bulk/extract path only: a byte-identical restatement skipped by the re-ingest gate. Distinct from `merged`, which is a canonical-form conflict merge on the point path | -| `unknown` | bulk/extract path only: the existing-key lookup failed (fail-open), so created-vs-updated is not knowable. Non-zero here means the panel below is under-reporting, not that nothing happened | +Outcome is an eleven-value enum set in `memory/app/set_commit.count_write`: + +| Outcome | Means | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created` | first write to this `memory_key` — genuinely new knowledge | +| `updated` | a new version of a key that already existed | +| `merged` | canonical-form match — caller restated something Loom already knew, **no row inserted** | +| `duplicate` | very-high similarity but canonical mismatch; inserted with `status='duplicate'` | +| `conflicted` | close-but-different peers; inserted and both sides flagged | +| `rejected` | a pinned peer blocked the write (409 PINNED_CONFLICT) | +| `blacklisted` | value matched a blacklist pattern (422 BLACKLISTED) | +| `too_large` | value exceeded `char_limit` (422 CHAR_LIMIT_EXCEEDED) | +| `precondition_failed` | `if_match_sha256` did not match the live row (409) | +| `error` | any other `HTTPException` — a CH outage or a namespace-config bug, deliberately NOT labelled `rejected` so an infrastructure failure is not read as a policy refusal | +| `unchanged` | bulk/extract path only: a byte-identical restatement skipped by the re-ingest gate. Distinct from `merged`, which is a canonical-form conflict merge on the point path | The four refusal outcomes are mapped once at the handler boundary from the `code` in the raised `HTTPException` (`_WRITE_OUTCOME_BY_ERROR_CODE`), not diff --git a/docs/architecture/code-index-architecture.md b/docs/architecture/code-index-architecture.md index 3803b03383c..83ef37de9f7 100644 --- a/docs/architecture/code-index-architecture.md +++ b/docs/architecture/code-index-architecture.md @@ -629,14 +629,14 @@ in `pkg/json/__init__.py`; its stored qualified name remains intact. Constructor names remain explicit, and ambiguous matches stay unlinked unless the memory's file scope selects one definition. -| Op | Path | How | -| -------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `code.search` | `code/app/search/pipeline.py` | Routes first (pattern, path, history question), then runs legs under the deadline (`gather.py`): lexical (idf-weighted token count), vector (a scan with no vector index, or twin shortlist), PR history, the definitions the query names (`definitions.py`: the functions of the innermost two frames inside the repository of a pasted Python traceback, read by file and name and each served as the chunk that holds the frame's source line, then the names the rest of the text spells out as code, each one written with its owner and after them the first other name, three definitions in all; for a name the text only calls without a receiver inside a fenced block marked as Python, outside its comments, its string literals and its lines that lead with a dotted name or a path and a colon (the form of a pasted exception or warning line), a method or a nested definition of a Python file is left out, and a definition in another language is read as for any other name; a traceback whose frames name nothing in the index adds no name of its own; in the places those leave, the functions outside test and vendored paths that hold a literal the text marks as code and no identifier rule reads, a token with a hyphen inside written between backticks or quotes or the name of a long option with underscores, found as a whole token by one read through the n-gram index that the leg waits half a second for, and under a request budget no more than half the leg window, a literal that more than three functions hold or whose read runs longer being dropped; the text is the request's `report` when it sends one, the whole of a report it searches with the opening of), fuzzy symbol vote. `fusion.py` fuses by reciprocal rank (k = 60); `rank.py` applies the priors and then serves the named definitions directly after the first unit, at its score; `serve.py` pages into the token budget or abstains. A repeat within the memo window is one read of `code_search_memo`. | -| `code.grep` | `code/store/index/grep.py` | The 3-gram index narrows granules; `position()` or `match()` decides; each hit joins its enclosing unit. `mode=presence` spans up to eight branch namespaces. | -| `code.symbol` | `code/app/symbol/` | A qualified name is a key-prefix read of `code_symbols`; a short name goes through `code_symbol_names`; several definitions rank by `near_paths` or the PR under review. | -| `code.callers`, `code.impact` | `code/store/index/edges.py` | Callers are the `to_symbol_id` range of `code_edges`, compiler rows preferred, with the unresolved count. `code.impact` maps diff hunks to seed symbols and walks outward; an empty walk answers `no_indexed_paths`, `no_seeds_in_hunks` or `no_static_callers`. | -| `code.outline`, `code.enclosing` | — | Per-path reads of `code_symbols` and `code_chunks` spans. | -| `code.trace` | `code/app/symbol/trace.py` | Reads the frames of the text: qualified `a::b` names, C/C++ `dir/file.cpp:N` locations, and Python frames in the interpreter, notebook and test-runner forms, which `frames` returns as `path:line in function`. A name resolves through the symbol table and a location to the innermost symbol that holds its line. A Python frame resolves to the definition of its function in the file under the longest tail of its printed path, as written or under `src/` or `lib/`; its line chooses only among several definitions of the name. Over `max_frames` a native backtrace keeps its first frames and a Python traceback its last. | +| Op | Path | How | +| -------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `code.search` | `code/app/search/pipeline.py` | Routes first (pattern, path, history question), then runs legs under the deadline (`gather.py`): lexical (idf-weighted token count), vector (a scan with no vector index, or twin shortlist), PR history, the definitions the query names (`definitions.py`: the functions of the innermost two frames inside the repository of a pasted Python traceback, read by file and name and each served as the chunk that holds the frame's source line, then the names the rest of the text spells out as code, each one written with its owner and after them the first other name, three definitions in all; for a name the text only calls without a receiver inside a fenced block marked as Python, outside its comments, its string literals and its lines that lead with a dotted name or a path and a colon (the form of a pasted exception or warning line), a method or a nested definition of a Python file is left out, and a definition in another language is read as for any other name; a traceback whose frames name nothing in the index adds no name of its own; in the places those leave, the functions outside test and vendored paths that hold a literal the text marks as code and no identifier rule reads, a token with a hyphen inside written between backticks or quotes or the name of a long option with underscores, found as a whole token by one read through the n-gram index that the leg waits half a second for, and under a request budget no more than half the leg window, a literal that more than three functions hold or whose read runs longer being dropped, the cut counted as `retrieval_work.literal_read_cut` and kept out of every cache (the `code.search` memo, a `code.ask` answer, a `memory.ask` precedent); a frame, name or literal lookup that fails counted as `retrieval_work.definition_leg_failed`, which makes the answer partial (`partial_reason: retrieval unavailable: definition`); the text is the request's `report` when it sends one, the whole of a report it searches with the opening of), fuzzy symbol vote. `fusion.py` fuses by reciprocal rank (k = 60); `rank.py` applies the priors and then serves the named definitions directly after the first unit, at its score; `serve.py` pages into the token budget or abstains. A repeat within the memo window is one read of `code_search_memo`. | +| `code.grep` | `code/store/index/grep.py` | The 3-gram index narrows granules; `position()` or `match()` decides; each hit joins its enclosing unit. `mode=presence` spans up to eight branch namespaces. | +| `code.symbol` | `code/app/symbol/` | A qualified name is a key-prefix read of `code_symbols`; a short name goes through `code_symbol_names`; several definitions rank by `near_paths` or the PR under review. | +| `code.callers`, `code.impact` | `code/store/index/edges.py` | Callers are the `to_symbol_id` range of `code_edges`, compiler rows preferred, with the unresolved count. `code.impact` maps diff hunks to seed symbols and walks outward; an empty walk answers `no_indexed_paths`, `no_seeds_in_hunks` or `no_static_callers`. | +| `code.outline`, `code.enclosing` | — | Per-path reads of `code_symbols` and `code_chunks` spans. | +| `code.trace` | `code/app/symbol/trace.py` | Reads the frames of the text: qualified `a::b` names, C/C++ `dir/file.cpp:N` locations, and Python frames in the interpreter, notebook and test-runner forms, which `frames` returns as `path:line in function`. A name resolves through the symbol table and a location to the innermost symbol that holds its line. A Python frame resolves to the definition of its function in the file under the longest tail of its printed path, as written or under `src/` or `lib/`; its line chooses only among several definitions of the name. Over `max_frames` a native backtrace keeps its first frames and a Python traceback its last. | The lexical text-index gate tokenizes the query with `splitByNonAlpha`, matching the index tokenizer. The score counts only whole app lexemes and rejects partial matches diff --git a/docs/architecture/document-sources.md b/docs/architecture/document-sources.md index c9a5b2f10dd..3acaedc49c9 100644 --- a/docs/architecture/document-sources.md +++ b/docs/architecture/document-sources.md @@ -944,10 +944,10 @@ inputs alone expose no mirrored document. A request keeps a monotonic mirror mark in its existing work bag, shared with child legs. An unbound direct helper serves no mirrored content. Active registrations, mirror bindings and listing starts are read in sequence before candidate permissions. A failed -unconditional read marks `mirror_unread`; a failed candidate read invalidates the whole -mirror plan without that marker. Checked adapters cover search, get, outline, download -and listing. Other readers, marked-request sinks and session protections remain -prerequisites to enabling mirrored sources. +unconditional read names `knowledge: mirror_unread` in the answer's `degraded`; a failed +candidate read invalidates the whole mirror plan without that marker. Checked adapters +cover search, get, outline, download and listing. Other readers, marked-request sinks +and session protections remain prerequisites to enabling mirrored sources. `documents.access_keys` and its bloom index select coarse candidates under the ClickHouse authority. Owner and group buckets retain candidates needing identity @@ -1006,22 +1006,25 @@ to someone else), a grant to one view of the file only (`view`), and a permissio or role the sync does not know admit nobody. A missing registry or listing row admits nobody. A leg whose per-request reads (the statements it issues whatever matched, the reader's canonical subject and verified emails among them) fail shows no mirrored -document and marks the answer `degraded: mirror_unread`; a read it issues only for -candidates (the lists, the members rows, the heads) that fails drops every mirrored -result without the marker, so the marker says nothing about what matched. Each leg reads -the registry row and the listing row first and then the members rows and the lists, -under `sequential_reads()`, so a lagging replica cannot pair a fresh listing row with an -older list. It computes the addresses the reader may see before its `LIMIT`, so a page -is never cut short by the check, and caches no admitted set. No score depends on a -document the reader may not see: a mirror's chunks add nothing to any corpus statistic -(the lexical leg's document counts, lengths and term frequencies), and a mirror leg -scores its lexical hits with fixed corpus constants, which depend on no document, so a -namespace fed only by mirrored sources still ranks by both legs. Under the Postgres -authority each leg judges the addresses it is about to answer by their heads, so a -narrowing or a retirement committed and not yet published already applies, and a missing -head drops the address; a leg that cannot read the heads shows no mirrored document. The -implementing pull request measures the leg on a mirror of a million documents under both -storage authorities and puts the figures here. +document and lists `knowledge: mirror_unread` in the answer's `degraded`; a read it +issues only for candidates (the lists, the members rows, the heads) that fails drops +every mirrored result without the marker, so the marker says nothing about what matched. +For the same reason a repository-docs search, its renewal or a listing that passes +`knowledge_repo_docs_timeout_s` under a plan that reads mirrors is dropped without +`knowledge: repo_docs_dropped` or `repo_docs_unlisted`: its candidate checks run inside +that bound. Each leg reads the registry row and the listing row first and then the +members rows and the lists, under `sequential_reads()`, so a lagging replica cannot pair +a fresh listing row with an older list. It computes the addresses the reader may see +before its `LIMIT`, so a page is never cut short by the check, and caches no admitted +set. No score depends on a document the reader may not see: a mirror's chunks add +nothing to any corpus statistic (the lexical leg's document counts, lengths and term +frequencies), and a mirror leg scores its lexical hits with fixed corpus constants, +which depend on no document, so a namespace fed only by mirrored sources still ranks by +both legs. Under the Postgres authority each leg judges the addresses it is about to +answer by their heads, so a narrowing or a retirement committed and not yet published +already applies, and a missing head drops the address; a leg that cannot read the heads +shows no mirrored document. The implementing pull request measures the leg on a mirror +of a million documents under both storage authorities and puts the figures here. ### Every complete listing reads the lists again @@ -1116,9 +1119,11 @@ against a live Workspace. `LOOM_KNOWLEDGE_SOURCE_PROBE_TIMEOUT_S` can be raised | A stolen connected credential changes the store | Only read scopes are accepted; the credential is sealed and never returned. | the connect callback; `server/core/secrets_at_rest.py` | Out of scope: response timing, and when a pass reaches the namespace sources, which the -mirrored sources' turns before them delay; a resource limit (memory, rows read) that a -mirror's size can trip on a per-request statement, which like timing depends on how much -the mirror holds; how fast the shared pass gets to a connected owner's own source, which +mirrored sources' turns before them delay; under a plan that reads mirrors, whether +`degraded` lists the repository-docs leg's own render notes, which follows whether the +leg answered within its bound and so, like timing, can depend on documents the caller may +not see; a resource limit (memory, rows read) that a mirror's size can trip on a +per-request statement, which like timing depends on how much the mirror holds; how fast the shared pass gets to a connected owner's own source, which its fresh or stale code and per-item status reflect; that a namespace erasure is still retrying, which a namespace admin sees whatever its cause; a worker an orchestrating agent starts outside a flagged session's process tree; a person who hands their own @@ -1606,9 +1611,9 @@ Each implementing pull request lists its own; these pin the model: - A namespace whose documents are all mirrored ranking by both legs. - The check fails closed: - A leg that cannot read the listing row or the owning source's registry row showing - no mirrored document, marked `degraded: mirror_unread`, and one that cannot read - the lists, the members rows or the heads dropping mirrored results without the - marker. + no mirrored document, its `degraded` naming `knowledge: mirror_unread`, and one + that cannot read the lists, the members rows or the heads dropping mirrored + results without the marker. - The same `degraded` marker for a query that matches a hidden document and one that matches nothing while a mirror read fails. - A failed list, members or heads read with one hidden candidate answering exactly diff --git a/docs/architecture/memory-architecture.md b/docs/architecture/memory-architecture.md index 149819e17d5..4652aa52eb5 100644 --- a/docs/architecture/memory-architecture.md +++ b/docs/architecture/memory-architecture.md @@ -1147,7 +1147,8 @@ and shared duplicate selection by phrase completion. the side legs, which the assembler folds in later, find no shared row. A pool with no shared definition reads nothing more; one whose source cannot be read loses every shared definition, noted on `memory.search`'s `degraded`. A parked next page applies the same - check, and so does `memory.search_trace`, whose response has no `degraded`. + check, and so does `memory.search_trace`, whose response carries the note in the + `degraded` the transport adds to every response. 6. **Fuse and rank** (`fusion.py`, `ranking.py`). The per-mode rank expression (`fact_rank.py`, `_fact_mode_rank_score`) adds the capped prior group (confidence, diff --git a/docs/development/adding-an-operation.md b/docs/development/adding-an-operation.md index 26111a4f4bf..456aedf7961 100644 --- a/docs/development/adding-an-operation.md +++ b/docs/development/adding-an-operation.md @@ -118,7 +118,7 @@ The declaration lives in the group's ops module, `server//api/ops_