From ce673f34f05b4026f024eff56520e3a58464c630 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Wed, 2 Dec 2026 23:40:40 +0530 Subject: [PATCH 01/30] code.symbol and code.grep lead with each definition's callers, test coverage and changing PRs The answers a text search cannot give sat behind three other ops. Both ops now start with a `lead` block for up to three definitions: callers one hop across virtual dispatch (code.callers), test evidence and measured coverage (code.coverage_claim) and the PRs that changed the definition (code.symbol_history). Each leg is its op's handler called in-process as the consumer `symbol_lead` or `grep_lead`. The legs run concurrently under the effective budget of the op's new `lead` shape less the time already spent; a leg still running or failed reads `unread` and notes a degradation, and the answer is served on time. `lead: false` leaves the block out; Loom's own callers of the two ops opt out, and code.edit_context never builds it. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 21 + docs/reference/operations/code.md | 5 + pyproject.toml | 1 + sdk/go/wire/models.gen.go | 6 +- sdk/python/loom/ops.py | 6 + sdk/ruby/lib/clickhouse/loom/generated/ops.rb | 4 +- sdk/rust/src/wire_models.rs | 8486 +++++++++-------- sdk/rust/tests/registry_contracts.rs | 15 + sdk/typescript/src/generated/ops.ts | 6 + server/code/api/models_common.py | 7 + server/code/api/models_grep.py | 14 +- server/code/api/models_symbol.py | 22 +- server/code/app/grep.py | 37 +- server/code/app/lead.py | 298 + server/code/app/presence.py | 1 + server/code/app/symbol/edit_target.py | 1 + server/code/app/symbol/symbol.py | 40 +- server/memory/app/code_grounding.py | 1 + server/memory/app/decision_extract.py | 1 + server/settings/catalog.py | 7 + server/transport/mcp_descriptions.py | 24 +- tests/integration/test_code_plane.py | 20 + tests/unit/conftest.py | 20 + tests/unit/test_code_grep_scan.py | 4 +- tests/unit/test_code_lead.py | 430 + tests/unit/test_shape_budgets.py | 16 +- 26 files changed, 5238 insertions(+), 4255 deletions(-) create mode 100644 server/code/app/lead.py create mode 100644 tests/unit/test_code_lead.py diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index bcc0280679a..572c5660bac 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -90,6 +90,27 @@ underscores. Toolsets: [MCP reference](../../reference/mcp.md#toolsets). | `code.map` | you want an orientation map of the repository's modules | | `code.trace` | you have a stack trace: each frame resolved to its unit | +`code.symbol` and `code.grep` start their answer with a `lead` block: what a +text search cannot answer about the definitions they found. It covers the first +three distinct definitions outside test files and documents (for `code.grep`, +the enclosing definitions of a first page's bodies). Each entry carries +`symbol`, `path` and `line` and three answers: + +| Key | From | Holds | +| ------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `callers` | [`code.callers`](../../reference/operations/code.md#codecallers), one hop | `count`, `files`, `through_overrides` (callers reached through a base or an override), `dispatch` seeds, the first three call sites, `truncated`, `epistemic` | +| `tested` | [`code.coverage_claim`](../../reference/operations/code.md#codecoverage_claim) | `verdict`, `tests`, `strongest_tier`, `measured` (`executed` or `unexecuted` by a verified coverage run) and the first three test files | +| `changed_by` | [`code.symbol_history`](../../reference/operations/code.md#codesymbol_history) | `prs`, `level` (`function` when the tracker read the diffs, `file` otherwise), `fixes`, `reverts` and the first three PRs, those naming the definition first | + +Every answer of every entry runs at once, beside the op's own reads. They share +what the op's `lead` latency budget leaves after the time already spent. An +answer still running at that point, or one that failed, reads +`{"unread": "deadline"}` or `{"unread": "failed"}` and the rest of the response +is served; an ambiguous or unresolved name reads `ambiguous` or `unresolved`. +Under `deadline_ms` the block also stops at the caller's deadline. +`lead: false` leaves the block out. `code.edit_context` has no `lead` block; +it reads the definition's tests itself. + Pass `pattern` as a list of exact strings to find any of them in one scan. For example, `["parse(", "parse_async("]` matches both fragments without escaping the parentheses. All alternatives share a result limit, and each matching line diff --git a/docs/reference/operations/code.md b/docs/reference/operations/code.md index 2bac18f44a3..60108e696eb 100644 --- a/docs/reference/operations/code.md +++ b/docs/reference/operations/code.md @@ -598,6 +598,7 @@ Before editing, read source, tests and notes. | Output field | Type | Meaning | | --- | --- | --- | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: per definition (the first three distinct ones outside test files), what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | @@ -788,11 +789,13 @@ Literal or regex search of indexed source with enclosing symbols and coverage. | `neighbours` | `bool \| None` | `None` | The neighbours graph block in the SAME call, matches mode only: the hits' enclosing functions become anchors (at most 20, first appearance) and each carries up to `neighbour_k` callers, callees and mapped tests at edge confidence >= 0.8… | | `neighbour_k` | `int` | `5` | With `neighbours`: at most this many callers and callees per anchor (1..20). | | `deadline_ms` | `int \| None` | `None` | The request's wall-clock budget in ms, from arrival (values under 200 read as 200). | +| `lead` | `bool` | `True` | Lead with callers through overrides, test coverage and changing PRs of up to three enclosing definitions; default true. | | Output field | Type | Meaning | | --- | --- | --- | | `lessons` | `list[dict[str, Any]]` | The memories about the answer's top files, best first, capped at `code_result_lessons_tokens`; each row {path, memory_key, namespace, excerpt, code_state}, with `rev`, `first_written`, `changed_since`, `code_moved` and `supersedes_key`… | | `lessons_left_out` | `int` | File lessons omitted by symbol focus, a token budget, truncation or supersession. | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: the block code.symbol leads with, for the first three distinct `definitions` of a first page outside test files. | | `matches` | `list[dict[str, Any]]` | {path, line, text, scope, scope_start_line, scope_end_line} per matching LINE, path/line ordered except when prioritize_patterns gives different literals first-page slots. scope_* is the span of the enclosing unit named by `scope` (0/0… | | `related` | `RelatedGrepEvidence \| None` | Related source for a qualified argument or member, separate from literal matches. | | `contexts` | `list[dict[str, Any]]` | Exact retained source windows for this page, with inclusive line bounds. | @@ -1665,9 +1668,11 @@ Find an exact definition by name or path:line. | `presence` | `bool` | `False` | Answer per namespace in `namespaces` whether the definition is there (the `presence` / `summary` blocks) instead of returning definitions. | | `neighbours` | `bool \| None` | `None` | The neighbours graph block for the resolved definitions themselves — k callers, callees, tests and citing documents per definition, in the same call. | | `neighbour_k` | `int` | `5` | How many callers, callees, tests and citing documents (each) the `neighbours` block lists per definition. | +| `lead` | `bool` | `True` | Lead with callers through overrides, test coverage and changing PRs of up to three definitions; default true. | | Output field | Type | Meaning | | --- | --- | --- | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: per definition (the first three distinct ones outside test files), what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | diff --git a/pyproject.toml b/pyproject.toml index d2795dcd77b..6450a9b5113 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -215,6 +215,7 @@ markers = [ "doctor_tier_read: a unit test that runs loom doctor's read of the failing code-index tiers (off by default in unit)", "claim_cap: a unit test that runs the namespace gate's claim cap (off by default in unit)", "deleted_value_check: a unit test that runs an extraction write's read of the refusal policy (off by default in unit)", + "code_lead: a unit test that runs the lead block of code.symbol and code.grep (off by default in unit)", ] [tool.mypy] diff --git a/sdk/go/wire/models.gen.go b/sdk/go/wire/models.gen.go index e6d53211753..d325e35c37e 100644 --- a/sdk/go/wire/models.gen.go +++ b/sdk/go/wire/models.gen.go @@ -1,5 +1,5 @@ // Code generated by scripts/codegen/sdk_go_gen.py; DO NOT EDIT. -// Registry model schema SHA-256: 3eb21f99aa661c271c54339556b012d4b6add7bb8c11ab3178a84662db3b3f7b +// Registry model schema SHA-256: 630554308591a16d738b5476fd3a9564b683ad99bb40b24708544085278bda80 // Package wire contains the Go requests and responses for Loom operations. package wire @@ -1433,6 +1433,7 @@ type CodeGrepInput struct { Neighbours Optional[bool] `json:"neighbours,omitempty"` NeighbourK *int64 `json:"neighbour_k,omitempty"` DeadlineMs Optional[int64] `json:"deadline_ms,omitempty"` + Lead *bool `json:"lead,omitempty"` } // CodeGrepOutput is the response from code.grep. @@ -1442,6 +1443,7 @@ type CodeGrepOutput struct { Mirrored *bool `json:"mirrored,omitempty"` Lessons *[]map[string]json.RawMessage `json:"lessons,omitempty"` LessonsLeftOut *int64 `json:"lessons_left_out,omitempty"` + Lead *[]map[string]json.RawMessage `json:"lead,omitempty"` Matches []map[string]json.RawMessage `json:"matches"` Related Optional[RelatedGrepEvidence] `json:"related,omitempty"` Contexts *[]map[string]json.RawMessage `json:"contexts,omitempty"` @@ -2413,6 +2415,7 @@ type CodeSymbolInput struct { Presence *bool `json:"presence,omitempty"` Neighbours Optional[bool] `json:"neighbours,omitempty"` NeighbourK *int64 `json:"neighbour_k,omitempty"` + Lead *bool `json:"lead,omitempty"` } // CodeSymbolOutput is the response from code.symbol. @@ -2420,6 +2423,7 @@ type CodeSymbolOutput struct { IgnoredArgs *[]string `json:"ignored_args,omitempty"` DidYouMean *map[string]string `json:"did_you_mean,omitempty"` Mirrored *bool `json:"mirrored,omitempty"` + Lead *[]map[string]json.RawMessage `json:"lead,omitempty"` Definitions []CodeUnit `json:"definitions"` LessonsLeftOut *int64 `json:"lessons_left_out,omitempty"` Ambiguous *bool `json:"ambiguous,omitempty"` diff --git a/sdk/python/loom/ops.py b/sdk/python/loom/ops.py index 7cb0243efb1..b76e5ea43b8 100644 --- a/sdk/python/loom/ops.py +++ b/sdk/python/loom/ops.py @@ -6445,6 +6445,7 @@ class CodeEditContextBody(TypedDict, total=False): class CodeSymbolOutput(TypedDict, total=False): + lead: NotRequired[list[dict[str, Any]]] definitions: Required[list["CodeUnit"]] lessons_left_out: NotRequired[int] ambiguous: NotRequired[bool] @@ -6732,6 +6733,7 @@ class CodeGrepInput(TypedDict, total=False): neighbours: NotRequired[Optional[bool]] neighbour_k: NotRequired[int] deadline_ms: NotRequired[Optional[int]] + lead: NotRequired[bool] class CodeGrepBody(TypedDict, total=False): @@ -6766,11 +6768,13 @@ class CodeGrepBody(TypedDict, total=False): neighbours: NotRequired[Optional[bool]] neighbour_k: NotRequired[int] deadline_ms: NotRequired[Optional[int]] + lead: NotRequired[bool] class CodeGrepOutput(TypedDict, total=False): lessons: NotRequired[list[dict[str, Any]]] lessons_left_out: NotRequired[int] + lead: NotRequired[list[dict[str, Any]]] matches: Required[list[dict[str, Any]]] related: NotRequired[Optional["RelatedGrepEvidence"]] contexts: NotRequired[list[dict[str, Any]]] @@ -8045,6 +8049,7 @@ class CodeSymbolInput(TypedDict, total=False): presence: NotRequired[bool] neighbours: NotRequired[Optional[bool]] neighbour_k: NotRequired[int] + lead: NotRequired[bool] class CodeSymbolBody(TypedDict, total=False): @@ -8074,6 +8079,7 @@ class CodeSymbolBody(TypedDict, total=False): presence: NotRequired[bool] neighbours: NotRequired[Optional[bool]] neighbour_k: NotRequired[int] + lead: NotRequired[bool] class CodeSymbolHistoryInput(TypedDict, total=False): diff --git a/sdk/ruby/lib/clickhouse/loom/generated/ops.rb b/sdk/ruby/lib/clickhouse/loom/generated/ops.rb index 0dbb0532617..cd3ecc48cc2 100644 --- a/sdk/ruby/lib/clickhouse/loom/generated/ops.rb +++ b/sdk/ruby/lib/clickhouse/loom/generated/ops.rb @@ -41,7 +41,7 @@ module Generated "code.examples" => OpSpec.new("code.examples", "code", "examples", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer name symbol_id top_k].freeze, [].freeze), "code.files" => OpSpec.new("code.files", "code", "files", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer glob stem path_prefix limit].freeze, [].freeze), "code.first_build" => OpSpec.new("code.first_build", "code", "first_build", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer sha pr_number].freeze, [].freeze), - "code.grep" => OpSpec.new("code.grep", "code", "grep", true, true, "viewer", "stable", %w[include_lessons lesson_namespaces org namespace agent user_id consumer pattern prioritize_patterns regex related_on_miss related_on_prefix include_dependencies case_sensitive context_lines prefer_complete_context path_prefix cursor exclude_unit_ids mode include_body limit path_globs exclude_globs langs namespaces neighbours neighbour_k deadline_ms].freeze, %w[pattern].freeze), + "code.grep" => OpSpec.new("code.grep", "code", "grep", true, true, "viewer", "stable", %w[include_lessons lesson_namespaces org namespace agent user_id consumer pattern prioritize_patterns regex related_on_miss related_on_prefix include_dependencies case_sensitive context_lines prefer_complete_context path_prefix cursor exclude_unit_ids mode include_body limit path_globs exclude_globs langs namespaces neighbours neighbour_k deadline_ms lead].freeze, %w[pattern].freeze), "code.history" => OpSpec.new("code.history", "code", "history", true, true, "viewer", "stable", %w[org namespace agent user_id consumer name symbol_id path numbers limit offset reviews_per_pr].freeze, [].freeze), "code.impact" => OpSpec.new("code.impact", "code", "impact", true, true, "viewer", "stable", %w[include_lessons lesson_namespaces pr_files pr_diff pr_head_sha pr_base_sha org namespace agent user_id consumer name symbol_id depth files diff exclude_authors summary_only per_hop_limit offset pr_number].freeze, [].freeze), "code.index_errors" => OpSpec.new("code.index_errors", "code", "index_errors", true, true, "viewer", "stable", %w[org namespace agent user_id consumer limit].freeze, [].freeze), @@ -67,7 +67,7 @@ module Generated "code.scip_status" => OpSpec.new("code.scip_status", "code", "scip_status", true, true, "viewer", "stable", %w[org namespace agent user_id consumer batch_id].freeze, %w[batch_id].freeze), "code.search" => OpSpec.new("code.search", "code", "search", true, true, "viewer", "stable", %w[include_lessons lesson_namespaces org namespace agent user_id consumer query report top_k token_budget path_prefix cursor exclude_unit_ids rerank expand annotate bodies kind_prior pr_leg_before embedding_model fresh min_fan_in sort_by pattern regex case_sensitive path_globs exclude_globs langs legs track_path vector_model vector_shortlist llm_legs deadline_ms namespaces].freeze, %w[query].freeze), "code.setting_facts" => OpSpec.new("code.setting_facts", "code", "setting_facts", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer name history_limit].freeze, %w[name].freeze), - "code.symbol" => OpSpec.new("code.symbol", "code", "symbol", true, true, "viewer", "stable", %w[org namespace agent user_id consumer name symbol_id include_body include_history include_examples test_examples_only example_context_lines include_lessons lesson_namespaces token_budget min_fan_in sort_by uses uses_limit uses_brief near_paths pr_number namespaces presence neighbours neighbour_k].freeze, [].freeze), + "code.symbol" => OpSpec.new("code.symbol", "code", "symbol", true, true, "viewer", "stable", %w[org namespace agent user_id consumer name symbol_id include_body include_history include_examples test_examples_only example_context_lines include_lessons lesson_namespaces token_budget min_fan_in sort_by uses uses_limit uses_brief near_paths pr_number namespaces presence neighbours neighbour_k lead].freeze, [].freeze), "code.symbol_history" => OpSpec.new("code.symbol_history", "code", "symbol_history", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer name symbol_id limit].freeze, [].freeze), "code.test_gate" => OpSpec.new("code.test_gate", "code", "test_gate", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer files diff depth limit].freeze, [].freeze), "code.test_home" => OpSpec.new("code.test_home", "code", "test_home", true, true, "viewer", "experimental", %w[org namespace agent user_id consumer file_stems settings engine symbols limit].freeze, [].freeze), diff --git a/sdk/rust/src/wire_models.rs b/sdk/rust/src/wire_models.rs index 4aa86138fd5..9dadd370b25 100644 --- a/sdk/rust/src/wire_models.rs +++ b/sdk/rust/src/wire_models.rs @@ -9264,66 +9264,66 @@ impl CodeCoverageClaimInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeUnit { - #[serde(default = "default_446")] + #[serde(default = "default_447")] pub unit_id: String, pub path: String, - #[serde(default = "default_447")] - pub start_line: Integer, #[serde(default = "default_448")] - pub end_line: Integer, + pub start_line: Integer, #[serde(default = "default_449")] - pub symbol: String, + pub end_line: Integer, #[serde(default = "default_450")] - pub kind: String, + pub symbol: String, #[serde(default = "default_451")] - pub signature: String, + pub kind: String, #[serde(default = "default_452")] - pub body: String, + pub signature: String, #[serde(default = "default_453")] - pub elided: bool, + pub body: String, #[serde(default = "default_454")] - pub body_hash: String, + pub elided: bool, #[serde(default = "default_455")] - pub description: String, + pub body_hash: String, #[serde(default = "default_456")] - pub tier: String, + pub description: String, #[serde(default = "default_457")] - pub score: f64, + pub tier: String, #[serde(default = "default_458")] - pub recent_prs: Vec>, + pub score: f64, #[serde(default = "default_459")] - pub examples: Vec>, + pub recent_prs: Vec>, #[serde(default = "default_460")] - pub tests: Vec>, + pub examples: Vec>, #[serde(default = "default_461")] - pub test_link_state: String, + pub tests: Vec>, #[serde(default = "default_462")] - pub lessons: Vec>, + pub test_link_state: String, #[serde(default = "default_463")] - pub lessons_unread: bool, + pub lessons: Vec>, #[serde(default = "default_464")] - pub churn: Integer, + pub lessons_unread: bool, #[serde(default = "default_465")] - pub amp: Integer, + pub churn: Integer, #[serde(default = "default_466")] - pub tested: bool, + pub amp: Integer, #[serde(default = "default_467")] - pub callees: Vec>, + pub tested: bool, #[serde(default = "default_468")] - pub granularity: String, + pub callees: Vec>, #[serde(default = "default_469")] - pub next: String, + pub granularity: String, #[serde(default = "default_470")] - pub outline: Vec>, + pub next: String, #[serde(default = "default_471")] - pub fan_in: Integer, + pub outline: Vec>, #[serde(default = "default_472")] - pub via: String, + pub fan_in: Integer, #[serde(default = "default_473")] - pub lexical_rank: Integer, + pub via: String, #[serde(default = "default_474")] - pub vector_rank: Integer, + pub lexical_rank: Integer, #[serde(default = "default_475")] + pub vector_rank: Integer, + #[serde(default = "default_476")] pub namespace: String, } @@ -9370,21 +9370,21 @@ pub enum CodeEditContextTargetStatus { pub struct CodeEditContextTarget { pub name: String, pub status: CodeEditContextTargetStatus, - #[serde(default = "default_494")] - pub definition_indices: Vec, #[serde(default = "default_495")] - pub candidates: Vec>, + pub definition_indices: Vec, #[serde(default = "default_496")] - pub resolved_by: String, + pub candidates: Vec>, #[serde(default = "default_497")] - pub presence: Vec>, + pub resolved_by: String, #[serde(default = "default_498")] - pub hierarchy: std::collections::HashMap>>, + pub presence: Vec>, #[serde(default = "default_499")] - pub documented_in: Vec>, + pub hierarchy: std::collections::HashMap>>, #[serde(default = "default_500")] - pub trace_run_id: String, + pub documented_in: Vec>, #[serde(default = "default_501")] + pub trace_run_id: String, + #[serde(default = "default_502")] pub picked_by: String, } @@ -9411,46 +9411,48 @@ pub struct CodeEditReadSource { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeSymbolOutput { + #[serde(default = "default_446")] + pub lead: Vec>, pub definitions: Vec, - #[serde(default = "default_476")] - pub lessons_left_out: Integer, #[serde(default = "default_477")] - pub ambiguous: bool, + pub lessons_left_out: Integer, #[serde(default = "default_478")] - pub hierarchy: std::collections::HashMap>>, + pub ambiguous: bool, #[serde(default = "default_479")] - pub candidates: Vec>, + pub hierarchy: std::collections::HashMap>>, #[serde(default = "default_480")] - pub tokens_returned: Integer, + pub candidates: Vec>, #[serde(default = "default_481")] - pub trace_run_id: String, + pub tokens_returned: Integer, #[serde(default = "default_482")] - pub uses: Option, + pub trace_run_id: String, #[serde(default = "default_483")] - pub uses_truncated: bool, + pub uses: Option, #[serde(default = "default_484")] - pub uses_skipped: String, + pub uses_truncated: bool, #[serde(default = "default_485")] - pub uses_tokens: Integer, + pub uses_skipped: String, #[serde(default = "default_486")] - pub picked_by: String, + pub uses_tokens: Integer, #[serde(default = "default_487")] - pub resolved_by: String, + pub picked_by: String, #[serde(default = "default_488")] - pub documented_in: Vec>, + pub resolved_by: String, #[serde(default = "default_489")] - pub neighbours: Vec>, + pub documented_in: Vec>, #[serde(default = "default_490")] - pub anchors: Integer, + pub neighbours: Vec>, #[serde(default = "default_491")] - pub neighbour_tokens: Integer, + pub anchors: Integer, #[serde(default = "default_492")] - pub presence: Vec>, + pub neighbour_tokens: Integer, #[serde(default = "default_493")] + pub presence: Vec>, + #[serde(default = "default_494")] pub summary: std::collections::HashMap>, - #[serde(default = "default_502")] - pub edit_targets: Vec, #[serde(default = "default_503")] + pub edit_targets: Vec, + #[serde(default = "default_504")] pub read_sources: Option>, } @@ -9604,30 +9606,30 @@ impl CodeEditContextInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeEnclosingOutput { - #[serde(default = "default_504")] - pub lessons: Vec>, #[serde(default = "default_505")] + pub lessons: Vec>, + #[serde(default = "default_506")] pub lessons_left_out: Integer, pub results: Vec>, pub resolved: Integer, pub paths_indexed: Integer, pub paths_total: Integer, pub took_ms: Integer, - #[serde(default = "default_506")] - pub as_of: std::collections::HashMap, #[serde(default = "default_507")] - pub bodies_returned: Integer, + pub as_of: std::collections::HashMap, #[serde(default = "default_508")] - pub bodies_elided: Integer, + pub bodies_returned: Integer, #[serde(default = "default_509")] - pub tokens_returned: Integer, + pub bodies_elided: Integer, #[serde(default = "default_510")] - pub neighbours: Vec>, + pub tokens_returned: Integer, #[serde(default = "default_511")] - pub anchors: Integer, + pub neighbours: Vec>, #[serde(default = "default_512")] - pub anchors_capped: bool, + pub anchors: Integer, #[serde(default = "default_513")] + pub anchors_capped: bool, + #[serde(default = "default_514")] pub neighbour_tokens: Integer, } @@ -9783,7 +9785,7 @@ impl CodeEnclosingInput { #[non_exhaustive] pub struct CodeExamplesOutput { pub examples: Vec>, - #[serde(default = "default_514")] + #[serde(default = "default_515")] pub trace_run_id: String, } @@ -9901,19 +9903,19 @@ impl CodeExamplesInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeFilesOutput { - #[serde(default = "default_515")] - pub files: Vec>, #[serde(default = "default_516")] - pub total: Integer, + pub files: Vec>, #[serde(default = "default_517")] - pub truncated: bool, + pub total: Integer, #[serde(default = "default_518")] - pub as_of: std::collections::HashMap, + pub truncated: bool, #[serde(default = "default_519")] - pub not_covered: bool, + pub as_of: std::collections::HashMap, #[serde(default = "default_520")] - pub note: String, + pub not_covered: bool, #[serde(default = "default_521")] + pub note: String, + #[serde(default = "default_522")] pub trace_run_id: String, } @@ -10042,51 +10044,51 @@ impl CodeFilesInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeFirstBuildOutput { - #[serde(default = "default_522")] - pub verdict: String, #[serde(default = "default_523")] - pub causes: Vec, + pub verdict: String, #[serde(default = "default_524")] - pub epistemic: String, + pub causes: Vec, #[serde(default = "default_525")] - pub sha: String, + pub epistemic: String, #[serde(default = "default_526")] - pub pr_number: Integer, + pub sha: String, #[serde(default = "default_527")] - pub merged_at: String, + pub pr_number: Integer, #[serde(default = "default_528")] - pub commit_time: String, + pub merged_at: String, #[serde(default = "default_529")] - pub ledger_known: bool, + pub commit_time: String, #[serde(default = "default_530")] - pub mirror_known: bool, + pub ledger_known: bool, #[serde(default = "default_531")] - pub first_build: std::collections::HashMap, + pub mirror_known: bool, #[serde(default = "default_532")] - pub lag_hours: Option, + pub first_build: std::collections::HashMap, #[serde(default = "default_533")] - pub later_builds: Integer, + pub lag_hours: Option, #[serde(default = "default_534")] - pub window_hours: Integer, + pub later_builds: Integer, #[serde(default = "default_535")] - pub candidates_checked: Integer, + pub window_hours: Integer, #[serde(default = "default_536")] - pub candidates_total: Integer, + pub candidates_checked: Integer, #[serde(default = "default_537")] - pub own_builds: Vec>, + pub candidates_total: Integer, #[serde(default = "default_538")] - pub containing_branches: Vec, + pub own_builds: Vec>, #[serde(default = "default_539")] - pub containing_namespaces: Vec, + pub containing_branches: Vec, #[serde(default = "default_540")] - pub nearest_namespace: String, + pub containing_namespaces: Vec, #[serde(default = "default_541")] - pub note: String, + pub nearest_namespace: String, #[serde(default = "default_542")] - pub tracker_namespace: String, + pub note: String, #[serde(default = "default_543")] - pub tracker_unavailable: bool, + pub tracker_namespace: String, #[serde(default = "default_544")] + pub tracker_unavailable: bool, + #[serde(default = "default_545")] pub trace_run_id: String, } @@ -10205,19 +10207,19 @@ pub struct GrepDependency { pub struct RelatedGrepEvidence { pub pattern: String, pub matches: Vec>, - #[serde(default = "default_547")] + #[serde(default = "default_549")] pub contexts: Vec>, - #[serde(default = "default_548")] + #[serde(default = "default_550")] pub contexts_partial: bool, - #[serde(default = "default_549")] + #[serde(default = "default_551")] pub definitions: Vec>, - #[serde(default = "default_550")] + #[serde(default = "default_552")] pub definitions_partial: bool, - #[serde(default = "default_551")] + #[serde(default = "default_553")] pub definitions_note: String, - #[serde(default = "default_552")] + #[serde(default = "default_554")] pub truncated: bool, - #[serde(default = "default_553")] + #[serde(default = "default_555")] pub dependencies: Vec, } @@ -10233,69 +10235,71 @@ pub enum CodeGrepOutputFallback { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeGrepOutput { - #[serde(default = "default_545")] - pub lessons: Vec>, #[serde(default = "default_546")] + pub lessons: Vec>, + #[serde(default = "default_547")] pub lessons_left_out: Integer, + #[serde(default = "default_548")] + pub lead: Vec>, pub matches: Vec>, - #[serde(default = "default_554")] + #[serde(default = "default_556")] pub related: Option, - #[serde(default = "default_555")] + #[serde(default = "default_557")] pub contexts: Vec>, - #[serde(default = "default_556")] + #[serde(default = "default_558")] pub contexts_partial: bool, - #[serde(default = "default_557")] + #[serde(default = "default_559")] pub definitions: Vec>, - #[serde(default = "default_558")] + #[serde(default = "default_560")] pub definitions_partial: bool, - #[serde(default = "default_559")] + #[serde(default = "default_561")] pub definitions_note: String, - #[serde(default = "default_560")] + #[serde(default = "default_562")] pub next_cursor: String, - #[serde(default = "default_561")] + #[serde(default = "default_563")] pub has_more: bool, - #[serde(default = "default_562")] + #[serde(default = "default_564")] pub files: Vec>, - #[serde(default = "default_563")] + #[serde(default = "default_565")] pub files_total: Integer, pub chunks_matched: Integer, - #[serde(default = "default_564")] + #[serde(default = "default_566")] pub truncated: bool, - #[serde(default = "default_565")] + #[serde(default = "default_567")] pub coverage_floor: bool, - #[serde(default = "default_566")] + #[serde(default = "default_568")] pub as_of: std::collections::HashMap, - #[serde(default = "default_567")] + #[serde(default = "default_569")] pub not_covered: bool, - #[serde(default = "default_568")] + #[serde(default = "default_570")] pub neighbours: Vec>, - #[serde(default = "default_569")] + #[serde(default = "default_571")] pub anchors: Integer, - #[serde(default = "default_570")] + #[serde(default = "default_572")] pub anchors_capped: bool, - #[serde(default = "default_571")] + #[serde(default = "default_573")] pub neighbour_tokens: Integer, - #[serde(default = "default_572")] + #[serde(default = "default_574")] pub note: String, - #[serde(default = "default_573")] + #[serde(default = "default_575")] pub verdict: String, - #[serde(default = "default_574")] + #[serde(default = "default_576")] pub template: String, - #[serde(default = "default_575")] + #[serde(default = "default_577")] pub error_code: String, - #[serde(default = "default_576")] + #[serde(default = "default_578")] pub coverage: f64, - #[serde(default = "default_577")] + #[serde(default = "default_579")] pub presence: Vec>, - #[serde(default = "default_578")] + #[serde(default = "default_580")] pub summary: std::collections::HashMap>, - #[serde(default = "default_579")] + #[serde(default = "default_581")] pub trace_run_id: String, - #[serde(default = "default_580")] + #[serde(default = "default_582")] pub partial: bool, - #[serde(default = "default_581")] + #[serde(default = "default_583")] pub partial_reason: String, - #[serde(default = "default_582")] + #[serde(default = "default_584")] pub fallback: CodeGrepOutputFallback, } @@ -10505,6 +10509,12 @@ pub struct CodeGrepInput { deserialize_with = "present_nullable" )] pub deadline_ms: Option>, + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "present_value" + )] + pub lead: Option, } impl CodeGrepInput { pub fn new(pattern: CodeGrepInputPattern) -> Self { @@ -10538,6 +10548,7 @@ impl CodeGrepInput { neighbours: None, neighbour_k: None, deadline_ms: None, + lead: None, } } pub fn include_lessons(mut self, include_lessons: bool) -> Self { @@ -10673,6 +10684,10 @@ impl CodeGrepInput { self.deadline_ms = Some(None); self } + pub fn lead(mut self, lead: bool) -> Self { + self.lead = Some(lead); + self + } pub async fn send( self, client: &crate::Client, @@ -10687,9 +10702,9 @@ impl CodeGrepInput { pub struct CodeHistoryOutput { pub prs: Vec>, pub paths: Vec, - #[serde(default = "default_583")] + #[serde(default = "default_585")] pub items: Vec>, - #[serde(default = "default_584")] + #[serde(default = "default_586")] pub trace_run_id: String, } @@ -10851,52 +10866,52 @@ impl CodeHistoryInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeImpactOutput { - #[serde(default = "default_585")] + #[serde(default = "default_587")] pub lessons: Vec>, - #[serde(default = "default_586")] + #[serde(default = "default_588")] pub lessons_left_out: Integer, pub impacted_symbols: Vec>, pub impacted_tests: Vec>, pub co_change_files: Vec>, - #[serde(default = "default_587")] + #[serde(default = "default_589")] pub blast_radius_score: f64, - #[serde(default = "default_588")] + #[serde(default = "default_590")] pub touched_symbols: Vec>, - #[serde(default = "default_589")] + #[serde(default = "default_591")] pub co_change_missing: Vec>, - #[serde(default = "default_590")] + #[serde(default = "default_592")] pub owners: Vec>, - #[serde(default = "default_591")] + #[serde(default = "default_593")] pub reverts: Vec>, - #[serde(default = "default_592")] + #[serde(default = "default_594")] pub counts_floor: bool, - #[serde(default = "default_593")] + #[serde(default = "default_595")] pub unresolved_calls: Integer, - #[serde(default = "default_594")] + #[serde(default = "default_596")] pub ambiguous_calls: Integer, - #[serde(default = "default_595")] + #[serde(default = "default_597")] pub epistemic: String, - #[serde(default = "default_596")] + #[serde(default = "default_598")] pub causes: Vec, - #[serde(default = "default_597")] + #[serde(default = "default_599")] pub by_hop_counts: std::collections::HashMap, - #[serde(default = "default_598")] + #[serde(default = "default_600")] pub truncated: bool, - #[serde(default = "default_599")] + #[serde(default = "default_601")] pub resolved_by: String, - #[serde(default = "default_600")] + #[serde(default = "default_602")] pub verdict: String, - #[serde(default = "default_601")] + #[serde(default = "default_603")] pub paths_seen: Vec>, - #[serde(default = "default_602")] + #[serde(default = "default_604")] pub overlay: bool, - #[serde(default = "default_603")] + #[serde(default = "default_605")] pub overlay_head_sha: String, - #[serde(default = "default_604")] + #[serde(default = "default_606")] pub overlay_added: Integer, - #[serde(default = "default_605")] + #[serde(default = "default_607")] pub overlay_note: String, - #[serde(default = "default_606")] + #[serde(default = "default_608")] pub trace_run_id: String, } @@ -11164,12 +11179,12 @@ impl CodeImpactInput { #[non_exhaustive] pub struct CodeIndexErrorRow { pub path: String, - #[serde(default = "default_607")] + #[serde(default = "default_609")] pub lang: String, pub error: String, - #[serde(default = "default_608")] + #[serde(default = "default_610")] pub indexed_commit: String, - #[serde(default = "default_609")] + #[serde(default = "default_611")] pub at: String, } @@ -11177,7 +11192,7 @@ pub struct CodeIndexErrorRow { #[non_exhaustive] pub struct CodeIndexErrorsOutput { pub rows: Vec, - #[serde(default = "default_610")] + #[serde(default = "default_612")] pub total: Integer, } @@ -11277,17 +11292,17 @@ pub struct CodeCompilerTier { pub tool: String, pub label: String, pub watermark_key: String, - #[serde(default = "default_620")] + #[serde(default = "default_622")] pub commit: String, - #[serde(default = "default_621")] + #[serde(default = "default_623")] pub lag: Integer, - #[serde(default = "default_622")] + #[serde(default = "default_624")] pub updated_at: String, - #[serde(default = "default_623")] + #[serde(default = "default_625")] pub primary: bool, - #[serde(default = "default_624")] + #[serde(default = "default_626")] pub workers: Vec, - #[serde(default = "default_625")] + #[serde(default = "default_627")] pub note: String, } @@ -11295,42 +11310,42 @@ pub struct CodeCompilerTier { #[non_exhaustive] pub struct CodeTierHealth { pub tier: String, - #[serde(default = "default_627")] + #[serde(default = "default_629")] pub state: String, - #[serde(default = "default_628")] + #[serde(default = "default_630")] pub kind: String, - #[serde(default = "default_629")] + #[serde(default = "default_631")] pub error: String, - #[serde(default = "default_630")] + #[serde(default = "default_632")] pub fix: String, - #[serde(default = "default_631")] + #[serde(default = "default_633")] pub failing_since: String, - #[serde(default = "default_632")] + #[serde(default = "default_634")] pub last_failed_at: String, - #[serde(default = "default_633")] + #[serde(default = "default_635")] pub failed_passes: Integer, - #[serde(default = "default_634")] + #[serde(default = "default_636")] pub last_ok_at: String, - #[serde(default = "default_635")] + #[serde(default = "default_637")] pub lag_commits: Integer, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeWorkerStatus { - #[serde(default = "default_651")] + #[serde(default = "default_653")] pub enabled: bool, - #[serde(default = "default_652")] + #[serde(default = "default_654")] pub interval_seconds: Integer, - #[serde(default = "default_653")] + #[serde(default = "default_655")] pub last_run_at: String, - #[serde(default = "default_654")] + #[serde(default = "default_656")] pub last_duration_ms: Integer, - #[serde(default = "default_655")] + #[serde(default = "default_657")] pub consecutive_failures: Integer, - #[serde(default = "default_656")] + #[serde(default = "default_658")] pub total_runs: Integer, - #[serde(default = "default_657")] + #[serde(default = "default_659")] pub last_error: String, } @@ -11339,84 +11354,84 @@ pub struct CodeWorkerStatus { pub struct CodeIndexStatusOutput { pub repo: String, pub branch: String, - #[serde(default = "default_611")] + #[serde(default = "default_613")] pub org: String, pub namespace: String, - #[serde(default = "default_612")] + #[serde(default = "default_614")] pub provider: String, - #[serde(default = "default_613")] + #[serde(default = "default_615")] pub profile: String, - #[serde(default = "default_614")] + #[serde(default = "default_616")] pub compiler_candidates: Vec, - #[serde(default = "default_615")] + #[serde(default = "default_617")] pub quality_warnings: Vec, - #[serde(default = "default_616")] + #[serde(default = "default_618")] pub git_head: String, - #[serde(default = "default_617")] + #[serde(default = "default_619")] pub scip_commit: String, - #[serde(default = "default_618")] + #[serde(default = "default_620")] pub scip_commit_py: String, - #[serde(default = "default_619")] + #[serde(default = "default_621")] pub scip_producer: String, - #[serde(default = "default_626")] + #[serde(default = "default_628")] pub compiler_tiers: Vec, - #[serde(default = "default_636")] + #[serde(default = "default_638")] pub tier_health: Vec, - #[serde(default = "default_637")] + #[serde(default = "default_639")] pub pr_cursor: String, - #[serde(default = "default_638")] + #[serde(default = "default_640")] pub commit_coverage: Option, - #[serde(default = "default_639")] + #[serde(default = "default_641")] pub clone_head: String, - #[serde(default = "default_640")] + #[serde(default = "default_642")] pub clone_fetched_at: String, - #[serde(default = "default_641")] + #[serde(default = "default_643")] pub fetch_overdue: bool, - #[serde(default = "default_642")] + #[serde(default = "default_644")] pub fast_tier_lag: Integer, - #[serde(default = "default_643")] + #[serde(default = "default_645")] pub scip_lag: Integer, - #[serde(default = "default_644")] + #[serde(default = "default_646")] pub scip_py_lag: Integer, - #[serde(default = "default_645")] + #[serde(default = "default_647")] pub last_refresh_at: String, - #[serde(default = "default_646")] + #[serde(default = "default_648")] pub last_refresh_detail: String, - #[serde(default = "default_647")] + #[serde(default = "default_649")] pub org_readable: bool, - #[serde(default = "default_648")] + #[serde(default = "default_650")] pub path_prefixes: Vec, - #[serde(default = "default_649")] + #[serde(default = "default_651")] pub counts: std::collections::HashMap, - #[serde(default = "default_650")] + #[serde(default = "default_652")] pub state: std::collections::HashMap>, - #[serde(default = "default_658")] + #[serde(default = "default_660")] pub workers: std::collections::HashMap, - #[serde(default = "default_659")] + #[serde(default = "default_661")] pub build_commit: String, - #[serde(default = "default_660")] + #[serde(default = "default_662")] pub ops: Vec, - #[serde(default = "default_661")] + #[serde(default = "default_663")] pub request_fields: std::collections::HashMap>, - #[serde(default = "default_662")] + #[serde(default = "default_664")] pub op_maturity: std::collections::HashMap, - #[serde(default = "default_663")] + #[serde(default = "default_665")] pub op_reach: std::collections::HashMap>, - #[serde(default = "default_664")] + #[serde(default = "default_666")] pub op_toolsets: std::collections::HashMap>, - #[serde(default = "default_665")] + #[serde(default = "default_667")] pub symbol_stats_rows: Integer, - #[serde(default = "default_666")] + #[serde(default = "default_668")] pub symbol_stats_at: String, - #[serde(default = "default_667")] + #[serde(default = "default_669")] pub unit_risk_rows: Integer, - #[serde(default = "default_668")] + #[serde(default = "default_670")] pub unit_risk_at: String, - #[serde(default = "default_669")] + #[serde(default = "default_671")] pub chunks_total: Integer, - #[serde(default = "default_670")] + #[serde(default = "default_672")] pub chunks_embedded: Integer, - #[serde(default = "default_671")] + #[serde(default = "default_673")] pub embedding_coverage: f64, } @@ -11540,9 +11555,9 @@ impl CodeIndexStatusInput { pub struct CodeMapOutput { pub map: String, pub tokens_used: Integer, - #[serde(default = "default_672")] + #[serde(default = "default_674")] pub commit_sha: String, - #[serde(default = "default_673")] + #[serde(default = "default_675")] pub trace_run_id: String, } @@ -11813,32 +11828,32 @@ impl CodeOutcomeInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeOutlineOutput { - #[serde(default = "default_674")] + #[serde(default = "default_676")] pub lessons: Vec>, - #[serde(default = "default_675")] + #[serde(default = "default_677")] pub lessons_left_out: Integer, pub path: String, pub entries: Vec>, pub total: Integer, pub returned: Integer, pub elided: Integer, - #[serde(default = "default_676")] + #[serde(default = "default_678")] pub next: String, - #[serde(default = "default_677")] + #[serde(default = "default_679")] pub indexed: bool, - #[serde(default = "default_678")] + #[serde(default = "default_680")] pub verdict: String, - #[serde(default = "default_679")] + #[serde(default = "default_681")] pub tokens_returned: Integer, - #[serde(default = "default_680")] + #[serde(default = "default_682")] pub took_ms: Integer, - #[serde(default = "default_681")] + #[serde(default = "default_683")] pub head: String, - #[serde(default = "default_682")] + #[serde(default = "default_684")] pub head_truncated: bool, - #[serde(default = "default_683")] + #[serde(default = "default_685")] pub as_of: std::collections::HashMap, - #[serde(default = "default_684")] + #[serde(default = "default_686")] pub trace_run_id: String, } @@ -11990,19 +12005,19 @@ pub enum CodePathGuardsOutputEpistemic { #[non_exhaustive] pub struct CodePathGuardsOutput { pub verdict: CodePathGuardsOutputVerdict, - #[serde(default = "default_685")] + #[serde(default = "default_687")] pub causes: Vec, - #[serde(default = "default_686")] + #[serde(default = "default_688")] pub epistemic: CodePathGuardsOutputEpistemic, - #[serde(default = "default_687")] + #[serde(default = "default_689")] pub explanation: String, - #[serde(default = "default_688")] + #[serde(default = "default_690")] pub hops: Vec>, - #[serde(default = "default_689")] + #[serde(default = "default_691")] pub named_at: Vec, - #[serde(default = "default_690")] + #[serde(default = "default_692")] pub visited_symbols: Integer, - #[serde(default = "default_691")] + #[serde(default = "default_693")] pub trace_run_id: String, } @@ -12108,21 +12123,21 @@ impl CodePathGuardsInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodePrCheckOutput { - #[serde(default = "default_692")] + #[serde(default = "default_694")] pub verdict: String, - #[serde(default = "default_693")] + #[serde(default = "default_695")] pub items: Vec>, - #[serde(default = "default_694")] + #[serde(default = "default_696")] pub undecided: bool, - #[serde(default = "default_695")] + #[serde(default = "default_697")] pub epistemic: String, - #[serde(default = "default_696")] + #[serde(default = "default_698")] pub thresholds: std::collections::HashMap, - #[serde(default = "default_697")] + #[serde(default = "default_699")] pub legs: std::collections::HashMap, - #[serde(default = "default_698")] + #[serde(default = "default_700")] pub draft: std::collections::HashMap, - #[serde(default = "default_699")] + #[serde(default = "default_701")] pub trace_run_id: String, } @@ -12311,22 +12326,22 @@ pub struct CodeReadRange { pub start_line: Integer, pub end_line: Integer, pub status: CodeReadRangeStatus, - #[serde(default = "default_702")] + #[serde(default = "default_704")] pub indexed_commit: String, - #[serde(default = "default_703")] + #[serde(default = "default_705")] pub windows: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeReadOutput { - #[serde(default = "default_700")] + #[serde(default = "default_702")] pub lessons: Vec>, - #[serde(default = "default_701")] + #[serde(default = "default_703")] pub lessons_left_out: Integer, pub results: Vec, pub as_of: std::collections::HashMap, - #[serde(default = "default_704")] + #[serde(default = "default_706")] pub trace_run_id: String, } @@ -12569,15 +12584,15 @@ impl CodeReadInput { #[non_exhaustive] pub struct CodeRecentCommitRow { pub commit: String, - #[serde(default = "default_705")] + #[serde(default = "default_707")] pub subject: String, - #[serde(default = "default_706")] + #[serde(default = "default_708")] pub committed_at: String, - #[serde(default = "default_707")] + #[serde(default = "default_709")] pub ingested_at: String, - #[serde(default = "default_708")] + #[serde(default = "default_710")] pub files: Integer, - #[serde(default = "default_709")] + #[serde(default = "default_711")] pub pr_number: Integer, } @@ -12680,11 +12695,11 @@ impl CodeRecentCommitsInput { #[non_exhaustive] pub struct CodeRefreshOutput { pub triggered: bool, - #[serde(default = "default_710")] + #[serde(default = "default_712")] pub already_running: bool, - #[serde(default = "default_711")] + #[serde(default = "default_713")] pub head_before: String, - #[serde(default = "default_712")] + #[serde(default = "default_714")] pub head_after: String, } @@ -12887,22 +12902,22 @@ pub struct CodeRepoAddOutput { pub org: String, pub namespace: String, pub repo: String, - #[serde(default = "default_713")] + #[serde(default = "default_715")] pub remote: String, - #[serde(default = "default_714")] + #[serde(default = "default_716")] pub provider: String, pub branch: String, pub join_policy: String, pub classification: String, - #[serde(default = "default_715")] + #[serde(default = "default_717")] pub index_stage: String, - #[serde(default = "default_716")] + #[serde(default = "default_718")] pub my_role: String, - #[serde(default = "default_717")] + #[serde(default = "default_719")] pub remote_head: String, - #[serde(default = "default_718")] + #[serde(default = "default_720")] pub also: Vec>, - #[serde(default = "default_719")] + #[serde(default = "default_721")] pub skipped: Vec>, } @@ -13130,29 +13145,29 @@ impl CodeRepoAddBranchInput { pub struct CodeRepoRemoteBranchesOutput { pub org: String, pub repo: String, - #[serde(default = "default_720")] + #[serde(default = "default_722")] pub remote: String, - #[serde(default = "default_721")] + #[serde(default = "default_723")] pub provider: String, - #[serde(default = "default_722")] + #[serde(default = "default_724")] pub warnings: Vec, - #[serde(default = "default_723")] + #[serde(default = "default_725")] pub default_branch: String, - #[serde(default = "default_724")] + #[serde(default = "default_726")] pub branches: Vec>, - #[serde(default = "default_725")] + #[serde(default = "default_727")] pub suggested: Vec, - #[serde(default = "default_726")] + #[serde(default = "default_728")] pub indexed: Vec>, - #[serde(default = "default_727")] + #[serde(default = "default_729")] pub cap: Integer, - #[serde(default = "default_728")] + #[serde(default = "default_730")] pub total: Integer, - #[serde(default = "default_729")] + #[serde(default = "default_731")] pub matched: Integer, - #[serde(default = "default_730")] + #[serde(default = "default_732")] pub truncated: bool, - #[serde(default = "default_731")] + #[serde(default = "default_733")] pub query: String, } @@ -13243,11 +13258,11 @@ pub struct CodeRepoRemoveOutput { pub registry_deactivated: bool, pub directory_deactivated: bool, pub purged_tables: Integer, - #[serde(default = "default_732")] + #[serde(default = "default_734")] pub erasure_id: String, - #[serde(default = "default_733")] + #[serde(default = "default_735")] pub mirror_removed: bool, - #[serde(default = "default_734")] + #[serde(default = "default_736")] pub sources_deactivated: Vec, } @@ -13381,14 +13396,14 @@ impl CodeRepoSetAccessInput { pub struct CodeRepoSetSourceOutput { pub org: String, pub namespace: String, - #[serde(default = "default_735")] + #[serde(default = "default_737")] pub tracker_namespaces: Vec, - #[serde(default = "default_736")] + #[serde(default = "default_738")] pub previous_tracker_namespaces: Vec, pub effective_within_s: Integer, - #[serde(default = "default_737")] + #[serde(default = "default_739")] pub not_covering: Vec, - #[serde(default = "default_738")] + #[serde(default = "default_740")] pub warning: String, } @@ -13803,43 +13818,43 @@ pub enum CodeReviewBriefOutputLedger { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeReviewBriefOutput { - #[serde(default = "default_739")] + #[serde(default = "default_741")] pub pr_number: Integer, - #[serde(default = "default_740")] + #[serde(default = "default_742")] pub merge_sha: String, - #[serde(default = "default_741")] + #[serde(default = "default_743")] pub source: CodeReviewBriefOutputSource, - #[serde(default = "default_742")] + #[serde(default = "default_744")] pub ledger: CodeReviewBriefOutputLedger, - #[serde(default = "default_743")] + #[serde(default = "default_745")] pub stored: bool, - #[serde(default = "default_744")] + #[serde(default = "default_746")] pub provenance: std::collections::HashMap, - #[serde(default = "default_745")] + #[serde(default = "default_747")] pub overlay: bool, - #[serde(default = "default_746")] + #[serde(default = "default_748")] pub overlay_head_sha: String, - #[serde(default = "default_747")] + #[serde(default = "default_749")] pub overlay_added: Integer, - #[serde(default = "default_748")] + #[serde(default = "default_750")] pub overlay_note: String, - #[serde(default = "default_749")] + #[serde(default = "default_751")] pub tier: String, - #[serde(default = "default_750")] + #[serde(default = "default_752")] pub built_at: String, - #[serde(default = "default_751")] + #[serde(default = "default_753")] pub indexed_commit: String, - #[serde(default = "default_752")] + #[serde(default = "default_754")] pub build_ms: Integer, - #[serde(default = "default_753")] + #[serde(default = "default_755")] pub tokens_used: Integer, - #[serde(default = "default_754")] + #[serde(default = "default_756")] pub token_budget: Integer, - #[serde(default = "default_755")] + #[serde(default = "default_757")] pub decisions: std::collections::HashMap, - #[serde(default = "default_756")] + #[serde(default = "default_758")] pub sections: std::collections::HashMap>, - #[serde(default = "default_757")] + #[serde(default = "default_759")] pub trace_run_id: String, } @@ -14224,11 +14239,11 @@ pub struct CodeScipStatusOutput { pub status: String, pub parts_received: Integer, pub total_parts: Integer, - #[serde(default = "default_758")] + #[serde(default = "default_760")] pub error: String, - #[serde(default = "default_759")] + #[serde(default = "default_761")] pub commit_sha: String, - #[serde(default = "default_760")] + #[serde(default = "default_762")] pub applied_at: String, } @@ -14387,63 +14402,63 @@ pub enum CodeSearchOutputEpistemic { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeSearchOutput { - #[serde(default = "default_761")] + #[serde(default = "default_763")] pub lessons: Vec>, - #[serde(default = "default_762")] + #[serde(default = "default_764")] pub lessons_left_out: Integer, pub results: Vec, pub route: String, - #[serde(default = "default_763")] + #[serde(default = "default_765")] pub next_cursor: String, - #[serde(default = "default_764")] + #[serde(default = "default_766")] pub has_more: bool, - #[serde(default = "default_765")] + #[serde(default = "default_767")] pub history: std::collections::HashMap, - #[serde(default = "default_766")] + #[serde(default = "default_768")] pub abstain: bool, - #[serde(default = "default_767")] + #[serde(default = "default_769")] pub abstain_code: CodeSearchOutputAbstainCode, - #[serde(default = "default_768")] + #[serde(default = "default_770")] pub abstain_reason: String, - #[serde(default = "default_769")] + #[serde(default = "default_771")] pub retrieval_risk: CodeSearchOutputRetrievalRisk, - #[serde(default = "default_770")] + #[serde(default = "default_772")] pub retrieval_confidence: f64, - #[serde(default = "default_771")] + #[serde(default = "default_773")] pub pick_confidence: CodeSearchOutputPickConfidence, - #[serde(default = "default_772")] + #[serde(default = "default_774")] pub route_agreement: f64, - #[serde(default = "default_773")] + #[serde(default = "default_775")] pub calibration_explanation: String, - #[serde(default = "default_774")] + #[serde(default = "default_776")] pub tokens_returned: Integer, - #[serde(default = "default_775")] + #[serde(default = "default_777")] pub constrained: bool, - #[serde(default = "default_776")] + #[serde(default = "default_778")] pub matched_files: Integer, - #[serde(default = "default_777")] + #[serde(default = "default_779")] pub as_of: std::collections::HashMap, - #[serde(default = "default_778")] + #[serde(default = "default_780")] pub score_explanation: String, - #[serde(default = "default_779")] + #[serde(default = "default_781")] pub retrieval_work: std::collections::HashMap, - #[serde(default = "default_780")] + #[serde(default = "default_782")] pub trace_run_id: String, - #[serde(default = "default_781")] + #[serde(default = "default_783")] pub top_similarity: f64, - #[serde(default = "default_782")] + #[serde(default = "default_784")] pub tracked: std::collections::HashMap, - #[serde(default = "default_783")] + #[serde(default = "default_785")] pub fanout: std::collections::HashMap, - #[serde(default = "default_784")] + #[serde(default = "default_786")] pub note: String, - #[serde(default = "default_785")] + #[serde(default = "default_787")] pub legs_timed_out: Vec, - #[serde(default = "default_786")] + #[serde(default = "default_788")] pub epistemic: CodeSearchOutputEpistemic, - #[serde(default = "default_787")] + #[serde(default = "default_789")] pub partial: bool, - #[serde(default = "default_788")] + #[serde(default = "default_790")] pub partial_reason: String, } @@ -14961,23 +14976,23 @@ impl CodeSearchInput { #[non_exhaustive] pub struct CodeSettingFactsOutput { pub name: String, - #[serde(default = "default_789")] + #[serde(default = "default_791")] pub verdict: String, - #[serde(default = "default_790")] + #[serde(default = "default_792")] pub causes: Vec, - #[serde(default = "default_791")] + #[serde(default = "default_793")] pub declaration: std::collections::HashMap, - #[serde(default = "default_792")] + #[serde(default = "default_794")] pub tier: String, - #[serde(default = "default_793")] + #[serde(default = "default_795")] pub history: Vec>, - #[serde(default = "default_794")] + #[serde(default = "default_796")] pub randomized_in_ci: std::collections::HashMap, - #[serde(default = "default_795")] + #[serde(default = "default_797")] pub tests_total: Integer, - #[serde(default = "default_796")] + #[serde(default = "default_798")] pub control: std::collections::HashMap, - #[serde(default = "default_797")] + #[serde(default = "default_799")] pub trace_run_id: String, } @@ -15235,6 +15250,12 @@ pub struct CodeSymbolInput { deserialize_with = "present_value" )] pub neighbour_k: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "present_value" + )] + pub lead: Option, } impl Default for CodeSymbolInput { fn default() -> Self { @@ -15270,6 +15291,7 @@ impl CodeSymbolInput { presence: None, neighbours: None, neighbour_k: None, + lead: None, } } pub fn org(mut self, org: impl Into) -> Self { @@ -15387,6 +15409,10 @@ impl CodeSymbolInput { self.neighbour_k = Some(neighbour_k.into()); self } + pub fn lead(mut self, lead: bool) -> Self { + self.lead = Some(lead); + self + } pub async fn send( self, client: &crate::Client, @@ -15399,31 +15425,31 @@ impl CodeSymbolInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeSymbolHistoryOutput { - #[serde(default = "default_798")] + #[serde(default = "default_800")] pub verdict: String, - #[serde(default = "default_799")] + #[serde(default = "default_801")] pub causes: Vec, - #[serde(default = "default_800")] + #[serde(default = "default_802")] pub epistemic: String, - #[serde(default = "default_801")] + #[serde(default = "default_803")] pub symbol: std::collections::HashMap, - #[serde(default = "default_802")] + #[serde(default = "default_804")] pub ambiguous: bool, - #[serde(default = "default_803")] + #[serde(default = "default_805")] pub candidates: Vec, - #[serde(default = "default_804")] + #[serde(default = "default_806")] pub prs: Vec>, - #[serde(default = "default_805")] + #[serde(default = "default_807")] pub review_comments: Vec>, - #[serde(default = "default_806")] + #[serde(default = "default_808")] pub open_issues_naming: Vec>, - #[serde(default = "default_807")] + #[serde(default = "default_809")] pub summary: std::collections::HashMap, - #[serde(default = "default_808")] + #[serde(default = "default_810")] pub tracker_namespace: String, - #[serde(default = "default_809")] + #[serde(default = "default_811")] pub tracker_unavailable: bool, - #[serde(default = "default_810")] + #[serde(default = "default_812")] pub trace_run_id: String, } @@ -15541,41 +15567,41 @@ impl CodeSymbolHistoryInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeTestGateOutput { - #[serde(default = "default_811")] + #[serde(default = "default_813")] pub tests: Vec>, - #[serde(default = "default_812")] + #[serde(default = "default_814")] pub untested: Vec>, - #[serde(default = "default_813")] + #[serde(default = "default_815")] pub unlinked: Vec>, - #[serde(default = "default_814")] + #[serde(default = "default_816")] pub changed_files: Vec, - #[serde(default = "default_815")] + #[serde(default = "default_817")] pub touched_symbols: Vec>, - #[serde(default = "default_816")] + #[serde(default = "default_818")] pub obligations: bool, - #[serde(default = "default_817")] + #[serde(default = "default_819")] pub tests_total: Integer, - #[serde(default = "default_818")] + #[serde(default = "default_820")] pub tests_unnamed: Integer, - #[serde(default = "default_819")] + #[serde(default = "default_821")] pub untested_total: Integer, - #[serde(default = "default_820")] + #[serde(default = "default_822")] pub unlinked_total: Integer, - #[serde(default = "default_821")] + #[serde(default = "default_823")] pub tests_capped: bool, - #[serde(default = "default_822")] + #[serde(default = "default_824")] pub untested_capped: bool, - #[serde(default = "default_823")] + #[serde(default = "default_825")] pub unlinked_capped: bool, - #[serde(default = "default_824")] + #[serde(default = "default_826")] pub counts_floor: bool, - #[serde(default = "default_825")] + #[serde(default = "default_827")] pub epistemic: String, - #[serde(default = "default_826")] + #[serde(default = "default_828")] pub causes: Vec, - #[serde(default = "default_827")] + #[serde(default = "default_829")] pub by_hop_counts: std::collections::HashMap, - #[serde(default = "default_828")] + #[serde(default = "default_830")] pub trace_run_id: String, } @@ -15704,21 +15730,21 @@ impl CodeTestGateInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeTestHomeOutput { - #[serde(default = "default_829")] + #[serde(default = "default_831")] pub verdict: String, - #[serde(default = "default_830")] + #[serde(default = "default_832")] pub home: String, - #[serde(default = "default_831")] + #[serde(default = "default_833")] pub candidates: Vec>, - #[serde(default = "default_832")] + #[serde(default = "default_834")] pub parts: Vec, - #[serde(default = "default_833")] + #[serde(default = "default_835")] pub src_paths: Vec, - #[serde(default = "default_834")] + #[serde(default = "default_836")] pub next_free_stateless_number: Integer, - #[serde(default = "default_835")] + #[serde(default = "default_837")] pub control: std::collections::HashMap, - #[serde(default = "default_836")] + #[serde(default = "default_838")] pub trace_run_id: String, } @@ -15858,27 +15884,27 @@ impl CodeTestHomeInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CodeTestsForOutput { - #[serde(default = "default_837")] + #[serde(default = "default_839")] pub tests: Vec>, - #[serde(default = "default_838")] + #[serde(default = "default_840")] pub total: Integer, - #[serde(default = "default_839")] + #[serde(default = "default_841")] pub truncated: bool, - #[serde(default = "default_840")] + #[serde(default = "default_842")] pub facets: Vec>, - #[serde(default = "default_841")] + #[serde(default = "default_843")] pub verdict: String, - #[serde(default = "default_842")] + #[serde(default = "default_844")] pub abstain: bool, - #[serde(default = "default_843")] + #[serde(default = "default_845")] pub uncovered_kinds: Vec, - #[serde(default = "default_844")] + #[serde(default = "default_846")] pub as_of: std::collections::HashMap, - #[serde(default = "default_845")] + #[serde(default = "default_847")] pub tokens_returned: Integer, - #[serde(default = "default_846")] + #[serde(default = "default_848")] pub took_ms: Integer, - #[serde(default = "default_847")] + #[serde(default = "default_849")] pub trace_run_id: String, } @@ -15984,9 +16010,9 @@ impl CodeTestsForInput { pub struct CodeTraceOutput { pub frames: Vec>, pub definitions: Vec, - #[serde(default = "default_848")] + #[serde(default = "default_850")] pub tokens_returned: Integer, - #[serde(default = "default_849")] + #[serde(default = "default_851")] pub trace_run_id: String, } @@ -16102,16 +16128,16 @@ pub enum CodeVerifyOutputVerdict { #[non_exhaustive] pub struct CodeVerifyOutput { pub verdict: CodeVerifyOutputVerdict, - #[serde(default = "default_850")] + #[serde(default = "default_852")] pub reason: String, pub explanation: String, - #[serde(default = "default_851")] + #[serde(default = "default_853")] pub evidence: Vec>, - #[serde(default = "default_852")] + #[serde(default = "default_854")] pub floors: std::collections::HashMap, - #[serde(default = "default_853")] + #[serde(default = "default_855")] pub index_verdict: String, - #[serde(default = "default_854")] + #[serde(default = "default_856")] pub trace_run_id: String, } @@ -16233,29 +16259,29 @@ impl CodeVerifyInput { #[non_exhaustive] pub struct CodeVerifyCitationsOutput { pub verdict: String, - #[serde(default = "default_855")] + #[serde(default = "default_857")] pub counts: std::collections::HashMap, - #[serde(default = "default_856")] + #[serde(default = "default_858")] pub citations: Vec>, - #[serde(default = "default_857")] + #[serde(default = "default_859")] pub skipped: Vec>, - #[serde(default = "default_858")] + #[serde(default = "default_860")] pub truncated: bool, - #[serde(default = "default_859")] + #[serde(default = "default_861")] pub epistemic: std::collections::HashMap, - #[serde(default = "default_860")] + #[serde(default = "default_862")] pub at_commit: std::collections::HashMap, - #[serde(default = "default_861")] + #[serde(default = "default_863")] pub pr_diff: std::collections::HashMap, - #[serde(default = "default_862")] + #[serde(default = "default_864")] pub namespaces: Vec, - #[serde(default = "default_863")] + #[serde(default = "default_865")] pub took_ms: Integer, - #[serde(default = "default_864")] + #[serde(default = "default_866")] pub as_of: std::collections::HashMap, - #[serde(default = "default_865")] + #[serde(default = "default_867")] pub note: String, - #[serde(default = "default_866")] + #[serde(default = "default_868")] pub trace_run_id: String, } @@ -16514,7 +16540,7 @@ pub struct CollectionCreateOutput { pub namespace: String, pub parent: String, pub created: bool, - #[serde(default = "default_867")] + #[serde(default = "default_869")] pub title: String, } @@ -16612,9 +16638,9 @@ impl CollectionCreateInput { pub struct CollectionDeleteOutput { pub namespace: String, pub deleted: bool, - #[serde(default = "default_868")] + #[serde(default = "default_870")] pub erasure_id: String, - #[serde(default = "default_869")] + #[serde(default = "default_871")] pub erasure_status: String, } @@ -16656,11 +16682,11 @@ pub struct CollectionEntry { pub parent: String, pub personal: bool, pub role: String, - #[serde(default = "default_870")] + #[serde(default = "default_872")] pub description: String, - #[serde(default = "default_871")] + #[serde(default = "default_873")] pub title: String, - #[serde(default = "default_872")] + #[serde(default = "default_874")] pub document_count: Option, } @@ -16668,7 +16694,7 @@ pub struct CollectionEntry { #[non_exhaustive] pub struct CollectionListOutput { pub collections: Vec, - #[serde(default = "default_873")] + #[serde(default = "default_875")] pub next_cursor: Option, } @@ -17010,13 +17036,13 @@ pub struct ConflictRow { #[non_exhaustive] pub struct ConflictsListOutput { pub rows: Vec, - #[serde(default = "default_874")] + #[serde(default = "default_876")] pub next_before_version: Option, - #[serde(default = "default_875")] + #[serde(default = "default_877")] pub total: Option, - #[serde(default = "default_876")] + #[serde(default = "default_878")] pub proposals: Option, - #[serde(default = "default_877")] + #[serde(default = "default_879")] pub keys: Option>, } @@ -17168,7 +17194,7 @@ pub struct ConflictRevisionSuggestion { pub target_local_id: Integer, pub peer_local_ids: Vec, pub rationale: String, - #[serde(default = "default_879")] + #[serde(default = "default_881")] pub apply_operation: String, } @@ -17176,11 +17202,11 @@ pub struct ConflictRevisionSuggestion { #[non_exhaustive] pub struct ConflictsProposeRevisionOutput { pub found: bool, - #[serde(default = "default_878")] - pub memories: Vec, #[serde(default = "default_880")] + pub memories: Vec, + #[serde(default = "default_882")] pub suggestions: Vec, - #[serde(default = "default_881")] + #[serde(default = "default_883")] pub note: String, } @@ -17260,9 +17286,9 @@ pub struct ConflictsResolveOutput { pub resolved: bool, pub decision: ConflictsResolveOutputDecision, pub affected_memory_ids: Vec, - #[serde(default = "default_882")] + #[serde(default = "default_884")] pub resolved_at: Option, - #[serde(default = "default_883")] + #[serde(default = "default_885")] pub total: Option, } @@ -17419,13 +17445,13 @@ pub enum ConnectionEntryKind { pub struct ConnectionEntry { pub kind: ConnectionEntryKind, pub connected: bool, - #[serde(default = "default_884")] + #[serde(default = "default_886")] pub connect_available: bool, - #[serde(default = "default_885")] + #[serde(default = "default_887")] pub stored: bool, - #[serde(default = "default_886")] + #[serde(default = "default_888")] pub account_email: Option, - #[serde(default = "default_887")] + #[serde(default = "default_889")] pub scopes: Vec, pub connect_url: String, } @@ -17600,23 +17626,23 @@ impl ConsolidationsListInput { pub struct ContextFetchOutput { pub found: bool, pub blob_key: String, - #[serde(default = "default_888")] + #[serde(default = "default_890")] pub content: String, - #[serde(default = "default_889")] + #[serde(default = "default_891")] pub content_type: String, - #[serde(default = "default_890")] + #[serde(default = "default_892")] pub summary: String, - #[serde(default = "default_891")] + #[serde(default = "default_893")] pub total_chars: Integer, - #[serde(default = "default_892")] + #[serde(default = "default_894")] pub total_lines: Integer, - #[serde(default = "default_893")] + #[serde(default = "default_895")] pub offset: Integer, - #[serde(default = "default_894")] + #[serde(default = "default_896")] pub next_offset: Integer, - #[serde(default = "default_895")] + #[serde(default = "default_897")] pub matched_lines: Integer, - #[serde(default = "default_896")] + #[serde(default = "default_898")] pub expires_at: Option, } @@ -17910,9 +17936,9 @@ pub enum ConversationAppendOutputReason { pub struct ConversationAppendOutput { pub msg_id: String, pub ts: String, - #[serde(default = "default_897")] + #[serde(default = "default_899")] pub stored: bool, - #[serde(default = "default_898")] + #[serde(default = "default_900")] pub reason: ConversationAppendOutputReason, } @@ -18061,13 +18087,13 @@ impl ConversationAppendInput { pub struct ConversationCompactOutput { pub compacted: bool, pub messages_summarized: Integer, - #[serde(default = "default_899")] + #[serde(default = "default_901")] pub summary_msg_id: String, - #[serde(default = "default_900")] + #[serde(default = "default_902")] pub tokens_in: Integer, - #[serde(default = "default_901")] + #[serde(default = "default_903")] pub tokens_out: Integer, - #[serde(default = "default_902")] + #[serde(default = "default_904")] pub reason: String, } @@ -18331,7 +18357,7 @@ pub enum ConversationEntryRole { #[non_exhaustive] pub struct ConversationEntry { pub msg_id: String, - #[serde(default = "default_911")] + #[serde(default = "default_913")] pub agent: String, pub role: ConversationEntryRole, pub content: String, @@ -18348,25 +18374,25 @@ pub struct ConversationEntry { pub struct ConversationGetOutput { pub found: bool, pub thread_id: String, - #[serde(default = "default_903")] + #[serde(default = "default_905")] pub title: String, - #[serde(default = "default_904")] + #[serde(default = "default_906")] pub metadata: std::collections::HashMap, - #[serde(default = "default_905")] + #[serde(default = "default_907")] pub run_id: String, - #[serde(default = "default_906")] + #[serde(default = "default_908")] pub user_id: String, - #[serde(default = "default_907")] + #[serde(default = "default_909")] pub agent: String, - #[serde(default = "default_908")] + #[serde(default = "default_910")] pub created_at: Option, - #[serde(default = "default_909")] + #[serde(default = "default_911")] pub updated_at: Option, - #[serde(default = "default_910")] - pub msg_count: Integer, #[serde(default = "default_912")] + pub msg_count: Integer, + #[serde(default = "default_914")] pub messages: Vec, - #[serde(default = "default_913")] + #[serde(default = "default_915")] pub next_cursor: Option, } @@ -18480,7 +18506,7 @@ impl ConversationGetInput { #[non_exhaustive] pub struct ConversationListOutput { pub rows: Vec, - #[serde(default = "default_914")] + #[serde(default = "default_916")] pub next_cursor: Option, } @@ -18626,7 +18652,7 @@ pub struct SavedMessageHit { #[non_exhaustive] pub struct ConversationListSavedMessagesOutput { pub rows: Vec, - #[serde(default = "default_915")] + #[serde(default = "default_917")] pub next_cursor: Option, } @@ -18766,7 +18792,7 @@ pub struct ConversationSaveMessageOutput { pub conversation_id: String, pub message_id: String, pub indexed: bool, - #[serde(default = "default_916")] + #[serde(default = "default_918")] pub reason: ConversationSaveMessageOutputReason, pub ts: String, } @@ -18939,7 +18965,7 @@ pub struct ConversationHit { pub role: ConversationHitRole, pub content_excerpt: String, pub ts: String, - #[serde(default = "default_917")] + #[serde(default = "default_919")] pub namespace: String, } @@ -18947,7 +18973,7 @@ pub struct ConversationHit { #[non_exhaustive] pub struct ConversationSearchOutput { pub hits: Vec, - #[serde(default = "default_918")] + #[serde(default = "default_920")] pub namespaces_skipped: Vec, } @@ -19480,7 +19506,7 @@ pub struct ConversationUnsaveMessageOutput { pub conversation_id: String, pub message_id: String, pub found: bool, - #[serde(default = "default_919")] + #[serde(default = "default_921")] pub removed: bool, pub ts: String, } @@ -19553,7 +19579,7 @@ impl ConversationUnsaveMessageInput { pub struct ConversationUpdateOutput { pub updated: bool, pub thread_id: String, - #[serde(default = "default_920")] + #[serde(default = "default_922")] pub updated_at: Option, } @@ -19658,17 +19684,17 @@ impl ConversationUpdateInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CostAgentSummaryRow { - #[serde(default = "default_921")] + #[serde(default = "default_923")] pub namespace: Option, - #[serde(default = "default_922")] + #[serde(default = "default_924")] pub agent: Option, - #[serde(default = "default_923")] + #[serde(default = "default_925")] pub day: Option, - #[serde(default = "default_924")] + #[serde(default = "default_926")] pub model: Option, - #[serde(default = "default_925")] + #[serde(default = "default_927")] pub consumer: Option, - #[serde(default = "default_926")] + #[serde(default = "default_928")] pub session_id: Option, pub turns: Integer, pub sessions: Integer, @@ -19817,18 +19843,18 @@ pub enum BudgetStatusOutputCapSource { #[non_exhaustive] pub struct BudgetStatusOutput { pub namespace: String, - #[serde(default = "default_927")] + #[serde(default = "default_929")] pub user_id: Option, #[serde(deserialize_with = "required_nullable")] pub spent_24h_usd: Option, pub cap_usd: f64, pub cap_source: BudgetStatusOutputCapSource, pub over_cap: bool, - #[serde(default = "default_928")] + #[serde(default = "default_930")] pub namespace_over_cap: Option, - #[serde(default = "default_929")] + #[serde(default = "default_931")] pub pct_of_cap: Option, - #[serde(default = "default_930")] + #[serde(default = "default_932")] pub namespaces_with_spend: Integer, } @@ -19901,11 +19927,11 @@ impl BudgetStatusInput { pub struct CostRecordTurnsOutput { pub recorded: Integer, pub priced: Integer, - #[serde(default = "default_931")] + #[serde(default = "default_933")] pub unpriced_models: Vec, - #[serde(default = "default_932")] + #[serde(default = "default_934")] pub cost_usd: f64, - #[serde(default = "default_933")] + #[serde(default = "default_935")] pub turns_dated_ahead: Integer, } @@ -20076,25 +20102,25 @@ impl CostRecordTurnsInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CostSummaryRow { - #[serde(default = "default_934")] + #[serde(default = "default_936")] pub namespace: Option, - #[serde(default = "default_935")] + #[serde(default = "default_937")] pub agent: Option, - #[serde(default = "default_936")] + #[serde(default = "default_938")] pub day: Option, - #[serde(default = "default_937")] + #[serde(default = "default_939")] pub operation: Option, - #[serde(default = "default_938")] + #[serde(default = "default_940")] pub memory_key: Option, - #[serde(default = "default_939")] + #[serde(default = "default_941")] pub user_id: Option, - #[serde(default = "default_940")] + #[serde(default = "default_942")] pub model: Option, - #[serde(default = "default_941")] + #[serde(default = "default_943")] pub traffic_class: Option, - #[serde(default = "default_942")] + #[serde(default = "default_944")] pub instance_label: Option, - #[serde(default = "default_943")] + #[serde(default = "default_945")] pub build_commit: Option, pub ops: Integer, pub errors: Integer, @@ -20104,9 +20130,9 @@ pub struct CostSummaryRow { pub latency_p50_ms: f64, pub latency_p95_ms: f64, pub latency_p99_ms: f64, - #[serde(default = "default_944")] + #[serde(default = "default_946")] pub cache_hits: Integer, - #[serde(default = "default_945")] + #[serde(default = "default_947")] pub cache_saved_usd: f64, } @@ -20117,9 +20143,9 @@ pub struct CostSummaryOutput { pub total_ops: Integer, pub total_errors: Integer, pub total_cost_usd: f64, - #[serde(default = "default_946")] + #[serde(default = "default_948")] pub cache_hits: Integer, - #[serde(default = "default_947")] + #[serde(default = "default_949")] pub cache_saved_usd: f64, } @@ -20306,31 +20332,31 @@ pub enum DecisionRowStage { #[non_exhaustive] pub struct DecisionRow { pub memory_key: String, - #[serde(default = "default_948")] + #[serde(default = "default_950")] pub category: String, - #[serde(default = "default_949")] + #[serde(default = "default_951")] pub scenario: String, - #[serde(default = "default_950")] + #[serde(default = "default_952")] pub reasoning: String, - #[serde(default = "default_951")] + #[serde(default = "default_953")] pub outcome: String, - #[serde(default = "default_952")] + #[serde(default = "default_954")] pub alternatives: Vec, - #[serde(default = "default_953")] + #[serde(default = "default_955")] pub confidence: Option, - #[serde(default = "default_954")] + #[serde(default = "default_956")] pub decision_maker: String, - #[serde(default = "default_955")] + #[serde(default = "default_957")] pub run_id: String, - #[serde(default = "default_956")] + #[serde(default = "default_958")] pub realized_outcome: String, - #[serde(default = "default_957")] + #[serde(default = "default_959")] pub success: Option, - #[serde(default = "default_958")] + #[serde(default = "default_960")] pub made_at: String, - #[serde(default = "default_959")] + #[serde(default = "default_961")] pub stage: DecisionRowStage, - #[serde(default = "default_960")] + #[serde(default = "default_962")] pub similarity: f64, } @@ -20342,7 +20368,7 @@ pub struct ChainNodeRow { pub relation: String, pub direction: String, pub via: String, - #[serde(default = "default_962")] + #[serde(default = "default_964")] pub decision: Option, } @@ -20350,7 +20376,7 @@ pub struct ChainNodeRow { #[non_exhaustive] pub struct DecisionChainOutput { pub seed: String, - #[serde(default = "default_961")] + #[serde(default = "default_963")] pub seed_decision: Option, pub nodes: Vec, } @@ -20435,7 +20461,7 @@ impl DecisionChainInput { pub struct DecisionOutcomeOutput { pub memory_key: String, pub updated: bool, - #[serde(default = "default_963")] + #[serde(default = "default_965")] pub memories_credited: Integer, } @@ -20513,7 +20539,7 @@ impl DecisionOutcomeInput { #[non_exhaustive] pub struct DecisionPrecedentsOutput { pub precedents: Vec, - #[serde(default = "default_964")] + #[serde(default = "default_966")] pub embedding_model: String, } @@ -20608,11 +20634,11 @@ impl DecisionPrecedentsInput { pub struct DecisionRecordOutput { pub memory_key: String, pub record_id: String, - #[serde(default = "default_965")] + #[serde(default = "default_967")] pub superseded_prior: bool, - #[serde(default = "default_966")] + #[serde(default = "default_968")] pub edges_written: Integer, - #[serde(default = "default_967")] + #[serde(default = "default_969")] pub next: String, } @@ -20888,7 +20914,7 @@ pub enum ErasureExportOutputScopeType { pub struct ErasureExportSection { pub rows: Vec>, pub count: Integer, - #[serde(default = "default_968")] + #[serde(default = "default_970")] pub truncated: bool, } @@ -21001,17 +21027,17 @@ pub struct ErasureListRow { pub requester: String, pub status: ErasureListRowStatus, pub requested_at: String, - #[serde(default = "default_969")] + #[serde(default = "default_971")] pub completed_at: Option, - #[serde(default = "default_970")] + #[serde(default = "default_972")] pub failure_reason: String, - #[serde(default = "default_971")] + #[serde(default = "default_973")] pub steps_completed_count: Integer, - #[serde(default = "default_972")] + #[serde(default = "default_974")] pub reversals_count: Integer, - #[serde(default = "default_973")] + #[serde(default = "default_975")] pub residue_count: Integer, - #[serde(default = "default_974")] + #[serde(default = "default_976")] pub verified_at: Option, } @@ -21108,7 +21134,7 @@ pub enum ErasureRequestOutputStatus { pub struct ErasureStepResult { pub step: String, pub rows_affected: Integer, - #[serde(default = "default_975")] + #[serde(default = "default_977")] pub notes: String, } @@ -21119,21 +21145,21 @@ pub struct ErasureRequestOutput { pub status: ErasureRequestOutputStatus, pub steps: Vec, pub requested_at: String, - #[serde(default = "default_976")] + #[serde(default = "default_978")] pub completed_at: Option, - #[serde(default = "default_977")] + #[serde(default = "default_979")] pub residue_count: Integer, - #[serde(default = "default_978")] + #[serde(default = "default_980")] pub residue: std::collections::HashMap, - #[serde(default = "default_979")] + #[serde(default = "default_981")] pub verified_at: Option, - #[serde(default = "default_980")] + #[serde(default = "default_982")] pub census: Option>, - #[serde(default = "default_981")] + #[serde(default = "default_983")] pub purge: bool, - #[serde(default = "default_982")] + #[serde(default = "default_984")] pub failure_reason: String, - #[serde(default = "default_983")] + #[serde(default = "default_985")] pub steps_completed: Vec, } @@ -21245,33 +21271,33 @@ pub enum ErasureStatusOutputStatus { pub struct ErasureStatusOutput { pub found: bool, pub erasure_id: String, - #[serde(default = "default_984")] + #[serde(default = "default_986")] pub org: Option, - #[serde(default = "default_985")] + #[serde(default = "default_987")] pub scope_type: Option, - #[serde(default = "default_986")] + #[serde(default = "default_988")] pub scope_value: Option, - #[serde(default = "default_987")] + #[serde(default = "default_989")] pub requester: Option, - #[serde(default = "default_988")] + #[serde(default = "default_990")] pub status: Option, - #[serde(default = "default_989")] + #[serde(default = "default_991")] pub current_step: Option, - #[serde(default = "default_990")] + #[serde(default = "default_992")] pub requested_at: Option, - #[serde(default = "default_991")] + #[serde(default = "default_993")] pub completed_at: Option, - #[serde(default = "default_992")] + #[serde(default = "default_994")] pub failure_reason: Option, - #[serde(default = "default_993")] + #[serde(default = "default_995")] pub residue_count: Integer, - #[serde(default = "default_994")] + #[serde(default = "default_996")] pub residue: std::collections::HashMap, - #[serde(default = "default_995")] + #[serde(default = "default_997")] pub verified_at: Option, - #[serde(default = "default_996")] + #[serde(default = "default_998")] pub census: Option>, - #[serde(default = "default_997")] + #[serde(default = "default_999")] pub purge: bool, } @@ -21308,9 +21334,9 @@ pub enum ExtractionPolicyOutputScope { #[non_exhaustive] pub struct NamespacePolicy { pub namespace: String, - #[serde(default = "default_1003")] + #[serde(default = "default_1005")] pub updated_by: String, - #[serde(default = "default_1004")] + #[serde(default = "default_1006")] pub updated_at: Option, } @@ -21319,17 +21345,17 @@ pub struct NamespacePolicy { pub struct ExtractionPolicyOutput { pub org: String, pub scope: ExtractionPolicyOutputScope, - #[serde(default = "default_998")] + #[serde(default = "default_1000")] pub namespace: String, - #[serde(default = "default_999")] + #[serde(default = "default_1001")] pub policy: String, - #[serde(default = "default_1000")] + #[serde(default = "default_1002")] pub updated_by: String, - #[serde(default = "default_1001")] + #[serde(default = "default_1003")] pub updated_at: Option, - #[serde(default = "default_1002")] + #[serde(default = "default_1004")] pub effective: String, - #[serde(default = "default_1005")] + #[serde(default = "default_1007")] pub namespace_policies: Vec, } @@ -21563,13 +21589,13 @@ pub struct FactRow { pub object: String, pub co_occur: Integer, pub last_seen: String, - #[serde(default = "default_1006")] + #[serde(default = "default_1008")] pub provenance: String, - #[serde(default = "default_1007")] + #[serde(default = "default_1009")] pub source_keys: Vec, - #[serde(default = "default_1008")] + #[serde(default = "default_1010")] pub sources: Vec, - #[serde(default = "default_1009")] + #[serde(default = "default_1011")] pub stale: bool, } @@ -21577,7 +21603,7 @@ pub struct FactRow { #[non_exhaustive] pub struct FactsListOutput { pub rows: Vec, - #[serde(default = "default_1010")] + #[serde(default = "default_1012")] pub truncated: bool, } @@ -21796,14 +21822,14 @@ impl FactsListInput { pub struct PathEdge { pub entity_a: String, pub entity_b: String, - #[serde(default = "default_1011")] + #[serde(default = "default_1013")] pub relation: String, - #[serde(default = "default_1012")] + #[serde(default = "default_1014")] pub direction: String, pub co_occur: Integer, - #[serde(default = "default_1013")] + #[serde(default = "default_1015")] pub valid_from: Option, - #[serde(default = "default_1014")] + #[serde(default = "default_1016")] pub valid_to: Option, } @@ -22034,23 +22060,23 @@ pub struct TraversalNode { pub hop: Integer, pub cumulative_weight: f64, pub via_co_occur: Integer, - #[serde(default = "default_1016")] + #[serde(default = "default_1018")] pub hub: bool, - #[serde(default = "default_1017")] + #[serde(default = "default_1019")] pub degree: Integer, - #[serde(default = "default_1018")] + #[serde(default = "default_1020")] pub via_relation: String, - #[serde(default = "default_1019")] + #[serde(default = "default_1021")] pub via_direction: String, - #[serde(default = "default_1020")] + #[serde(default = "default_1022")] pub via_provenance: String, - #[serde(default = "default_1021")] + #[serde(default = "default_1023")] pub valid_from: String, - #[serde(default = "default_1022")] + #[serde(default = "default_1024")] pub valid_to: String, - #[serde(default = "default_1023")] + #[serde(default = "default_1025")] pub community_id: Option, - #[serde(default = "default_1024")] + #[serde(default = "default_1026")] pub path: Vec, } @@ -22058,12 +22084,12 @@ pub struct TraversalNode { #[non_exhaustive] pub struct FactsTraverseOutput { pub seed: String, - #[serde(default = "default_1015")] + #[serde(default = "default_1017")] pub seed_community_id: Option, pub nodes: Vec, - #[serde(default = "default_1025")] + #[serde(default = "default_1027")] pub truncated: bool, - #[serde(default = "default_1026")] + #[serde(default = "default_1028")] pub hubs: Vec, } @@ -22272,7 +22298,7 @@ pub struct GrantsApproveOutput { pub subject: String, pub namespace: String, pub decision: GrantsApproveOutputDecision, - #[serde(default = "default_1027")] + #[serde(default = "default_1029")] pub role: Option, pub decided_at: String, } @@ -22551,9 +22577,9 @@ pub struct GrantEntry { #[non_exhaustive] pub struct GrantsListOutput { pub rows: Vec, - #[serde(default = "default_1028")] + #[serde(default = "default_1030")] pub next_cursor: Option, - #[serde(default = "default_1029")] + #[serde(default = "default_1031")] pub truncated: bool, } @@ -22669,12 +22695,12 @@ pub enum PendingForMeEntryRequestedRole { #[non_exhaustive] pub struct PendingForMeEntry { pub namespace: String, - #[serde(default = "default_1030")] + #[serde(default = "default_1032")] pub kind: String, pub subject: String, pub current_role: PendingForMeEntryCurrentRole, pub requested_role: PendingForMeEntryRequestedRole, - #[serde(default = "default_1031")] + #[serde(default = "default_1033")] pub pending_since: Option, } @@ -22733,7 +22759,7 @@ impl GrantsPendingForMeInput { #[non_exhaustive] pub struct GrantsRevokeOutput { pub revoked: bool, - #[serde(default = "default_1032")] + #[serde(default = "default_1034")] pub revoked_at: Option, } @@ -22863,7 +22889,7 @@ impl GrantsShareAgentInput { #[non_exhaustive] pub struct GrantsUnshareAgentOutput { pub revoked: bool, - #[serde(default = "default_1033")] + #[serde(default = "default_1035")] pub revoked_at: Option, } @@ -22923,7 +22949,7 @@ pub enum HelpGetOutputAudience { pub struct HelpOutlineEntry { pub section: String, pub anchor: String, - #[serde(default = "default_1041")] + #[serde(default = "default_1043")] pub heading: String, } @@ -22933,21 +22959,21 @@ pub struct HelpGetOutput { pub available: bool, pub found: bool, pub path: String, - #[serde(default = "default_1034")] + #[serde(default = "default_1036")] pub title: String, - #[serde(default = "default_1035")] + #[serde(default = "default_1037")] pub section: String, - #[serde(default = "default_1036")] + #[serde(default = "default_1038")] pub anchor: String, - #[serde(default = "default_1037")] + #[serde(default = "default_1039")] pub audience: HelpGetOutputAudience, - #[serde(default = "default_1038")] + #[serde(default = "default_1040")] pub text: String, - #[serde(default = "default_1039")] + #[serde(default = "default_1041")] pub truncated: bool, - #[serde(default = "default_1040")] - pub next_offset: Integer, #[serde(default = "default_1042")] + pub next_offset: Integer, + #[serde(default = "default_1044")] pub sections: Vec, } @@ -23092,21 +23118,21 @@ pub struct InboxPayload { pub inbox: String, pub owner_agent: String, pub owner_namespace: String, - #[serde(default = "default_1043")] + #[serde(default = "default_1045")] pub description: String, - #[serde(default = "default_1044")] + #[serde(default = "default_1046")] pub posters: Vec, - #[serde(default = "default_1045")] + #[serde(default = "default_1047")] pub accept_disclosure: Vec, pub default_lease_seconds: Integer, pub max_attempts: Integer, pub max_defers: Integer, pub triage_escalate_after_seconds: Integer, - #[serde(default = "default_1046")] + #[serde(default = "default_1048")] pub webhook_url: String, - #[serde(default = "default_1047")] + #[serde(default = "default_1049")] pub created_by: String, - #[serde(default = "default_1048")] + #[serde(default = "default_1050")] pub owner_subject: String, pub created_at: String, pub updated_at: String, @@ -23216,9 +23242,9 @@ pub struct PolicyPayload { pub poster: String, pub kind: String, pub mode: PolicyPayloadMode, - #[serde(default = "default_1049")] + #[serde(default = "default_1051")] pub require_evidence: Vec, - #[serde(default = "default_1050")] + #[serde(default = "default_1052")] pub set_by: String, pub set_at: String, pub version: Integer, @@ -23288,7 +23314,7 @@ impl InboxPolicyListInput { pub struct InboxPolicySetOutput { #[serde(deserialize_with = "required_nullable")] pub policy: Option, - #[serde(default = "default_1051")] + #[serde(default = "default_1053")] pub removed: bool, } @@ -23417,15 +23443,15 @@ pub struct Principal { pub subject: String, pub label: String, pub kind: PrincipalKind, - #[serde(default = "default_1052")] + #[serde(default = "default_1054")] pub namespaces: Vec, - #[serde(default = "default_1053")] + #[serde(default = "default_1055")] pub roles: Vec, - #[serde(default = "default_1054")] + #[serde(default = "default_1056")] pub last_seen: Option, - #[serde(default = "default_1055")] + #[serde(default = "default_1057")] pub can_already_post: bool, - #[serde(default = "default_1056")] + #[serde(default = "default_1058")] pub listed: bool, } @@ -23787,15 +23813,15 @@ pub struct AnalysisColumn { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct InsightsQueryOutput { - #[serde(default = "default_1057")] + #[serde(default = "default_1059")] pub columns: Vec, - #[serde(default = "default_1058")] + #[serde(default = "default_1060")] pub rows: Vec>, - #[serde(default = "default_1059")] + #[serde(default = "default_1061")] pub row_count: Integer, - #[serde(default = "default_1060")] + #[serde(default = "default_1062")] pub truncated: bool, - #[serde(default = "default_1061")] + #[serde(default = "default_1063")] pub sql_digest: String, } @@ -24094,32 +24120,32 @@ pub struct DatasetOut { pub dataset_id: String, pub source_uri: String, pub name: String, - #[serde(default = "default_1062")] + #[serde(default = "default_1064")] pub sheet: String, - #[serde(default = "default_1063")] + #[serde(default = "default_1065")] pub row_start: Integer, - #[serde(default = "default_1064")] + #[serde(default = "default_1066")] pub row_end: Integer, pub revision: Integer, pub snapshot_id: String, pub schema_state: String, pub columns: Vec, - #[serde(default = "default_1065")] + #[serde(default = "default_1067")] pub clarifications: Vec, pub row_count: Integer, - #[serde(default = "default_1066")] + #[serde(default = "default_1068")] pub rejected_rows: Integer, - #[serde(default = "default_1067")] + #[serde(default = "default_1069")] pub rejected: Vec, - #[serde(default = "default_1068")] + #[serde(default = "default_1070")] pub complete: bool, - #[serde(default = "default_1069")] + #[serde(default = "default_1071")] pub approved_by: String, - #[serde(default = "default_1070")] + #[serde(default = "default_1072")] pub approved_at: Option, - #[serde(default = "default_1071")] + #[serde(default = "default_1073")] pub created_at: Option, - #[serde(default = "default_1072")] + #[serde(default = "default_1074")] pub rows: Vec>, } @@ -24127,9 +24153,9 @@ pub struct DatasetOut { #[non_exhaustive] pub struct KnowledgeDatasetApproveOutput { pub found: bool, - #[serde(default = "default_1073")] + #[serde(default = "default_1075")] pub dataset: Option, - #[serde(default = "default_1074")] + #[serde(default = "default_1076")] pub retyped: bool, } @@ -24223,9 +24249,9 @@ impl KnowledgeDatasetApproveInput { #[non_exhaustive] pub struct KnowledgeDatasetGetOutput { pub found: bool, - #[serde(default = "default_1075")] + #[serde(default = "default_1077")] pub revision: Integer, - #[serde(default = "default_1076")] + #[serde(default = "default_1078")] pub datasets: Vec, } @@ -24298,7 +24324,7 @@ impl KnowledgeDatasetGetInput { pub struct KnowledgeDocCluster { pub content_sha256: String, pub doc_count: Integer, - #[serde(default = "default_1077")] + #[serde(default = "default_1079")] pub docs: Vec>, } @@ -24308,16 +24334,16 @@ pub struct KnowledgeChunkCluster { pub content_sha256: String, pub chunk_count: Integer, pub uri_count: Integer, - #[serde(default = "default_1079")] + #[serde(default = "default_1081")] pub samples: Vec>, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeDedupListOutput { - #[serde(default = "default_1078")] - pub doc_clusters: Vec, #[serde(default = "default_1080")] + pub doc_clusters: Vec, + #[serde(default = "default_1082")] pub chunk_clusters: Vec, } @@ -24394,7 +24420,7 @@ pub struct KnowledgeDedupResolveOutput { pub canonical_uri: String, pub duplicate_uri: String, pub decision: String, - #[serde(default = "default_1081")] + #[serde(default = "default_1083")] pub superseded_uri: String, } @@ -24513,24 +24539,24 @@ impl KnowledgeDeleteInput { #[non_exhaustive] pub struct KnowledgeFormat { pub format: String, - #[serde(default = "default_1082")] + #[serde(default = "default_1084")] pub extensions: Vec, - #[serde(default = "default_1083")] + #[serde(default = "default_1085")] pub media_types: Vec, - #[serde(default = "default_1084")] + #[serde(default = "default_1086")] pub available: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeFormatsOutput { - #[serde(default = "default_1085")] + #[serde(default = "default_1087")] pub formats: Vec, - #[serde(default = "default_1086")] + #[serde(default = "default_1088")] pub max_upload_bytes: Integer, - #[serde(default = "default_1087")] + #[serde(default = "default_1089")] pub refused_extensions: Vec, - #[serde(default = "default_1088")] + #[serde(default = "default_1090")] pub default_format: String, } @@ -24632,7 +24658,7 @@ impl KnowledgeGapsDraftInput { pub struct KnowledgeGap { pub gap_id: String, pub head: String, - #[serde(default = "default_1089")] + #[serde(default = "default_1091")] pub samples: Vec, pub askers: Integer, pub asks: Integer, @@ -24642,13 +24668,13 @@ pub struct KnowledgeGap { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeGapsListOutput { - #[serde(default = "default_1090")] + #[serde(default = "default_1092")] pub gaps: Vec, - #[serde(default = "default_1091")] + #[serde(default = "default_1093")] pub built_at: Option, - #[serde(default = "default_1092")] + #[serde(default = "default_1094")] pub capturing: Option, - #[serde(default = "default_1093")] + #[serde(default = "default_1095")] pub enabled: bool, } @@ -24714,7 +24740,7 @@ pub struct KnowledgeIngestOutput { pub ingestion_id: String, pub state: String, pub source_uri: String, - #[serde(default = "default_1094")] + #[serde(default = "default_1096")] pub namespace: String, } @@ -24933,9 +24959,9 @@ impl KnowledgeIngestInput { #[non_exhaustive] pub struct KnowledgeIngestCancelOutput { pub found: bool, - #[serde(default = "default_1095")] + #[serde(default = "default_1097")] pub state: String, - #[serde(default = "default_1096")] + #[serde(default = "default_1098")] pub cancelled: bool, } @@ -24986,39 +25012,39 @@ impl KnowledgeIngestCancelInput { pub struct KnowledgeIngestStatusOutput { pub found: bool, pub ingestion_id: String, - #[serde(default = "default_1097")] + #[serde(default = "default_1099")] pub source_uri: String, - #[serde(default = "default_1098")] + #[serde(default = "default_1100")] pub state: String, - #[serde(default = "default_1099")] + #[serde(default = "default_1101")] pub stage: String, - #[serde(default = "default_1100")] + #[serde(default = "default_1102")] pub attempts: Integer, - #[serde(default = "default_1101")] + #[serde(default = "default_1103")] pub error_code: String, - #[serde(default = "default_1102")] + #[serde(default = "default_1104")] pub error_message: String, - #[serde(default = "default_1103")] + #[serde(default = "default_1105")] pub format: String, - #[serde(default = "default_1104")] + #[serde(default = "default_1106")] pub coverage: Option>, - #[serde(default = "default_1105")] + #[serde(default = "default_1107")] pub warnings: Vec, - #[serde(default = "default_1106")] + #[serde(default = "default_1108")] pub chunks: Integer, - #[serde(default = "default_1107")] + #[serde(default = "default_1109")] pub revision: Integer, - #[serde(default = "default_1108")] + #[serde(default = "default_1110")] pub expected_revision: Option, - #[serde(default = "default_1109")] + #[serde(default = "default_1111")] pub filename: String, - #[serde(default = "default_1110")] + #[serde(default = "default_1112")] pub retrieval: String, - #[serde(default = "default_1111")] + #[serde(default = "default_1113")] pub cancel_requested: bool, - #[serde(default = "default_1112")] + #[serde(default = "default_1114")] pub created_at: Option, - #[serde(default = "default_1113")] + #[serde(default = "default_1115")] pub updated_at: Option, } @@ -25075,21 +25101,21 @@ pub struct DocumentCount { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct DocumentTotals { - #[serde(default = "default_1114")] + #[serde(default = "default_1116")] pub live: Option, - #[serde(default = "default_1115")] + #[serde(default = "default_1117")] pub deleted: Option, - #[serde(default = "default_1116")] + #[serde(default = "default_1118")] pub newest_ingested_at: Option, - #[serde(default = "default_1117")] + #[serde(default = "default_1119")] pub by_format: Vec, - #[serde(default = "default_1118")] + #[serde(default = "default_1120")] pub by_source_scheme: Vec, - #[serde(default = "default_1119")] + #[serde(default = "default_1121")] pub earlier_revisions: Option, - #[serde(default = "default_1120")] + #[serde(default = "default_1122")] pub unnumbered: Option, - #[serde(default = "default_1121")] + #[serde(default = "default_1123")] pub retired_versions: Option, } @@ -25104,15 +25130,15 @@ pub struct ChunkModelCount { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ChunkTotals { - #[serde(default = "default_1122")] + #[serde(default = "default_1124")] pub embedder_model: String, - #[serde(default = "default_1123")] + #[serde(default = "default_1125")] pub live: Option, - #[serde(default = "default_1124")] + #[serde(default = "default_1126")] pub searchable: Option, - #[serde(default = "default_1125")] + #[serde(default = "default_1127")] pub unembedded: Option, - #[serde(default = "default_1126")] + #[serde(default = "default_1128")] pub by_model: Vec, } @@ -25137,9 +25163,9 @@ pub struct DocumentDecisions { #[non_exhaustive] pub struct DecisionTotals { pub definition: String, - #[serde(default = "default_1127")] + #[serde(default = "default_1129")] pub refs: Vec, - #[serde(default = "default_1128")] + #[serde(default = "default_1130")] pub all_documents: Option, } @@ -25154,7 +25180,7 @@ pub struct DocumentChunks { pub min_chars: Integer, pub median_chars: Integer, pub max_chars: Integer, - #[serde(default = "default_1131")] + #[serde(default = "default_1133")] pub models: Vec, } @@ -25204,11 +25230,11 @@ pub struct IngestJob { pub failure_class: IngestJobFailureClass, pub queued_at: String, pub updated_at: String, - #[serde(default = "default_1136")] + #[serde(default = "default_1138")] pub ended_at: Option, - #[serde(default = "default_1137")] + #[serde(default = "default_1139")] pub next_attempt_at: Option, - #[serde(default = "default_1138")] + #[serde(default = "default_1140")] pub stalled: bool, } @@ -25218,11 +25244,11 @@ pub struct SourceJobs { pub source_uri: String, pub jobs: Integer, pub open_jobs: Integer, - #[serde(default = "default_1135")] + #[serde(default = "default_1137")] pub open_ingestion_id: String, pub latest: IngestJob, pub current: IngestJob, - #[serde(default = "default_1139")] + #[serde(default = "default_1141")] pub replaced: bool, } @@ -25235,18 +25261,18 @@ pub struct InspectDocument { pub source_scheme: String, pub version: Integer, pub revision: Integer, - #[serde(default = "default_1129")] + #[serde(default = "default_1131")] pub ingestion_id: String, pub ingested_at: String, - #[serde(default = "default_1130")] - pub retired_versions: Option, #[serde(default = "default_1132")] + pub retired_versions: Option, + #[serde(default = "default_1134")] pub chunks: Option, - #[serde(default = "default_1133")] + #[serde(default = "default_1135")] pub decisions: Option, - #[serde(default = "default_1134")] + #[serde(default = "default_1136")] pub extraction: Option, - #[serde(default = "default_1140")] + #[serde(default = "default_1142")] pub jobs: Option, } @@ -25291,40 +25317,40 @@ pub struct DocumentFinding { pub kind: DocumentFindingKind, pub rule_version: Integer, pub source_op: String, - #[serde(default = "default_1143")] + #[serde(default = "default_1145")] pub window_seconds: Option, - #[serde(default = "default_1144")] + #[serde(default = "default_1146")] pub population: Option, pub sample_limit: Integer, pub samples_complete: bool, - #[serde(default = "default_1145")] + #[serde(default = "default_1147")] pub evidence: Vec, - #[serde(default = "default_1146")] + #[serde(default = "default_1148")] pub exceptions: String, - #[serde(default = "default_1147")] + #[serde(default = "default_1149")] pub uncertainty: String, pub code: String, pub severity: DocumentFindingSeverity, pub count: Integer, pub share: f64, - #[serde(default = "default_1148")] + #[serde(default = "default_1150")] pub samples: Vec, - #[serde(default = "default_1149")] + #[serde(default = "default_1151")] pub ingested: Integer, - #[serde(default = "default_1150")] + #[serde(default = "default_1152")] pub ingested_samples: Vec, pub detail: String, pub remedy: String, - #[serde(default = "default_1151")] + #[serde(default = "default_1153")] pub refs: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ReportCoverage { - #[serde(default = "default_1153")] + #[serde(default = "default_1155")] pub rules_run: Vec, - #[serde(default = "default_1154")] + #[serde(default = "default_1156")] pub rules_skipped: Vec, pub complete: bool, } @@ -25332,43 +25358,43 @@ pub struct ReportCoverage { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct IngestionTotals { - #[serde(default = "default_1155")] + #[serde(default = "default_1157")] pub sources: Option, - #[serde(default = "default_1156")] + #[serde(default = "default_1158")] pub without_document: Option, - #[serde(default = "default_1157")] + #[serde(default = "default_1159")] pub replaced: Option, - #[serde(default = "default_1158")] + #[serde(default = "default_1160")] pub pending: Option, - #[serde(default = "default_1159")] + #[serde(default = "default_1161")] pub processing: Option, - #[serde(default = "default_1160")] + #[serde(default = "default_1162")] pub stalled: Option, - #[serde(default = "default_1161")] + #[serde(default = "default_1163")] pub ready: Option, - #[serde(default = "default_1162")] + #[serde(default = "default_1164")] pub partial: Option, - #[serde(default = "default_1163")] + #[serde(default = "default_1165")] pub failed: Option, - #[serde(default = "default_1164")] + #[serde(default = "default_1166")] pub cancelled: Option, - #[serde(default = "default_1165")] + #[serde(default = "default_1167")] pub oldest_open_queued_at: Option, pub worker_enabled: bool, - #[serde(default = "default_1166")] + #[serde(default = "default_1168")] pub extractor_configured: Option, - #[serde(default = "default_1167")] + #[serde(default = "default_1169")] pub without_document_listed: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ExtractionTotals { - #[serde(default = "default_1168")] + #[serde(default = "default_1170")] pub documents: Option, - #[serde(default = "default_1169")] + #[serde(default = "default_1171")] pub incomplete: Option, - #[serde(default = "default_1170")] + #[serde(default = "default_1172")] pub lost: Vec, } @@ -25398,31 +25424,31 @@ pub struct IngestFinding { pub kind: IngestFindingKind, pub rule_version: Integer, pub source_op: String, - #[serde(default = "default_1171")] + #[serde(default = "default_1173")] pub window_seconds: Option, - #[serde(default = "default_1172")] + #[serde(default = "default_1174")] pub population: Option, pub sample_limit: Integer, pub samples_complete: bool, - #[serde(default = "default_1173")] + #[serde(default = "default_1175")] pub evidence: Vec, - #[serde(default = "default_1174")] + #[serde(default = "default_1176")] pub exceptions: String, - #[serde(default = "default_1175")] + #[serde(default = "default_1177")] pub uncertainty: String, pub code: String, pub severity: IngestFindingSeverity, pub count: Integer, pub share: f64, - #[serde(default = "default_1176")] + #[serde(default = "default_1178")] pub samples: Vec, - #[serde(default = "default_1177")] + #[serde(default = "default_1179")] pub ingestion_ids: Vec, - #[serde(default = "default_1178")] + #[serde(default = "default_1180")] pub without_document: Integer, pub detail: String, pub remedy: String, - #[serde(default = "default_1179")] + #[serde(default = "default_1181")] pub refs: Vec, } @@ -25449,20 +25475,20 @@ pub struct KnowledgeInspectOutput { pub documents: DocumentTotals, pub chunks: ChunkTotals, pub decisions: DecisionTotals, - #[serde(default = "default_1141")] + #[serde(default = "default_1143")] pub listed: Vec, - #[serde(default = "default_1142")] + #[serde(default = "default_1144")] pub listed_complete: bool, - #[serde(default = "default_1152")] + #[serde(default = "default_1154")] pub findings: Vec, pub coverage: ReportCoverage, pub ingestions: IngestionTotals, pub extraction: ExtractionTotals, - #[serde(default = "default_1180")] + #[serde(default = "default_1182")] pub ingest_findings: Vec, - #[serde(default = "default_1181")] + #[serde(default = "default_1183")] pub memory_findings: Vec, - #[serde(default = "default_1182")] + #[serde(default = "default_1184")] pub skipped: Vec, } @@ -25609,7 +25635,7 @@ pub struct KnowledgeListEntry { #[non_exhaustive] pub struct KnowledgeListOutput { pub rows: Vec, - #[serde(default = "default_1183")] + #[serde(default = "default_1185")] pub next_cursor: Option, } @@ -25775,9 +25801,9 @@ pub enum KnowledgeMoveResultReason { #[non_exhaustive] pub struct KnowledgeMoveResult { pub source_uri: String, - #[serde(default = "default_1185")] + #[serde(default = "default_1187")] pub moved: bool, - #[serde(default = "default_1186")] + #[serde(default = "default_1188")] pub reason: KnowledgeMoveResultReason, } @@ -25785,9 +25811,9 @@ pub struct KnowledgeMoveResult { #[non_exhaustive] pub struct KnowledgeMoveOutput { pub found: bool, - #[serde(default = "default_1184")] + #[serde(default = "default_1186")] pub to_namespace: String, - #[serde(default = "default_1187")] + #[serde(default = "default_1189")] pub results: Vec, } @@ -25853,17 +25879,17 @@ pub struct OutlineEntry { pub struct KnowledgeOutlineOutput { pub found: bool, pub source_uri: String, - #[serde(default = "default_1188")] + #[serde(default = "default_1190")] pub title: String, - #[serde(default = "default_1189")] + #[serde(default = "default_1191")] pub structured: bool, - #[serde(default = "default_1190")] + #[serde(default = "default_1192")] pub chunk_count: Integer, - #[serde(default = "default_1191")] + #[serde(default = "default_1193")] pub sections: Vec, - #[serde(default = "default_1192")] + #[serde(default = "default_1194")] pub section_content: Option, - #[serde(default = "default_1193")] + #[serde(default = "default_1195")] pub section_chunk_idxs: Vec, } @@ -25970,12 +25996,12 @@ pub struct QueryReceipt { pub struct KnowledgeQueryOutput { pub columns: Vec, pub rows: Vec>, - #[serde(default = "default_1194")] + #[serde(default = "default_1196")] pub row_ids: Vec>, - #[serde(default = "default_1195")] + #[serde(default = "default_1197")] pub truncated: bool, pub complete: bool, - #[serde(default = "default_1196")] + #[serde(default = "default_1198")] pub incomplete: Vec, pub receipt: QueryReceipt, } @@ -26648,9 +26674,9 @@ pub struct QueryHistoryListOutputQueryHistorySource { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct QueryHistoryListOutput { - #[serde(default = "default_1197")] + #[serde(default = "default_1199")] pub enabled: bool, - #[serde(default = "default_1198")] + #[serde(default = "default_1200")] pub sources: Vec, } @@ -26781,7 +26807,7 @@ impl QueryHistoryRemoveInput { #[non_exhaustive] pub struct KnowledgeReadsOutput { pub window_days: Integer, - #[serde(default = "default_1199")] + #[serde(default = "default_1201")] pub reads: Vec>, } @@ -26884,15 +26910,15 @@ pub enum KnowledgeRestoreOutputOriginal { #[non_exhaustive] pub struct KnowledgeRestoreOutput { pub restored: bool, - #[serde(default = "default_1200")] + #[serde(default = "default_1202")] pub reason: KnowledgeRestoreOutputReason, - #[serde(default = "default_1201")] + #[serde(default = "default_1203")] pub doc_id: String, - #[serde(default = "default_1202")] + #[serde(default = "default_1204")] pub revision: Option, - #[serde(default = "default_1203")] + #[serde(default = "default_1205")] pub chunks_restored: Integer, - #[serde(default = "default_1204")] + #[serde(default = "default_1206")] pub original: KnowledgeRestoreOutputOriginal, } @@ -26965,35 +26991,35 @@ pub struct KnowledgeSourceCrawlProof { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceProbe { - #[serde(default = "default_1209")] + #[serde(default = "default_1211")] pub documents: Integer, - #[serde(default = "default_1210")] + #[serde(default = "default_1212")] pub more: bool, - #[serde(default = "default_1211")] + #[serde(default = "default_1213")] pub sample: Vec, - #[serde(default = "default_1212")] + #[serde(default = "default_1214")] pub checked: Integer, - #[serde(default = "default_1213")] + #[serde(default = "default_1215")] pub sampled: bool, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceAddOutput { - #[serde(default = "default_1205")] + #[serde(default = "default_1207")] pub crawl_proof: Option, pub name: String, pub kind: String, pub namespace: String, - #[serde(default = "default_1206")] + #[serde(default = "default_1208")] pub items: Vec>, - #[serde(default = "default_1207")] + #[serde(default = "default_1209")] pub include: Vec, - #[serde(default = "default_1208")] + #[serde(default = "default_1210")] pub config: std::collections::HashMap, - #[serde(default = "default_1214")] + #[serde(default = "default_1216")] pub probe: KnowledgeSourceProbe, - #[serde(default = "default_1215")] + #[serde(default = "default_1217")] pub dry_run: bool, } @@ -27210,21 +27236,21 @@ impl KnowledgeSourceAddInput { #[non_exhaustive] pub struct KnowledgeSourceCheckOutput { pub name: String, - #[serde(default = "default_1216")] + #[serde(default = "default_1218")] pub reachable: bool, - #[serde(default = "default_1217")] + #[serde(default = "default_1219")] pub documents: Integer, - #[serde(default = "default_1218")] + #[serde(default = "default_1220")] pub more: bool, - #[serde(default = "default_1219")] + #[serde(default = "default_1221")] pub sample: Vec, - #[serde(default = "default_1220")] + #[serde(default = "default_1222")] pub checked: Integer, - #[serde(default = "default_1221")] + #[serde(default = "default_1223")] pub sampled: bool, - #[serde(default = "default_1222")] + #[serde(default = "default_1224")] pub summary: String, - #[serde(default = "default_1223")] + #[serde(default = "default_1225")] pub checked_at: String, } @@ -27273,37 +27299,37 @@ impl KnowledgeSourceCheckInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceSync { - #[serde(default = "default_1234")] + #[serde(default = "default_1236")] pub requested_at: String, - #[serde(default = "default_1235")] + #[serde(default = "default_1237")] pub last_synced_at: String, - #[serde(default = "default_1236")] + #[serde(default = "default_1238")] pub status: String, - #[serde(default = "default_1237")] + #[serde(default = "default_1239")] pub documents_seen: Integer, - #[serde(default = "default_1238")] + #[serde(default = "default_1240")] pub changed: Integer, - #[serde(default = "default_1239")] + #[serde(default = "default_1241")] pub removed: Integer, - #[serde(default = "default_1240")] + #[serde(default = "default_1242")] pub unconverted: Integer, - #[serde(default = "default_1241")] + #[serde(default = "default_1243")] pub unconverted_reasons: std::collections::HashMap, - #[serde(default = "default_1242")] + #[serde(default = "default_1244")] pub skipped: Integer, - #[serde(default = "default_1243")] + #[serde(default = "default_1245")] pub error: String, - #[serde(default = "default_1244")] + #[serde(default = "default_1246")] pub pending_extract: Integer, - #[serde(default = "default_1245")] + #[serde(default = "default_1247")] pub last_extracted_at: String, - #[serde(default = "default_1246")] + #[serde(default = "default_1248")] pub extracted: Integer, - #[serde(default = "default_1247")] + #[serde(default = "default_1249")] pub flagged_pinned: Integer, - #[serde(default = "default_1248")] + #[serde(default = "default_1250")] pub unextracted: Integer, - #[serde(default = "default_1249")] + #[serde(default = "default_1251")] pub extract_error: String, } @@ -27311,11 +27337,11 @@ pub struct KnowledgeSourceSync { #[non_exhaustive] pub struct KnowledgeSourceDocument { pub source_uri: String, - #[serde(default = "default_1251")] + #[serde(default = "default_1253")] pub title: String, - #[serde(default = "default_1252")] + #[serde(default = "default_1254")] pub source_revision: String, - #[serde(default = "default_1253")] + #[serde(default = "default_1255")] pub ingested_at: String, } @@ -27324,29 +27350,29 @@ pub struct KnowledgeSourceDocument { pub struct KnowledgeSourceInspectOutput { pub name: String, pub kind: String, - #[serde(default = "default_1224")] + #[serde(default = "default_1226")] pub credential_mode: String, - #[serde(default = "default_1225")] + #[serde(default = "default_1227")] pub owned_by_caller: bool, - #[serde(default = "default_1226")] + #[serde(default = "default_1228")] pub access: String, - #[serde(default = "default_1227")] + #[serde(default = "default_1229")] pub crawl_options: std::collections::HashMap, - #[serde(default = "default_1228")] + #[serde(default = "default_1230")] pub owner_subject: String, - #[serde(default = "default_1229")] + #[serde(default = "default_1231")] pub items: Vec>, - #[serde(default = "default_1230")] + #[serde(default = "default_1232")] pub include: Vec, - #[serde(default = "default_1231")] + #[serde(default = "default_1233")] pub config: std::collections::HashMap, - #[serde(default = "default_1232")] + #[serde(default = "default_1234")] pub created_by: String, - #[serde(default = "default_1233")] + #[serde(default = "default_1235")] pub created_at: String, - #[serde(default = "default_1250")] + #[serde(default = "default_1252")] pub sync: KnowledgeSourceSync, - #[serde(default = "default_1254")] + #[serde(default = "default_1256")] pub documents: Vec, } @@ -27399,40 +27425,40 @@ impl KnowledgeSourceInspectInput { pub struct KnowledgeSourceEntry { pub name: String, pub kind: String, - #[serde(default = "default_1255")] + #[serde(default = "default_1257")] pub credential_mode: String, - #[serde(default = "default_1256")] + #[serde(default = "default_1258")] pub owned_by_caller: bool, - #[serde(default = "default_1257")] + #[serde(default = "default_1259")] pub access: String, - #[serde(default = "default_1258")] + #[serde(default = "default_1260")] pub crawl_options: std::collections::HashMap, - #[serde(default = "default_1259")] + #[serde(default = "default_1261")] pub owner_subject: String, - #[serde(default = "default_1260")] + #[serde(default = "default_1262")] pub items: Vec>, - #[serde(default = "default_1261")] + #[serde(default = "default_1263")] pub include: Vec, - #[serde(default = "default_1262")] + #[serde(default = "default_1264")] pub config: std::collections::HashMap, - #[serde(default = "default_1263")] + #[serde(default = "default_1265")] pub created_by: String, - #[serde(default = "default_1264")] + #[serde(default = "default_1266")] pub created_at: String, - #[serde(default = "default_1265")] + #[serde(default = "default_1267")] pub sync: KnowledgeSourceSync, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceListOutput { - #[serde(default = "default_1266")] + #[serde(default = "default_1268")] pub sources: Vec, - #[serde(default = "default_1267")] + #[serde(default = "default_1269")] pub enabled: bool, - #[serde(default = "default_1268")] + #[serde(default = "default_1270")] pub accepts_sources: bool, - #[serde(default = "default_1269")] + #[serde(default = "default_1271")] pub self_service: bool, } @@ -27485,18 +27511,18 @@ impl KnowledgeSourceListInput { #[non_exhaustive] pub struct KnowledgeSourceParsedLink { pub link: String, - #[serde(default = "default_1270")] + #[serde(default = "default_1272")] pub kind: String, - #[serde(default = "default_1271")] + #[serde(default = "default_1273")] pub item: std::collections::HashMap, - #[serde(default = "default_1272")] + #[serde(default = "default_1274")] pub unreadable: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceParseLinksOutput { - #[serde(default = "default_1273")] + #[serde(default = "default_1275")] pub links: Vec, } @@ -27547,25 +27573,25 @@ impl KnowledgeSourceParseLinksInput { #[derive(Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct PushStatusOutput { - #[serde(default = "default_1274")] + #[serde(default = "default_1276")] pub enabled: bool, - #[serde(default = "default_1275")] + #[serde(default = "default_1277")] pub status: String, - #[serde(default = "default_1276")] + #[serde(default = "default_1278")] pub provider: String, - #[serde(default = "default_1277")] + #[serde(default = "default_1279")] pub generation: String, - #[serde(default = "default_1278")] + #[serde(default = "default_1280")] pub callback_url: String, - #[serde(default = "default_1279")] + #[serde(default = "default_1281")] pub provider_id: String, - #[serde(default = "default_1280")] + #[serde(default = "default_1282")] pub challenge_fingerprint: String, - #[serde(default = "default_1281")] + #[serde(default = "default_1283")] pub verification_token: String, - #[serde(default = "default_1282")] + #[serde(default = "default_1284")] pub channels: Integer, - #[serde(default = "default_1283")] + #[serde(default = "default_1285")] pub expires_at: f64, } impl std::fmt::Debug for PushStatusOutput { @@ -27810,7 +27836,7 @@ impl PushStatusInput { #[non_exhaustive] pub struct KnowledgeSourceRemoveOutput { pub name: String, - #[serde(default = "default_1284")] + #[serde(default = "default_1286")] pub documents_pending: Integer, } @@ -27872,12 +27898,12 @@ impl KnowledgeSourceRemoveInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceRotateOutput { - #[serde(default = "default_1285")] + #[serde(default = "default_1287")] pub crawl_proof: Option, pub name: String, - #[serde(default = "default_1286")] + #[serde(default = "default_1288")] pub probe: KnowledgeSourceProbe, - #[serde(default = "default_1287")] + #[serde(default = "default_1289")] pub rotated_at: String, } @@ -27929,7 +27955,7 @@ impl KnowledgeSourceRotateInput { #[non_exhaustive] pub struct KnowledgeSourceSyncNowOutput { pub name: String, - #[serde(default = "default_1288")] + #[serde(default = "default_1290")] pub enabled: bool, } @@ -27991,20 +28017,20 @@ impl KnowledgeSourceSyncNowInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KnowledgeSourceUpdateOutput { - #[serde(default = "default_1289")] + #[serde(default = "default_1291")] pub crawl_proof: Option, pub name: String, - #[serde(default = "default_1290")] + #[serde(default = "default_1292")] pub items: Vec>, - #[serde(default = "default_1291")] + #[serde(default = "default_1293")] pub include: Vec, - #[serde(default = "default_1292")] + #[serde(default = "default_1294")] pub config: std::collections::HashMap, - #[serde(default = "default_1293")] + #[serde(default = "default_1295")] pub added: Vec>, - #[serde(default = "default_1294")] + #[serde(default = "default_1296")] pub removed: Vec>, - #[serde(default = "default_1295")] + #[serde(default = "default_1297")] pub probe: KnowledgeSourceProbe, } @@ -28135,9 +28161,9 @@ impl KnowledgeSourceUpdateInput { pub struct CitedChunk { pub source_uri: String, pub chunk_idx: Integer, - #[serde(default = "default_1297")] + #[serde(default = "default_1299")] pub revision: Integer, - #[serde(default = "default_1298")] + #[serde(default = "default_1300")] pub locator: Option>, } @@ -28146,12 +28172,12 @@ pub struct CitedChunk { pub struct SynthesizeCalculation { pub columns: Vec, pub rows: Vec>, - #[serde(default = "default_1305")] + #[serde(default = "default_1307")] pub row_ids: Vec>, - #[serde(default = "default_1306")] + #[serde(default = "default_1308")] pub truncated: bool, pub complete: bool, - #[serde(default = "default_1307")] + #[serde(default = "default_1309")] pub incomplete: Vec, pub receipt: QueryReceipt, pub citation: String, @@ -28165,23 +28191,23 @@ pub struct KnowledgeSynthesizeOutput { pub chunks_read: Integer, pub documents: Integer, pub reduce_rounds: Integer, - #[serde(default = "default_1296")] + #[serde(default = "default_1298")] pub citations: Vec, - #[serde(default = "default_1299")] + #[serde(default = "default_1301")] pub cited_chunks: Vec, - #[serde(default = "default_1300")] + #[serde(default = "default_1302")] pub unsupported_citations: Vec, - #[serde(default = "default_1301")] + #[serde(default = "default_1303")] pub truncated: bool, - #[serde(default = "default_1302")] + #[serde(default = "default_1304")] pub abstain: bool, - #[serde(default = "default_1303")] + #[serde(default = "default_1305")] pub abstain_reason: String, - #[serde(default = "default_1304")] + #[serde(default = "default_1306")] pub clarification: String, - #[serde(default = "default_1308")] + #[serde(default = "default_1310")] pub calculations: Vec, - #[serde(default = "default_1309")] + #[serde(default = "default_1311")] pub model: String, } @@ -28297,13 +28323,13 @@ impl KnowledgeSynthesizeInput { #[non_exhaustive] pub struct KnowledgeUpdateMetadataOutput { pub updated: bool, - #[serde(default = "default_1310")] + #[serde(default = "default_1312")] pub title: String, - #[serde(default = "default_1311")] + #[serde(default = "default_1313")] pub description: String, - #[serde(default = "default_1312")] + #[serde(default = "default_1314")] pub tags: Vec, - #[serde(default = "default_1313")] + #[serde(default = "default_1315")] pub chunks_reindexed: Integer, } @@ -28415,13 +28441,13 @@ pub struct KnowledgeUpsertOutput { pub chunks_superseded: Integer, pub embedding_model: String, pub embedding_dim: Integer, - #[serde(default = "default_1314")] + #[serde(default = "default_1316")] pub duplicate_of_uri: String, - #[serde(default = "default_1315")] + #[serde(default = "default_1317")] pub duplicate_chunk_count: Integer, - #[serde(default = "default_1316")] + #[serde(default = "default_1318")] pub namespace: String, - #[serde(default = "default_1317")] + #[serde(default = "default_1319")] pub source_uri: String, } @@ -28606,26 +28632,26 @@ pub struct LearningEntry { pub memory_type: String, pub proposed_value: Value, pub supporter_count: Integer, - #[serde(default = "default_1318")] + #[serde(default = "default_1320")] pub supporter_sessions: Integer, - #[serde(default = "default_1319")] + #[serde(default = "default_1321")] pub supporter_writers: Integer, pub confidence_avg: f64, pub supporters: Vec, pub rationale: String, - #[serde(default = "default_1320")] + #[serde(default = "default_1322")] pub source_kind: String, - #[serde(default = "default_1321")] + #[serde(default = "default_1323")] pub source_resource_id: String, - #[serde(default = "default_1322")] + #[serde(default = "default_1324")] pub agent: String, pub status: LearningEntryStatus, pub proposed_at: String, - #[serde(default = "default_1323")] + #[serde(default = "default_1325")] pub decided_at: Option, - #[serde(default = "default_1324")] + #[serde(default = "default_1326")] pub decided_by: String, - #[serde(default = "default_1325")] + #[serde(default = "default_1327")] pub decision_reason: String, } @@ -28828,11 +28854,11 @@ pub enum LearningsReviewOutputNewStatus { pub struct LearningsReviewOutput { pub candidate_id: String, pub new_status: LearningsReviewOutputNewStatus, - #[serde(default = "default_1326")] + #[serde(default = "default_1328")] pub promoted_to_shared: bool, - #[serde(default = "default_1327")] + #[serde(default = "default_1329")] pub promoted_to_knowledge: bool, - #[serde(default = "default_1328")] + #[serde(default = "default_1330")] pub knowledge_source_uri: String, pub decided_at: String, } @@ -29036,7 +29062,7 @@ impl MemoryAgentsListInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct AggregateRow { - #[serde(default = "default_1329")] + #[serde(default = "default_1331")] pub group: std::collections::HashMap, pub metric: f64, } @@ -29044,9 +29070,9 @@ pub struct AggregateRow { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryAggregateOutput { - #[serde(default = "default_1330")] + #[serde(default = "default_1332")] pub rows: Vec, - #[serde(default = "default_1331")] + #[serde(default = "default_1333")] pub sql_executed: String, } @@ -29214,15 +29240,15 @@ impl MemoryAggregateInput { pub struct BulkSetResult { pub memory_key: String, pub version: Integer, - #[serde(default = "default_1332")] + #[serde(default = "default_1334")] pub memory_id: String, - #[serde(default = "default_1333")] + #[serde(default = "default_1335")] pub conflict_verdict: String, - #[serde(default = "default_1334")] + #[serde(default = "default_1336")] pub peers: Vec, - #[serde(default = "default_1335")] + #[serde(default = "default_1337")] pub next: String, - #[serde(default = "default_1336")] + #[serde(default = "default_1338")] pub pinned_blocker_id: String, } @@ -29230,29 +29256,29 @@ pub struct BulkSetResult { #[non_exhaustive] pub struct MemoryBulkSetOutput { pub written: Vec, - #[serde(default = "default_1337")] + #[serde(default = "default_1339")] pub skipped_pinned: Vec, - #[serde(default = "default_1338")] + #[serde(default = "default_1340")] pub skipped_locked: Vec, - #[serde(default = "default_1339")] + #[serde(default = "default_1341")] pub skipped_blacklisted: Vec, - #[serde(default = "default_1340")] + #[serde(default = "default_1342")] pub merged: Vec, - #[serde(default = "default_1341")] + #[serde(default = "default_1343")] pub value_updates_linked: Integer, - #[serde(default = "default_1342")] + #[serde(default = "default_1344")] pub rejected_pinned: Vec, - #[serde(default = "default_1343")] + #[serde(default = "default_1345")] pub duplicates: Vec, - #[serde(default = "default_1344")] + #[serde(default = "default_1346")] pub conflicted: Vec, - #[serde(default = "default_1345")] + #[serde(default = "default_1347")] pub unchecked: Integer, - #[serde(default = "default_1346")] + #[serde(default = "default_1348")] pub retyped: Vec, - #[serde(default = "default_1347")] + #[serde(default = "default_1349")] pub identity_duplicates: std::collections::HashMap, - #[serde(default = "default_1348")] + #[serde(default = "default_1350")] pub stage_ms: std::collections::HashMap, } @@ -29402,18 +29428,18 @@ pub enum ApplyRowStatus { #[non_exhaustive] pub struct ApplyRow { pub memory_key: String, - #[serde(default = "default_1356")] + #[serde(default = "default_1358")] pub memory_id: String, - #[serde(default = "default_1357")] + #[serde(default = "default_1359")] pub agent: String, - #[serde(default = "default_1358")] + #[serde(default = "default_1360")] pub user_id: String, - #[serde(default = "default_1359")] + #[serde(default = "default_1361")] pub session_id: String, pub status: ApplyRowStatus, - #[serde(default = "default_1360")] + #[serde(default = "default_1362")] pub version: Option, - #[serde(default = "default_1361")] + #[serde(default = "default_1363")] pub detail: String, } @@ -29423,21 +29449,21 @@ pub struct MemoryApplyOutput { pub action: String, pub dry_run: bool, pub target: String, - #[serde(default = "default_1349")] + #[serde(default = "default_1351")] pub matched: Integer, - #[serde(default = "default_1350")] + #[serde(default = "default_1352")] pub applied: Integer, - #[serde(default = "default_1351")] + #[serde(default = "default_1353")] pub would_apply: Integer, - #[serde(default = "default_1352")] + #[serde(default = "default_1354")] pub refused: Integer, - #[serde(default = "default_1353")] + #[serde(default = "default_1355")] pub noop: Integer, - #[serde(default = "default_1354")] + #[serde(default = "default_1356")] pub failed: Integer, - #[serde(default = "default_1355")] + #[serde(default = "default_1357")] pub truncated: bool, - #[serde(default = "default_1362")] + #[serde(default = "default_1364")] pub rows: Vec, } @@ -30171,137 +30197,137 @@ pub enum MemoryAskOutputDeepFirst { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryAskOutput { - #[serde(default = "default_1363")] + #[serde(default = "default_1365")] pub answer: String, - #[serde(default = "default_1364")] + #[serde(default = "default_1366")] pub source: MemoryAskOutputSource, - #[serde(default = "default_1365")] + #[serde(default = "default_1367")] pub abstain: bool, - #[serde(default = "default_1366")] + #[serde(default = "default_1368")] pub abstain_reason: String, - #[serde(default = "default_1367")] + #[serde(default = "default_1369")] pub memory_keys: Vec, - #[serde(default = "default_1368")] + #[serde(default = "default_1370")] pub results: Vec, - #[serde(default = "default_1369")] + #[serde(default = "default_1371")] pub cited_sessions: Vec, - #[serde(default = "default_1370")] + #[serde(default = "default_1372")] pub next: String, - #[serde(default = "default_1371")] + #[serde(default = "default_1373")] pub synth_model: String, - #[serde(default = "default_1372")] + #[serde(default = "default_1374")] pub route_tier: MemoryAskOutputRouteTier, - #[serde(default = "default_1373")] + #[serde(default = "default_1375")] pub route_reason: String, - #[serde(default = "default_1374")] + #[serde(default = "default_1376")] pub llm_cache_hits: Integer, - #[serde(default = "default_1375")] + #[serde(default = "default_1377")] pub llm_cache_misses: Integer, - #[serde(default = "default_1376")] + #[serde(default = "default_1378")] pub llm_cache: bool, - #[serde(default = "default_1377")] + #[serde(default = "default_1379")] pub llm_cache_saved_usd: f64, - #[serde(default = "default_1378")] + #[serde(default = "default_1380")] pub temporal_consistency: Option, - #[serde(default = "default_1379")] + #[serde(default = "default_1381")] pub citation_concentration: Option, - #[serde(default = "default_1380")] + #[serde(default = "default_1382")] pub escalated: bool, - #[serde(default = "default_1381")] + #[serde(default = "default_1383")] pub gate_mode: String, - #[serde(default = "default_1382")] + #[serde(default = "default_1384")] pub gate_kept: Integer, - #[serde(default = "default_1383")] + #[serde(default = "default_1385")] pub gate_dropped: Integer, - #[serde(default = "default_1384")] + #[serde(default = "default_1386")] pub pending_extraction: Integer, - #[serde(default = "default_1385")] + #[serde(default = "default_1387")] pub pending_evidence: Integer, - #[serde(default = "default_1386")] + #[serde(default = "default_1388")] pub retrieval_query: String, - #[serde(default = "default_1387")] + #[serde(default = "default_1389")] pub facets: Vec, - #[serde(default = "default_1388")] + #[serde(default = "default_1390")] pub facet_memories_added: Integer, - #[serde(default = "default_1389")] + #[serde(default = "default_1391")] pub consistency: MemoryAskOutputConsistency, - #[serde(default = "default_1390")] + #[serde(default = "default_1392")] pub consistency_score: f64, - #[serde(default = "default_1391")] + #[serde(default = "default_1393")] pub consistency_note: String, - #[serde(default = "default_1392")] + #[serde(default = "default_1394")] pub identifier_chase_hops: Integer, - #[serde(default = "default_1393")] + #[serde(default = "default_1395")] pub identifier_chase_added: Integer, - #[serde(default = "default_1394")] + #[serde(default = "default_1396")] pub premise_conflict: String, - #[serde(default = "default_1395")] + #[serde(default = "default_1397")] pub premise_note: String, - #[serde(default = "default_1396")] + #[serde(default = "default_1398")] pub premise_verdict: String, - #[serde(default = "default_1397")] + #[serde(default = "default_1399")] pub attribution_note: String, - #[serde(default = "default_1398")] + #[serde(default = "default_1400")] pub depth: MemoryAskOutputDepth, - #[serde(default = "default_1399")] + #[serde(default = "default_1401")] pub deep_fired: bool, - #[serde(default = "default_1400")] + #[serde(default = "default_1402")] pub decomposed: Vec, - #[serde(default = "default_1401")] + #[serde(default = "default_1403")] pub decomposed_parts: Integer, - #[serde(default = "default_1402")] + #[serde(default = "default_1404")] pub superseded_dropped: Integer, - #[serde(default = "default_1403")] + #[serde(default = "default_1405")] pub stale_sentences_masked: Integer, - #[serde(default = "default_1404")] + #[serde(default = "default_1406")] pub entity_followed: Vec, - #[serde(default = "default_1405")] + #[serde(default = "default_1407")] pub when_evidence_turns: Integer, - #[serde(default = "default_1406")] + #[serde(default = "default_1408")] pub decompose_failed: Integer, - #[serde(default = "default_1407")] + #[serde(default = "default_1409")] pub pool_k: Integer, - #[serde(default = "default_1408")] + #[serde(default = "default_1410")] pub grounding: MemoryAskOutputGrounding, - #[serde(default = "default_1409")] + #[serde(default = "default_1411")] pub deep_reason: String, - #[serde(default = "default_1410")] + #[serde(default = "default_1412")] pub deep_keys: Vec, - #[serde(default = "default_1411")] + #[serde(default = "default_1413")] pub deep_chars: Integer, - #[serde(default = "default_1412")] + #[serde(default = "default_1414")] pub code_hits: Integer, - #[serde(default = "default_1413")] + #[serde(default = "default_1415")] pub pool_facts: Integer, - #[serde(default = "default_1414")] + #[serde(default = "default_1416")] pub pool_chunks: Integer, - #[serde(default = "default_1415")] + #[serde(default = "default_1417")] pub prompt_blocks: std::collections::HashMap, - #[serde(default = "default_1416")] + #[serde(default = "default_1418")] pub deep_selector: MemoryAskOutputDeepSelector, - #[serde(default = "default_1417")] + #[serde(default = "default_1419")] pub deep_first: MemoryAskOutputDeepFirst, - #[serde(default = "default_1418")] + #[serde(default = "default_1420")] pub synth_calls: Integer, - #[serde(default = "default_1419")] + #[serde(default = "default_1421")] pub synth_input_tokens: Integer, - #[serde(default = "default_1420")] + #[serde(default = "default_1422")] pub synth_cached_input_tokens: Integer, - #[serde(default = "default_1421")] + #[serde(default = "default_1423")] pub synth_cache_write_tokens: Integer, - #[serde(default = "default_1422")] + #[serde(default = "default_1424")] pub synth_cost_usd: f64, - #[serde(default = "default_1423")] + #[serde(default = "default_1425")] pub context_tokens_est: Integer, - #[serde(default = "default_1424")] + #[serde(default = "default_1426")] pub context_trimmed: Integer, - #[serde(default = "default_1425")] + #[serde(default = "default_1427")] pub summary_hits: Integer, - #[serde(default = "default_1426")] + #[serde(default = "default_1428")] pub knowledge_hits: Integer, - #[serde(default = "default_1427")] + #[serde(default = "default_1429")] pub timeline_rows: Integer, - #[serde(default = "default_1428")] + #[serde(default = "default_1430")] pub count_recomputed: bool, } @@ -31256,36 +31282,36 @@ pub struct MemoryAutoRetirement { pub reason: String, pub memory_id: String, pub memory_key: String, - #[serde(default = "default_1429")] + #[serde(default = "default_1431")] pub agent: String, - #[serde(default = "default_1430")] + #[serde(default = "default_1432")] pub user_id: String, - #[serde(default = "default_1431")] + #[serde(default = "default_1433")] pub session_id: String, - #[serde(default = "default_1432")] + #[serde(default = "default_1434")] pub superseded_by: String, - #[serde(default = "default_1433")] + #[serde(default = "default_1435")] pub superseded_by_key: String, - #[serde(default = "default_1434")] + #[serde(default = "default_1436")] pub label: String, - #[serde(default = "default_1435")] + #[serde(default = "default_1437")] pub unconfirmed: bool, - #[serde(default = "default_1436")] + #[serde(default = "default_1438")] pub judge_verdict: String, - #[serde(default = "default_1437")] + #[serde(default = "default_1439")] pub judge_confidence: Option, - #[serde(default = "default_1438")] + #[serde(default = "default_1440")] pub judge_model: String, - #[serde(default = "default_1439")] + #[serde(default = "default_1441")] pub judge_prompt_version: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryAutoRetirementsOutput { - #[serde(default = "default_1440")] + #[serde(default = "default_1442")] pub rows: Vec, - #[serde(default = "default_1441")] + #[serde(default = "default_1443")] pub next_cursor: Option, } @@ -31379,9 +31405,9 @@ impl MemoryAutoRetirementsInput { #[non_exhaustive] pub struct BacklinkVersion { pub version: Integer, - #[serde(default = "default_1443")] + #[serde(default = "default_1445")] pub status: String, - #[serde(default = "default_1444")] + #[serde(default = "default_1446")] pub created_at: String, } @@ -31389,7 +31415,7 @@ pub struct BacklinkVersion { #[non_exhaustive] pub struct BacklinkDigest { pub session_id: String, - #[serde(default = "default_1446")] + #[serde(default = "default_1448")] pub date: String, } @@ -31397,9 +31423,9 @@ pub struct BacklinkDigest { #[non_exhaustive] pub struct BacklinkEdge { pub memory_key: String, - #[serde(default = "default_1448")] + #[serde(default = "default_1450")] pub relation: String, - #[serde(default = "default_1449")] + #[serde(default = "default_1451")] pub created_at: String, } @@ -31407,7 +31433,7 @@ pub struct BacklinkEdge { #[non_exhaustive] pub struct BacklinkRelated { pub memory_key: String, - #[serde(default = "default_1453")] + #[serde(default = "default_1455")] pub shared_entities: Vec, } @@ -31415,19 +31441,19 @@ pub struct BacklinkRelated { #[non_exhaustive] pub struct MemoryBacklinksOutput { pub memory_key: String, - #[serde(default = "default_1442")] + #[serde(default = "default_1444")] pub found: bool, - #[serde(default = "default_1445")] - pub versions: Vec, #[serde(default = "default_1447")] + pub versions: Vec, + #[serde(default = "default_1449")] pub digests: Vec, - #[serde(default = "default_1450")] + #[serde(default = "default_1452")] pub links_in: Vec, - #[serde(default = "default_1451")] + #[serde(default = "default_1453")] pub links_out: Vec, - #[serde(default = "default_1452")] - pub evidence_count: Integer, #[serde(default = "default_1454")] + pub evidence_count: Integer, + #[serde(default = "default_1456")] pub related: Vec, } @@ -31532,36 +31558,36 @@ impl MemoryBacklinksInput { #[non_exhaustive] pub struct BriefEvidence { pub memory_key: String, - #[serde(default = "default_1459")] + #[serde(default = "default_1461")] pub source: String, - #[serde(default = "default_1460")] + #[serde(default = "default_1462")] pub source_class: String, - #[serde(default = "default_1461")] + #[serde(default = "default_1463")] pub verified: bool, - #[serde(default = "default_1462")] + #[serde(default = "default_1464")] pub when: String, - #[serde(default = "default_1463")] + #[serde(default = "default_1465")] pub session_id: String, - #[serde(default = "default_1464")] + #[serde(default = "default_1466")] pub excerpt: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryBriefOutput { - #[serde(default = "default_1455")] + #[serde(default = "default_1457")] pub query: String, - #[serde(default = "default_1456")] + #[serde(default = "default_1458")] pub answer: String, - #[serde(default = "default_1457")] + #[serde(default = "default_1459")] pub abstained: bool, - #[serde(default = "default_1458")] + #[serde(default = "default_1460")] pub grounding: String, - #[serde(default = "default_1465")] + #[serde(default = "default_1467")] pub evidence: Vec, - #[serde(default = "default_1466")] + #[serde(default = "default_1468")] pub unknowns: Vec, - #[serde(default = "default_1467")] + #[serde(default = "default_1469")] pub next_reads: Vec, } @@ -31975,9 +32001,9 @@ pub struct MemoryBulkGetOutputMemoryGetOutput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryBulkGetOutput { - #[serde(default = "default_1468")] + #[serde(default = "default_1470")] pub results: std::collections::HashMap, - #[serde(default = "default_1469")] + #[serde(default = "default_1471")] pub missing: Vec, } @@ -32490,7 +32516,7 @@ pub struct MemoryClearOutput { pub cleared_at: String, pub rows_affected: std::collections::HashMap, pub total: Integer, - #[serde(default = "default_1470")] + #[serde(default = "default_1472")] pub locked_skipped: Integer, } @@ -32578,21 +32604,21 @@ pub struct MemoryConsolidateResult { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryConsolidateOutput { - #[serde(default = "default_1471")] + #[serde(default = "default_1473")] pub consolidated: Vec, - #[serde(default = "default_1472")] + #[serde(default = "default_1474")] pub examined: Integer, - #[serde(default = "default_1473")] + #[serde(default = "default_1475")] pub clusters_found: Integer, - #[serde(default = "default_1474")] + #[serde(default = "default_1476")] pub clusters_failed: Integer, - #[serde(default = "default_1475")] + #[serde(default = "default_1477")] pub clusters_refused_lossy: Integer, - #[serde(default = "default_1476")] + #[serde(default = "default_1478")] pub skipped_in_flight: Integer, - #[serde(default = "default_1477")] + #[serde(default = "default_1479")] pub tokens_in: Integer, - #[serde(default = "default_1478")] + #[serde(default = "default_1480")] pub tokens_out: Integer, } @@ -32733,7 +32759,7 @@ impl MemoryConsolidateInput { #[non_exhaustive] pub struct MemoryCopyToOutput { pub copied: bool, - #[serde(default = "default_1479")] + #[serde(default = "default_1481")] pub target_memory_id: String, pub target_namespace: String, pub target_key: String, @@ -32844,11 +32870,11 @@ impl MemoryCopyToInput { #[non_exhaustive] pub struct MemoryCrossPromoteOutput { pub promoted: bool, - #[serde(default = "default_1480")] + #[serde(default = "default_1482")] pub target_memory_id: String, pub target_namespace: String, pub target_key: String, - #[serde(default = "default_1481")] + #[serde(default = "default_1483")] pub cross_promoted_from_memory_id: String, } @@ -32931,23 +32957,23 @@ pub struct DedupCollapsePair { #[non_exhaustive] pub struct MemoryDedupCollapseOutput { pub namespace: String, - #[serde(default = "default_1482")] + #[serde(default = "default_1484")] pub prefix: String, - #[serde(default = "default_1483")] + #[serde(default = "default_1485")] pub dry_run: bool, - #[serde(default = "default_1484")] + #[serde(default = "default_1486")] pub pairs: Integer, - #[serde(default = "default_1485")] + #[serde(default = "default_1487")] pub canonical_live: Integer, - #[serde(default = "default_1486")] + #[serde(default = "default_1488")] pub orphans: Integer, - #[serde(default = "default_1487")] + #[serde(default = "default_1489")] pub mirror_stale: Integer, - #[serde(default = "default_1488")] + #[serde(default = "default_1490")] pub restamped: Integer, - #[serde(default = "default_1489")] + #[serde(default = "default_1491")] pub truncated: bool, - #[serde(default = "default_1490")] + #[serde(default = "default_1492")] pub sample: Vec, } @@ -33046,7 +33072,7 @@ pub struct DedupDuplicate { pub memory_id: String, pub memory_key: String, pub agent: String, - #[serde(default = "default_1493")] + #[serde(default = "default_1495")] pub created_at: Option, } @@ -33054,12 +33080,12 @@ pub struct DedupDuplicate { #[non_exhaustive] pub struct DedupCluster { pub canonical_id: String, - #[serde(default = "default_1491")] + #[serde(default = "default_1493")] pub canonical_key: String, - #[serde(default = "default_1492")] + #[serde(default = "default_1494")] pub canonical_agent: String, pub dup_count: Integer, - #[serde(default = "default_1494")] + #[serde(default = "default_1496")] pub duplicates: Vec, } @@ -33131,11 +33157,11 @@ pub struct MemoryDedupResolveOutput { pub canonical_key: String, pub duplicate_key: String, pub decision: String, - #[serde(default = "default_1495")] + #[serde(default = "default_1497")] pub canonical_tombstoned: bool, - #[serde(default = "default_1496")] + #[serde(default = "default_1498")] pub duplicate_tombstoned: bool, - #[serde(default = "default_1497")] + #[serde(default = "default_1499")] pub ignored_args: Vec, } @@ -33273,17 +33299,17 @@ pub struct LostName { pub struct DefinitionEntry { pub memory_key: String, pub promoted_at: String, - #[serde(default = "default_1498")] + #[serde(default = "default_1500")] pub capped: bool, - #[serde(default = "default_1499")] + #[serde(default = "default_1501")] pub term: Option, - #[serde(default = "default_1500")] + #[serde(default = "default_1502")] pub aliases: Vec, - #[serde(default = "default_1501")] + #[serde(default = "default_1503")] pub verdict: Option, - #[serde(default = "default_1502")] + #[serde(default = "default_1504")] pub lapse_reason: Option, - #[serde(default = "default_1503")] + #[serde(default = "default_1505")] pub lost: Vec, } @@ -33344,15 +33370,15 @@ impl MemoryDefinitionsListInput { #[non_exhaustive] pub struct MemoryDeleteVersionOutput { pub tombstoned: bool, - #[serde(default = "default_1504")] + #[serde(default = "default_1506")] pub version: Integer, - #[serde(default = "default_1505")] + #[serde(default = "default_1507")] pub found: bool, - #[serde(default = "default_1506")] + #[serde(default = "default_1508")] pub reason: String, - #[serde(default = "default_1507")] + #[serde(default = "default_1509")] pub dependents_tombstoned: Integer, - #[serde(default = "default_1508")] + #[serde(default = "default_1510")] pub dependents_downgraded: Integer, } @@ -33479,21 +33505,21 @@ pub struct DemonstrationRow { pub struct MemoryDemonstrateOutput { pub query: String, pub demonstrations: Vec, - #[serde(default = "default_1509")] + #[serde(default = "default_1511")] pub votes: std::collections::HashMap, - #[serde(default = "default_1510")] + #[serde(default = "default_1512")] pub predicted_label: String, - #[serde(default = "default_1511")] + #[serde(default = "default_1513")] pub margin: f64, - #[serde(default = "default_1512")] + #[serde(default = "default_1514")] pub abstain: bool, - #[serde(default = "default_1513")] + #[serde(default = "default_1515")] pub abstain_reason: String, - #[serde(default = "default_1514")] + #[serde(default = "default_1516")] pub few_shot_block: String, - #[serde(default = "default_1515")] + #[serde(default = "default_1517")] pub examined: Integer, - #[serde(default = "default_1516")] + #[serde(default = "default_1518")] pub labelled: Integer, } @@ -33633,7 +33659,7 @@ impl MemoryDemonstrateInput { pub struct MemoryDemoteOutput { pub demoted: bool, pub was_reversible: bool, - #[serde(default = "default_1517")] + #[serde(default = "default_1519")] pub tombstoned_at: Option, } @@ -33695,15 +33721,15 @@ impl MemoryDemoteInput { pub struct DigestRow { pub session_id: String, pub summary_text: String, - #[serde(default = "default_1518")] + #[serde(default = "default_1520")] pub key_facts: Vec, - #[serde(default = "default_1519")] + #[serde(default = "default_1521")] pub derived_from: Vec, - #[serde(default = "default_1520")] + #[serde(default = "default_1522")] pub valid_at: Option, - #[serde(default = "default_1521")] + #[serde(default = "default_1523")] pub created_at: Option, - #[serde(default = "default_1522")] + #[serde(default = "default_1524")] pub version: Integer, } @@ -33711,7 +33737,7 @@ pub struct DigestRow { #[non_exhaustive] pub struct MemoryDigestsOutput { pub rows: Vec, - #[serde(default = "default_1523")] + #[serde(default = "default_1525")] pub truncated: bool, } @@ -33836,17 +33862,17 @@ pub struct MemoryEvidenceItem { pub evidence_id: String, pub support_type: String, pub scope: MemoryEvidenceItemScope, - #[serde(default = "default_1527")] + #[serde(default = "default_1529")] pub role: String, - #[serde(default = "default_1528")] + #[serde(default = "default_1530")] pub observed_at: Option, - #[serde(default = "default_1529")] + #[serde(default = "default_1531")] pub content: String, - #[serde(default = "default_1530")] + #[serde(default = "default_1532")] pub char_start: Integer, - #[serde(default = "default_1531")] + #[serde(default = "default_1533")] pub char_end: Integer, - #[serde(default = "default_1532")] + #[serde(default = "default_1534")] pub span: String, } @@ -33854,23 +33880,23 @@ pub struct MemoryEvidenceItem { #[non_exhaustive] pub struct MemoryEvidenceOutput { pub found: bool, - #[serde(default = "default_1524")] + #[serde(default = "default_1526")] pub memory_key: String, - #[serde(default = "default_1525")] + #[serde(default = "default_1527")] pub memory_id: String, - #[serde(default = "default_1526")] + #[serde(default = "default_1528")] pub value: String, - #[serde(default = "default_1533")] + #[serde(default = "default_1535")] pub items: Vec, - #[serde(default = "default_1534")] + #[serde(default = "default_1536")] pub truncated: bool, - #[serde(default = "default_1535")] + #[serde(default = "default_1537")] pub cited: Integer, - #[serde(default = "default_1536")] + #[serde(default = "default_1538")] pub lexical: Integer, - #[serde(default = "default_1537")] + #[serde(default = "default_1539")] pub window: Integer, - #[serde(default = "default_1538")] + #[serde(default = "default_1540")] pub derived: Integer, } @@ -33975,26 +34001,26 @@ impl MemoryEvidenceInput { #[non_exhaustive] pub struct EvidenceChunk { pub session_id: String, - #[serde(default = "default_1539")] + #[serde(default = "default_1541")] pub chunk_index: Integer, pub content: String, - #[serde(default = "default_1540")] + #[serde(default = "default_1542")] pub content_sha256: String, - #[serde(default = "default_1541")] + #[serde(default = "default_1543")] pub agent: String, - #[serde(default = "default_1542")] + #[serde(default = "default_1544")] pub user_id: String, - #[serde(default = "default_1543")] + #[serde(default = "default_1545")] pub parent_memory_key: String, - #[serde(default = "default_1544")] + #[serde(default = "default_1546")] pub memory_keys: Vec, - #[serde(default = "default_1545")] + #[serde(default = "default_1547")] pub line_start: Integer, - #[serde(default = "default_1546")] + #[serde(default = "default_1548")] pub line_end: Integer, - #[serde(default = "default_1547")] + #[serde(default = "default_1549")] pub created_at: String, - #[serde(default = "default_1548")] + #[serde(default = "default_1550")] pub source_url: String, } @@ -34003,17 +34029,17 @@ pub struct EvidenceChunk { pub struct EvidenceDigest { pub session_id: String, pub summary_text: String, - #[serde(default = "default_1550")] + #[serde(default = "default_1552")] pub agent: String, - #[serde(default = "default_1551")] + #[serde(default = "default_1553")] pub user_id: String, - #[serde(default = "default_1552")] + #[serde(default = "default_1554")] pub key_facts: Vec, - #[serde(default = "default_1553")] + #[serde(default = "default_1555")] pub derived_from: Vec, - #[serde(default = "default_1554")] + #[serde(default = "default_1556")] pub valid_at: String, - #[serde(default = "default_1555")] + #[serde(default = "default_1557")] pub created_at: String, } @@ -34023,28 +34049,28 @@ pub struct EvidenceEdge { pub from_key: String, pub to_key: String, pub relation: String, - #[serde(default = "default_1557")] + #[serde(default = "default_1559")] pub confidence: f64, - #[serde(default = "default_1558")] + #[serde(default = "default_1560")] pub explanation: String, - #[serde(default = "default_1559")] + #[serde(default = "default_1561")] pub created_at: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryExportEvidenceOutput { - #[serde(default = "default_1549")] + #[serde(default = "default_1551")] pub chunks: Vec, - #[serde(default = "default_1556")] + #[serde(default = "default_1558")] pub digests: Vec, - #[serde(default = "default_1560")] + #[serde(default = "default_1562")] pub edges: Vec, - #[serde(default = "default_1561")] + #[serde(default = "default_1563")] pub has_more: bool, - #[serde(default = "default_1562")] + #[serde(default = "default_1564")] pub next_cursor: String, - #[serde(default = "default_1563")] + #[serde(default = "default_1565")] pub held_high: Integer, } @@ -34237,15 +34263,15 @@ impl ExposureSummaryInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryExtractionRetryMineOutput { - #[serde(default = "default_1564")] + #[serde(default = "default_1566")] pub requeued: Vec, - #[serde(default = "default_1565")] + #[serde(default = "default_1567")] pub not_failed: Vec, - #[serde(default = "default_1566")] + #[serde(default = "default_1568")] pub model_calls_off: Vec, - #[serde(default = "default_1567")] + #[serde(default = "default_1569")] pub expired: Vec, - #[serde(default = "default_1568")] + #[serde(default = "default_1570")] pub unknown: Vec, } @@ -34306,20 +34332,20 @@ pub struct ExtractionQueueRow { pub content_chars: Integer, pub written: Integer, pub last_error: String, - #[serde(default = "default_1569")] + #[serde(default = "default_1571")] pub enqueued_at: Option, - #[serde(default = "default_1570")] + #[serde(default = "default_1572")] pub updated_at: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryExtractionStatusOutput { - #[serde(default = "default_1571")] + #[serde(default = "default_1573")] pub batches: Vec, - #[serde(default = "default_1572")] + #[serde(default = "default_1574")] pub pending: Integer, - #[serde(default = "default_1573")] + #[serde(default = "default_1575")] pub failed: Integer, } @@ -34467,13 +34493,13 @@ impl MemoryExtractionStatusInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryExtractionStatusMineOutput { - #[serde(default = "default_1574")] + #[serde(default = "default_1576")] pub batches: Vec, - #[serde(default = "default_1575")] + #[serde(default = "default_1577")] pub unknown: Vec, - #[serde(default = "default_1576")] + #[serde(default = "default_1578")] pub pending: Integer, - #[serde(default = "default_1577")] + #[serde(default = "default_1579")] pub failed: Integer, } @@ -34594,39 +34620,39 @@ pub struct MemoryForFileHit { pub memory_key: String, pub memory_type: String, pub value: String, - #[serde(default = "default_1578")] + #[serde(default = "default_1580")] pub value_truncated: bool, - #[serde(default = "default_1579")] + #[serde(default = "default_1581")] pub tags: Vec, - #[serde(default = "default_1580")] + #[serde(default = "default_1582")] pub confidence: f64, - #[serde(default = "default_1581")] + #[serde(default = "default_1583")] pub pinned: bool, - #[serde(default = "default_1582")] + #[serde(default = "default_1584")] pub status: String, - #[serde(default = "default_1583")] + #[serde(default = "default_1585")] pub agent: String, - #[serde(default = "default_1584")] + #[serde(default = "default_1586")] pub updated_at: Option, - #[serde(default = "default_1585")] + #[serde(default = "default_1587")] pub namespace: String, - #[serde(default = "default_1586")] + #[serde(default = "default_1588")] pub actor: String, - #[serde(default = "default_1587")] + #[serde(default = "default_1589")] pub supersedes_key: String, - #[serde(default = "default_1588")] + #[serde(default = "default_1590")] pub supersedes: String, - #[serde(default = "default_1589")] + #[serde(default = "default_1591")] pub supersedes_kind: MemoryForFileHitSupersedesKind, - #[serde(default = "default_1590")] + #[serde(default = "default_1592")] pub matched_files: Vec, - #[serde(default = "default_1591")] + #[serde(default = "default_1593")] pub source_resource_id: String, - #[serde(default = "default_1592")] + #[serde(default = "default_1594")] pub verification: MemoryForFileHitVerification, - #[serde(default = "default_1593")] + #[serde(default = "default_1595")] pub code_state: MemoryForFileHitCodeState, - #[serde(default = "default_1594")] + #[serde(default = "default_1596")] pub code_moved: Vec, } @@ -34636,7 +34662,7 @@ pub struct MemoryForFilePrintedRow { pub namespace: String, pub memory_key: String, pub line: String, - #[serde(default = "default_1598")] + #[serde(default = "default_1600")] pub binding: bool, } @@ -34646,13 +34672,13 @@ pub struct MemoryForFileOutput { pub path: String, pub total: Integer, pub hits: Vec, - #[serde(default = "default_1595")] + #[serde(default = "default_1597")] pub rendered: String, - #[serde(default = "default_1596")] + #[serde(default = "default_1598")] pub tokens_estimate: Integer, - #[serde(default = "default_1597")] - pub truncated: bool, #[serde(default = "default_1599")] + pub truncated: bool, + #[serde(default = "default_1601")] pub printed: Vec, } @@ -34760,61 +34786,61 @@ impl MemoryForFileInput { #[non_exhaustive] pub struct MemoryGetByIdOutput { pub found: bool, - #[serde(default = "default_1600")] + #[serde(default = "default_1602")] pub memory_id: String, - #[serde(default = "default_1601")] + #[serde(default = "default_1603")] pub namespace: String, - #[serde(default = "default_1602")] + #[serde(default = "default_1604")] pub agent: String, - #[serde(default = "default_1603")] + #[serde(default = "default_1605")] pub user_id: String, - #[serde(default = "default_1604")] + #[serde(default = "default_1606")] pub session_id: String, - #[serde(default = "default_1605")] + #[serde(default = "default_1607")] pub memory_key: String, - #[serde(default = "default_1606")] + #[serde(default = "default_1608")] pub memory_type: Option, - #[serde(default = "default_1607")] + #[serde(default = "default_1609")] pub value: Value, - #[serde(default = "default_1608")] + #[serde(default = "default_1610")] pub confidence: Option, - #[serde(default = "default_1609")] + #[serde(default = "default_1611")] pub version: Option, - #[serde(default = "default_1610")] + #[serde(default = "default_1612")] pub created_at: Option, - #[serde(default = "default_1611")] + #[serde(default = "default_1613")] pub expires_at: Option, - #[serde(default = "default_1612")] + #[serde(default = "default_1614")] pub valid_at: Option, - #[serde(default = "default_1613")] + #[serde(default = "default_1615")] pub valid_to: Option, - #[serde(default = "default_1614")] + #[serde(default = "default_1616")] pub pinned: bool, - #[serde(default = "default_1615")] + #[serde(default = "default_1617")] pub content_sha256: String, - #[serde(default = "default_1616")] + #[serde(default = "default_1618")] pub verified_by: String, - #[serde(default = "default_1617")] + #[serde(default = "default_1619")] pub verified_at: Option, - #[serde(default = "default_1618")] + #[serde(default = "default_1620")] pub verification: String, - #[serde(default = "default_1619")] + #[serde(default = "default_1621")] pub sensitivity: String, - #[serde(default = "default_1620")] + #[serde(default = "default_1622")] pub actor: String, - #[serde(default = "default_1621")] + #[serde(default = "default_1623")] pub source_class: String, - #[serde(default = "default_1622")] + #[serde(default = "default_1624")] pub lock_mode: String, - #[serde(default = "default_1623")] + #[serde(default = "default_1625")] pub lock_reason: String, - #[serde(default = "default_1624")] + #[serde(default = "default_1626")] pub lock_until: Option, - #[serde(default = "default_1625")] + #[serde(default = "default_1627")] pub locked_by: String, - #[serde(default = "default_1626")] + #[serde(default = "default_1628")] pub on_expire: String, - #[serde(default = "default_1627")] + #[serde(default = "default_1629")] pub expire_reason: String, } @@ -34890,41 +34916,41 @@ pub struct MemoryHealthTopRow { pub memory_type: String, pub recall_count: Integer, pub used_count: Integer, - #[serde(default = "default_1630")] + #[serde(default = "default_1632")] pub harm_count: Integer, - #[serde(default = "default_1631")] + #[serde(default = "default_1633")] pub last_recalled_at: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryHealthStaleness { - #[serde(default = "default_1633")] + #[serde(default = "default_1635")] pub by_age: std::collections::HashMap, - #[serde(default = "default_1634")] + #[serde(default = "default_1636")] pub with_validity_end: Integer, - #[serde(default = "default_1635")] + #[serde(default = "default_1637")] pub with_validity_end_share: f64, - #[serde(default = "default_1636")] + #[serde(default = "default_1638")] pub with_expiry: Integer, - #[serde(default = "default_1637")] + #[serde(default = "default_1639")] pub expiring_7d: Integer, - #[serde(default = "default_1638")] + #[serde(default = "default_1640")] pub pinned: Integer, - #[serde(default = "default_1639")] + #[serde(default = "default_1641")] pub days_since_reinforced_p50: Integer, - #[serde(default = "default_1640")] + #[serde(default = "default_1642")] pub days_since_reinforced_p90: Integer, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryHealthFootprint { - #[serde(default = "default_1642")] + #[serde(default = "default_1644")] pub value_chars: Integer, - #[serde(default = "default_1643")] + #[serde(default = "default_1645")] pub value_tokens_est: Integer, - #[serde(default = "default_1644")] + #[serde(default = "default_1646")] pub tokens_per_row_est: f64, } @@ -34934,19 +34960,19 @@ pub struct MemoryHealthOutput { pub live: Integer, pub recalled_ever: Integer, pub used_ever: Integer, - #[serde(default = "default_1628")] + #[serde(default = "default_1630")] pub harmed_ever: Integer, pub silent: Integer, pub silent_older: Integer, pub silent_share: f64, pub silent_after_days: Integer, - #[serde(default = "default_1629")] + #[serde(default = "default_1631")] pub by_type: Vec, - #[serde(default = "default_1632")] + #[serde(default = "default_1634")] pub top_recalled: Vec, - #[serde(default = "default_1641")] + #[serde(default = "default_1643")] pub staleness: MemoryHealthStaleness, - #[serde(default = "default_1645")] + #[serde(default = "default_1647")] pub footprint: MemoryHealthFootprint, } @@ -35066,51 +35092,51 @@ impl MemoryHealthInput { pub struct MemoryHistoryRow { pub memory_id: String, pub version: Integer, - #[serde(default = "default_1646")] + #[serde(default = "default_1648")] pub version_text: String, - #[serde(default = "default_1647")] + #[serde(default = "default_1649")] pub value: Value, pub confidence: f64, - #[serde(default = "default_1648")] + #[serde(default = "default_1650")] pub source_trace: String, - #[serde(default = "default_1649")] + #[serde(default = "default_1651")] pub pinned: bool, pub created_at: String, - #[serde(default = "default_1650")] + #[serde(default = "default_1652")] pub expires_at: Option, - #[serde(default = "default_1651")] + #[serde(default = "default_1653")] pub tombstoned_at: Option, - #[serde(default = "default_1652")] + #[serde(default = "default_1654")] pub redacted_at: Option, - #[serde(default = "default_1653")] + #[serde(default = "default_1655")] pub redaction_reason: String, - #[serde(default = "default_1654")] + #[serde(default = "default_1656")] pub content_sha256: String, - #[serde(default = "default_1655")] + #[serde(default = "default_1657")] pub actor: String, - #[serde(default = "default_1656")] + #[serde(default = "default_1658")] pub source_class: String, - #[serde(default = "default_1657")] + #[serde(default = "default_1659")] pub agent: String, - #[serde(default = "default_1658")] + #[serde(default = "default_1660")] pub written_at: Option, - #[serde(default = "default_1659")] + #[serde(default = "default_1661")] pub status: String, - #[serde(default = "default_1660")] + #[serde(default = "default_1662")] pub conflict_with: Vec, - #[serde(default = "default_1661")] + #[serde(default = "default_1663")] pub tags: Vec, - #[serde(default = "default_1662")] + #[serde(default = "default_1664")] pub verified_at: Option, - #[serde(default = "default_1663")] + #[serde(default = "default_1665")] pub verified_by: String, - #[serde(default = "default_1664")] + #[serde(default = "default_1666")] pub verified_sha256: String, - #[serde(default = "default_1665")] + #[serde(default = "default_1667")] pub lock_mode: String, - #[serde(default = "default_1666")] + #[serde(default = "default_1668")] pub lock_reason: String, - #[serde(default = "default_1667")] + #[serde(default = "default_1669")] pub lock_until: Option, } @@ -35220,13 +35246,13 @@ impl MemoryHistoryInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryImportTotals { - #[serde(default = "default_1668")] + #[serde(default = "default_1670")] pub written: Integer, - #[serde(default = "default_1669")] + #[serde(default = "default_1671")] pub held: Integer, - #[serde(default = "default_1670")] + #[serde(default = "default_1672")] pub skipped: Integer, - #[serde(default = "default_1671")] + #[serde(default = "default_1673")] pub refused: Integer, } @@ -35309,11 +35335,11 @@ pub struct MemoryImportResult { pub index: Integer, pub key: String, pub outcome: MemoryImportResultOutcome, - #[serde(default = "default_1672")] + #[serde(default = "default_1674")] pub reason: MemoryImportResultReason, - #[serde(default = "default_1673")] + #[serde(default = "default_1675")] pub held_by: String, - #[serde(default = "default_1674")] + #[serde(default = "default_1676")] pub note: MemoryImportResultNote, } @@ -35322,7 +35348,7 @@ pub struct MemoryImportResult { pub struct MemoryImportOutput { pub totals: MemoryImportTotals, pub results: Vec, - #[serde(default = "default_1675")] + #[serde(default = "default_1677")] pub dry_run: bool, } @@ -35515,9 +35541,9 @@ pub struct MemoryImportCuratedRow { pub section_heading: String, pub bytes_written: Integer, pub verdict: String, - #[serde(default = "default_1676")] + #[serde(default = "default_1678")] pub rejection_reason: String, - #[serde(default = "default_1677")] + #[serde(default = "default_1679")] pub pinned_blocker_id: Option, } @@ -35609,21 +35635,21 @@ impl MemoryImportCuratedInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryImportEvidenceOutput { - #[serde(default = "default_1678")] + #[serde(default = "default_1680")] pub chunks_written: Integer, - #[serde(default = "default_1679")] + #[serde(default = "default_1681")] pub links_written: Integer, - #[serde(default = "default_1680")] + #[serde(default = "default_1682")] pub digests_written: Integer, - #[serde(default = "default_1681")] + #[serde(default = "default_1683")] pub embedding_model: String, - #[serde(default = "default_1682")] + #[serde(default = "default_1684")] pub embedding_dim: Integer, - #[serde(default = "default_1683")] + #[serde(default = "default_1685")] pub edited: Vec, - #[serde(default = "default_1684")] + #[serde(default = "default_1686")] pub skipped: Integer, - #[serde(default = "default_1685")] + #[serde(default = "default_1687")] pub unchecked: Integer, } @@ -35960,7 +35986,7 @@ pub struct InspectRow { pub memory_key: String, pub memory_id: String, pub version: Integer, - #[serde(default = "default_1695")] + #[serde(default = "default_1697")] pub content_sha256: String, pub memory_type: String, pub status: String, @@ -35971,9 +35997,9 @@ pub struct InspectRow { pub actor: String, pub updated_at: String, pub sensitivity: String, - #[serde(default = "default_1696")] + #[serde(default = "default_1698")] pub versions: Integer, - #[serde(default = "default_1697")] + #[serde(default = "default_1699")] pub excerpt: String, } @@ -35981,27 +36007,27 @@ pub struct InspectRow { #[non_exhaustive] pub struct InspectView { pub definition: String, - #[serde(default = "default_1686")] + #[serde(default = "default_1688")] pub refs: Vec, - #[serde(default = "default_1687")] + #[serde(default = "default_1689")] pub live_rows: Integer, - #[serde(default = "default_1688")] + #[serde(default = "default_1690")] pub by_type: Vec, - #[serde(default = "default_1689")] + #[serde(default = "default_1691")] pub by_status: Vec, - #[serde(default = "default_1690")] + #[serde(default = "default_1692")] pub by_source_class: Vec, - #[serde(default = "default_1691")] + #[serde(default = "default_1693")] pub top_tags: Vec, - #[serde(default = "default_1692")] + #[serde(default = "default_1694")] pub categories: Vec, - #[serde(default = "default_1693")] + #[serde(default = "default_1695")] pub first_updated_at: Option, - #[serde(default = "default_1694")] + #[serde(default = "default_1696")] pub last_updated_at: Option, - #[serde(default = "default_1698")] + #[serde(default = "default_1700")] pub newest: Vec, - #[serde(default = "default_1699")] + #[serde(default = "default_1701")] pub complete: bool, } @@ -36017,32 +36043,32 @@ pub struct InspectCall { #[non_exhaustive] pub struct InspectActivity { pub window_seconds: Integer, - #[serde(default = "default_1700")] + #[serde(default = "default_1702")] pub calls: Vec, - #[serde(default = "default_1701")] + #[serde(default = "default_1703")] pub first_at: Option, - #[serde(default = "default_1702")] + #[serde(default = "default_1704")] pub last_at: Option, - #[serde(default = "default_1703")] + #[serde(default = "default_1705")] pub gap: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct InspectSettings { - #[serde(default = "default_1704")] + #[serde(default = "default_1706")] pub guide_revision: Integer, - #[serde(default = "default_1705")] + #[serde(default = "default_1707")] pub guide_summary: String, - #[serde(default = "default_1706")] + #[serde(default = "default_1708")] pub categories_registered: Integer, - #[serde(default = "default_1707")] + #[serde(default = "default_1709")] pub extraction_policy: Option, - #[serde(default = "default_1708")] + #[serde(default = "default_1710")] pub extraction_policy_unavailable: String, - #[serde(default = "default_1709")] + #[serde(default = "default_1711")] pub extraction_instructions: String, - #[serde(default = "default_1710")] + #[serde(default = "default_1712")] pub extraction_instructions_refs: Vec, } @@ -36058,7 +36084,7 @@ pub struct MemoryInspectOutput { pub others: InspectView, pub activity: InspectActivity, pub settings: InspectSettings, - #[serde(default = "default_1711")] + #[serde(default = "default_1713")] pub skipped: Vec, } @@ -36152,7 +36178,7 @@ pub struct MemoryKeyRef { #[non_exhaustive] pub struct MemoryKeysOutput { pub keys: Vec, - #[serde(default = "default_1712")] + #[serde(default = "default_1714")] pub truncated: bool, } @@ -36255,9 +36281,9 @@ pub struct LineageCandidate { pub decided_at: String, pub decided_by: String, pub match_confidence: LineageCandidateMatchConfidence, - #[serde(default = "default_1721")] + #[serde(default = "default_1723")] pub seeded_from_thread_id: String, - #[serde(default = "default_1722")] + #[serde(default = "default_1724")] pub seeded_from_msg_id: String, } @@ -36275,25 +36301,25 @@ pub struct LineageAuditEvent { pub struct MemoryLineageOutput { pub found: bool, pub memory_key: String, - #[serde(default = "default_1713")] + #[serde(default = "default_1715")] pub promotion_event: String, - #[serde(default = "default_1714")] + #[serde(default = "default_1716")] pub promoted_by: String, - #[serde(default = "default_1715")] + #[serde(default = "default_1717")] pub promoted_at: Option, - #[serde(default = "default_1716")] + #[serde(default = "default_1718")] pub rationale: String, - #[serde(default = "default_1717")] + #[serde(default = "default_1719")] pub source_trace: String, - #[serde(default = "default_1718")] + #[serde(default = "default_1720")] pub source_resource_id: String, - #[serde(default = "default_1719")] + #[serde(default = "default_1721")] pub mechanism: MemoryLineageOutputMechanism, - #[serde(default = "default_1720")] + #[serde(default = "default_1722")] pub supporters: Vec, - #[serde(default = "default_1723")] + #[serde(default = "default_1725")] pub candidate: Option, - #[serde(default = "default_1724")] + #[serde(default = "default_1726")] pub audit_chain: Vec, } @@ -36422,11 +36448,11 @@ pub struct MemoryLinkOutput { pub from_key: String, pub to_key: String, pub relation: String, - #[serde(default = "default_1725")] + #[serde(default = "default_1727")] pub confidence: f64, - #[serde(default = "default_1726")] + #[serde(default = "default_1728")] pub conflict_opened: bool, - #[serde(default = "default_1727")] + #[serde(default = "default_1729")] pub relation_defaulted: bool, } @@ -36740,17 +36766,17 @@ pub struct MemoryListEntry { pub struct MemoryListOutput { pub entries: Vec, pub truncated: bool, - #[serde(default = "default_1728")] + #[serde(default = "default_1730")] pub total: Integer, - #[serde(default = "default_1729")] + #[serde(default = "default_1731")] pub today: Integer, - #[serde(default = "default_1730")] + #[serde(default = "default_1732")] pub namespace_version: String, - #[serde(default = "default_1731")] + #[serde(default = "default_1733")] pub unchanged: bool, - #[serde(default = "default_1732")] + #[serde(default = "default_1734")] pub hidden: Integer, - #[serde(default = "default_1733")] + #[serde(default = "default_1735")] pub hidden_hint: String, } @@ -37136,19 +37162,19 @@ impl MemoryListInput { #[non_exhaustive] pub struct MemoryLockOutput { pub locked: bool, - #[serde(default = "default_1734")] + #[serde(default = "default_1736")] pub reason: String, - #[serde(default = "default_1735")] + #[serde(default = "default_1737")] pub memory_id: String, - #[serde(default = "default_1736")] + #[serde(default = "default_1738")] pub version: Option, - #[serde(default = "default_1737")] + #[serde(default = "default_1739")] pub lock_mode: String, - #[serde(default = "default_1738")] + #[serde(default = "default_1740")] pub lock_until: Option, - #[serde(default = "default_1739")] + #[serde(default = "default_1741")] pub locked_by: String, - #[serde(default = "default_1740")] + #[serde(default = "default_1742")] pub previous_mode: String, } @@ -37307,21 +37333,21 @@ pub struct MemoryMoveOutput { pub from_key: String, pub to_key: String, pub redirected: bool, - #[serde(default = "default_1741")] + #[serde(default = "default_1743")] pub memory_id: String, - #[serde(default = "default_1742")] + #[serde(default = "default_1744")] pub version: Integer, - #[serde(default = "default_1743")] + #[serde(default = "default_1745")] pub content_sha256: String, - #[serde(default = "default_1744")] + #[serde(default = "default_1746")] pub advisories: Vec, - #[serde(default = "default_1745")] + #[serde(default = "default_1747")] pub dry_run: bool, - #[serde(default = "default_1746")] + #[serde(default = "default_1748")] pub memory_type: String, - #[serde(default = "default_1747")] + #[serde(default = "default_1749")] pub value_preview: String, - #[serde(default = "default_1748")] + #[serde(default = "default_1750")] pub sensitivity: String, } @@ -37533,7 +37559,7 @@ impl MemoryMoveInput { pub struct MemoryOutcomeOutput { pub recorded: bool, pub evidence_count_after: Integer, - #[serde(default = "default_1749")] + #[serde(default = "default_1751")] pub quarantined: bool, } @@ -37776,13 +37802,13 @@ impl MemoryOutcomeRunInput { #[non_exhaustive] pub struct OutlineSession { pub session_id: String, - #[serde(default = "default_1751")] + #[serde(default = "default_1753")] pub date: String, - #[serde(default = "default_1752")] + #[serde(default = "default_1754")] pub headline: String, - #[serde(default = "default_1753")] + #[serde(default = "default_1755")] pub key_facts: Integer, - #[serde(default = "default_1754")] + #[serde(default = "default_1756")] pub rows: Integer, } @@ -37790,7 +37816,7 @@ pub struct OutlineSession { #[non_exhaustive] pub struct OutlineHub { pub entity: String, - #[serde(default = "default_1757")] + #[serde(default = "default_1759")] pub degree: Integer, } @@ -37798,28 +37824,28 @@ pub struct OutlineHub { #[non_exhaustive] pub struct OutlineCommunity { pub community_id: Integer, - #[serde(default = "default_1759")] + #[serde(default = "default_1761")] pub label: String, - #[serde(default = "default_1760")] + #[serde(default = "default_1762")] pub size: Integer, - #[serde(default = "default_1761")] + #[serde(default = "default_1763")] pub computed_at: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryOutlineOutput { - #[serde(default = "default_1750")] + #[serde(default = "default_1752")] pub rows_by_type: std::collections::HashMap, - #[serde(default = "default_1755")] + #[serde(default = "default_1757")] pub sessions: Vec, - #[serde(default = "default_1756")] - pub sessions_total: Integer, #[serde(default = "default_1758")] + pub sessions_total: Integer, + #[serde(default = "default_1760")] pub hubs: Vec, - #[serde(default = "default_1762")] + #[serde(default = "default_1764")] pub communities: Vec, - #[serde(default = "default_1763")] + #[serde(default = "default_1765")] pub profile_chars: Integer, } @@ -37971,7 +37997,7 @@ pub struct OwnerUsageRow { pub recalls: Integer, pub used: Integer, pub harm: Integer, - #[serde(default = "default_1764")] + #[serde(default = "default_1766")] pub last_recalled: Option, } @@ -38458,7 +38484,7 @@ pub struct MemoryPromoteOutput { pub shared_memory_key: String, pub promotion_event: String, pub reversible_until: String, - #[serde(default = "default_1765")] + #[serde(default = "default_1767")] pub ignored_args: Vec, } @@ -38627,18 +38653,18 @@ impl MemoryPromoteInput { pub struct MemoryProposalDecision { pub memory_key: String, pub decided: bool, - #[serde(default = "default_1767")] + #[serde(default = "default_1769")] pub status: String, - #[serde(default = "default_1768")] + #[serde(default = "default_1770")] pub reason: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryProposalDecideOutput { - #[serde(default = "default_1766")] + #[serde(default = "default_1768")] pub decided: Integer, - #[serde(default = "default_1769")] + #[serde(default = "default_1771")] pub results: Vec, } @@ -38739,33 +38765,33 @@ pub enum MemoryProposalReady { pub struct MemoryProposal { pub memory_key: String, pub memory_id: String, - #[serde(default = "default_1770")] + #[serde(default = "default_1772")] pub content_sha256: String, - #[serde(default = "default_1771")] + #[serde(default = "default_1773")] pub agent: String, - #[serde(default = "default_1772")] + #[serde(default = "default_1774")] pub memory_type: String, - #[serde(default = "default_1773")] + #[serde(default = "default_1775")] pub value_preview: String, - #[serde(default = "default_1774")] + #[serde(default = "default_1776")] pub sensitivity: String, - #[serde(default = "default_1775")] + #[serde(default = "default_1777")] pub tags: Vec, - #[serde(default = "default_1776")] + #[serde(default = "default_1778")] pub created_at: String, - #[serde(default = "default_1777")] + #[serde(default = "default_1779")] pub graded_passes: Integer, - #[serde(default = "default_1778")] + #[serde(default = "default_1780")] pub graded_fails: Integer, - #[serde(default = "default_1779")] + #[serde(default = "default_1781")] pub last_graded_at: String, - #[serde(default = "default_1780")] + #[serde(default = "default_1782")] pub used_count: Integer, - #[serde(default = "default_1781")] + #[serde(default = "default_1783")] pub harm_count: Integer, - #[serde(default = "default_1782")] + #[serde(default = "default_1784")] pub ready: MemoryProposalReady, - #[serde(default = "default_1783")] + #[serde(default = "default_1785")] pub conflict_with: Vec, } @@ -38781,24 +38807,24 @@ pub enum ProposalPolicyMode { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ProposalPolicy { - #[serde(default = "default_1786")] + #[serde(default = "default_1788")] pub mode: ProposalPolicyMode, - #[serde(default = "default_1787")] + #[serde(default = "default_1789")] pub min_passes: Integer, - #[serde(default = "default_1788")] + #[serde(default = "default_1790")] pub max_fails: Integer, - #[serde(default = "default_1789")] + #[serde(default = "default_1791")] pub reject_after_fails: Integer, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryProposalsOutput { - #[serde(default = "default_1784")] + #[serde(default = "default_1786")] pub proposals: Vec, - #[serde(default = "default_1785")] + #[serde(default = "default_1787")] pub total: Integer, - #[serde(default = "default_1790")] + #[serde(default = "default_1792")] pub policy: ProposalPolicy, } @@ -38916,19 +38942,19 @@ impl MemoryProposalsInput { pub struct MemoryProvenanceLink { pub direction: String, pub memory_key: String, - #[serde(default = "default_1804")] + #[serde(default = "default_1806")] pub relation: String, - #[serde(default = "default_1805")] + #[serde(default = "default_1807")] pub label: String, - #[serde(default = "default_1806")] + #[serde(default = "default_1808")] pub explanation: String, - #[serde(default = "default_1807")] + #[serde(default = "default_1809")] pub evidence: Vec, - #[serde(default = "default_1808")] + #[serde(default = "default_1810")] pub confidence: f64, - #[serde(default = "default_1809")] + #[serde(default = "default_1811")] pub author: String, - #[serde(default = "default_1810")] + #[serde(default = "default_1812")] pub run_id: String, } @@ -38936,33 +38962,33 @@ pub struct MemoryProvenanceLink { #[non_exhaustive] pub struct MemoryProvenanceOutput { pub found: bool, - #[serde(default = "default_1791")] + #[serde(default = "default_1793")] pub source_trace: String, - #[serde(default = "default_1792")] + #[serde(default = "default_1794")] pub source_kind: String, - #[serde(default = "default_1793")] + #[serde(default = "default_1795")] pub actor: String, - #[serde(default = "default_1794")] + #[serde(default = "default_1796")] pub source_class: String, - #[serde(default = "default_1795")] + #[serde(default = "default_1797")] pub source_label: String, - #[serde(default = "default_1796")] + #[serde(default = "default_1798")] pub thread_id: String, - #[serde(default = "default_1797")] + #[serde(default = "default_1799")] pub thread_exists: bool, - #[serde(default = "default_1798")] + #[serde(default = "default_1800")] pub thread_title: String, - #[serde(default = "default_1799")] + #[serde(default = "default_1801")] pub agent: String, - #[serde(default = "default_1800")] + #[serde(default = "default_1802")] pub session_id: String, - #[serde(default = "default_1801")] + #[serde(default = "default_1803")] pub run_id: String, - #[serde(default = "default_1802")] + #[serde(default = "default_1804")] pub written_at: String, - #[serde(default = "default_1803")] + #[serde(default = "default_1805")] pub source_resource_id: String, - #[serde(default = "default_1811")] + #[serde(default = "default_1813")] pub links: Vec, } @@ -39057,17 +39083,17 @@ impl MemoryProvenanceInput { pub struct RecallTurn { pub evidence_id: String, pub session_id: String, - #[serde(default = "default_1812")] + #[serde(default = "default_1814")] pub role: String, - #[serde(default = "default_1813")] + #[serde(default = "default_1815")] pub actor: String, - #[serde(default = "default_1814")] + #[serde(default = "default_1816")] pub observed_at: String, - #[serde(default = "default_1815")] + #[serde(default = "default_1817")] pub content: String, - #[serde(default = "default_1816")] + #[serde(default = "default_1818")] pub truncated: bool, - #[serde(default = "default_1817")] + #[serde(default = "default_1819")] pub matched_tokens: Integer, } @@ -39084,21 +39110,21 @@ pub enum MemoryRecallOutputOrder { #[non_exhaustive] pub struct MemoryRecallOutput { pub turns: Vec, - #[serde(default = "default_1818")] + #[serde(default = "default_1820")] pub total_matched: Integer, - #[serde(default = "default_1819")] + #[serde(default = "default_1821")] pub returned: Integer, - #[serde(default = "default_1820")] + #[serde(default = "default_1822")] pub has_more: bool, - #[serde(default = "default_1821")] + #[serde(default = "default_1823")] pub next_cursor: String, - #[serde(default = "default_1822")] + #[serde(default = "default_1824")] pub next_offset: Integer, - #[serde(default = "default_1823")] + #[serde(default = "default_1825")] pub order: MemoryRecallOutputOrder, - #[serde(default = "default_1824")] + #[serde(default = "default_1826")] pub query_tokens: Vec, - #[serde(default = "default_1825")] + #[serde(default = "default_1827")] pub tokens_returned: Integer, } @@ -39380,19 +39406,19 @@ pub struct MemoryRecordConflictRow { pub schema_name: String, pub memory_key: String, pub field_name: String, - #[serde(default = "default_1826")] + #[serde(default = "default_1828")] pub prior_value: Value, - #[serde(default = "default_1827")] + #[serde(default = "default_1829")] pub incoming_value: Value, pub prior_record_id: String, pub incoming_record_id: String, - #[serde(default = "default_1828")] + #[serde(default = "default_1830")] pub prior_memory_id: String, - #[serde(default = "default_1829")] + #[serde(default = "default_1831")] pub incoming_memory_id: String, - #[serde(default = "default_1830")] + #[serde(default = "default_1832")] pub detected_at: Option, - #[serde(default = "default_1831")] + #[serde(default = "default_1833")] pub resolved_at: Option, } @@ -39400,7 +39426,7 @@ pub struct MemoryRecordConflictRow { #[non_exhaustive] pub struct MemoryRecordConflictsOutput { pub rows: Vec, - #[serde(default = "default_1832")] + #[serde(default = "default_1834")] pub truncated: bool, } @@ -39510,19 +39536,19 @@ pub enum MemoryRecordRowStatus { #[non_exhaustive] pub struct MemoryRecordRow { pub record_id: String, - #[serde(default = "default_1833")] + #[serde(default = "default_1835")] pub memory_key: String, - #[serde(default = "default_1834")] + #[serde(default = "default_1836")] pub memory_id: String, - #[serde(default = "default_1835")] + #[serde(default = "default_1837")] pub record: std::collections::HashMap, - #[serde(default = "default_1836")] + #[serde(default = "default_1838")] pub field_states: std::collections::HashMap, - #[serde(default = "default_1837")] + #[serde(default = "default_1839")] pub status: MemoryRecordRowStatus, - #[serde(default = "default_1838")] + #[serde(default = "default_1840")] pub valid_at: Option, - #[serde(default = "default_1839")] + #[serde(default = "default_1841")] pub valid_to: Option, } @@ -39589,7 +39615,7 @@ impl MemoryRecordHistoryInput { #[non_exhaustive] pub struct MemoryRecordQueryOutput { pub rows: Vec, - #[serde(default = "default_1840")] + #[serde(default = "default_1842")] pub truncated: bool, } @@ -39813,15 +39839,15 @@ pub enum MemoryRecordWriteOutputKeySource { pub struct MemoryRecordWriteOutput { pub record_id: String, pub field_count: Integer, - #[serde(default = "default_1841")] + #[serde(default = "default_1843")] pub memory_key: String, - #[serde(default = "default_1842")] + #[serde(default = "default_1844")] pub key_source: MemoryRecordWriteOutputKeySource, - #[serde(default = "default_1843")] + #[serde(default = "default_1845")] pub fold: std::collections::HashMap, - #[serde(default = "default_1844")] + #[serde(default = "default_1846")] pub superseded_record_id: String, - #[serde(default = "default_1845")] + #[serde(default = "default_1847")] pub conflicts: Integer, } @@ -40064,13 +40090,13 @@ impl MemoryRecordWriteInput { #[non_exhaustive] pub struct MemoryRedactOutput { pub redacted: bool, - #[serde(default = "default_1846")] + #[serde(default = "default_1848")] pub refused_head: bool, - #[serde(default = "default_1847")] + #[serde(default = "default_1849")] pub redacted_at: Option, - #[serde(default = "default_1848")] + #[serde(default = "default_1850")] pub cache_rows_deleted: Integer, - #[serde(default = "default_1849")] + #[serde(default = "default_1851")] pub precedent_rows_deleted: Integer, } @@ -40230,7 +40256,7 @@ impl MemoryReindexInput { #[non_exhaustive] pub struct MemoryRejectOutput { pub rejected: bool, - #[serde(default = "default_1850")] + #[serde(default = "default_1852")] pub rejected_at: Option, } @@ -40346,7 +40372,7 @@ pub struct MemoryRelatedHit { pub struct MemoryRelatedOutput { pub results: Vec, pub source_entities: Vec, - #[serde(default = "default_1851")] + #[serde(default = "default_1853")] pub reason: String, } @@ -40461,13 +40487,13 @@ impl MemoryRelatedInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryResolveOrphanDuplicatesOutput { - #[serde(default = "default_1852")] + #[serde(default = "default_1854")] pub candidates: Integer, - #[serde(default = "default_1853")] + #[serde(default = "default_1855")] pub reactivated: Integer, - #[serde(default = "default_1854")] + #[serde(default = "default_1856")] pub dry_run: bool, - #[serde(default = "default_1855")] + #[serde(default = "default_1857")] pub memory_ids: Vec, } @@ -40544,15 +40570,15 @@ impl MemoryResolveOrphanDuplicatesInput { #[non_exhaustive] pub struct MemoryRestoreOutput { pub restored: bool, - #[serde(default = "default_1856")] + #[serde(default = "default_1858")] pub memory_id: Option, - #[serde(default = "default_1857")] + #[serde(default = "default_1859")] pub version: Option, - #[serde(default = "default_1858")] + #[serde(default = "default_1860")] pub expired: bool, - #[serde(default = "default_1859")] + #[serde(default = "default_1861")] pub redacted: bool, - #[serde(default = "default_1860")] + #[serde(default = "default_1862")] pub from_status: String, } @@ -40672,13 +40698,13 @@ pub struct SearchTraceHit { pub content_excerpt: String, pub distance: f64, pub similarity: f64, - #[serde(default = "default_1861")] + #[serde(default = "default_1863")] pub entity_boost: f64, pub rank_score: f64, pub rank: Integer, - #[serde(default = "default_1862")] + #[serde(default = "default_1864")] pub source: String, - #[serde(default = "default_1863")] + #[serde(default = "default_1865")] pub parent_memory_key: String, } @@ -40688,11 +40714,11 @@ pub struct MemorySearchTraceOutput { pub results: Vec, pub embedding_model: String, pub entity_filter: Vec, - #[serde(default = "default_1864")] + #[serde(default = "default_1866")] pub query_spellings: std::collections::HashMap, - #[serde(default = "default_1865")] + #[serde(default = "default_1867")] pub query_spellings_skipped: bool, - #[serde(default = "default_1866")] + #[serde(default = "default_1868")] pub stale_dropped: Integer, } @@ -41873,7 +41899,7 @@ pub struct SearchTraceLogRow { pub embedding_model: String, pub latency_ms: Integer, pub run_id: String, - #[serde(default = "default_1867")] + #[serde(default = "default_1869")] pub operation: String, } @@ -41982,71 +42008,71 @@ pub struct RefusedFact { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemorySetFromMessagesOutput { - #[serde(default = "default_1868")] + #[serde(default = "default_1870")] pub written: Vec, - #[serde(default = "default_1869")] + #[serde(default = "default_1871")] pub refused: Vec, - #[serde(default = "default_1870")] + #[serde(default = "default_1872")] pub tokens_in: Integer, - #[serde(default = "default_1871")] + #[serde(default = "default_1873")] pub tokens_out: Integer, - #[serde(default = "default_1872")] + #[serde(default = "default_1874")] pub llm_provider: String, - #[serde(default = "default_1873")] + #[serde(default = "default_1875")] pub llm_model: String, - #[serde(default = "default_1874")] + #[serde(default = "default_1876")] pub segments: Integer, - #[serde(default = "default_1875")] + #[serde(default = "default_1877")] pub foresight: Integer, - #[serde(default = "default_1876")] + #[serde(default = "default_1878")] pub forgotten: Integer, - #[serde(default = "default_1877")] + #[serde(default = "default_1879")] pub forgotten_keys: Vec, - #[serde(default = "default_1878")] + #[serde(default = "default_1880")] pub forget_requests: Integer, - #[serde(default = "default_1879")] + #[serde(default = "default_1881")] pub about_other: Integer, - #[serde(default = "default_1880")] + #[serde(default = "default_1882")] pub premise_facts: Integer, - #[serde(default = "default_1881")] + #[serde(default = "default_1883")] pub learning_candidates: Integer, - #[serde(default = "default_1882")] + #[serde(default = "default_1884")] pub ignored_args: Vec, - #[serde(default = "default_1883")] + #[serde(default = "default_1885")] pub segmenter: String, - #[serde(default = "default_1884")] + #[serde(default = "default_1886")] pub cached_tokens_in: Integer, - #[serde(default = "default_1885")] + #[serde(default = "default_1887")] pub ontology_warnings: Vec, - #[serde(default = "default_1886")] + #[serde(default = "default_1888")] pub evidence_ids: Vec, - #[serde(default = "default_1887")] + #[serde(default = "default_1889")] pub belief_source_links: Integer, - #[serde(default = "default_1888")] + #[serde(default = "default_1890")] pub pipeline_errors: Vec, - #[serde(default = "default_1889")] + #[serde(default = "default_1891")] pub value_updates_linked: Integer, - #[serde(default = "default_1890")] + #[serde(default = "default_1892")] pub stubbed_fields: Vec, - #[serde(default = "default_1891")] + #[serde(default = "default_1893")] pub degraded: Vec, - #[serde(default = "default_1892")] + #[serde(default = "default_1894")] pub deferred: bool, - #[serde(default = "default_1893")] + #[serde(default = "default_1895")] pub queue_id: String, - #[serde(default = "default_1894")] + #[serde(default = "default_1896")] pub deferred_by: String, - #[serde(default = "default_1895")] + #[serde(default = "default_1897")] pub stage_ms: std::collections::HashMap, - #[serde(default = "default_1896")] + #[serde(default = "default_1898")] pub observation_date_source: String, - #[serde(default = "default_1897")] + #[serde(default = "default_1899")] pub under_operator_policy: bool, - #[serde(default = "default_1898")] + #[serde(default = "default_1900")] pub extract_prompt_keys: Vec, - #[serde(default = "default_1899")] + #[serde(default = "default_1901")] pub llm_cache_hits: Integer, - #[serde(default = "default_1900")] + #[serde(default = "default_1902")] pub llm_cache_misses: Integer, } @@ -42501,22 +42527,22 @@ pub enum StackEntrySection { #[non_exhaustive] pub struct StackEntry { pub section: StackEntrySection, - #[serde(default = "default_1901")] + #[serde(default = "default_1903")] pub memory_key: String, - #[serde(default = "default_1902")] + #[serde(default = "default_1904")] pub memory_type: String, - #[serde(default = "default_1903")] + #[serde(default = "default_1905")] pub value: String, pub tokens: Integer, - #[serde(default = "default_1904")] + #[serde(default = "default_1906")] pub pinned: bool, - #[serde(default = "default_1905")] + #[serde(default = "default_1907")] pub recall_count: Integer, - #[serde(default = "default_1906")] + #[serde(default = "default_1908")] pub last_recalled_at: Option, - #[serde(default = "default_1907")] + #[serde(default = "default_1909")] pub actor: String, - #[serde(default = "default_1908")] + #[serde(default = "default_1910")] pub namespace: String, } @@ -42701,14 +42727,14 @@ impl MemoryStackInput { pub struct MemoryStatus { pub memory_id: String, pub status: String, - #[serde(default = "default_1909")] + #[serde(default = "default_1911")] pub superseded_by: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemoryStatusesOutput { - #[serde(default = "default_1910")] + #[serde(default = "default_1912")] pub rows: Vec, } @@ -42757,23 +42783,23 @@ impl MemoryStatusesInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MemorySweepExpiredOutput { - #[serde(default = "default_1911")] + #[serde(default = "default_1913")] pub scanned: Integer, - #[serde(default = "default_1912")] + #[serde(default = "default_1914")] pub tombstoned: Integer, - #[serde(default = "default_1913")] + #[serde(default = "default_1915")] pub demoted: Integer, - #[serde(default = "default_1914")] + #[serde(default = "default_1916")] pub anonymized: Integer, - #[serde(default = "default_1915")] + #[serde(default = "default_1917")] pub locked_skipped: Integer, - #[serde(default = "default_1916")] + #[serde(default = "default_1918")] pub moved_skipped: Integer, - #[serde(default = "default_1917")] + #[serde(default = "default_1919")] pub dry_run: bool, - #[serde(default = "default_1918")] + #[serde(default = "default_1920")] pub sample: Vec>, - #[serde(default = "default_1919")] + #[serde(default = "default_1921")] pub failures: Vec, } @@ -42850,10 +42876,10 @@ pub struct MemoryTimelineEntry { pub memory_key: String, pub memory_type: String, pub content_excerpt: String, - #[serde(default = "default_1920")] + #[serde(default = "default_1922")] pub valid_at: Option, pub created_at: String, - #[serde(default = "default_1921")] + #[serde(default = "default_1923")] pub namespace: String, } @@ -42861,7 +42887,7 @@ pub struct MemoryTimelineEntry { #[non_exhaustive] pub struct MemoryTimelineOutput { pub events: Vec, - #[serde(default = "default_1922")] + #[serde(default = "default_1924")] pub total_matching: Integer, } @@ -43053,9 +43079,9 @@ impl MemoryTimelineInput { pub struct MemoryTouchResult { pub memory_key: String, pub touched: bool, - #[serde(default = "default_1925")] + #[serde(default = "default_1927")] pub version: Option, - #[serde(default = "default_1926")] + #[serde(default = "default_1928")] pub expires_at: Option, } @@ -43063,13 +43089,13 @@ pub struct MemoryTouchResult { #[non_exhaustive] pub struct MemoryTouchOutput { pub touched: bool, - #[serde(default = "default_1923")] + #[serde(default = "default_1925")] pub version: Option, - #[serde(default = "default_1924")] + #[serde(default = "default_1926")] pub expires_at: Option, - #[serde(default = "default_1927")] + #[serde(default = "default_1929")] pub results: Vec, - #[serde(default = "default_1928")] + #[serde(default = "default_1930")] pub touched_count: Integer, } @@ -43249,15 +43275,15 @@ impl MemoryTouchInput { #[non_exhaustive] pub struct MemoryUnlockOutput { pub unlocked: bool, - #[serde(default = "default_1929")] + #[serde(default = "default_1931")] pub reason: String, - #[serde(default = "default_1930")] + #[serde(default = "default_1932")] pub memory_id: String, - #[serde(default = "default_1931")] + #[serde(default = "default_1933")] pub version: Option, - #[serde(default = "default_1932")] + #[serde(default = "default_1934")] pub previous_mode: String, - #[serde(default = "default_1933")] + #[serde(default = "default_1935")] pub unlocked_by: String, } @@ -43362,11 +43388,11 @@ impl MemoryUnlockInput { #[non_exhaustive] pub struct MemoryUnpinOutput { pub unpinned: bool, - #[serde(default = "default_1934")] + #[serde(default = "default_1936")] pub reason: String, - #[serde(default = "default_1935")] + #[serde(default = "default_1937")] pub memory_id: String, - #[serde(default = "default_1936")] + #[serde(default = "default_1938")] pub version: Option, } @@ -43460,15 +43486,15 @@ impl MemoryUnpinInput { #[non_exhaustive] pub struct MemoryUpdateCandidate { pub memory_id: String, - #[serde(default = "default_1942")] + #[serde(default = "default_1944")] pub agent: String, - #[serde(default = "default_1943")] + #[serde(default = "default_1945")] pub user_id: String, - #[serde(default = "default_1944")] + #[serde(default = "default_1946")] pub session_id: String, - #[serde(default = "default_1945")] + #[serde(default = "default_1947")] pub version: Integer, - #[serde(default = "default_1946")] + #[serde(default = "default_1948")] pub status: String, } @@ -43476,23 +43502,23 @@ pub struct MemoryUpdateCandidate { #[non_exhaustive] pub struct MemoryUpdateOutput { pub updated: bool, - #[serde(default = "default_1937")] + #[serde(default = "default_1939")] pub memory_id: String, - #[serde(default = "default_1938")] + #[serde(default = "default_1940")] pub memory_key: String, - #[serde(default = "default_1939")] + #[serde(default = "default_1941")] pub new_version: Integer, - #[serde(default = "default_1940")] + #[serde(default = "default_1942")] pub content_sha256: String, - #[serde(default = "default_1941")] + #[serde(default = "default_1943")] pub reason: String, - #[serde(default = "default_1947")] + #[serde(default = "default_1949")] pub candidates: Vec, - #[serde(default = "default_1948")] + #[serde(default = "default_1950")] pub conflict_verdict: String, - #[serde(default = "default_1949")] + #[serde(default = "default_1951")] pub conflict_peers: Integer, - #[serde(default = "default_1950")] + #[serde(default = "default_1952")] pub duplicate_of: String, } @@ -43701,15 +43727,15 @@ impl MemoryUpdateInput { #[non_exhaustive] pub struct MemoryUpdateByIdOutput { pub updated: bool, - #[serde(default = "default_1951")] + #[serde(default = "default_1953")] pub new_version: Integer, - #[serde(default = "default_1952")] + #[serde(default = "default_1954")] pub content_sha256: String, - #[serde(default = "default_1953")] + #[serde(default = "default_1955")] pub conflict_verdict: String, - #[serde(default = "default_1954")] + #[serde(default = "default_1956")] pub conflict_peers: Integer, - #[serde(default = "default_1955")] + #[serde(default = "default_1957")] pub duplicate_of: String, } @@ -43837,23 +43863,23 @@ impl MemoryUpdateByIdInput { #[non_exhaustive] pub struct MemoryVerifyOutput { pub found: bool, - #[serde(default = "default_1956")] + #[serde(default = "default_1958")] pub changed: bool, - #[serde(default = "default_1957")] + #[serde(default = "default_1959")] pub memory_id: String, - #[serde(default = "default_1958")] + #[serde(default = "default_1960")] pub memory_key: String, - #[serde(default = "default_1959")] + #[serde(default = "default_1961")] pub namespace: String, - #[serde(default = "default_1960")] + #[serde(default = "default_1962")] pub verified_by: String, - #[serde(default = "default_1961")] + #[serde(default = "default_1963")] pub verified_at: Option, - #[serde(default = "default_1962")] + #[serde(default = "default_1964")] pub verification: String, - #[serde(default = "default_1963")] + #[serde(default = "default_1965")] pub version: Integer, - #[serde(default = "default_1964")] + #[serde(default = "default_1966")] pub content_sha256: String, } @@ -44058,13 +44084,13 @@ pub struct SchemaFieldOutput { #[serde(rename = "type")] pub r#type: String, pub required: bool, - #[serde(default = "default_1967")] + #[serde(default = "default_1969")] pub identity: bool, - #[serde(default = "default_1968")] + #[serde(default = "default_1970")] pub enum_values: Vec, - #[serde(default = "default_1969")] + #[serde(default = "default_1971")] pub constraints: std::collections::HashMap, - #[serde(default = "default_1970")] + #[serde(default = "default_1972")] pub description: String, } @@ -44073,11 +44099,11 @@ pub struct SchemaFieldOutput { pub struct MemorySchemaSummary { pub schema_id: String, pub name: String, - #[serde(default = "default_1965")] + #[serde(default = "default_1967")] pub description: String, - #[serde(default = "default_1966")] + #[serde(default = "default_1968")] pub status: String, - #[serde(default = "default_1971")] + #[serde(default = "default_1973")] pub fields: Vec, } @@ -44492,13 +44518,13 @@ impl MemorySchemaRegisterInput { #[non_exhaustive] pub struct MentorPlane { pub plane: String, - #[serde(default = "default_1973")] + #[serde(default = "default_1975")] pub calls: Integer, - #[serde(default = "default_1974")] + #[serde(default = "default_1976")] pub available: Option, - #[serde(default = "default_1975")] + #[serde(default = "default_1977")] pub when: String, - #[serde(default = "default_1976")] + #[serde(default = "default_1978")] pub mentored: bool, } @@ -44508,11 +44534,11 @@ pub struct MentorHint { pub code: String, pub severity: String, pub text: String, - #[serde(default = "default_1978")] + #[serde(default = "default_1980")] pub ops: Vec, - #[serde(default = "default_1979")] + #[serde(default = "default_1981")] pub evidence: std::collections::HashMap, - #[serde(default = "default_1980")] + #[serde(default = "default_1982")] pub plane: Option, } @@ -44520,9 +44546,9 @@ pub struct MentorHint { #[non_exhaustive] pub struct MentorAdoption { pub code: String, - #[serde(default = "default_1982")] + #[serde(default = "default_1984")] pub shown_sessions: Integer, - #[serde(default = "default_1983")] + #[serde(default = "default_1985")] pub followed_sessions: Integer, } @@ -44558,7 +44584,7 @@ pub enum UsageRungSource { #[non_exhaustive] pub struct UsageRung { pub rung: UsageRungRung, - #[serde(default = "default_1985")] + #[serde(default = "default_1987")] pub count: Option, pub source: UsageRungSource, pub meaning: String, @@ -44573,27 +44599,27 @@ pub struct MentorBriefOutput { pub window_seconds: Integer, pub computed_at: String, pub sessions: Integer, - #[serde(default = "default_1972")] + #[serde(default = "default_1974")] pub usage: std::collections::HashMap, - #[serde(default = "default_1977")] + #[serde(default = "default_1979")] pub planes: Vec, - #[serde(default = "default_1981")] + #[serde(default = "default_1983")] pub hints: Vec, - #[serde(default = "default_1984")] - pub adoption: Vec, #[serde(default = "default_1986")] + pub adoption: Vec, + #[serde(default = "default_1988")] pub usage_evidence: Vec, - #[serde(default = "default_1987")] + #[serde(default = "default_1989")] pub ledger_from: Option, - #[serde(default = "default_1988")] + #[serde(default = "default_1990")] pub ledger_retention_days: Option, - #[serde(default = "default_1989")] + #[serde(default = "default_1991")] pub agents: Vec, - #[serde(default = "default_1990")] + #[serde(default = "default_1992")] pub agent_defaulted: bool, - #[serde(default = "default_1991")] + #[serde(default = "default_1993")] pub skipped: Vec, - #[serde(default = "default_1992")] + #[serde(default = "default_1994")] pub healthy: bool, } @@ -44742,33 +44768,33 @@ impl MentorGuideInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct NamespaceAuditSummary { - #[serde(default = "default_1993")] + #[serde(default = "default_1995")] pub live_rows: Integer, - #[serde(default = "default_1994")] + #[serde(default = "default_1996")] pub live_bytes: Integer, - #[serde(default = "default_1995")] + #[serde(default = "default_1997")] pub excerpt_bytes: Integer, - #[serde(default = "default_1996")] + #[serde(default = "default_1998")] pub version_rows: Integer, - #[serde(default = "default_1997")] + #[serde(default = "default_1999")] pub version_bytes: Integer, - #[serde(default = "default_1998")] + #[serde(default = "default_2000")] pub unembedded_rows: Integer, - #[serde(default = "default_1999")] + #[serde(default = "default_2001")] pub gets: Integer, - #[serde(default = "default_2000")] + #[serde(default = "default_2002")] pub searches: Integer, - #[serde(default = "default_2001")] + #[serde(default = "default_2003")] pub sets: Integer, - #[serde(default = "default_2002")] + #[serde(default = "default_2004")] pub get_search_ratio: f64, - #[serde(default = "default_2003")] + #[serde(default = "default_2005")] pub inspector_calls: Integer, - #[serde(default = "default_2004")] + #[serde(default = "default_2006")] pub typed_gets: Integer, - #[serde(default = "default_2005")] + #[serde(default = "default_2007")] pub written_in_window: Integer, - #[serde(default = "default_2006")] + #[serde(default = "default_2008")] pub ledger_calls: Integer, } @@ -44800,25 +44826,25 @@ pub struct NamespaceAuditFinding { pub kind: NamespaceAuditFindingKind, pub rule_version: Integer, pub source_op: String, - #[serde(default = "default_2007")] + #[serde(default = "default_2009")] pub window_seconds: Option, - #[serde(default = "default_2008")] + #[serde(default = "default_2010")] pub population: Option, pub sample_limit: Integer, pub samples_complete: bool, - #[serde(default = "default_2009")] + #[serde(default = "default_2011")] pub evidence: Vec, - #[serde(default = "default_2010")] + #[serde(default = "default_2012")] pub exceptions: String, - #[serde(default = "default_2011")] + #[serde(default = "default_2013")] pub uncertainty: String, pub code: String, pub severity: NamespaceAuditFindingSeverity, pub count: Integer, pub share: f64, - #[serde(default = "default_2012")] + #[serde(default = "default_2014")] pub bytes: Integer, - #[serde(default = "default_2013")] + #[serde(default = "default_2015")] pub samples: Vec>, pub detail: String, pub remedy: String, @@ -44833,7 +44859,7 @@ pub struct NamespaceAuditOutput { pub window_seconds: Integer, pub summary: NamespaceAuditSummary, pub findings: Vec, - #[serde(default = "default_2014")] + #[serde(default = "default_2016")] pub skipped: Vec, pub coverage: ReportCoverage, pub healthy: bool, @@ -44924,29 +44950,29 @@ pub enum BrowseEntryMyStatus { #[non_exhaustive] pub struct BrowseEntry { pub namespace: String, - #[serde(default = "default_2015")] + #[serde(default = "default_2017")] pub kind: String, pub description: String, pub owner_email: String, pub member_count: Integer, - #[serde(default = "default_2016")] + #[serde(default = "default_2018")] pub requires_approval: bool, pub created_at: String, - #[serde(default = "default_2017")] + #[serde(default = "default_2019")] pub join_policy: String, - #[serde(default = "default_2018")] + #[serde(default = "default_2020")] pub visibility: String, - #[serde(default = "default_2019")] + #[serde(default = "default_2021")] pub my_status: BrowseEntryMyStatus, - #[serde(default = "default_2020")] + #[serde(default = "default_2022")] pub my_role: String, - #[serde(default = "default_2021")] + #[serde(default = "default_2023")] pub repo: String, - #[serde(default = "default_2022")] + #[serde(default = "default_2024")] pub branch: String, - #[serde(default = "default_2023")] + #[serde(default = "default_2025")] pub guide_revision: Integer, - #[serde(default = "default_2024")] + #[serde(default = "default_2026")] pub guide_summary: String, } @@ -45050,9 +45076,9 @@ pub enum NamespaceCancelRequestOutputClearedRole { pub struct NamespaceCancelRequestOutput { pub cancelled: bool, pub namespace: String, - #[serde(default = "default_2025")] + #[serde(default = "default_2027")] pub cleared_role: Option, - #[serde(default = "default_2026")] + #[serde(default = "default_2028")] pub cancelled_at: Option, } @@ -45124,7 +45150,7 @@ pub struct NamespaceDeleteOutput { pub deleted: bool, pub namespace: String, pub updated_at: String, - #[serde(default = "default_2027")] + #[serde(default = "default_2029")] pub sources_retired: Vec, } @@ -45193,67 +45219,67 @@ pub enum NamespaceGetOutputClassification { pub struct NamespaceGetOutput { pub found: bool, pub namespace: String, - #[serde(default = "default_2028")] + #[serde(default = "default_2030")] pub kind: Option, - #[serde(default = "default_2029")] + #[serde(default = "default_2031")] pub owner_email: Option, - #[serde(default = "default_2030")] + #[serde(default = "default_2032")] pub description: Option, - #[serde(default = "default_2031")] + #[serde(default = "default_2033")] pub tags: Option>, - #[serde(default = "default_2032")] + #[serde(default = "default_2034")] pub active: Option, - #[serde(default = "default_2033")] + #[serde(default = "default_2035")] pub conversation_logging_enabled: Option, - #[serde(default = "default_2034")] + #[serde(default = "default_2036")] pub capture_generation_io: Option, - #[serde(default = "default_2035")] + #[serde(default = "default_2037")] pub coverage_sweep: Option, - #[serde(default = "default_2036")] + #[serde(default = "default_2038")] pub consolidation_enabled: Option, - #[serde(default = "default_2037")] + #[serde(default = "default_2039")] pub daily_cost_cap_usd: Option, - #[serde(default = "default_2038")] + #[serde(default = "default_2040")] pub daily_user_cost_cap_usd: Option, - #[serde(default = "default_2039")] + #[serde(default = "default_2041")] pub budget_alert_inbox: Option, - #[serde(default = "default_2040")] + #[serde(default = "default_2042")] pub conflict_threshold: Option, - #[serde(default = "default_2041")] + #[serde(default = "default_2043")] pub retention_days: Option, - #[serde(default = "default_2042")] + #[serde(default = "default_2044")] pub warm_days: Option, - #[serde(default = "default_2043")] + #[serde(default = "default_2045")] pub visibility: Option, - #[serde(default = "default_2044")] + #[serde(default = "default_2046")] pub requires_approval: Option, - #[serde(default = "default_2045")] + #[serde(default = "default_2047")] pub join_policy: Option, - #[serde(default = "default_2046")] + #[serde(default = "default_2048")] pub effective_join_policy: Option, - #[serde(default = "default_2047")] + #[serde(default = "default_2049")] pub retrieval_defaults: Option>, - #[serde(default = "default_2048")] + #[serde(default = "default_2050")] pub rerank_endpoint: Option, - #[serde(default = "default_2049")] + #[serde(default = "default_2051")] pub classify_endpoint: Option, - #[serde(default = "default_2050")] + #[serde(default = "default_2052")] pub default_conflict_policy: Option, - #[serde(default = "default_2051")] + #[serde(default = "default_2053")] pub proposal_policy: Option, - #[serde(default = "default_2052")] + #[serde(default = "default_2054")] pub code_change_policy: Option, - #[serde(default = "default_2053")] + #[serde(default = "default_2055")] pub tag_registry: Option>>, - #[serde(default = "default_2054")] + #[serde(default = "default_2056")] pub classification: Option, - #[serde(default = "default_2055")] + #[serde(default = "default_2057")] pub guide_revision: Option, - #[serde(default = "default_2056")] + #[serde(default = "default_2058")] pub guide_summary: Option, - #[serde(default = "default_2057")] + #[serde(default = "default_2059")] pub created_at: Option, - #[serde(default = "default_2058")] + #[serde(default = "default_2060")] pub updated_at: Option, } @@ -45306,17 +45332,17 @@ impl NamespaceGetInput { #[non_exhaustive] pub struct NamespaceGuideGetOutput { pub found: bool, - #[serde(default = "default_2059")] + #[serde(default = "default_2061")] pub revision: Integer, - #[serde(default = "default_2060")] + #[serde(default = "default_2062")] pub content: String, - #[serde(default = "default_2061")] + #[serde(default = "default_2063")] pub summary: String, - #[serde(default = "default_2062")] + #[serde(default = "default_2064")] pub note: String, - #[serde(default = "default_2063")] + #[serde(default = "default_2065")] pub updated_by: String, - #[serde(default = "default_2064")] + #[serde(default = "default_2066")] pub updated_at: Option, } @@ -45453,17 +45479,17 @@ impl NamespaceGuideHistoryInput { #[non_exhaustive] pub struct NamespaceGuideSetOutputNamespaceGuideGetOutput { pub found: bool, - #[serde(default = "default_2066")] + #[serde(default = "default_2068")] pub revision: Integer, - #[serde(default = "default_2067")] + #[serde(default = "default_2069")] pub content: String, - #[serde(default = "default_2068")] + #[serde(default = "default_2070")] pub summary: String, - #[serde(default = "default_2069")] + #[serde(default = "default_2071")] pub note: String, - #[serde(default = "default_2070")] + #[serde(default = "default_2072")] pub updated_by: String, - #[serde(default = "default_2071")] + #[serde(default = "default_2073")] pub updated_at: Option, } @@ -45471,10 +45497,10 @@ pub struct NamespaceGuideSetOutputNamespaceGuideGetOutput { #[non_exhaustive] pub struct NamespaceGuideSetOutput { pub written: bool, - #[serde(default = "default_2065")] + #[serde(default = "default_2067")] pub conflict: bool, pub revision: Integer, - #[serde(default = "default_2072")] + #[serde(default = "default_2074")] pub current: Option, } @@ -45595,7 +45621,7 @@ pub struct InventorySection { #[serde(deserialize_with = "required_nullable")] pub latest_at: Option, pub complete: bool, - #[serde(default = "default_2073")] + #[serde(default = "default_2075")] pub reason: String, } @@ -45625,10 +45651,10 @@ pub struct InventoryPopulation { pub population: InventoryPopulationPopulation, #[serde(deserialize_with = "required_nullable")] pub total: Option, - #[serde(default = "default_2074")] + #[serde(default = "default_2076")] pub top: Vec, pub complete: bool, - #[serde(default = "default_2075")] + #[serde(default = "default_2077")] pub reason: String, } @@ -45794,11 +45820,11 @@ pub struct NamespaceJoinOutput { pub joined: bool, pub namespace: String, pub role: NamespaceJoinOutputRole, - #[serde(default = "default_2076")] + #[serde(default = "default_2078")] pub status: String, - #[serde(default = "default_2077")] + #[serde(default = "default_2079")] pub requested_role: Option, - #[serde(default = "default_2078")] + #[serde(default = "default_2080")] pub pending_admins: Vec, pub joined_at: String, } @@ -45890,7 +45916,7 @@ impl NamespaceJoinInput { pub struct NamespaceLeaveOutput { pub left: bool, pub namespace: String, - #[serde(default = "default_2079")] + #[serde(default = "default_2081")] pub left_at: Option, } @@ -45967,27 +45993,27 @@ pub enum NamespaceEntryVisibility { #[non_exhaustive] pub struct NamespaceEntry { pub namespace: String, - #[serde(default = "default_2080")] + #[serde(default = "default_2082")] pub kind: String, pub owner_email: String, pub description: String, pub tags: Vec, pub active: bool, - #[serde(default = "default_2081")] + #[serde(default = "default_2083")] pub consolidation_enabled: bool, - #[serde(default = "default_2082")] + #[serde(default = "default_2084")] pub daily_cost_cap_usd: f64, - #[serde(default = "default_2083")] + #[serde(default = "default_2085")] pub daily_user_cost_cap_usd: f64, - #[serde(default = "default_2084")] + #[serde(default = "default_2086")] pub budget_alert_inbox: String, - #[serde(default = "default_2085")] + #[serde(default = "default_2087")] pub conflict_threshold: Option, - #[serde(default = "default_2086")] + #[serde(default = "default_2088")] pub retention_days: Integer, - #[serde(default = "default_2087")] + #[serde(default = "default_2089")] pub warm_days: Integer, - #[serde(default = "default_2088")] + #[serde(default = "default_2090")] pub visibility: NamespaceEntryVisibility, pub created_at: String, pub updated_at: String, @@ -46142,27 +46168,27 @@ pub enum MineEntryVisibility { pub struct MineEntry { pub namespace: String, pub role: String, - #[serde(default = "default_2089")] + #[serde(default = "default_2091")] pub status: String, - #[serde(default = "default_2090")] + #[serde(default = "default_2092")] pub pending_role: Option, - #[serde(default = "default_2091")] + #[serde(default = "default_2093")] pub pending_since: Option, - #[serde(default = "default_2092")] + #[serde(default = "default_2094")] pub pending_admins: Vec, - #[serde(default = "default_2093")] + #[serde(default = "default_2095")] pub visibility: MineEntryVisibility, - #[serde(default = "default_2094")] + #[serde(default = "default_2096")] pub kind: String, - #[serde(default = "default_2095")] + #[serde(default = "default_2097")] pub title: String, - #[serde(default = "default_2096")] + #[serde(default = "default_2098")] pub description: String, - #[serde(default = "default_2097")] + #[serde(default = "default_2099")] pub joined_at: Option, - #[serde(default = "default_2098")] + #[serde(default = "default_2100")] pub is_new: bool, - #[serde(default = "default_2099")] + #[serde(default = "default_2101")] pub inherited: bool, } @@ -46228,7 +46254,7 @@ pub struct OntologyEntry { pub name: String, pub status: String, pub description: String, - #[serde(default = "default_2100")] + #[serde(default = "default_2102")] pub cardinality: String, pub created_by: String, pub updated_at: String, @@ -46421,7 +46447,7 @@ pub struct NamespaceRegisterOutput { pub registered: bool, pub namespace: String, pub updated_at: String, - #[serde(default = "default_2101")] + #[serde(default = "default_2103")] pub visibility: NamespaceRegisterOutputVisibility, } @@ -47501,7 +47527,7 @@ impl NamespaceRegisterOntologyInput { #[non_exhaustive] pub struct NamespaceRestoreOutput { pub restored: bool, - #[serde(default = "default_2102")] + #[serde(default = "default_2104")] pub publication_pending: bool, pub target_namespace: String, pub snapshot_id: String, @@ -48388,15 +48414,15 @@ pub struct NamespaceRollbackOutput { pub version_at: Integer, pub reinstate: Integer, pub remove: Integer, - #[serde(default = "default_2103")] + #[serde(default = "default_2105")] pub skipped_no_head: Integer, - #[serde(default = "default_2104")] + #[serde(default = "default_2106")] pub skipped_already_gone: Integer, - #[serde(default = "default_2105")] + #[serde(default = "default_2107")] pub truncated: bool, - #[serde(default = "default_2106")] + #[serde(default = "default_2108")] pub sample: Vec>, - #[serde(default = "default_2107")] + #[serde(default = "default_2109")] pub applied_at: Option, } @@ -48575,101 +48601,101 @@ pub struct NamespaceSnapshotOutputSnapshotMemoryRow { pub confidence: f64, pub source_trace: String, pub pinned: bool, - #[serde(default = "default_2108")] + #[serde(default = "default_2110")] pub expires_at: Option, - #[serde(default = "default_2109")] + #[serde(default = "default_2111")] pub entities: Vec, - #[serde(default = "default_2110")] + #[serde(default = "default_2112")] pub version: Integer, - #[serde(default = "default_2111")] + #[serde(default = "default_2113")] pub content_sha256: String, - #[serde(default = "default_2112")] + #[serde(default = "default_2114")] pub actor: String, - #[serde(default = "default_2113")] + #[serde(default = "default_2115")] pub source_class: String, - #[serde(default = "default_2114")] + #[serde(default = "default_2116")] pub source_resource_id: String, - #[serde(default = "default_2115")] + #[serde(default = "default_2117")] pub verified_by: String, - #[serde(default = "default_2116")] + #[serde(default = "default_2118")] pub verified_at: Option, - #[serde(default = "default_2117")] + #[serde(default = "default_2119")] pub verified_sha256: String, - #[serde(default = "default_2118")] + #[serde(default = "default_2120")] pub grounding: String, - #[serde(default = "default_2119")] + #[serde(default = "default_2121")] pub evidence: String, - #[serde(default = "default_2120")] + #[serde(default = "default_2122")] pub tags: Vec, - #[serde(default = "default_2121")] + #[serde(default = "default_2123")] pub valid_at: Option, - #[serde(default = "default_2122")] + #[serde(default = "default_2124")] pub valid_to: Option, - #[serde(default = "default_2123")] + #[serde(default = "default_2125")] pub created_at: Option, - #[serde(default = "default_2124")] + #[serde(default = "default_2126")] pub updated_at: Option, - #[serde(default = "default_2125")] + #[serde(default = "default_2127")] pub value_json: String, - #[serde(default = "default_2126")] + #[serde(default = "default_2128")] pub status: NamespaceSnapshotOutputSnapshotMemoryRowStatus, - #[serde(default = "default_2127")] + #[serde(default = "default_2129")] pub requires_review: Option, - #[serde(default = "default_2128")] + #[serde(default = "default_2130")] pub conflict_with: Vec, - #[serde(default = "default_2129")] + #[serde(default = "default_2131")] pub duplicate_of: String, - #[serde(default = "default_2130")] + #[serde(default = "default_2132")] pub evidence_count: Integer, - #[serde(default = "default_2131")] + #[serde(default = "default_2133")] pub recall_count: Integer, - #[serde(default = "default_2132")] + #[serde(default = "default_2134")] pub last_recalled_at: Option, - #[serde(default = "default_2133")] + #[serde(default = "default_2135")] pub cross_promoted_from_memory_id: String, - #[serde(default = "default_2134")] + #[serde(default = "default_2136")] pub cross_promoted_from_namespace: String, - #[serde(default = "default_2135")] + #[serde(default = "default_2137")] pub superseded_by: String, - #[serde(default = "default_2136")] + #[serde(default = "default_2138")] pub rejection_reason: String, - #[serde(default = "default_2137")] + #[serde(default = "default_2139")] pub temporal_anchor: Option, - #[serde(default = "default_2138")] + #[serde(default = "default_2140")] pub temporal_confidence: f64, - #[serde(default = "default_2139")] + #[serde(default = "default_2141")] pub invalid_at: Option, - #[serde(default = "default_2140")] + #[serde(default = "default_2142")] pub char_limit: Option, - #[serde(default = "default_2141")] + #[serde(default = "default_2143")] pub reinforcement_count: Integer, - #[serde(default = "default_2142")] + #[serde(default = "default_2144")] pub last_reinforced_at: Option, - #[serde(default = "default_2143")] + #[serde(default = "default_2145")] pub mentioned_at: Option, - #[serde(default = "default_2144")] + #[serde(default = "default_2146")] pub sensitivity: String, - #[serde(default = "default_2145")] + #[serde(default = "default_2147")] pub redacted_at: Option, - #[serde(default = "default_2146")] + #[serde(default = "default_2148")] pub redaction_reason: String, - #[serde(default = "default_2147")] + #[serde(default = "default_2149")] pub lock_mode: String, - #[serde(default = "default_2148")] + #[serde(default = "default_2150")] pub lock_reason: String, - #[serde(default = "default_2149")] + #[serde(default = "default_2151")] pub lock_until: Option, - #[serde(default = "default_2150")] + #[serde(default = "default_2152")] pub locked_by: String, - #[serde(default = "default_2151")] + #[serde(default = "default_2153")] pub locked_at: Option, - #[serde(default = "default_2152")] + #[serde(default = "default_2154")] pub on_expire: String, - #[serde(default = "default_2153")] + #[serde(default = "default_2155")] pub expire_reason: String, - #[serde(default = "default_2154")] + #[serde(default = "default_2156")] pub files: Vec, - #[serde(default = "default_2155")] + #[serde(default = "default_2157")] pub concepts: Vec, } @@ -48678,11 +48704,11 @@ pub struct NamespaceSnapshotOutputSnapshotMemoryRow { pub struct NamespaceSnapshotOutputSnapshotTypeRow { pub memory_type: String, pub retention_days: Integer, - #[serde(default = "default_2156")] + #[serde(default = "default_2158")] pub dedup_threshold: Option, - #[serde(default = "default_2157")] + #[serde(default = "default_2159")] pub hot_quota: Integer, - #[serde(default = "default_2158")] + #[serde(default = "default_2160")] pub conflict_policy: String, } @@ -48897,7 +48923,7 @@ pub struct TaxonomyCommunity { pub community_id: Integer, pub label: String, pub size: Integer, - #[serde(default = "default_2159")] + #[serde(default = "default_2161")] pub top_entities: Vec, } @@ -48908,9 +48934,9 @@ pub struct NamespaceTaxonomyOutput { pub entities: Vec, pub memory_count: Integer, pub memory_types: Vec, - #[serde(default = "default_2160")] + #[serde(default = "default_2162")] pub communities: Vec, - #[serde(default = "default_2161")] + #[serde(default = "default_2163")] pub communities_computed_at: String, } @@ -49010,15 +49036,15 @@ pub enum TuneProposalTarget { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TuneEvidence { - #[serde(default = "default_2163")] + #[serde(default = "default_2165")] pub finding_codes: Vec, - #[serde(default = "default_2164")] + #[serde(default = "default_2166")] pub supporting_count: Integer, - #[serde(default = "default_2165")] + #[serde(default = "default_2167")] pub supporting: Vec, - #[serde(default = "default_2166")] + #[serde(default = "default_2168")] pub counter_count: Option, - #[serde(default = "default_2167")] + #[serde(default = "default_2169")] pub documents: Vec, } @@ -49044,10 +49070,10 @@ pub enum TuneApplyVia { #[non_exhaustive] pub struct TuneApply { pub op: String, - #[serde(default = "default_2171")] + #[serde(default = "default_2173")] pub via: TuneApplyVia, pub args: std::collections::HashMap, - #[serde(default = "default_2172")] + #[serde(default = "default_2174")] pub args_complete: bool, pub required_role: String, pub guard: String, @@ -49066,7 +49092,7 @@ pub struct ChunkStats { pub sections: Integer, pub sections_cut: Integer, pub max_input_tokens: Integer, - #[serde(default = "default_2174")] + #[serde(default = "default_2176")] pub over_input_limit: Option, } @@ -49086,25 +49112,25 @@ pub struct TuneProposal { pub title: String, pub rationale: String, pub current: String, - #[serde(default = "default_2162")] + #[serde(default = "default_2164")] pub current_revision: Option, pub proposed: String, pub evidence: TuneEvidence, - #[serde(default = "default_2168")] + #[serde(default = "default_2170")] pub affected_agents: Vec, - #[serde(default = "default_2169")] + #[serde(default = "default_2171")] pub affected_agents_total: Option, - #[serde(default = "default_2170")] + #[serde(default = "default_2172")] pub effect: TuneProposalEffect, pub historical: String, pub apply: TuneApply, - #[serde(default = "default_2173")] - pub apply_also: Vec, #[serde(default = "default_2175")] + pub apply_also: Vec, + #[serde(default = "default_2177")] pub preview: Option, - #[serde(default = "default_2176")] + #[serde(default = "default_2178")] pub limits: String, - #[serde(default = "default_2177")] + #[serde(default = "default_2179")] pub refs: Vec, } @@ -49112,13 +49138,13 @@ pub struct TuneProposal { #[non_exhaustive] pub struct ChunkingSample { pub cap: Integer, - #[serde(default = "default_2183")] + #[serde(default = "default_2185")] pub population: Option, pub documents: Integer, pub unread: Integer, pub load_cap: Integer, pub embedder_model: String, - #[serde(default = "default_2184")] + #[serde(default = "default_2186")] pub input_token_limit: Option, pub current: ChunkStats, } @@ -49129,21 +49155,21 @@ pub struct NamespaceTuneOutput { pub org: String, pub namespace: String, pub computed_at: String, - #[serde(default = "default_2178")] + #[serde(default = "default_2180")] pub proposals: Vec, - #[serde(default = "default_2179")] + #[serde(default = "default_2181")] pub guide_revision: Option, - #[serde(default = "default_2180")] + #[serde(default = "default_2182")] pub categories_registered: Option, - #[serde(default = "default_2181")] + #[serde(default = "default_2183")] pub extraction_policy: Option, - #[serde(default = "default_2182")] + #[serde(default = "default_2184")] pub extraction_policy_unavailable: String, - #[serde(default = "default_2185")] + #[serde(default = "default_2187")] pub chunking: Option, - #[serde(default = "default_2186")] + #[serde(default = "default_2188")] pub skipped: Vec, - #[serde(default = "default_2187")] + #[serde(default = "default_2189")] pub model_used: bool, } @@ -49264,25 +49290,25 @@ pub struct NamespaceValidateFinding { pub kind: NamespaceValidateFindingKind, pub rule_version: Integer, pub source_op: String, - #[serde(default = "default_2188")] + #[serde(default = "default_2190")] pub window_seconds: Option, - #[serde(default = "default_2189")] + #[serde(default = "default_2191")] pub population: Option, pub sample_limit: Integer, pub samples_complete: bool, - #[serde(default = "default_2190")] + #[serde(default = "default_2192")] pub evidence: Vec, - #[serde(default = "default_2191")] + #[serde(default = "default_2193")] pub exceptions: String, - #[serde(default = "default_2192")] + #[serde(default = "default_2194")] pub uncertainty: String, pub check: String, pub severity: NamespaceValidateFindingSeverity, pub count: Integer, - #[serde(default = "default_2193")] + #[serde(default = "default_2195")] pub samples: Vec>, pub detail: String, - #[serde(default = "default_2194")] + #[serde(default = "default_2196")] pub totals: std::collections::HashMap, } @@ -49296,9 +49322,9 @@ pub struct NamespaceValidateOutput { pub warnings: Integer, pub infos: Integer, pub findings: Vec, - #[serde(default = "default_2195")] + #[serde(default = "default_2197")] pub skipped: Vec, - #[serde(default = "default_2196")] + #[serde(default = "default_2198")] pub keys_scoped: Integer, pub coverage: ReportCoverage, pub checked_at: String, @@ -49418,9 +49444,9 @@ impl NamespaceValidateInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ObserveCrystallizeOutput { - #[serde(default = "default_2197")] + #[serde(default = "default_2199")] pub enqueued: Integer, - #[serde(default = "default_2198")] + #[serde(default = "default_2200")] pub session_id: String, } @@ -49517,23 +49543,23 @@ impl ObserveCrystallizeInput { #[non_exhaustive] pub struct ObserveRecordOutput { pub memory_key: String, - #[serde(default = "default_2199")] + #[serde(default = "default_2201")] pub memory_id: String, - #[serde(default = "default_2200")] + #[serde(default = "default_2202")] pub kind: String, - #[serde(default = "default_2201")] + #[serde(default = "default_2203")] pub tags: Vec, - #[serde(default = "default_2202")] + #[serde(default = "default_2204")] pub file_paths: Vec, - #[serde(default = "default_2203")] + #[serde(default = "default_2205")] pub content_sha256: String, - #[serde(default = "default_2204")] + #[serde(default = "default_2206")] pub tool_name: String, - #[serde(default = "default_2205")] + #[serde(default = "default_2207")] pub has_error: bool, - #[serde(default = "default_2206")] + #[serde(default = "default_2208")] pub narrative_chars: Integer, - #[serde(default = "default_2207")] + #[serde(default = "default_2209")] pub skipped_reason: String, } @@ -49732,26 +49758,26 @@ pub struct ProjectionFailureRow { pub failure_id: String, pub org: String, pub namespace: String, - #[serde(default = "default_2208")] + #[serde(default = "default_2210")] pub agent: String, pub projection: String, - #[serde(default = "default_2209")] + #[serde(default = "default_2211")] pub source_operation: String, - #[serde(default = "default_2210")] + #[serde(default = "default_2212")] pub source_resource_id: String, - #[serde(default = "default_2211")] + #[serde(default = "default_2213")] pub memory_keys: Vec, - #[serde(default = "default_2212")] + #[serde(default = "default_2214")] pub error_type: String, - #[serde(default = "default_2213")] + #[serde(default = "default_2215")] pub error_message: String, - #[serde(default = "default_2214")] + #[serde(default = "default_2216")] pub payload: std::collections::HashMap, - #[serde(default = "default_2215")] + #[serde(default = "default_2217")] pub status: String, - #[serde(default = "default_2216")] + #[serde(default = "default_2218")] pub created_at: Option, - #[serde(default = "default_2217")] + #[serde(default = "default_2219")] pub resolved_at: Option, } @@ -49905,22 +49931,22 @@ pub struct ProjectionFailureRetryRow { pub projection: String, pub retried: bool, pub resolved: bool, - #[serde(default = "default_2218")] + #[serde(default = "default_2220")] pub abandoned: bool, - #[serde(default = "default_2219")] + #[serde(default = "default_2221")] pub reason: String, - #[serde(default = "default_2220")] + #[serde(default = "default_2222")] pub error: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ProjectionFailureRetryOutput { - #[serde(default = "default_2221")] + #[serde(default = "default_2223")] pub results: Vec, pub retried: Integer, pub resolved: Integer, - #[serde(default = "default_2222")] + #[serde(default = "default_2224")] pub abandoned: Integer, } @@ -50002,15 +50028,15 @@ impl ProjectionFailureRetryInput { pub struct OrgModelCallsOutput { pub org: String, pub enabled: bool, - #[serde(default = "default_2223")] + #[serde(default = "default_2225")] pub reason: String, - #[serde(default = "default_2224")] + #[serde(default = "default_2226")] pub updated_by: String, - #[serde(default = "default_2225")] + #[serde(default = "default_2227")] pub updated_at: Option, - #[serde(default = "default_2226")] + #[serde(default = "default_2228")] pub locked: bool, - #[serde(default = "default_2227")] + #[serde(default = "default_2229")] pub locked_by: String, } @@ -50349,7 +50375,7 @@ impl PolicyDecisionsInput { #[non_exhaustive] pub struct PolicyDeleteOutput { pub removed: bool, - #[serde(default = "default_2228")] + #[serde(default = "default_2230")] pub widening: bool, } @@ -50415,12 +50441,12 @@ pub struct PolicyRuleOut { pub condition: std::collections::HashMap, pub description: String, pub enabled: bool, - #[serde(default = "default_2229")] + #[serde(default = "default_2231")] pub mode: String, pub created_by: String, - #[serde(default = "default_2230")] + #[serde(default = "default_2232")] pub created_at: Option, - #[serde(default = "default_2231")] + #[serde(default = "default_2233")] pub updated_at: Option, } @@ -50492,9 +50518,9 @@ impl PolicyListInput { pub struct PolicySetOutput { pub rule: PolicyRuleOut, pub leaf_count: Integer, - #[serde(default = "default_2232")] + #[serde(default = "default_2234")] pub widening: bool, - #[serde(default = "default_2233")] + #[serde(default = "default_2235")] pub change: Vec, } @@ -50764,37 +50790,37 @@ pub struct ProcedureEvolveOutput { pub revision: Integer, pub changed: bool, pub template: bool, - #[serde(default = "default_2234")] + #[serde(default = "default_2236")] pub folded_runs: Integer, - #[serde(default = "default_2235")] + #[serde(default = "default_2237")] pub gate: ProcedureEvolveOutputGate, - #[serde(default = "default_2236")] + #[serde(default = "default_2238")] pub gate_mode: String, - #[serde(default = "default_2237")] + #[serde(default = "default_2239")] pub gate_llr: f64, - #[serde(default = "default_2238")] + #[serde(default = "default_2240")] pub gate_before: std::collections::HashMap, - #[serde(default = "default_2239")] + #[serde(default = "default_2241")] pub gate_after: std::collections::HashMap, - #[serde(default = "default_2240")] + #[serde(default = "default_2242")] pub gate_cost_before: std::collections::HashMap, - #[serde(default = "default_2241")] + #[serde(default = "default_2243")] pub gate_cost_after: std::collections::HashMap, - #[serde(default = "default_2242")] + #[serde(default = "default_2244")] pub gate_reason: String, - #[serde(default = "default_2243")] + #[serde(default = "default_2245")] pub dead_end_steps: Vec, - #[serde(default = "default_2244")] + #[serde(default = "default_2246")] pub fail_prone_steps: Vec, - #[serde(default = "default_2245")] + #[serde(default = "default_2247")] pub fail_prone_transitions: Vec, - #[serde(default = "default_2246")] + #[serde(default = "default_2248")] pub run_stats: std::collections::HashMap, - #[serde(default = "default_2247")] + #[serde(default = "default_2249")] pub strikes: Integer, - #[serde(default = "default_2248")] + #[serde(default = "default_2250")] pub quarantined: bool, - #[serde(default = "default_2249")] + #[serde(default = "default_2251")] pub retention: std::collections::HashMap, } @@ -51017,9 +51043,9 @@ pub struct ProcedureForkOutput { pub memory_key: String, pub version: Integer, pub name: String, - #[serde(default = "default_2250")] + #[serde(default = "default_2252")] pub steps: Vec, - #[serde(default = "default_2251")] + #[serde(default = "default_2253")] pub forked_from: std::collections::HashMap, } @@ -51279,32 +51305,32 @@ pub enum ProcedureLocateOutputStatus { #[non_exhaustive] pub struct ProcedureLocateOutput { pub memory_key: String, - #[serde(default = "default_2252")] + #[serde(default = "default_2254")] pub name: String, - #[serde(default = "default_2253")] + #[serde(default = "default_2255")] pub status: ProcedureLocateOutputStatus, pub matched: bool, - #[serde(default = "default_2254")] + #[serde(default = "default_2256")] pub active: Option>, - #[serde(default = "default_2255")] + #[serde(default = "default_2257")] pub hops: Vec>>, - #[serde(default = "default_2256")] + #[serde(default = "default_2258")] pub entry_nodes: Vec, - #[serde(default = "default_2257")] + #[serde(default = "default_2259")] pub dominant_next: Vec, - #[serde(default = "default_2258")] + #[serde(default = "default_2260")] pub revisits: std::collections::HashMap, - #[serde(default = "default_2259")] + #[serde(default = "default_2261")] pub looping: bool, - #[serde(default = "default_2260")] + #[serde(default = "default_2262")] pub exits: Vec, - #[serde(default = "default_2261")] + #[serde(default = "default_2263")] pub failure_notes: Vec>, - #[serde(default = "default_2262")] + #[serde(default = "default_2264")] pub rendered: String, - #[serde(default = "default_2263")] + #[serde(default = "default_2265")] pub run_stats: std::collections::HashMap, - #[serde(default = "default_2264")] + #[serde(default = "default_2266")] pub for_agent: std::collections::HashMap, } @@ -51459,43 +51485,43 @@ pub struct ProcedureMatch { pub name: String, pub situation: String, pub steps: Vec, - #[serde(default = "default_2265")] + #[serde(default = "default_2267")] pub tags: Vec, - #[serde(default = "default_2266")] + #[serde(default = "default_2268")] pub metadata: std::collections::HashMap, pub similarity: f64, pub memory_key: String, pub namespace: String, - #[serde(default = "default_2267")] + #[serde(default = "default_2269")] pub graph: Option>, - #[serde(default = "default_2268")] + #[serde(default = "default_2270")] pub template: bool, - #[serde(default = "default_2269")] + #[serde(default = "default_2271")] pub run_stats: std::collections::HashMap, - #[serde(default = "default_2270")] + #[serde(default = "default_2272")] pub status: ProcedureMatchStatus, - #[serde(default = "default_2271")] + #[serde(default = "default_2273")] pub quarantined: Option>, - #[serde(default = "default_2272")] + #[serde(default = "default_2274")] pub fail_prone_steps: Vec, - #[serde(default = "default_2273")] + #[serde(default = "default_2275")] pub revision: Integer, - #[serde(default = "default_2274")] + #[serde(default = "default_2276")] pub rejected_revisions: Vec>, - #[serde(default = "default_2275")] + #[serde(default = "default_2277")] pub tool_overlap: f64, - #[serde(default = "default_2276")] + #[serde(default = "default_2278")] pub score: f64, - #[serde(default = "default_2277")] + #[serde(default = "default_2279")] pub utility: f64, - #[serde(default = "default_2278")] + #[serde(default = "default_2280")] pub goal_similarity: Option, - #[serde(default = "default_2279")] + #[serde(default = "default_2281")] pub for_agent: std::collections::HashMap, - #[serde(default = "default_2280")] + #[serde(default = "default_2282")] pub run_stats_by_agent: std::collections::HashMap>, - #[serde(default = "default_2281")] + #[serde(default = "default_2283")] pub actor: String, } @@ -51503,11 +51529,11 @@ pub struct ProcedureMatch { #[non_exhaustive] pub struct ProcedureMatchOutput { pub matches: Vec, - #[serde(default = "default_2282")] + #[serde(default = "default_2284")] pub matched: Integer, - #[serde(default = "default_2283")] + #[serde(default = "default_2285")] pub procedure_key: String, - #[serde(default = "default_2284")] + #[serde(default = "default_2286")] pub score: f64, } @@ -51899,9 +51925,9 @@ pub struct ProcedureReviseOutput { pub revision: Integer, pub prior_revision: Integer, pub digest: String, - #[serde(default = "default_2285")] + #[serde(default = "default_2287")] pub steps: Vec, - #[serde(default = "default_2286")] + #[serde(default = "default_2288")] pub outcome: ProcedureReviseOutputOutcome, } @@ -52013,14 +52039,14 @@ pub struct ProfileActivityEntry { pub agent: String, pub last_activated_at: String, pub event_count: Integer, - #[serde(default = "default_2287")] + #[serde(default = "default_2289")] pub operations: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ProfileActivityOutput { - #[serde(default = "default_2288")] + #[serde(default = "default_2290")] pub entries: Vec, } @@ -52128,17 +52154,17 @@ impl ProfileActivityInput { #[non_exhaustive] pub struct ProfileMutationOutput { pub version: Integer, - #[serde(default = "default_2289")] + #[serde(default = "default_2291")] pub memory_id: String, - #[serde(default = "default_2290")] + #[serde(default = "default_2292")] pub content_sha256: String, - #[serde(default = "default_2291")] + #[serde(default = "default_2293")] pub namespace: String, - #[serde(default = "default_2292")] + #[serde(default = "default_2294")] pub label: String, - #[serde(default = "default_2293")] + #[serde(default = "default_2295")] pub char_limit: Option, - #[serde(default = "default_2294")] + #[serde(default = "default_2296")] pub value_length: Integer, } @@ -52247,7 +52273,7 @@ pub struct ProfileRenderOutput { pub rendered: String, pub section_count: Integer, pub total_chars: Integer, - #[serde(default = "default_2295")] + #[serde(default = "default_2297")] pub labels: Vec, } @@ -52632,17 +52658,17 @@ pub enum ProfileStructuredOutputStatus { #[non_exhaustive] pub struct ProfileStructuredOutput { pub status: ProfileStructuredOutputStatus, - #[serde(default = "default_2296")] + #[serde(default = "default_2298")] pub profile: std::collections::HashMap, - #[serde(default = "default_2297")] + #[serde(default = "default_2299")] pub built_at: Option, - #[serde(default = "default_2298")] + #[serde(default = "default_2300")] pub memory_id: String, - #[serde(default = "default_2299")] + #[serde(default = "default_2301")] pub version: Integer, - #[serde(default = "default_2300")] + #[serde(default = "default_2302")] pub version_text: String, - #[serde(default = "default_2301")] + #[serde(default = "default_2303")] pub schema_sha256: String, } @@ -52759,13 +52785,13 @@ impl ProfileStructuredInput { #[non_exhaustive] pub struct ProfileSchemaOutput { pub found: bool, - #[serde(default = "default_2302")] + #[serde(default = "default_2304")] pub json_schema: std::collections::HashMap, - #[serde(default = "default_2303")] + #[serde(default = "default_2305")] pub schema_sha256: String, - #[serde(default = "default_2304")] + #[serde(default = "default_2306")] pub updated_by: String, - #[serde(default = "default_2305")] + #[serde(default = "default_2307")] pub updated_at: Option, } @@ -52918,10 +52944,10 @@ pub enum RunBeginOutputStatus { #[non_exhaustive] pub struct RunBeginOutput { pub run_id: String, - #[serde(default = "default_2306")] + #[serde(default = "default_2308")] pub status: RunBeginOutputStatus, pub started_at: String, - #[serde(default = "default_2307")] + #[serde(default = "default_2309")] pub next: String, } @@ -53129,29 +53155,29 @@ pub struct RunCompleteOutput { pub run_id: String, pub status: RunCompleteOutputStatus, pub duration_ms: Integer, - #[serde(default = "default_2308")] + #[serde(default = "default_2310")] pub used_applied: Integer, - #[serde(default = "default_2309")] + #[serde(default = "default_2311")] pub evidence_applied: Integer, - #[serde(default = "default_2310")] + #[serde(default = "default_2312")] pub harm_applied: Integer, - #[serde(default = "default_2311")] + #[serde(default = "default_2313")] pub memories_written: Vec, - #[serde(default = "default_2312")] + #[serde(default = "default_2314")] pub recalled: Integer, - #[serde(default = "default_2313")] + #[serde(default = "default_2315")] pub observations: Integer, - #[serde(default = "default_2314")] + #[serde(default = "default_2316")] pub procedure_runs_recorded: Integer, - #[serde(default = "default_2315")] + #[serde(default = "default_2317")] pub reflection_key: String, - #[serde(default = "default_2316")] + #[serde(default = "default_2318")] pub retain: String, - #[serde(default = "default_2317")] + #[serde(default = "default_2319")] pub retained: Integer, - #[serde(default = "default_2318")] + #[serde(default = "default_2320")] pub demoted: Integer, - #[serde(default = "default_2319")] + #[serde(default = "default_2321")] pub expiring: Integer, } @@ -53672,25 +53698,25 @@ pub enum RunGetOutputOverBudgetItem { #[non_exhaustive] pub struct RunGetOutput { pub found: bool, - #[serde(default = "default_2320")] + #[serde(default = "default_2322")] pub run: Option, - #[serde(default = "default_2321")] + #[serde(default = "default_2323")] pub recalled: Integer, - #[serde(default = "default_2322")] + #[serde(default = "default_2324")] pub recalled_keys: Vec, - #[serde(default = "default_2323")] + #[serde(default = "default_2325")] pub memories_written: Vec, - #[serde(default = "default_2324")] + #[serde(default = "default_2326")] pub observations: Integer, - #[serde(default = "default_2325")] + #[serde(default = "default_2327")] pub turns: Integer, - #[serde(default = "default_2326")] + #[serde(default = "default_2328")] pub unpriced_turns: Integer, - #[serde(default = "default_2327")] + #[serde(default = "default_2329")] pub cost_usd: f64, - #[serde(default = "default_2328")] + #[serde(default = "default_2330")] pub elapsed_seconds: Integer, - #[serde(default = "default_2329")] + #[serde(default = "default_2331")] pub over_budget: Vec, } @@ -53757,17 +53783,17 @@ pub struct RunGradeProposal { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct RunGradeOutput { - #[serde(default = "default_2330")] + #[serde(default = "default_2332")] pub graded: Integer, - #[serde(default = "default_2331")] + #[serde(default = "default_2333")] pub run_ids: Vec, - #[serde(default = "default_2332")] + #[serde(default = "default_2334")] pub skipped_active: Integer, - #[serde(default = "default_2333")] + #[serde(default = "default_2335")] pub unchanged: Integer, - #[serde(default = "default_2334")] + #[serde(default = "default_2336")] pub memories_counted: Integer, - #[serde(default = "default_2335")] + #[serde(default = "default_2337")] pub proposals_decided: Vec, } @@ -53882,7 +53908,7 @@ impl RunGradeInput { #[non_exhaustive] pub struct RunListOutput { pub runs: Vec, - #[serde(default = "default_2336")] + #[serde(default = "default_2338")] pub total: Option, } @@ -54159,39 +54185,39 @@ pub struct LiveSearchHit { pub title: String, pub url: String, pub provider: LiveSearchHitProvider, - #[serde(default = "default_2339")] + #[serde(default = "default_2341")] pub content: String, - #[serde(default = "default_2340")] + #[serde(default = "default_2342")] pub live: LiveSearchHitLive, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct LiveSearchResults { - #[serde(default = "default_2338")] + #[serde(default = "default_2340")] pub live: LiveSearchResultsLive, - #[serde(default = "default_2341")] + #[serde(default = "default_2343")] pub results: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SearchOutput { - #[serde(default = "default_2337")] + #[serde(default = "default_2339")] pub tracker: Option>, - #[serde(default = "default_2342")] + #[serde(default = "default_2344")] pub live: Option, - #[serde(default = "default_2343")] + #[serde(default = "default_2345")] pub memory: std::collections::HashMap, - #[serde(default = "default_2344")] + #[serde(default = "default_2346")] pub knowledge: std::collections::HashMap, - #[serde(default = "default_2345")] + #[serde(default = "default_2347")] pub profile: std::collections::HashMap, - #[serde(default = "default_2346")] + #[serde(default = "default_2348")] pub conversations: std::collections::HashMap, - #[serde(default = "default_2347")] + #[serde(default = "default_2349")] pub withheld: Option>, - #[serde(default = "default_2348")] + #[serde(default = "default_2350")] pub namespaces_skipped: Vec, } @@ -54384,7 +54410,7 @@ impl SearchInput { pub struct SessionBriefDeleteOutput { pub deleted: bool, pub brief_key: String, - #[serde(default = "default_2349")] + #[serde(default = "default_2351")] pub revision: Integer, } @@ -54477,67 +54503,67 @@ impl SessionBriefDeleteInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct BriefDecision { - #[serde(default = "default_2358")] + #[serde(default = "default_2360")] pub what: String, - #[serde(default = "default_2359")] + #[serde(default = "default_2361")] pub why: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct BriefDeadEnd { - #[serde(default = "default_2361")] + #[serde(default = "default_2363")] pub tried: String, - #[serde(default = "default_2362")] + #[serde(default = "default_2364")] pub why_not: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct BriefDone { - #[serde(default = "default_2364")] + #[serde(default = "default_2366")] pub what: String, - #[serde(rename = "ref", default = "default_2365")] + #[serde(rename = "ref", default = "default_2367")] pub r#ref: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct BriefFile { - #[serde(default = "default_2369")] + #[serde(default = "default_2371")] pub path: String, - #[serde(default = "default_2370")] + #[serde(default = "default_2372")] pub role: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct BriefSections { - #[serde(default = "default_2355")] + #[serde(default = "default_2357")] pub goal: String, - #[serde(default = "default_2356")] + #[serde(default = "default_2358")] pub status: String, - #[serde(default = "default_2357")] + #[serde(default = "default_2359")] pub verification: String, - #[serde(default = "default_2360")] + #[serde(default = "default_2362")] pub decisions: Vec, - #[serde(default = "default_2363")] + #[serde(default = "default_2365")] pub dead_ends: Vec, - #[serde(default = "default_2366")] + #[serde(default = "default_2368")] pub done: Vec, - #[serde(default = "default_2367")] + #[serde(default = "default_2369")] pub open_questions: Vec, - #[serde(default = "default_2368")] + #[serde(default = "default_2370")] pub next_steps: Vec, - #[serde(default = "default_2371")] + #[serde(default = "default_2373")] pub files: Vec, - #[serde(default = "default_2372")] + #[serde(default = "default_2374")] pub constraints: Vec, - #[serde(default = "default_2373")] + #[serde(default = "default_2375")] pub pointers: Vec, - #[serde(default = "default_2374")] + #[serde(default = "default_2376")] pub client_summary: String, - #[serde(default = "default_2375")] + #[serde(default = "default_2377")] pub client_summary_at: String, } @@ -54545,45 +54571,45 @@ pub struct BriefSections { #[non_exhaustive] pub struct SessionBriefGetOutput { pub found: bool, - #[serde(default = "default_2350")] + #[serde(default = "default_2352")] pub brief_key: String, - #[serde(default = "default_2351")] + #[serde(default = "default_2353")] pub revision: Integer, - #[serde(default = "default_2352")] + #[serde(default = "default_2354")] pub snapshot_id: String, - #[serde(default = "default_2353")] + #[serde(default = "default_2355")] pub snapshot_key: String, - #[serde(default = "default_2354")] + #[serde(default = "default_2356")] pub rendered: String, - #[serde(default = "default_2376")] + #[serde(default = "default_2378")] pub sections: Option, - #[serde(default = "default_2377")] + #[serde(default = "default_2379")] pub project: String, - #[serde(default = "default_2378")] + #[serde(default = "default_2380")] pub branch: String, - #[serde(default = "default_2379")] + #[serde(default = "default_2381")] pub head_sha: String, - #[serde(default = "default_2380")] + #[serde(default = "default_2382")] pub author: String, - #[serde(default = "default_2381")] + #[serde(default = "default_2383")] pub trigger: String, - #[serde(default = "default_2382")] + #[serde(default = "default_2384")] pub actor: String, - #[serde(default = "default_2383")] + #[serde(default = "default_2385")] pub source_sessions: Vec, - #[serde(default = "default_2384")] + #[serde(default = "default_2386")] pub updated_at: Option, - #[serde(default = "default_2385")] + #[serde(default = "default_2387")] pub age_seconds: Integer, - #[serde(default = "default_2386")] + #[serde(default = "default_2388")] pub revisions: Integer, - #[serde(default = "default_2387")] + #[serde(default = "default_2389")] pub events_total: Integer, - #[serde(default = "default_2388")] + #[serde(default = "default_2390")] pub source_chars: Integer, - #[serde(default = "default_2389")] + #[serde(default = "default_2391")] pub brief_chars: Integer, - #[serde(default = "default_2390")] + #[serde(default = "default_2392")] pub deleted: bool, } @@ -54758,34 +54784,34 @@ impl SessionBriefGetInput { pub struct SessionBriefSummary { pub brief_key: String, pub revision: Integer, - #[serde(default = "default_2391")] + #[serde(default = "default_2393")] pub project: String, - #[serde(default = "default_2392")] + #[serde(default = "default_2394")] pub branch: String, - #[serde(default = "default_2393")] + #[serde(default = "default_2395")] pub agent: String, - #[serde(default = "default_2394")] + #[serde(default = "default_2396")] pub goal: String, - #[serde(default = "default_2395")] + #[serde(default = "default_2397")] pub status: String, - #[serde(default = "default_2396")] + #[serde(default = "default_2398")] pub author: String, - #[serde(default = "default_2397")] + #[serde(default = "default_2399")] pub actor: String, - #[serde(default = "default_2398")] + #[serde(default = "default_2400")] pub updated_at: Option, - #[serde(default = "default_2399")] + #[serde(default = "default_2401")] pub age_seconds: Integer, - #[serde(default = "default_2400")] + #[serde(default = "default_2402")] pub brief_chars: Integer, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SessionBriefListOutput { - #[serde(default = "default_2401")] + #[serde(default = "default_2403")] pub briefs: Vec, - #[serde(default = "default_2402")] + #[serde(default = "default_2404")] pub rendered: String, } @@ -54925,25 +54951,25 @@ impl SessionBriefListInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SessionBriefStats { - #[serde(default = "default_2406")] + #[serde(default = "default_2408")] pub events_in: Integer, - #[serde(default = "default_2407")] + #[serde(default = "default_2409")] pub windows: Integer, - #[serde(default = "default_2408")] + #[serde(default = "default_2410")] pub events_total: Integer, - #[serde(default = "default_2409")] + #[serde(default = "default_2411")] pub source_chars: Integer, - #[serde(default = "default_2410")] + #[serde(default = "default_2412")] pub brief_chars: Integer, - #[serde(default = "default_2411")] + #[serde(default = "default_2413")] pub compression_ratio: f64, - #[serde(default = "default_2412")] + #[serde(default = "default_2414")] pub dropped_ungrounded: Integer, - #[serde(default = "default_2413")] + #[serde(default = "default_2415")] pub tokens_in: Integer, - #[serde(default = "default_2414")] + #[serde(default = "default_2416")] pub tokens_out: Integer, - #[serde(default = "default_2415")] + #[serde(default = "default_2417")] pub llm_model: String, } @@ -54953,13 +54979,13 @@ pub struct SessionBriefSaveOutput { pub brief_key: String, pub revision: Integer, pub changed: bool, - #[serde(default = "default_2403")] + #[serde(default = "default_2405")] pub author: String, - #[serde(default = "default_2404")] + #[serde(default = "default_2406")] pub reason: String, - #[serde(default = "default_2405")] + #[serde(default = "default_2407")] pub rendered: String, - #[serde(default = "default_2416")] + #[serde(default = "default_2418")] pub stats: SessionBriefStats, } @@ -55704,39 +55730,39 @@ pub struct TaskPayload { pub priority: Integer, pub disclosure: TaskPayloadDisclosure, pub status: TaskPayloadStatus, - #[serde(default = "default_2417")] + #[serde(default = "default_2419")] pub reason: String, - #[serde(default = "default_2418")] + #[serde(default = "default_2420")] pub blocked_on: String, - #[serde(default = "default_2419")] + #[serde(default = "default_2421")] pub not_before: Option, - #[serde(default = "default_2420")] + #[serde(default = "default_2422")] pub resume_at: Option, - #[serde(default = "default_2421")] + #[serde(default = "default_2423")] pub deadline: Option, - #[serde(default = "default_2422")] + #[serde(default = "default_2424")] pub defer_count: Integer, pub title: String, - #[serde(default = "default_2423")] + #[serde(default = "default_2425")] pub brief: std::collections::HashMap, pub from_agent: String, - #[serde(default = "default_2424")] + #[serde(default = "default_2426")] pub from_subject: String, - #[serde(default = "default_2425")] + #[serde(default = "default_2427")] pub origin: String, - #[serde(default = "default_2426")] + #[serde(default = "default_2428")] pub parent_task_id: Option, - #[serde(default = "default_2427")] + #[serde(default = "default_2429")] pub owner: String, - #[serde(default = "default_2428")] + #[serde(default = "default_2430")] pub attempt: Integer, - #[serde(default = "default_2429")] + #[serde(default = "default_2431")] pub fence: Integer, - #[serde(default = "default_2430")] + #[serde(default = "default_2432")] pub lease_until: Option, - #[serde(default = "default_2431")] + #[serde(default = "default_2433")] pub outcome: std::collections::HashMap, - #[serde(default = "default_2432")] + #[serde(default = "default_2434")] pub last_actor: String, pub created_at: String, pub updated_at: String, @@ -55747,7 +55773,7 @@ pub struct TaskPayload { #[non_exhaustive] pub struct TaskOutput { pub task: TaskPayload, - #[serde(default = "default_2433")] + #[serde(default = "default_2435")] pub seq: Integer, } @@ -56148,10 +56174,10 @@ impl TaskCompleteInput { pub struct InboxCount { pub inbox: String, pub status: String, - #[serde(default = "default_2434")] + #[serde(default = "default_2436")] pub blocked_on: String, pub n: Integer, - #[serde(default = "default_2435")] + #[serde(default = "default_2437")] pub oldest: Option, } @@ -56238,7 +56264,7 @@ pub struct TaskCreateOutput { pub task: TaskPayload, pub created: bool, pub seq: Integer, - #[serde(default = "default_2436")] + #[serde(default = "default_2438")] pub next: String, } @@ -56577,7 +56603,7 @@ impl TaskFailInput { #[non_exhaustive] pub struct TaskGetOutput { pub found: bool, - #[serde(default = "default_2437")] + #[serde(default = "default_2439")] pub task: Option, } @@ -56711,23 +56737,23 @@ pub struct TaskEventPayload { pub task_id: String, pub inbox: String, pub event: String, - #[serde(default = "default_2438")] + #[serde(default = "default_2440")] pub from_status: String, - #[serde(default = "default_2439")] + #[serde(default = "default_2441")] pub to_status: String, - #[serde(default = "default_2440")] + #[serde(default = "default_2442")] pub actor: String, - #[serde(default = "default_2441")] + #[serde(default = "default_2443")] pub agent: String, - #[serde(default = "default_2442")] + #[serde(default = "default_2444")] pub fence: Integer, - #[serde(default = "default_2443")] + #[serde(default = "default_2445")] pub version: Integer, - #[serde(default = "default_2444")] + #[serde(default = "default_2446")] pub reason: String, - #[serde(default = "default_2445")] + #[serde(default = "default_2447")] pub patch: std::collections::HashMap, - #[serde(default = "default_2446")] + #[serde(default = "default_2448")] pub note: String, pub ts: String, } @@ -57067,7 +57093,7 @@ pub struct TaskPullOutput { pub tasks: Vec, pub waited_ms: Integer, pub backend: String, - #[serde(default = "default_2447")] + #[serde(default = "default_2449")] pub note: String, } @@ -57463,7 +57489,7 @@ impl TaskUnblockInput { pub struct TaskUpdateOutput { pub task: TaskPayload, pub seq: Integer, - #[serde(default = "default_2448")] + #[serde(default = "default_2450")] pub conflict: bool, } @@ -57826,19 +57852,19 @@ impl TaskReasonInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TrackerAnswerOutput { - #[serde(default = "default_2449")] + #[serde(default = "default_2451")] pub intent: String, - #[serde(default = "default_2450")] + #[serde(default = "default_2452")] pub anchors: std::collections::HashMap, - #[serde(default = "default_2451")] + #[serde(default = "default_2453")] pub sections: Vec>, - #[serde(default = "default_2452")] + #[serde(default = "default_2454")] pub searched: Vec, - #[serde(default = "default_2453")] + #[serde(default = "default_2455")] pub lines: Vec, - #[serde(default = "default_2454")] + #[serde(default = "default_2456")] pub restricted: bool, - #[serde(default = "default_2455")] + #[serde(default = "default_2457")] pub verdict: String, } @@ -57934,17 +57960,17 @@ impl TrackerAnswerInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TrackerBindingOutput { - #[serde(default = "default_2456")] + #[serde(default = "default_2458")] pub tracker_namespace: String, - #[serde(default = "default_2457")] + #[serde(default = "default_2459")] pub tracker_namespaces: Vec, - #[serde(default = "default_2458")] + #[serde(default = "default_2460")] pub restricted: bool, - #[serde(default = "default_2459")] + #[serde(default = "default_2461")] pub kind: String, - #[serde(default = "default_2460")] + #[serde(default = "default_2462")] pub authorized: bool, - #[serde(default = "default_2461")] + #[serde(default = "default_2463")] pub templates: Vec, } @@ -57997,13 +58023,13 @@ impl TrackerBindingInput { #[non_exhaustive] pub struct TrackerComponentOutput { pub component: String, - #[serde(default = "default_2462")] + #[serde(default = "default_2464")] pub risk: std::collections::HashMap, - #[serde(default = "default_2463")] + #[serde(default = "default_2465")] pub open_issues: Vec>, - #[serde(default = "default_2464")] + #[serde(default = "default_2466")] pub known: bool, - #[serde(default = "default_2465")] + #[serde(default = "default_2467")] pub tracker_unavailable: bool, } @@ -58064,9 +58090,9 @@ impl TrackerComponentInput { #[non_exhaustive] pub struct TrackerContractOutput { pub database: String, - #[serde(default = "default_2466")] + #[serde(default = "default_2468")] pub tables: Vec>, - #[serde(default = "default_2467")] + #[serde(default = "default_2469")] pub templates: std::collections::HashMap, } @@ -58119,66 +58145,66 @@ impl TrackerContractInput { #[non_exhaustive] pub struct TrackerLegStatus { pub name: String, - #[serde(default = "default_2478")] + #[serde(default = "default_2480")] pub status: String, - #[serde(default = "default_2479")] + #[serde(default = "default_2481")] pub reason: String, - #[serde(default = "default_2480")] + #[serde(default = "default_2482")] pub message: String, - #[serde(default = "default_2481")] + #[serde(default = "default_2483")] pub retried: bool, - #[serde(default = "default_2482")] + #[serde(default = "default_2484")] pub ms: Integer, - #[serde(default = "default_2483")] + #[serde(default = "default_2485")] pub cause: String, - #[serde(default = "default_2484")] + #[serde(default = "default_2486")] pub namespace: String, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TrackerDuplicateCheckOutput { - #[serde(default = "default_2468")] + #[serde(default = "default_2470")] pub verdict: String, - #[serde(default = "default_2469")] + #[serde(default = "default_2471")] pub items: Vec>, - #[serde(default = "default_2470")] + #[serde(default = "default_2472")] pub undecided: bool, - #[serde(default = "default_2471")] + #[serde(default = "default_2473")] pub epistemic: String, - #[serde(default = "default_2472")] + #[serde(default = "default_2474")] pub thresholds: std::collections::HashMap, - #[serde(default = "default_2473")] + #[serde(default = "default_2475")] pub judge: std::collections::HashMap, - #[serde(default = "default_2474")] + #[serde(default = "default_2476")] pub fit_at: String, - #[serde(default = "default_2475")] + #[serde(default = "default_2477")] pub fit: std::collections::HashMap, - #[serde(default = "default_2476")] + #[serde(default = "default_2478")] pub query: std::collections::HashMap, - #[serde(default = "default_2477")] + #[serde(default = "default_2479")] pub legs: std::collections::HashMap, - #[serde(default = "default_2485")] + #[serde(default = "default_2487")] pub leg_status: Vec, - #[serde(default = "default_2486")] + #[serde(default = "default_2488")] pub tracker_unavailable: bool, - #[serde(default = "default_2487")] + #[serde(default = "default_2489")] pub namespaces: Vec, - #[serde(default = "default_2488")] + #[serde(default = "default_2490")] pub by_namespace: std::collections::HashMap>, - #[serde(default = "default_2489")] + #[serde(default = "default_2491")] pub closest: Vec>, - #[serde(default = "default_2490")] + #[serde(default = "default_2492")] pub needs: Vec>, - #[serde(default = "default_2491")] + #[serde(default = "default_2493")] pub closest_note: String, - #[serde(default = "default_2492")] + #[serde(default = "default_2494")] pub nearest: Vec>, - #[serde(default = "default_2493")] + #[serde(default = "default_2495")] pub rerank: std::collections::HashMap, - #[serde(default = "default_2494")] + #[serde(default = "default_2496")] pub answer: String, - #[serde(default = "default_2495")] + #[serde(default = "default_2497")] pub related_prs: Vec>, } @@ -58385,17 +58411,17 @@ impl TrackerDuplicateCheckInput { #[non_exhaustive] pub struct TrackerFlakyOutput { pub test_name: String, - #[serde(default = "default_2496")] + #[serde(default = "default_2498")] pub known_flaky: bool, - #[serde(default = "default_2497")] + #[serde(default = "default_2499")] pub open_issues: Integer, - #[serde(default = "default_2498")] + #[serde(default = "default_2500")] pub issues: Vec>, - #[serde(default = "default_2499")] + #[serde(default = "default_2501")] pub verdict: String, - #[serde(default = "default_2500")] + #[serde(default = "default_2502")] pub tracker_unavailable: bool, - #[serde(default = "default_2501")] + #[serde(default = "default_2503")] pub signal: Option>, } @@ -58478,9 +58504,9 @@ impl TrackerFlakyInput { #[non_exhaustive] pub struct TrackerItemOutput { pub items: Vec>, - #[serde(default = "default_2502")] + #[serde(default = "default_2504")] pub unknown: Vec, - #[serde(default = "default_2503")] + #[serde(default = "default_2505")] pub tracker_unavailable: bool, } @@ -58529,19 +58555,19 @@ impl TrackerItemInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TrackerLinksOutput { - #[serde(default = "default_2504")] + #[serde(default = "default_2506")] pub subject: std::collections::HashMap, - #[serde(default = "default_2505")] + #[serde(default = "default_2507")] pub verdict: String, - #[serde(default = "default_2506")] + #[serde(default = "default_2508")] pub items: Vec>, - #[serde(default = "default_2507")] + #[serde(default = "default_2509")] pub epistemic: String, - #[serde(default = "default_2508")] + #[serde(default = "default_2510")] pub record: std::collections::HashMap, - #[serde(default = "default_2509")] + #[serde(default = "default_2511")] pub computed_at: String, - #[serde(default = "default_2510")] + #[serde(default = "default_2512")] pub tracker_unavailable: bool, } @@ -58639,11 +58665,11 @@ impl TrackerLinksInput { pub struct TrackerReleaseOutput { pub version: String, pub blockers: Vec>, - #[serde(default = "default_2511")] + #[serde(default = "default_2513")] pub active_blockers: Integer, - #[serde(default = "default_2512")] + #[serde(default = "default_2514")] pub health: std::collections::HashMap, - #[serde(default = "default_2513")] + #[serde(default = "default_2515")] pub tracker_unavailable: bool, } @@ -58692,17 +58718,17 @@ impl TrackerReleaseInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TrackerSimilarOutput { - #[serde(default = "default_2514")] + #[serde(default = "default_2516")] pub items: Vec>, - #[serde(default = "default_2515")] + #[serde(default = "default_2517")] pub query: std::collections::HashMap, - #[serde(default = "default_2516")] + #[serde(default = "default_2518")] pub legs: std::collections::HashMap, - #[serde(default = "default_2517")] + #[serde(default = "default_2519")] pub epistemic: String, - #[serde(default = "default_2518")] + #[serde(default = "default_2520")] pub tracker_unavailable: bool, - #[serde(default = "default_2519")] + #[serde(default = "default_2521")] pub namespaces: Vec, } @@ -58823,19 +58849,19 @@ pub struct TrackerSourceAddOutput { pub name: String, pub host: String, pub database: String, - #[serde(default = "default_2520")] + #[serde(default = "default_2522")] pub namespaces: Vec>, - #[serde(default = "default_2521")] + #[serde(default = "default_2523")] pub contract: std::collections::HashMap, - #[serde(default = "default_2522")] + #[serde(default = "default_2524")] pub roles: Vec, - #[serde(default = "default_2523")] + #[serde(default = "default_2525")] pub my_role: String, - #[serde(default = "default_2524")] + #[serde(default = "default_2526")] pub dry_run: bool, - #[serde(default = "default_2525")] + #[serde(default = "default_2527")] pub written: bool, - #[serde(default = "default_2526")] + #[serde(default = "default_2528")] pub view_templates: std::collections::HashMap, } @@ -58998,13 +59024,13 @@ impl TrackerSourceAddInput { #[non_exhaustive] pub struct TrackerSourceCheckOutput { pub name: String, - #[serde(default = "default_2527")] + #[serde(default = "default_2529")] pub database: String, - #[serde(default = "default_2528")] + #[serde(default = "default_2530")] pub reachable: bool, - #[serde(default = "default_2529")] + #[serde(default = "default_2531")] pub contract: std::collections::HashMap, - #[serde(default = "default_2530")] + #[serde(default = "default_2532")] pub view_templates: std::collections::HashMap, } @@ -59044,11 +59070,11 @@ impl TrackerSourceCheckInput { pub struct TrackerSourceInspectOutput { pub host: String, pub database: String, - #[serde(default = "default_2531")] + #[serde(default = "default_2533")] pub tables: Vec>, - #[serde(default = "default_2532")] + #[serde(default = "default_2534")] pub roles: Vec, - #[serde(default = "default_2533")] + #[serde(default = "default_2535")] pub proposal: std::collections::HashMap, } @@ -59177,9 +59203,9 @@ impl TrackerSourceInspectInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TrackerSourceListOutput { - #[serde(default = "default_2534")] + #[serde(default = "default_2536")] pub sources: Vec>, - #[serde(default = "default_2535")] + #[serde(default = "default_2537")] pub self_service: bool, } @@ -59232,9 +59258,9 @@ impl TrackerSourceListInput { #[non_exhaustive] pub struct TrackerSourceRemoveOutput { pub name: String, - #[serde(default = "default_2536")] + #[serde(default = "default_2538")] pub deactivated: bool, - #[serde(default = "default_2537")] + #[serde(default = "default_2539")] pub namespaces_retired: Vec, } @@ -59275,9 +59301,9 @@ impl TrackerSourceRemoveInput { #[non_exhaustive] pub struct TrackerSourceRotateOutput { pub name: String, - #[serde(default = "default_2538")] + #[serde(default = "default_2540")] pub contract: std::collections::HashMap, - #[serde(default = "default_2539")] + #[serde(default = "default_2541")] pub rotated_at: String, } @@ -59324,11 +59350,11 @@ impl TrackerSourceRotateInput { #[non_exhaustive] pub struct TrackerSourceSetMappingOutput { pub name: String, - #[serde(default = "default_2540")] + #[serde(default = "default_2542")] pub contract: std::collections::HashMap, - #[serde(default = "default_2541")] + #[serde(default = "default_2543")] pub dry_run: bool, - #[serde(default = "default_2542")] + #[serde(default = "default_2544")] pub written: bool, } @@ -59395,45 +59421,45 @@ impl TrackerSourceSetMappingInput { #[non_exhaustive] pub struct TrackerTestSignalOutput { pub test_name: String, - #[serde(default = "default_2543")] + #[serde(default = "default_2545")] pub verdict: String, - #[serde(default = "default_2544")] + #[serde(default = "default_2546")] pub why: Vec, - #[serde(default = "default_2545")] + #[serde(default = "default_2547")] pub lower_bound: f64, - #[serde(default = "default_2546")] + #[serde(default = "default_2548")] pub window_days: Integer, - #[serde(default = "default_2547")] + #[serde(default = "default_2549")] pub since: String, - #[serde(default = "default_2548")] + #[serde(default = "default_2550")] pub features: std::collections::HashMap, - #[serde(default = "default_2549")] + #[serde(default = "default_2551")] pub infra: std::collections::HashMap, - #[serde(default = "default_2550")] + #[serde(default = "default_2552")] pub churn: std::collections::HashMap, - #[serde(default = "default_2551")] + #[serde(default = "default_2553")] pub thresholds: std::collections::HashMap, - #[serde(default = "default_2552")] + #[serde(default = "default_2554")] pub source: String, - #[serde(default = "default_2553")] + #[serde(default = "default_2555")] pub timings_ms: std::collections::HashMap, - #[serde(default = "default_2554")] + #[serde(default = "default_2556")] pub tracker_unavailable: bool, - #[serde(default = "default_2555")] + #[serde(default = "default_2557")] pub rollup: std::collections::HashMap, - #[serde(default = "default_2556")] + #[serde(default = "default_2558")] pub streak: std::collections::HashMap, - #[serde(default = "default_2557")] + #[serde(default = "default_2559")] pub smells: std::collections::HashMap, - #[serde(default = "default_2558")] + #[serde(default = "default_2560")] pub prior: std::collections::HashMap, - #[serde(default = "default_2559")] + #[serde(default = "default_2561")] pub unavailable_reason: String, - #[serde(default = "default_2560")] + #[serde(default = "default_2562")] pub candidates: Vec>, - #[serde(default = "default_2561")] + #[serde(default = "default_2563")] pub candidate_matches: Integer, - #[serde(default = "default_2562")] + #[serde(default = "default_2564")] pub resolved_from: String, } @@ -59537,9 +59563,9 @@ impl TrackerTestSignalInput { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UiVitalsOutput { - #[serde(default = "default_2563")] + #[serde(default = "default_2565")] pub recorded: bool, - #[serde(default = "default_2564")] + #[serde(default = "default_2566")] pub route: String, } @@ -59723,7 +59749,7 @@ pub struct WebhookDelivery { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct WebhookDeliveriesOutput { - #[serde(default = "default_2565")] + #[serde(default = "default_2567")] pub deliveries: Vec, } @@ -59845,14 +59871,14 @@ pub struct WebhookInfo { pub secret_ref: String, pub events: Vec, pub created_at: String, - #[serde(default = "default_2566")] + #[serde(default = "default_2568")] pub secret_present: bool, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct WebhookListOutput { - #[serde(default = "default_2567")] + #[serde(default = "default_2569")] pub webhooks: Vec, } @@ -60034,7 +60060,7 @@ pub struct WorkingMemoryMutationOutput { pub version: Integer, pub char_limit: Integer, pub value_length: Integer, - #[serde(default = "default_2568")] + #[serde(default = "default_2570")] pub fill_ratio: f64, } @@ -60258,15 +60284,15 @@ impl WorkingMemoryDeleteInput { pub struct WorkingMemoryGetOutput { pub found: bool, pub block_key: String, - #[serde(default = "default_2569")] + #[serde(default = "default_2571")] pub content: String, - #[serde(default = "default_2570")] + #[serde(default = "default_2572")] pub char_limit: Integer, - #[serde(default = "default_2571")] + #[serde(default = "default_2573")] pub version: Integer, - #[serde(default = "default_2572")] + #[serde(default = "default_2574")] pub updated_at: Option, - #[serde(default = "default_2573")] + #[serde(default = "default_2575")] pub fill_ratio: f64, } @@ -60377,7 +60403,7 @@ pub struct WorkingMemoryBlock { pub content: String, pub char_limit: Integer, pub version: Integer, - #[serde(default = "default_2574")] + #[serde(default = "default_2576")] pub updated_at: Option, } @@ -60385,7 +60411,7 @@ pub struct WorkingMemoryBlock { #[non_exhaustive] pub struct WorkingMemoryRenderOutput { pub rendered: String, - #[serde(default = "default_2575")] + #[serde(default = "default_2577")] pub blocks: Vec, pub block_count: Integer, pub total_chars: Integer, @@ -62090,17 +62116,17 @@ fn default_444() -> std::collections::HashMap { fn default_445() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_446() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_446() -> Vec> { + serde_json::from_str("[]").expect("schema default") } -fn default_447() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_447() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_448() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_449() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_449() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_450() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -62111,23 +62137,23 @@ fn default_451() -> String { fn default_452() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_453() -> bool { - serde_json::from_str("false").expect("schema default") -} -fn default_454() -> String { +fn default_453() -> String { serde_json::from_str("\"\"").expect("schema default") } +fn default_454() -> bool { + serde_json::from_str("false").expect("schema default") +} fn default_455() -> String { serde_json::from_str("\"\"").expect("schema default") } fn default_456() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_457() -> f64 { - serde_json::from_str("0.0").expect("schema default") +fn default_457() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_458() -> Vec> { - serde_json::from_str("[]").expect("schema default") +fn default_458() -> f64 { + serde_json::from_str("0.0").expect("schema default") } fn default_459() -> Vec> { serde_json::from_str("[]").expect("schema default") @@ -62135,247 +62161,247 @@ fn default_459() -> Vec> { fn default_460() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_461() -> String { +fn default_461() -> Vec> { + serde_json::from_str("[]").expect("schema default") +} +fn default_462() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_462() -> Vec> { +fn default_463() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_463() -> bool { +fn default_464() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_464() -> Integer { +fn default_465() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_465() -> Integer { +fn default_466() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_466() -> bool { +fn default_467() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_467() -> Vec> { +fn default_468() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_468() -> String { +fn default_469() -> String { serde_json::from_str("\"unit\"").expect("schema default") } -fn default_469() -> String { +fn default_470() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_470() -> Vec> { +fn default_471() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_471() -> Integer { +fn default_472() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_472() -> String { +fn default_473() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_473() -> Integer { +fn default_474() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_474() -> Integer { +fn default_475() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_475() -> String { +fn default_476() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_476() -> Integer { +fn default_477() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_477() -> bool { +fn default_478() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_478() -> std::collections::HashMap>> +fn default_479() -> std::collections::HashMap>> { serde_json::from_str("{}").expect("schema default") } -fn default_479() -> Vec> { +fn default_480() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_480() -> Integer { +fn default_481() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_481() -> String { +fn default_482() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_482() -> Option { +fn default_483() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_483() -> bool { +fn default_484() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_484() -> String { +fn default_485() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_485() -> Integer { +fn default_486() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_486() -> String { +fn default_487() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_487() -> String { +fn default_488() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_488() -> Vec> { +fn default_489() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_489() -> Vec> { +fn default_490() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_490() -> Integer { +fn default_491() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_491() -> Integer { +fn default_492() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_492() -> Vec> { +fn default_493() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_493() -> std::collections::HashMap> { +fn default_494() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_494() -> Vec { +fn default_495() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_495() -> Vec> { +fn default_496() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_496() -> String { +fn default_497() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_497() -> Vec> { +fn default_498() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_498() -> std::collections::HashMap>> +fn default_499() -> std::collections::HashMap>> { serde_json::from_str("{}").expect("schema default") } -fn default_499() -> Vec> { +fn default_500() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_500() -> String { +fn default_501() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_501() -> String { +fn default_502() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_502() -> Vec { +fn default_503() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_503() -> Option> { +fn default_504() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_504() -> Vec> { +fn default_505() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_505() -> Integer { +fn default_506() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_506() -> std::collections::HashMap { +fn default_507() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_507() -> Integer { - serde_json::from_str("0").expect("schema default") -} fn default_508() -> Integer { serde_json::from_str("0").expect("schema default") } fn default_509() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_510() -> Vec> { +fn default_510() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_511() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_511() -> Integer { +fn default_512() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_512() -> bool { +fn default_513() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_513() -> Integer { +fn default_514() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_514() -> String { +fn default_515() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_515() -> Vec> { +fn default_516() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_516() -> Integer { +fn default_517() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_517() -> bool { +fn default_518() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_518() -> std::collections::HashMap { +fn default_519() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_519() -> bool { +fn default_520() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_520() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_521() -> String { serde_json::from_str("\"\"").expect("schema default") } fn default_522() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_523() -> String { serde_json::from_str("\"unknown\"").expect("schema default") } -fn default_523() -> Vec { +fn default_524() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_524() -> String { +fn default_525() -> String { serde_json::from_str("\"lower_bound\"").expect("schema default") } -fn default_525() -> String { +fn default_526() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_526() -> Integer { +fn default_527() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_527() -> String { +fn default_528() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_528() -> String { +fn default_529() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_529() -> bool { +fn default_530() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_530() -> bool { +fn default_531() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_531() -> std::collections::HashMap { +fn default_532() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_532() -> Option { +fn default_533() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_533() -> Integer { - serde_json::from_str("0").expect("schema default") -} fn default_534() -> Integer { - serde_json::from_str("72").expect("schema default") + serde_json::from_str("0").expect("schema default") } fn default_535() -> Integer { - serde_json::from_str("0").expect("schema default") + serde_json::from_str("72").expect("schema default") } fn default_536() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_537() -> Vec> { - serde_json::from_str("[]").expect("schema default") +fn default_537() -> Integer { + serde_json::from_str("0").expect("schema default") } -fn default_538() -> Vec { +fn default_538() -> Vec> { serde_json::from_str("[]").expect("schema default") } fn default_539() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_540() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_540() -> Vec { + serde_json::from_str("[]").expect("schema default") } fn default_541() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -62383,266 +62409,266 @@ fn default_541() -> String { fn default_542() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_543() -> bool { +fn default_543() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_544() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_544() -> String { +fn default_545() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_545() -> Vec> { +fn default_546() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_546() -> Integer { +fn default_547() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_547() -> Vec> { +fn default_548() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_548() -> bool { - serde_json::from_str("false").expect("schema default") -} fn default_549() -> Vec> { serde_json::from_str("[]").expect("schema default") } fn default_550() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_551() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_551() -> Vec> { + serde_json::from_str("[]").expect("schema default") } fn default_552() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_553() -> Vec { +fn default_553() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_554() -> bool { + serde_json::from_str("false").expect("schema default") +} +fn default_555() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_554() -> Option { +fn default_556() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_555() -> Vec> { +fn default_557() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_556() -> bool { +fn default_558() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_557() -> Vec> { +fn default_559() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_558() -> bool { +fn default_560() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_559() -> String { +fn default_561() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_560() -> String { +fn default_562() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_561() -> bool { +fn default_563() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_562() -> Vec> { +fn default_564() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_563() -> Integer { +fn default_565() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_564() -> bool { +fn default_566() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_565() -> bool { +fn default_567() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_566() -> std::collections::HashMap { +fn default_568() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_567() -> bool { +fn default_569() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_568() -> Vec> { +fn default_570() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_569() -> Integer { +fn default_571() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_570() -> bool { +fn default_572() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_571() -> Integer { +fn default_573() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_572() -> String { +fn default_574() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_573() -> String { +fn default_575() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_574() -> String { +fn default_576() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_575() -> String { +fn default_577() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_576() -> f64 { +fn default_578() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_577() -> Vec> { +fn default_579() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_578() -> std::collections::HashMap> { +fn default_580() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_579() -> String { +fn default_581() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_580() -> bool { +fn default_582() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_581() -> String { +fn default_583() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_582() -> CodeGrepOutputFallback { +fn default_584() -> CodeGrepOutputFallback { serde_json::from_str("\"\"").expect("schema default") } -fn default_583() -> Vec> { +fn default_585() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_584() -> String { +fn default_586() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_585() -> Vec> { +fn default_587() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_586() -> Integer { +fn default_588() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_587() -> f64 { +fn default_589() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_588() -> Vec> { +fn default_590() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_589() -> Vec> { +fn default_591() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_590() -> Vec> { +fn default_592() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_591() -> Vec> { +fn default_593() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_592() -> bool { +fn default_594() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_593() -> Integer { +fn default_595() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_594() -> Integer { +fn default_596() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_595() -> String { +fn default_597() -> String { serde_json::from_str("\"lower_bound\"").expect("schema default") } -fn default_596() -> Vec { +fn default_598() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_597() -> std::collections::HashMap { +fn default_599() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_598() -> bool { +fn default_600() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_599() -> String { +fn default_601() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_600() -> String { +fn default_602() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_601() -> Vec> { +fn default_603() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_602() -> bool { +fn default_604() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_603() -> String { +fn default_605() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_604() -> Integer { +fn default_606() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_605() -> String { +fn default_607() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_606() -> String { +fn default_608() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_607() -> String { +fn default_609() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_608() -> String { +fn default_610() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_609() -> String { +fn default_611() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_610() -> Integer { +fn default_612() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_611() -> String { +fn default_613() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_612() -> String { +fn default_614() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_613() -> String { +fn default_615() -> String { serde_json::from_str("\"generic\"").expect("schema default") } -fn default_614() -> Vec { +fn default_616() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_615() -> Vec { +fn default_617() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_616() -> String { +fn default_618() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_617() -> String { +fn default_619() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_618() -> String { +fn default_620() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_619() -> String { +fn default_621() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_620() -> String { +fn default_622() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_621() -> Integer { +fn default_623() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_622() -> String { +fn default_624() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_623() -> bool { +fn default_625() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_624() -> Vec { +fn default_626() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_625() -> String { +fn default_627() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_626() -> Vec { +fn default_628() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_627() -> String { - serde_json::from_str("\"ok\"").expect("schema default") -} -fn default_628() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_629() -> String { - serde_json::from_str("\"\"").expect("schema default") + serde_json::from_str("\"ok\"").expect("schema default") } fn default_630() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -62653,708 +62679,708 @@ fn default_631() -> String { fn default_632() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_633() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_633() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_634() -> String { serde_json::from_str("\"\"").expect("schema default") } fn default_635() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_636() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_637() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_636() -> Vec { +fn default_638() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_637() -> String { +fn default_639() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_638() -> Option { +fn default_640() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_639() -> String { +fn default_641() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_640() -> String { +fn default_642() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_641() -> bool { +fn default_643() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_642() -> Integer { +fn default_644() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_643() -> Integer { +fn default_645() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_644() -> Integer { +fn default_646() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_645() -> String { +fn default_647() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_646() -> String { +fn default_648() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_647() -> bool { +fn default_649() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_648() -> Vec { +fn default_650() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_649() -> std::collections::HashMap { +fn default_651() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_650() -> std::collections::HashMap> { +fn default_652() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_651() -> bool { +fn default_653() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_652() -> Integer { +fn default_654() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_653() -> String { +fn default_655() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_654() -> Integer { +fn default_656() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_655() -> Integer { +fn default_657() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_656() -> Integer { +fn default_658() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_657() -> String { +fn default_659() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_658() -> std::collections::HashMap { +fn default_660() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_659() -> String { +fn default_661() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_660() -> Vec { +fn default_662() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_661() -> std::collections::HashMap> { +fn default_663() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_662() -> std::collections::HashMap { +fn default_664() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_663() -> std::collections::HashMap> { +fn default_665() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_664() -> std::collections::HashMap> { +fn default_666() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_665() -> Integer { +fn default_667() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_666() -> String { +fn default_668() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_667() -> Integer { +fn default_669() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_668() -> String { +fn default_670() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_669() -> Integer { +fn default_671() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_670() -> Integer { +fn default_672() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_671() -> f64 { +fn default_673() -> f64 { serde_json::from_str("1.0").expect("schema default") } -fn default_672() -> String { +fn default_674() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_673() -> String { +fn default_675() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_674() -> Vec> { +fn default_676() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_675() -> Integer { +fn default_677() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_676() -> String { +fn default_678() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_677() -> bool { +fn default_679() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_678() -> String { +fn default_680() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_679() -> Integer { +fn default_681() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_680() -> Integer { +fn default_682() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_681() -> String { +fn default_683() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_682() -> bool { +fn default_684() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_683() -> std::collections::HashMap { +fn default_685() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_684() -> String { +fn default_686() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_685() -> Vec { +fn default_687() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_686() -> CodePathGuardsOutputEpistemic { +fn default_688() -> CodePathGuardsOutputEpistemic { serde_json::from_str("\"lower_bound\"").expect("schema default") } -fn default_687() -> String { +fn default_689() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_688() -> Vec> { +fn default_690() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_689() -> Vec { +fn default_691() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_690() -> Integer { +fn default_692() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_691() -> String { +fn default_693() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_692() -> String { +fn default_694() -> String { serde_json::from_str("\"none\"").expect("schema default") } -fn default_693() -> Vec> { +fn default_695() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_694() -> bool { +fn default_696() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_695() -> String { +fn default_697() -> String { serde_json::from_str("\"heuristic\"").expect("schema default") } -fn default_696() -> std::collections::HashMap { +fn default_698() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_697() -> std::collections::HashMap { +fn default_699() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_698() -> std::collections::HashMap { +fn default_700() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_699() -> String { +fn default_701() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_700() -> Vec> { +fn default_702() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_701() -> Integer { +fn default_703() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_702() -> String { +fn default_704() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_703() -> Vec { +fn default_705() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_704() -> String { +fn default_706() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_705() -> String { +fn default_707() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_706() -> String { +fn default_708() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_707() -> String { +fn default_709() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_708() -> Integer { +fn default_710() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_709() -> Integer { +fn default_711() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_710() -> bool { +fn default_712() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_711() -> String { +fn default_713() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_712() -> String { +fn default_714() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_713() -> String { +fn default_715() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_714() -> String { +fn default_716() -> String { serde_json::from_str("\"git\"").expect("schema default") } -fn default_715() -> String { +fn default_717() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_716() -> String { +fn default_718() -> String { serde_json::from_str("\"admin\"").expect("schema default") } -fn default_717() -> String { +fn default_719() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_718() -> Vec> { +fn default_720() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_719() -> Vec> { +fn default_721() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_720() -> String { +fn default_722() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_721() -> String { +fn default_723() -> String { serde_json::from_str("\"git\"").expect("schema default") } -fn default_722() -> Vec { +fn default_724() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_723() -> String { +fn default_725() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_724() -> Vec> { +fn default_726() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_725() -> Vec { +fn default_727() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_726() -> Vec> { +fn default_728() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_727() -> Integer { +fn default_729() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_728() -> Integer { +fn default_730() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_729() -> Integer { +fn default_731() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_730() -> bool { +fn default_732() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_731() -> String { +fn default_733() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_732() -> String { +fn default_734() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_733() -> bool { +fn default_735() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_734() -> Vec { +fn default_736() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_735() -> Vec { +fn default_737() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_736() -> Vec { +fn default_738() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_737() -> Vec { +fn default_739() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_738() -> String { +fn default_740() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_739() -> Integer { +fn default_741() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_740() -> String { +fn default_742() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_741() -> CodeReviewBriefOutputSource { +fn default_743() -> CodeReviewBriefOutputSource { serde_json::from_str("\"missing\"").expect("schema default") } -fn default_742() -> CodeReviewBriefOutputLedger { +fn default_744() -> CodeReviewBriefOutputLedger { serde_json::from_str("\"\"").expect("schema default") } -fn default_743() -> bool { +fn default_745() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_744() -> std::collections::HashMap { +fn default_746() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_745() -> bool { +fn default_747() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_746() -> String { +fn default_748() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_747() -> Integer { +fn default_749() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_748() -> String { +fn default_750() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_749() -> String { +fn default_751() -> String { serde_json::from_str("\"standard\"").expect("schema default") } -fn default_750() -> String { +fn default_752() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_751() -> String { +fn default_753() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_752() -> Integer { +fn default_754() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_753() -> Integer { +fn default_755() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_754() -> Integer { +fn default_756() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_755() -> std::collections::HashMap { +fn default_757() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_756() -> std::collections::HashMap> { +fn default_758() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_757() -> String { +fn default_759() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_758() -> String { +fn default_760() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_759() -> String { +fn default_761() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_760() -> String { +fn default_762() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_761() -> Vec> { +fn default_763() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_762() -> Integer { +fn default_764() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_763() -> String { +fn default_765() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_764() -> bool { +fn default_766() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_765() -> std::collections::HashMap { +fn default_767() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_766() -> bool { +fn default_768() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_767() -> CodeSearchOutputAbstainCode { +fn default_769() -> CodeSearchOutputAbstainCode { serde_json::from_str("\"\"").expect("schema default") } -fn default_768() -> String { +fn default_770() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_769() -> CodeSearchOutputRetrievalRisk { +fn default_771() -> CodeSearchOutputRetrievalRisk { serde_json::from_str("\"low\"").expect("schema default") } -fn default_770() -> f64 { +fn default_772() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_771() -> CodeSearchOutputPickConfidence { +fn default_773() -> CodeSearchOutputPickConfidence { serde_json::from_str("\"\"").expect("schema default") } -fn default_772() -> f64 { +fn default_774() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_773() -> String { +fn default_775() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_774() -> Integer { +fn default_776() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_775() -> bool { +fn default_777() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_776() -> Integer { +fn default_778() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_777() -> std::collections::HashMap { +fn default_779() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_778() -> String { +fn default_780() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_779() -> std::collections::HashMap { +fn default_781() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_780() -> String { +fn default_782() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_781() -> f64 { +fn default_783() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_782() -> std::collections::HashMap { +fn default_784() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_783() -> std::collections::HashMap { +fn default_785() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_784() -> String { +fn default_786() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_785() -> Vec { +fn default_787() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_786() -> CodeSearchOutputEpistemic { +fn default_788() -> CodeSearchOutputEpistemic { serde_json::from_str("\"\"").expect("schema default") } -fn default_787() -> bool { +fn default_789() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_788() -> String { +fn default_790() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_789() -> String { +fn default_791() -> String { serde_json::from_str("\"unknown\"").expect("schema default") } -fn default_790() -> Vec { +fn default_792() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_791() -> std::collections::HashMap { +fn default_793() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_792() -> String { +fn default_794() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_793() -> Vec> { +fn default_795() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_794() -> std::collections::HashMap { +fn default_796() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_795() -> Integer { +fn default_797() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_796() -> std::collections::HashMap { +fn default_798() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_797() -> String { +fn default_799() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_798() -> String { +fn default_800() -> String { serde_json::from_str("\"unknown\"").expect("schema default") } -fn default_799() -> Vec { +fn default_801() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_800() -> String { +fn default_802() -> String { serde_json::from_str("\"lower_bound\"").expect("schema default") } -fn default_801() -> std::collections::HashMap { +fn default_803() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_802() -> bool { +fn default_804() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_803() -> Vec { +fn default_805() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_804() -> Vec> { +fn default_806() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_805() -> Vec> { +fn default_807() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_806() -> Vec> { +fn default_808() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_807() -> std::collections::HashMap { +fn default_809() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_808() -> String { +fn default_810() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_809() -> bool { +fn default_811() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_810() -> String { +fn default_812() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_811() -> Vec> { +fn default_813() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_812() -> Vec> { +fn default_814() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_813() -> Vec> { +fn default_815() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_814() -> Vec { +fn default_816() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_815() -> Vec> { +fn default_817() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_816() -> bool { +fn default_818() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_817() -> Integer { +fn default_819() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_818() -> Integer { +fn default_820() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_819() -> Integer { +fn default_821() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_820() -> Integer { +fn default_822() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_821() -> bool { +fn default_823() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_822() -> bool { +fn default_824() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_823() -> bool { +fn default_825() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_824() -> bool { +fn default_826() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_825() -> String { +fn default_827() -> String { serde_json::from_str("\"lower_bound\"").expect("schema default") } -fn default_826() -> Vec { +fn default_828() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_827() -> std::collections::HashMap { +fn default_829() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_828() -> String { +fn default_830() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_829() -> String { +fn default_831() -> String { serde_json::from_str("\"unknown\"").expect("schema default") } -fn default_830() -> String { +fn default_832() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_831() -> Vec> { +fn default_833() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_832() -> Vec { +fn default_834() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_833() -> Vec { +fn default_835() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_834() -> Integer { +fn default_836() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_835() -> std::collections::HashMap { +fn default_837() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_836() -> String { +fn default_838() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_837() -> Vec> { +fn default_839() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_838() -> Integer { +fn default_840() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_839() -> bool { +fn default_841() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_840() -> Vec> { +fn default_842() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_841() -> String { +fn default_843() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_842() -> bool { +fn default_844() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_843() -> Vec { +fn default_845() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_844() -> std::collections::HashMap { +fn default_846() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_845() -> Integer { +fn default_847() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_846() -> Integer { +fn default_848() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_847() -> String { +fn default_849() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_848() -> Integer { +fn default_850() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_849() -> String { +fn default_851() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_850() -> String { +fn default_852() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_851() -> Vec> { +fn default_853() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_852() -> std::collections::HashMap { +fn default_854() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_853() -> String { +fn default_855() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_854() -> String { +fn default_856() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_855() -> std::collections::HashMap { +fn default_857() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_856() -> Vec> { +fn default_858() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_857() -> Vec> { +fn default_859() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_858() -> bool { +fn default_860() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_859() -> std::collections::HashMap { +fn default_861() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_860() -> std::collections::HashMap { +fn default_862() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_861() -> std::collections::HashMap { +fn default_863() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_862() -> Vec { +fn default_864() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_863() -> Integer { +fn default_865() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_864() -> std::collections::HashMap { +fn default_866() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_865() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_866() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_867() -> String { serde_json::from_str("\"\"").expect("schema default") } @@ -63370,156 +63396,156 @@ fn default_870() -> String { fn default_871() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_872() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_872() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_873() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_873() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_874() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_875() -> Option { +fn default_875() -> Option { serde_json::from_str("null").expect("schema default") } fn default_876() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_877() -> Option> { +fn default_877() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_878() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_879() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_878() -> Vec { +fn default_880() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_879() -> String { +fn default_881() -> String { serde_json::from_str("\"conflicts.resolve\"").expect("schema default") } -fn default_880() -> Vec { +fn default_882() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_881() -> String { +fn default_883() -> String { serde_json::from_str("\"No changes were applied.\"").expect("schema default") } -fn default_882() -> Option { +fn default_884() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_883() -> Option { +fn default_885() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_884() -> bool { +fn default_886() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_885() -> bool { +fn default_887() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_886() -> Option { +fn default_888() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_887() -> Vec { +fn default_889() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_888() -> String { +fn default_890() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_889() -> String { +fn default_891() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_890() -> String { +fn default_892() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_891() -> Integer { +fn default_893() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_892() -> Integer { +fn default_894() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_893() -> Integer { +fn default_895() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_894() -> Integer { +fn default_896() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_895() -> Integer { +fn default_897() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_896() -> Option { +fn default_898() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_897() -> bool { +fn default_899() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_898() -> ConversationAppendOutputReason { +fn default_900() -> ConversationAppendOutputReason { serde_json::from_str("\"\"").expect("schema default") } -fn default_899() -> String { +fn default_901() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_900() -> Integer { +fn default_902() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_901() -> Integer { +fn default_903() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_902() -> String { +fn default_904() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_903() -> String { +fn default_905() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_904() -> std::collections::HashMap { +fn default_906() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_905() -> String { +fn default_907() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_906() -> String { +fn default_908() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_907() -> String { +fn default_909() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_908() -> Option { +fn default_910() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_909() -> Option { +fn default_911() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_910() -> Integer { +fn default_912() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_911() -> String { +fn default_913() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_912() -> Vec { +fn default_914() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_913() -> Option { +fn default_915() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_914() -> Option { +fn default_916() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_915() -> Option { +fn default_917() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_916() -> ConversationSaveMessageOutputReason { +fn default_918() -> ConversationSaveMessageOutputReason { serde_json::from_str("\"\"").expect("schema default") } -fn default_917() -> String { +fn default_919() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_918() -> Vec { +fn default_920() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_919() -> bool { +fn default_921() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_920() -> Option { - serde_json::from_str("null").expect("schema default") -} -fn default_921() -> Option { - serde_json::from_str("null").expect("schema default") -} fn default_922() -> Option { serde_json::from_str("null").expect("schema default") } @@ -63538,30 +63564,30 @@ fn default_926() -> Option { fn default_927() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_928() -> Option { +fn default_928() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_929() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_930() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_929() -> Option { +fn default_931() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_930() -> Integer { +fn default_932() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_931() -> Vec { +fn default_933() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_932() -> f64 { +fn default_934() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_933() -> Integer { +fn default_935() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_934() -> Option { - serde_json::from_str("null").expect("schema default") -} -fn default_935() -> Option { - serde_json::from_str("null").expect("schema default") -} fn default_936() -> Option { serde_json::from_str("null").expect("schema default") } @@ -63586,11 +63612,11 @@ fn default_942() -> Option { fn default_943() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_944() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_944() -> Option { + serde_json::from_str("null").expect("schema default") } -fn default_945() -> f64 { - serde_json::from_str("0.0").expect("schema default") +fn default_945() -> Option { + serde_json::from_str("null").expect("schema default") } fn default_946() -> Integer { serde_json::from_str("0").expect("schema default") @@ -63598,11 +63624,11 @@ fn default_946() -> Integer { fn default_947() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_948() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_948() -> Integer { + serde_json::from_str("0").expect("schema default") } -fn default_949() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_949() -> f64 { + serde_json::from_str("0.0").expect("schema default") } fn default_950() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -63610,621 +63636,621 @@ fn default_950() -> String { fn default_951() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_952() -> Vec { +fn default_952() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_953() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_954() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_953() -> Option { +fn default_955() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_954() -> String { +fn default_956() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_955() -> String { +fn default_957() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_956() -> String { +fn default_958() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_957() -> Option { +fn default_959() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_958() -> String { +fn default_960() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_959() -> DecisionRowStage { +fn default_961() -> DecisionRowStage { serde_json::from_str("\"decided\"").expect("schema default") } -fn default_960() -> f64 { +fn default_962() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_961() -> Option { +fn default_963() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_962() -> Option { +fn default_964() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_963() -> Integer { +fn default_965() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_964() -> String { +fn default_966() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_965() -> bool { +fn default_967() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_966() -> Integer { +fn default_968() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_967() -> String { +fn default_969() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_968() -> bool { +fn default_970() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_969() -> Option { +fn default_971() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_970() -> String { +fn default_972() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_971() -> Integer { +fn default_973() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_972() -> Integer { +fn default_974() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_973() -> Integer { +fn default_975() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_974() -> Option { +fn default_976() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_975() -> String { +fn default_977() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_976() -> Option { +fn default_978() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_977() -> Integer { +fn default_979() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_978() -> std::collections::HashMap { +fn default_980() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_979() -> Option { +fn default_981() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_980() -> Option> { +fn default_982() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_981() -> bool { +fn default_983() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_982() -> String { +fn default_984() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_983() -> Vec { +fn default_985() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_984() -> Option { +fn default_986() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_985() -> Option { +fn default_987() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_986() -> Option { +fn default_988() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_987() -> Option { +fn default_989() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_988() -> Option { +fn default_990() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_989() -> Option { +fn default_991() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_990() -> Option { +fn default_992() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_991() -> Option { +fn default_993() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_992() -> Option { +fn default_994() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_993() -> Integer { +fn default_995() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_994() -> std::collections::HashMap { +fn default_996() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_995() -> Option { +fn default_997() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_996() -> Option> { +fn default_998() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_997() -> bool { +fn default_999() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_998() -> String { +fn default_1000() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_999() -> String { +fn default_1001() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1000() -> String { +fn default_1002() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1001() -> Option { +fn default_1003() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1002() -> String { +fn default_1004() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1003() -> String { +fn default_1005() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1004() -> Option { +fn default_1006() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1005() -> Vec { +fn default_1007() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1006() -> String { +fn default_1008() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1007() -> Vec { +fn default_1009() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1008() -> Vec { +fn default_1010() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1009() -> bool { +fn default_1011() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1010() -> bool { +fn default_1012() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1011() -> String { +fn default_1013() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1012() -> String { +fn default_1014() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1013() -> Option { +fn default_1015() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1014() -> Option { +fn default_1016() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1015() -> Option { +fn default_1017() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1016() -> bool { +fn default_1018() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1017() -> Integer { +fn default_1019() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1018() -> String { +fn default_1020() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1019() -> String { +fn default_1021() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1020() -> String { +fn default_1022() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1021() -> String { +fn default_1023() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1022() -> String { +fn default_1024() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1023() -> Option { +fn default_1025() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1024() -> Vec { +fn default_1026() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1025() -> bool { +fn default_1027() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1026() -> Vec { +fn default_1028() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1027() -> Option { +fn default_1029() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1028() -> Option { +fn default_1030() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1029() -> bool { +fn default_1031() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1030() -> String { +fn default_1032() -> String { serde_json::from_str("\"memory\"").expect("schema default") } -fn default_1031() -> Option { +fn default_1033() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1032() -> Option { +fn default_1034() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1033() -> Option { +fn default_1035() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1034() -> String { +fn default_1036() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1035() -> String { +fn default_1037() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1036() -> String { +fn default_1038() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1037() -> HelpGetOutputAudience { +fn default_1039() -> HelpGetOutputAudience { serde_json::from_str("\"user\"").expect("schema default") } -fn default_1038() -> String { +fn default_1040() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1039() -> bool { +fn default_1041() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1040() -> Integer { +fn default_1042() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1041() -> String { +fn default_1043() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1042() -> Vec { +fn default_1044() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1043() -> String { +fn default_1045() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1044() -> Vec { +fn default_1046() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1045() -> Vec { +fn default_1047() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1046() -> String { +fn default_1048() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1047() -> String { +fn default_1049() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1048() -> String { +fn default_1050() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1049() -> Vec { +fn default_1051() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1050() -> String { +fn default_1052() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1051() -> bool { +fn default_1053() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1052() -> Vec { +fn default_1054() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1053() -> Vec { +fn default_1055() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1054() -> Option { +fn default_1056() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1055() -> bool { +fn default_1057() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1056() -> bool { +fn default_1058() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1057() -> Vec { +fn default_1059() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1058() -> Vec> { +fn default_1060() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1059() -> Integer { +fn default_1061() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1060() -> bool { +fn default_1062() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1061() -> String { +fn default_1063() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1062() -> String { +fn default_1064() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1063() -> Integer { +fn default_1065() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1064() -> Integer { +fn default_1066() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1065() -> Vec { +fn default_1067() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1066() -> Integer { +fn default_1068() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1067() -> Vec { +fn default_1069() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1068() -> bool { +fn default_1070() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1069() -> String { +fn default_1071() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1070() -> Option { +fn default_1072() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1071() -> Option { +fn default_1073() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1072() -> Vec> { +fn default_1074() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1073() -> Option { +fn default_1075() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1074() -> bool { +fn default_1076() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1075() -> Integer { +fn default_1077() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1076() -> Vec { +fn default_1078() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1077() -> Vec> { +fn default_1079() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1078() -> Vec { +fn default_1080() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1079() -> Vec> { +fn default_1081() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1080() -> Vec { +fn default_1082() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1081() -> String { +fn default_1083() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1082() -> Vec { +fn default_1084() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1083() -> Vec { +fn default_1085() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1084() -> Option { +fn default_1086() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1085() -> Vec { +fn default_1087() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1086() -> Integer { +fn default_1088() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1087() -> Vec { +fn default_1089() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1088() -> String { +fn default_1090() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1089() -> Vec { +fn default_1091() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1090() -> Vec { +fn default_1092() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1091() -> Option { +fn default_1093() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1092() -> Option { +fn default_1094() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1093() -> bool { +fn default_1095() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1094() -> String { +fn default_1096() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1095() -> String { +fn default_1097() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1096() -> bool { +fn default_1098() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1097() -> String { +fn default_1099() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1098() -> String { +fn default_1100() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1099() -> String { +fn default_1101() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1100() -> Integer { +fn default_1102() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1101() -> String { +fn default_1103() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1102() -> String { +fn default_1104() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1103() -> String { +fn default_1105() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1104() -> Option> { +fn default_1106() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_1105() -> Vec { +fn default_1107() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1106() -> Integer { +fn default_1108() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1107() -> Integer { +fn default_1109() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1108() -> Option { +fn default_1110() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1109() -> String { +fn default_1111() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1110() -> String { +fn default_1112() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1111() -> bool { +fn default_1113() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1112() -> Option { +fn default_1114() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1113() -> Option { +fn default_1115() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1114() -> Option { +fn default_1116() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1115() -> Option { +fn default_1117() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1116() -> Option { +fn default_1118() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1117() -> Vec { +fn default_1119() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1118() -> Vec { +fn default_1120() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1119() -> Option { +fn default_1121() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1120() -> Option { +fn default_1122() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1121() -> Option { +fn default_1123() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1122() -> String { +fn default_1124() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1123() -> Option { +fn default_1125() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1124() -> Option { +fn default_1126() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1125() -> Option { +fn default_1127() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1126() -> Vec { +fn default_1128() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1127() -> Vec { +fn default_1129() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1128() -> Option { +fn default_1130() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1129() -> String { +fn default_1131() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1130() -> Option { +fn default_1132() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1131() -> Vec { +fn default_1133() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1132() -> Option { +fn default_1134() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1133() -> Option { +fn default_1135() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1134() -> Option { +fn default_1136() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1135() -> String { +fn default_1137() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1136() -> Option { +fn default_1138() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1137() -> Option { +fn default_1139() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1138() -> bool { +fn default_1140() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1139() -> bool { +fn default_1141() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1140() -> Option { +fn default_1142() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1141() -> Vec { +fn default_1143() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1142() -> bool { +fn default_1144() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1143() -> Option { +fn default_1145() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1144() -> Option { +fn default_1146() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1145() -> Vec { +fn default_1147() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1146() -> String { +fn default_1148() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1147() -> String { +fn default_1149() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1148() -> Vec { +fn default_1150() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1149() -> Integer { +fn default_1151() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1150() -> Vec { +fn default_1152() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1151() -> Vec { +fn default_1153() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1152() -> Vec { +fn default_1154() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1153() -> Vec { +fn default_1155() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1154() -> Vec { +fn default_1156() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1155() -> Option { - serde_json::from_str("null").expect("schema default") -} -fn default_1156() -> Option { - serde_json::from_str("null").expect("schema default") -} fn default_1157() -> Option { serde_json::from_str("null").expect("schema default") } @@ -64249,216 +64275,216 @@ fn default_1163() -> Option { fn default_1164() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1165() -> Option { +fn default_1165() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1166() -> Option { +fn default_1166() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1167() -> Vec { +fn default_1167() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_1168() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_1169() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1168() -> Option { +fn default_1170() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1169() -> Option { +fn default_1171() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1170() -> Vec { +fn default_1172() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1171() -> Option { +fn default_1173() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1172() -> Option { +fn default_1174() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1173() -> Vec { +fn default_1175() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1174() -> String { +fn default_1176() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1175() -> String { +fn default_1177() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1176() -> Vec { +fn default_1178() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1177() -> Vec { +fn default_1179() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1178() -> Integer { +fn default_1180() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1179() -> Vec { +fn default_1181() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1180() -> Vec { +fn default_1182() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1181() -> Vec { +fn default_1183() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1182() -> Vec { +fn default_1184() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1183() -> Option { +fn default_1185() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1184() -> String { +fn default_1186() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1185() -> bool { +fn default_1187() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1186() -> KnowledgeMoveResultReason { +fn default_1188() -> KnowledgeMoveResultReason { serde_json::from_str("\"\"").expect("schema default") } -fn default_1187() -> Vec { +fn default_1189() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1188() -> String { +fn default_1190() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1189() -> bool { +fn default_1191() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1190() -> Integer { +fn default_1192() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1191() -> Vec { +fn default_1193() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1192() -> Option { +fn default_1194() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1193() -> Vec { +fn default_1195() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1194() -> Vec> { +fn default_1196() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1195() -> bool { +fn default_1197() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1196() -> Vec { +fn default_1198() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1197() -> bool { +fn default_1199() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1198() -> Vec { +fn default_1200() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1199() -> Vec> { +fn default_1201() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1200() -> KnowledgeRestoreOutputReason { +fn default_1202() -> KnowledgeRestoreOutputReason { serde_json::from_str("\"\"").expect("schema default") } -fn default_1201() -> String { +fn default_1203() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1202() -> Option { +fn default_1204() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1203() -> Integer { +fn default_1205() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1204() -> KnowledgeRestoreOutputOriginal { +fn default_1206() -> KnowledgeRestoreOutputOriginal { serde_json::from_str("\"none\"").expect("schema default") } -fn default_1205() -> Option { +fn default_1207() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1206() -> Vec> { +fn default_1208() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1207() -> Vec { +fn default_1209() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1208() -> std::collections::HashMap { +fn default_1210() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1209() -> Integer { +fn default_1211() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1210() -> bool { +fn default_1212() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1211() -> Vec { +fn default_1213() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1212() -> Integer { +fn default_1214() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1213() -> bool { +fn default_1215() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1214() -> KnowledgeSourceProbe { +fn default_1216() -> KnowledgeSourceProbe { serde_json::from_str( "{\"documents\":0,\"more\":false,\"sample\":[],\"checked\":0,\"sampled\":false}", ) .expect("schema default") } -fn default_1215() -> bool { +fn default_1217() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1216() -> bool { +fn default_1218() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1217() -> Integer { +fn default_1219() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1218() -> bool { +fn default_1220() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1219() -> Vec { +fn default_1221() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1220() -> Integer { +fn default_1222() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1221() -> bool { +fn default_1223() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1222() -> String { +fn default_1224() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1223() -> String { +fn default_1225() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1224() -> String { +fn default_1226() -> String { serde_json::from_str("\"shared\"").expect("schema default") } -fn default_1225() -> bool { +fn default_1227() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1226() -> String { +fn default_1228() -> String { serde_json::from_str("\"namespace\"").expect("schema default") } -fn default_1227() -> std::collections::HashMap { +fn default_1229() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1228() -> String { +fn default_1230() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1229() -> Vec> { +fn default_1231() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1230() -> Vec { +fn default_1232() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1231() -> std::collections::HashMap { +fn default_1233() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1232() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_1233() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_1234() -> String { serde_json::from_str("\"\"").expect("schema default") } @@ -64468,11 +64494,11 @@ fn default_1235() -> String { fn default_1236() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1237() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1237() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_1238() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1238() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1239() -> Integer { serde_json::from_str("0").expect("schema default") @@ -64480,14 +64506,14 @@ fn default_1239() -> Integer { fn default_1240() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1241() -> std::collections::HashMap { - serde_json::from_str("{}").expect("schema default") +fn default_1241() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_1242() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1243() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1243() -> std::collections::HashMap { + serde_json::from_str("{}").expect("schema default") } fn default_1244() -> Integer { serde_json::from_str("0").expect("schema default") @@ -64498,98 +64524,98 @@ fn default_1245() -> String { fn default_1246() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1247() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1247() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1248() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1249() -> String { +fn default_1249() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1250() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1251() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1250() -> KnowledgeSourceSync { +fn default_1252() -> KnowledgeSourceSync { serde_json::from_str("{\"requested_at\":\"\",\"last_synced_at\":\"\",\"status\":\"\",\"documents_seen\":0,\"changed\":0,\"removed\":0,\"unconverted\":0,\"unconverted_reasons\":{},\"skipped\":0,\"error\":\"\",\"pending_extract\":0,\"last_extracted_at\":\"\",\"extracted\":0,\"flagged_pinned\":0,\"unextracted\":0,\"extract_error\":\"\"}").expect("schema default") } -fn default_1251() -> String { +fn default_1253() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1252() -> String { +fn default_1254() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1253() -> String { +fn default_1255() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1254() -> Vec { +fn default_1256() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1255() -> String { +fn default_1257() -> String { serde_json::from_str("\"shared\"").expect("schema default") } -fn default_1256() -> bool { +fn default_1258() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1257() -> String { +fn default_1259() -> String { serde_json::from_str("\"namespace\"").expect("schema default") } -fn default_1258() -> std::collections::HashMap { +fn default_1260() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1259() -> String { +fn default_1261() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1260() -> Vec> { +fn default_1262() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1261() -> Vec { +fn default_1263() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1262() -> std::collections::HashMap { +fn default_1264() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1263() -> String { +fn default_1265() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1264() -> String { +fn default_1266() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1265() -> KnowledgeSourceSync { +fn default_1267() -> KnowledgeSourceSync { serde_json::from_str("{\"requested_at\":\"\",\"last_synced_at\":\"\",\"status\":\"\",\"documents_seen\":0,\"changed\":0,\"removed\":0,\"unconverted\":0,\"unconverted_reasons\":{},\"skipped\":0,\"error\":\"\",\"pending_extract\":0,\"last_extracted_at\":\"\",\"extracted\":0,\"flagged_pinned\":0,\"unextracted\":0,\"extract_error\":\"\"}").expect("schema default") } -fn default_1266() -> Vec { +fn default_1268() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1267() -> bool { +fn default_1269() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1268() -> bool { +fn default_1270() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1269() -> bool { +fn default_1271() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1270() -> String { +fn default_1272() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1271() -> std::collections::HashMap { +fn default_1273() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1272() -> String { +fn default_1274() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1273() -> Vec { +fn default_1275() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1274() -> bool { +fn default_1276() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1275() -> String { - serde_json::from_str("\"disabled\"").expect("schema default") -} -fn default_1276() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_1277() -> String { - serde_json::from_str("\"\"").expect("schema default") + serde_json::from_str("\"disabled\"").expect("schema default") } fn default_1278() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -64603,219 +64629,219 @@ fn default_1280() -> String { fn default_1281() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1282() -> Integer { +fn default_1282() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_1283() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_1284() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1283() -> f64 { +fn default_1285() -> f64 { serde_json::from_str("0").expect("schema default") } -fn default_1284() -> Integer { +fn default_1286() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1285() -> Option { +fn default_1287() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1286() -> KnowledgeSourceProbe { +fn default_1288() -> KnowledgeSourceProbe { serde_json::from_str( "{\"documents\":0,\"more\":false,\"sample\":[],\"checked\":0,\"sampled\":false}", ) .expect("schema default") } -fn default_1287() -> String { +fn default_1289() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1288() -> bool { +fn default_1290() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1289() -> Option { +fn default_1291() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1290() -> Vec> { +fn default_1292() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1291() -> Vec { +fn default_1293() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1292() -> std::collections::HashMap { +fn default_1294() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1293() -> Vec> { +fn default_1295() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1294() -> Vec> { +fn default_1296() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1295() -> KnowledgeSourceProbe { +fn default_1297() -> KnowledgeSourceProbe { serde_json::from_str( "{\"documents\":0,\"more\":false,\"sample\":[],\"checked\":0,\"sampled\":false}", ) .expect("schema default") } -fn default_1296() -> Vec { +fn default_1298() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1297() -> Integer { +fn default_1299() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1298() -> Option> { +fn default_1300() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_1299() -> Vec { +fn default_1301() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1300() -> Vec { +fn default_1302() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1301() -> bool { +fn default_1303() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1302() -> bool { +fn default_1304() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1303() -> String { +fn default_1305() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1304() -> String { +fn default_1306() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1305() -> Vec> { +fn default_1307() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1306() -> bool { +fn default_1308() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1307() -> Vec { +fn default_1309() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1308() -> Vec { +fn default_1310() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1309() -> String { +fn default_1311() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1310() -> String { +fn default_1312() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1311() -> String { +fn default_1313() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1312() -> Vec { +fn default_1314() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1313() -> Integer { +fn default_1315() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1314() -> String { +fn default_1316() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1315() -> Integer { +fn default_1317() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1316() -> String { +fn default_1318() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1317() -> String { +fn default_1319() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1318() -> Integer { +fn default_1320() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1319() -> Integer { +fn default_1321() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1320() -> String { +fn default_1322() -> String { serde_json::from_str("\"memory_supporters\"").expect("schema default") } -fn default_1321() -> String { +fn default_1323() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1322() -> String { +fn default_1324() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1323() -> Option { +fn default_1325() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1324() -> String { +fn default_1326() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1325() -> String { +fn default_1327() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1326() -> bool { +fn default_1328() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1327() -> bool { +fn default_1329() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1328() -> String { +fn default_1330() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1329() -> std::collections::HashMap { +fn default_1331() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1330() -> Vec { +fn default_1332() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1331() -> String { +fn default_1333() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1332() -> String { +fn default_1334() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1333() -> String { +fn default_1335() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1334() -> Vec { +fn default_1336() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1335() -> String { +fn default_1337() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1336() -> String { +fn default_1338() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1337() -> Vec { +fn default_1339() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1338() -> Vec { +fn default_1340() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1339() -> Vec { +fn default_1341() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1340() -> Vec { +fn default_1342() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1341() -> Integer { +fn default_1343() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1342() -> Vec { +fn default_1344() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1343() -> Vec { +fn default_1345() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1344() -> Vec { +fn default_1346() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1345() -> Integer { +fn default_1347() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1346() -> Vec { +fn default_1348() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1347() -> std::collections::HashMap { +fn default_1349() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1348() -> std::collections::HashMap { +fn default_1350() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1349() -> Integer { - serde_json::from_str("0").expect("schema default") -} -fn default_1350() -> Integer { - serde_json::from_str("0").expect("schema default") -} fn default_1351() -> Integer { serde_json::from_str("0").expect("schema default") } @@ -64828,215 +64854,215 @@ fn default_1353() -> Integer { fn default_1354() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1355() -> bool { +fn default_1355() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1356() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1357() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1356() -> String { +fn default_1358() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1357() -> String { +fn default_1359() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1358() -> String { +fn default_1360() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1359() -> String { +fn default_1361() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1360() -> Option { +fn default_1362() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1361() -> String { +fn default_1363() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1362() -> Vec { +fn default_1364() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1363() -> String { +fn default_1365() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1364() -> MemoryAskOutputSource { +fn default_1366() -> MemoryAskOutputSource { serde_json::from_str("\"synthesized\"").expect("schema default") } -fn default_1365() -> bool { +fn default_1367() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1366() -> String { +fn default_1368() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1367() -> Vec { +fn default_1369() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1368() -> Vec { +fn default_1370() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1369() -> Vec { +fn default_1371() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1370() -> String { +fn default_1372() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1371() -> String { +fn default_1373() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1372() -> MemoryAskOutputRouteTier { +fn default_1374() -> MemoryAskOutputRouteTier { serde_json::from_str("\"\"").expect("schema default") } -fn default_1373() -> String { +fn default_1375() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1374() -> Integer { +fn default_1376() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1375() -> Integer { +fn default_1377() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1376() -> bool { +fn default_1378() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1377() -> f64 { +fn default_1379() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_1378() -> Option { +fn default_1380() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1379() -> Option { +fn default_1381() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1380() -> bool { +fn default_1382() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1381() -> String { +fn default_1383() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1382() -> Integer { +fn default_1384() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1383() -> Integer { +fn default_1385() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1384() -> Integer { +fn default_1386() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1385() -> Integer { +fn default_1387() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1386() -> String { +fn default_1388() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1387() -> Vec { +fn default_1389() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1388() -> Integer { +fn default_1390() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1389() -> MemoryAskOutputConsistency { +fn default_1391() -> MemoryAskOutputConsistency { serde_json::from_str("\"\"").expect("schema default") } -fn default_1390() -> f64 { +fn default_1392() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_1391() -> String { +fn default_1393() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1392() -> Integer { +fn default_1394() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1393() -> Integer { +fn default_1395() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1394() -> String { +fn default_1396() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1395() -> String { +fn default_1397() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1396() -> String { +fn default_1398() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1397() -> String { +fn default_1399() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1398() -> MemoryAskOutputDepth { +fn default_1400() -> MemoryAskOutputDepth { serde_json::from_str("\"\"").expect("schema default") } -fn default_1399() -> bool { +fn default_1401() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1400() -> Vec { +fn default_1402() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1401() -> Integer { +fn default_1403() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1402() -> Integer { +fn default_1404() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1403() -> Integer { +fn default_1405() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1404() -> Vec { +fn default_1406() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1405() -> Integer { +fn default_1407() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1406() -> Integer { +fn default_1408() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1407() -> Integer { +fn default_1409() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1408() -> MemoryAskOutputGrounding { +fn default_1410() -> MemoryAskOutputGrounding { serde_json::from_str("\"\"").expect("schema default") } -fn default_1409() -> String { +fn default_1411() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1410() -> Vec { +fn default_1412() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1411() -> Integer { +fn default_1413() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1412() -> Integer { +fn default_1414() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1413() -> Integer { +fn default_1415() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1414() -> Integer { +fn default_1416() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1415() -> std::collections::HashMap { +fn default_1417() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1416() -> MemoryAskOutputDeepSelector { +fn default_1418() -> MemoryAskOutputDeepSelector { serde_json::from_str("\"\"").expect("schema default") } -fn default_1417() -> MemoryAskOutputDeepFirst { +fn default_1419() -> MemoryAskOutputDeepFirst { serde_json::from_str("\"\"").expect("schema default") } -fn default_1418() -> Integer { - serde_json::from_str("0").expect("schema default") -} -fn default_1419() -> Integer { - serde_json::from_str("0").expect("schema default") -} fn default_1420() -> Integer { serde_json::from_str("0").expect("schema default") } fn default_1421() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1422() -> f64 { - serde_json::from_str("0.0").expect("schema default") +fn default_1422() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_1423() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1424() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1424() -> f64 { + serde_json::from_str("0.0").expect("schema default") } fn default_1425() -> Integer { serde_json::from_str("0").expect("schema default") @@ -65047,143 +65073,143 @@ fn default_1426() -> Integer { fn default_1427() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1428() -> bool { +fn default_1428() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1429() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1430() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1429() -> String { +fn default_1431() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_1430() -> String { +fn default_1432() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_1431() -> String { +fn default_1433() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_1432() -> String { +fn default_1434() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1433() -> String { +fn default_1435() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1434() -> String { +fn default_1436() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1435() -> bool { +fn default_1437() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1436() -> String { +fn default_1438() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1437() -> Option { +fn default_1439() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1438() -> String { +fn default_1440() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1439() -> String { +fn default_1441() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1440() -> Vec { +fn default_1442() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1441() -> Option { +fn default_1443() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1442() -> bool { +fn default_1444() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1443() -> String { +fn default_1445() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1444() -> String { +fn default_1446() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1445() -> Vec { +fn default_1447() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1446() -> String { +fn default_1448() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1447() -> Vec { +fn default_1449() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1448() -> String { +fn default_1450() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1449() -> String { +fn default_1451() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1450() -> Vec { +fn default_1452() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1451() -> Vec { +fn default_1453() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1452() -> Integer { +fn default_1454() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1453() -> Vec { +fn default_1455() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1454() -> Vec { +fn default_1456() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1455() -> String { +fn default_1457() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1456() -> String { +fn default_1458() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1457() -> bool { +fn default_1459() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1458() -> String { +fn default_1460() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1459() -> String { +fn default_1461() -> String { serde_json::from_str("\"fact\"").expect("schema default") } -fn default_1460() -> String { +fn default_1462() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1461() -> bool { +fn default_1463() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1462() -> String { +fn default_1464() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1463() -> String { +fn default_1465() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1464() -> String { +fn default_1466() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1465() -> Vec { - serde_json::from_str("[]").expect("schema default") -} -fn default_1466() -> Vec { +fn default_1467() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1467() -> Vec { +fn default_1468() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1468() -> std::collections::HashMap { - serde_json::from_str("{}").expect("schema default") -} fn default_1469() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1470() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1470() -> std::collections::HashMap { + serde_json::from_str("{}").expect("schema default") } -fn default_1471() -> Vec { +fn default_1471() -> Vec { serde_json::from_str("[]").expect("schema default") } fn default_1472() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1473() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1473() -> Vec { + serde_json::from_str("[]").expect("schema default") } fn default_1474() -> Integer { serde_json::from_str("0").expect("schema default") @@ -65200,11 +65226,11 @@ fn default_1477() -> Integer { fn default_1478() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1479() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1479() -> Integer { + serde_json::from_str("0").expect("schema default") } -fn default_1480() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1480() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_1481() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -65212,14 +65238,14 @@ fn default_1481() -> String { fn default_1482() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1483() -> bool { - serde_json::from_str("true").expect("schema default") +fn default_1483() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_1484() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1484() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_1485() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1485() -> bool { + serde_json::from_str("true").expect("schema default") } fn default_1486() -> Integer { serde_json::from_str("0").expect("schema default") @@ -65230,345 +65256,345 @@ fn default_1487() -> Integer { fn default_1488() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1489() -> bool { +fn default_1489() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1490() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1491() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1490() -> Vec { +fn default_1492() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1491() -> String { +fn default_1493() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1492() -> String { +fn default_1494() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1493() -> Option { +fn default_1495() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1494() -> Vec { +fn default_1496() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1495() -> bool { +fn default_1497() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1496() -> bool { +fn default_1498() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1497() -> Vec { +fn default_1499() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1498() -> bool { +fn default_1500() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1499() -> Option { +fn default_1501() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1500() -> Vec { +fn default_1502() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1501() -> Option { +fn default_1503() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1502() -> Option { +fn default_1504() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1503() -> Vec { +fn default_1505() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1504() -> Integer { +fn default_1506() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1505() -> bool { +fn default_1507() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1506() -> String { +fn default_1508() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1507() -> Integer { +fn default_1509() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1508() -> Integer { +fn default_1510() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1509() -> std::collections::HashMap { +fn default_1511() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1510() -> String { +fn default_1512() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1511() -> f64 { +fn default_1513() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_1512() -> bool { +fn default_1514() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1513() -> String { +fn default_1515() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1514() -> String { +fn default_1516() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1515() -> Integer { +fn default_1517() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1516() -> Integer { +fn default_1518() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1517() -> Option { +fn default_1519() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1518() -> Vec { +fn default_1520() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1519() -> Vec { +fn default_1521() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1520() -> Option { +fn default_1522() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1521() -> Option { +fn default_1523() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1522() -> Integer { +fn default_1524() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1523() -> bool { +fn default_1525() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1524() -> String { +fn default_1526() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1525() -> String { +fn default_1527() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1526() -> String { +fn default_1528() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1527() -> String { +fn default_1529() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1528() -> Option { +fn default_1530() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1529() -> String { +fn default_1531() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1530() -> Integer { +fn default_1532() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1531() -> Integer { +fn default_1533() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1532() -> String { +fn default_1534() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1533() -> Vec { +fn default_1535() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1534() -> bool { +fn default_1536() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1535() -> Integer { +fn default_1537() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1536() -> Integer { +fn default_1538() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1537() -> Integer { +fn default_1539() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1538() -> Integer { +fn default_1540() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1539() -> Integer { +fn default_1541() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1540() -> String { +fn default_1542() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1541() -> String { +fn default_1543() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1542() -> String { +fn default_1544() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_1543() -> String { +fn default_1545() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1544() -> Vec { +fn default_1546() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1545() -> Integer { +fn default_1547() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1546() -> Integer { +fn default_1548() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1547() -> String { +fn default_1549() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1548() -> String { +fn default_1550() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1549() -> Vec { +fn default_1551() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1550() -> String { +fn default_1552() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_1551() -> String { +fn default_1553() -> String { serde_json::from_str("\"-\"").expect("schema default") } -fn default_1552() -> Vec { +fn default_1554() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1553() -> Vec { +fn default_1555() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1554() -> String { +fn default_1556() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1555() -> String { +fn default_1557() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1556() -> Vec { +fn default_1558() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1557() -> f64 { +fn default_1559() -> f64 { serde_json::from_str("1.0").expect("schema default") } -fn default_1558() -> String { +fn default_1560() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1559() -> String { +fn default_1561() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1560() -> Vec { +fn default_1562() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1561() -> bool { +fn default_1563() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1562() -> String { +fn default_1564() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1563() -> Integer { +fn default_1565() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1564() -> Vec { +fn default_1566() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1565() -> Vec { +fn default_1567() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1566() -> Vec { +fn default_1568() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1567() -> Vec { +fn default_1569() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1568() -> Vec { +fn default_1570() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1569() -> Option { +fn default_1571() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1570() -> Option { +fn default_1572() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1571() -> Vec { +fn default_1573() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1572() -> Integer { +fn default_1574() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1573() -> Integer { +fn default_1575() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1574() -> Vec { +fn default_1576() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1575() -> Vec { +fn default_1577() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1576() -> Integer { +fn default_1578() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1577() -> Integer { +fn default_1579() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1578() -> bool { +fn default_1580() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1579() -> Vec { +fn default_1581() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1580() -> f64 { +fn default_1582() -> f64 { serde_json::from_str("1.0").expect("schema default") } -fn default_1581() -> bool { +fn default_1583() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1582() -> String { +fn default_1584() -> String { serde_json::from_str("\"active\"").expect("schema default") } -fn default_1583() -> String { +fn default_1585() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1584() -> Option { +fn default_1586() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1585() -> String { +fn default_1587() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1586() -> String { +fn default_1588() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1587() -> String { +fn default_1589() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1588() -> String { +fn default_1590() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1589() -> MemoryForFileHitSupersedesKind { +fn default_1591() -> MemoryForFileHitSupersedesKind { serde_json::from_str("\"\"").expect("schema default") } -fn default_1590() -> Vec { +fn default_1592() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1591() -> String { +fn default_1593() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1592() -> MemoryForFileHitVerification { +fn default_1594() -> MemoryForFileHitVerification { serde_json::from_str("\"none\"").expect("schema default") } -fn default_1593() -> MemoryForFileHitCodeState { +fn default_1595() -> MemoryForFileHitCodeState { serde_json::from_str("\"\"").expect("schema default") } -fn default_1594() -> Vec { +fn default_1596() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1595() -> String { +fn default_1597() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1596() -> Integer { +fn default_1598() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1597() -> bool { +fn default_1599() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1598() -> bool { +fn default_1600() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1599() -> Vec { +fn default_1601() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1600() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_1601() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_1602() -> String { serde_json::from_str("\"\"").expect("schema default") } @@ -65581,22 +65607,22 @@ fn default_1604() -> String { fn default_1605() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1606() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_1606() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_1607() -> Value { - serde_json::from_str("null").expect("schema default") +fn default_1607() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_1608() -> Option { +fn default_1608() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1609() -> Option { +fn default_1609() -> Value { serde_json::from_str("null").expect("schema default") } -fn default_1610() -> Option { +fn default_1610() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1611() -> Option { +fn default_1611() -> Option { serde_json::from_str("null").expect("schema default") } fn default_1612() -> Option { @@ -65605,548 +65631,548 @@ fn default_1612() -> Option { fn default_1613() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1614() -> bool { +fn default_1614() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_1615() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_1616() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1615() -> String { +fn default_1617() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1616() -> String { +fn default_1618() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1617() -> Option { +fn default_1619() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1618() -> String { +fn default_1620() -> String { serde_json::from_str("\"none\"").expect("schema default") } -fn default_1619() -> String { +fn default_1621() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1620() -> String { +fn default_1622() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1621() -> String { +fn default_1623() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1622() -> String { +fn default_1624() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1623() -> String { +fn default_1625() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1624() -> Option { +fn default_1626() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1625() -> String { +fn default_1627() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1626() -> String { +fn default_1628() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1627() -> String { +fn default_1629() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1628() -> Integer { +fn default_1630() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1629() -> Vec { +fn default_1631() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1630() -> Integer { +fn default_1632() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1631() -> Option { +fn default_1633() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1632() -> Vec { +fn default_1634() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1633() -> std::collections::HashMap { +fn default_1635() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1634() -> Integer { +fn default_1636() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1635() -> f64 { +fn default_1637() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_1636() -> Integer { +fn default_1638() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1637() -> Integer { +fn default_1639() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1638() -> Integer { +fn default_1640() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1639() -> Integer { +fn default_1641() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1640() -> Integer { +fn default_1642() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1641() -> MemoryHealthStaleness { +fn default_1643() -> MemoryHealthStaleness { serde_json::from_str("{\"by_age\":{},\"with_validity_end\":0,\"with_validity_end_share\":0.0,\"with_expiry\":0,\"expiring_7d\":0,\"pinned\":0,\"days_since_reinforced_p50\":0,\"days_since_reinforced_p90\":0}").expect("schema default") } -fn default_1642() -> Integer { +fn default_1644() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1643() -> Integer { +fn default_1645() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1644() -> f64 { +fn default_1646() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_1645() -> MemoryHealthFootprint { +fn default_1647() -> MemoryHealthFootprint { serde_json::from_str("{\"value_chars\":0,\"value_tokens_est\":0,\"tokens_per_row_est\":0.0}") .expect("schema default") } -fn default_1646() -> String { +fn default_1648() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1647() -> Value { +fn default_1649() -> Value { serde_json::from_str("null").expect("schema default") } -fn default_1648() -> String { +fn default_1650() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1649() -> bool { +fn default_1651() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1650() -> Option { +fn default_1652() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1651() -> Option { +fn default_1653() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1652() -> Option { +fn default_1654() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1653() -> String { +fn default_1655() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1654() -> String { +fn default_1656() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1655() -> String { +fn default_1657() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1656() -> String { +fn default_1658() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1657() -> String { +fn default_1659() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1658() -> Option { +fn default_1660() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1659() -> String { +fn default_1661() -> String { serde_json::from_str("\"active\"").expect("schema default") } -fn default_1660() -> Vec { +fn default_1662() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1661() -> Vec { +fn default_1663() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1662() -> Option { +fn default_1664() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1663() -> String { +fn default_1665() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1664() -> String { +fn default_1666() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1665() -> String { +fn default_1667() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1666() -> String { +fn default_1668() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1667() -> Option { +fn default_1669() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1668() -> Integer { +fn default_1670() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1669() -> Integer { +fn default_1671() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1670() -> Integer { +fn default_1672() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1671() -> Integer { +fn default_1673() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1672() -> MemoryImportResultReason { +fn default_1674() -> MemoryImportResultReason { serde_json::from_str("\"\"").expect("schema default") } -fn default_1673() -> String { +fn default_1675() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1674() -> MemoryImportResultNote { +fn default_1676() -> MemoryImportResultNote { serde_json::from_str("\"\"").expect("schema default") } -fn default_1675() -> bool { +fn default_1677() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1676() -> String { +fn default_1678() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1677() -> Option { +fn default_1679() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1678() -> Integer { +fn default_1680() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1679() -> Integer { +fn default_1681() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1680() -> Integer { +fn default_1682() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1681() -> String { +fn default_1683() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1682() -> Integer { +fn default_1684() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1683() -> Vec { +fn default_1685() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1684() -> Integer { +fn default_1686() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1685() -> Integer { +fn default_1687() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1686() -> Vec { +fn default_1688() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1687() -> Integer { +fn default_1689() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1688() -> Vec { +fn default_1690() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1689() -> Vec { +fn default_1691() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1690() -> Vec { +fn default_1692() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1691() -> Vec { +fn default_1693() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1692() -> Vec { +fn default_1694() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1693() -> Option { +fn default_1695() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1694() -> Option { +fn default_1696() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1695() -> String { +fn default_1697() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1696() -> Integer { +fn default_1698() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1697() -> String { +fn default_1699() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1698() -> Vec { +fn default_1700() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1699() -> bool { +fn default_1701() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1700() -> Vec { +fn default_1702() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1701() -> Option { +fn default_1703() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1702() -> Option { +fn default_1704() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1703() -> String { +fn default_1705() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1704() -> Integer { +fn default_1706() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1705() -> String { +fn default_1707() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1706() -> Integer { +fn default_1708() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1707() -> Option { +fn default_1709() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1708() -> String { +fn default_1710() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1709() -> String { +fn default_1711() -> String { serde_json::from_str("\"Each request that extracts memories from messages may send extraction instructions; no user, agent or session setting stores them.\"").expect("schema default") } -fn default_1710() -> Vec { +fn default_1712() -> Vec { serde_json::from_str("[\"memory.set_from_messages\",\"extraction_instructions\"]") .expect("schema default") } -fn default_1711() -> Vec { +fn default_1713() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1712() -> bool { +fn default_1714() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1713() -> String { +fn default_1715() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1714() -> String { +fn default_1716() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1715() -> Option { +fn default_1717() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1716() -> String { +fn default_1718() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1717() -> String { +fn default_1719() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1718() -> String { +fn default_1720() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1719() -> MemoryLineageOutputMechanism { +fn default_1721() -> MemoryLineageOutputMechanism { serde_json::from_str("\"unknown\"").expect("schema default") } -fn default_1720() -> Vec { +fn default_1722() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1721() -> String { +fn default_1723() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1722() -> String { +fn default_1724() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1723() -> Option { +fn default_1725() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1724() -> Vec { +fn default_1726() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1725() -> f64 { +fn default_1727() -> f64 { serde_json::from_str("1.0").expect("schema default") } -fn default_1726() -> bool { +fn default_1728() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1727() -> bool { +fn default_1729() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1728() -> Integer { +fn default_1730() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1729() -> Integer { +fn default_1731() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1730() -> String { +fn default_1732() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1731() -> bool { +fn default_1733() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1732() -> Integer { +fn default_1734() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1733() -> String { +fn default_1735() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1734() -> String { +fn default_1736() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1735() -> String { +fn default_1737() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1736() -> Option { +fn default_1738() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1737() -> String { +fn default_1739() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1738() -> Option { +fn default_1740() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1739() -> String { +fn default_1741() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1740() -> String { +fn default_1742() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1741() -> String { +fn default_1743() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1742() -> Integer { +fn default_1744() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1743() -> String { +fn default_1745() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1744() -> Vec { +fn default_1746() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1745() -> bool { +fn default_1747() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1746() -> String { +fn default_1748() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1747() -> String { +fn default_1749() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1748() -> String { +fn default_1750() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1749() -> bool { +fn default_1751() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1750() -> std::collections::HashMap { +fn default_1752() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1751() -> String { +fn default_1753() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1752() -> String { +fn default_1754() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1753() -> Integer { +fn default_1755() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1754() -> Integer { +fn default_1756() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1755() -> Vec { +fn default_1757() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1756() -> Integer { +fn default_1758() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1757() -> Integer { +fn default_1759() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1758() -> Vec { +fn default_1760() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1759() -> String { +fn default_1761() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1760() -> Integer { +fn default_1762() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1761() -> String { +fn default_1763() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1762() -> Vec { +fn default_1764() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1763() -> Integer { +fn default_1765() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1764() -> Option { +fn default_1766() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1765() -> Vec { +fn default_1767() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1766() -> Integer { +fn default_1768() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1767() -> String { +fn default_1769() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1768() -> String { +fn default_1770() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1769() -> Vec { +fn default_1771() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1770() -> String { +fn default_1772() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1771() -> String { +fn default_1773() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1772() -> String { +fn default_1774() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1773() -> String { +fn default_1775() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1774() -> String { +fn default_1776() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1775() -> Vec { +fn default_1777() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1776() -> String { +fn default_1778() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1777() -> Integer { +fn default_1779() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1778() -> Integer { +fn default_1780() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1779() -> String { +fn default_1781() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1780() -> Integer { +fn default_1782() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1781() -> Integer { +fn default_1783() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1782() -> MemoryProposalReady { +fn default_1784() -> MemoryProposalReady { serde_json::from_str("\"\"").expect("schema default") } -fn default_1783() -> Vec { +fn default_1785() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1784() -> Vec { +fn default_1786() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1785() -> Integer { +fn default_1787() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1786() -> ProposalPolicyMode { +fn default_1788() -> ProposalPolicyMode { serde_json::from_str("\"manual\"").expect("schema default") } -fn default_1787() -> Integer { +fn default_1789() -> Integer { serde_json::from_str("2").expect("schema default") } -fn default_1788() -> Integer { +fn default_1790() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1789() -> Integer { +fn default_1791() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1790() -> ProposalPolicy { +fn default_1792() -> ProposalPolicy { serde_json::from_str( "{\"mode\":\"manual\",\"min_passes\":2,\"max_fails\":0,\"reject_after_fails\":0}", ) .expect("schema default") } -fn default_1791() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_1792() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_1793() -> String { serde_json::from_str("\"\"").expect("schema default") } @@ -66159,14 +66185,14 @@ fn default_1795() -> String { fn default_1796() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1797() -> bool { - serde_json::from_str("false").expect("schema default") +fn default_1797() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1798() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1799() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1799() -> bool { + serde_json::from_str("false").expect("schema default") } fn default_1800() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -66189,324 +66215,324 @@ fn default_1805() -> String { fn default_1806() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1807() -> Vec { +fn default_1807() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_1808() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_1809() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1808() -> f64 { +fn default_1810() -> f64 { serde_json::from_str("1.0").expect("schema default") } -fn default_1809() -> String { +fn default_1811() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1810() -> String { +fn default_1812() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1811() -> Vec { +fn default_1813() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1812() -> String { +fn default_1814() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1813() -> String { +fn default_1815() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1814() -> String { +fn default_1816() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1815() -> String { +fn default_1817() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1816() -> bool { +fn default_1818() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1817() -> Integer { +fn default_1819() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1818() -> Integer { +fn default_1820() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1819() -> Integer { +fn default_1821() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1820() -> bool { +fn default_1822() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1821() -> String { +fn default_1823() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1822() -> Integer { +fn default_1824() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_1823() -> MemoryRecallOutputOrder { +fn default_1825() -> MemoryRecallOutputOrder { serde_json::from_str("\"recent\"").expect("schema default") } -fn default_1824() -> Vec { +fn default_1826() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1825() -> Integer { +fn default_1827() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1826() -> Value { +fn default_1828() -> Value { serde_json::from_str("null").expect("schema default") } -fn default_1827() -> Value { +fn default_1829() -> Value { serde_json::from_str("null").expect("schema default") } -fn default_1828() -> String { +fn default_1830() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1829() -> String { +fn default_1831() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1830() -> Option { +fn default_1832() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1831() -> Option { +fn default_1833() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1832() -> bool { +fn default_1834() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1833() -> String { +fn default_1835() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1834() -> String { +fn default_1836() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1835() -> std::collections::HashMap { +fn default_1837() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1836() -> std::collections::HashMap { +fn default_1838() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1837() -> MemoryRecordRowStatus { +fn default_1839() -> MemoryRecordRowStatus { serde_json::from_str("\"active\"").expect("schema default") } -fn default_1838() -> Option { +fn default_1840() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1839() -> Option { +fn default_1841() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1840() -> bool { +fn default_1842() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1841() -> String { +fn default_1843() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1842() -> MemoryRecordWriteOutputKeySource { +fn default_1844() -> MemoryRecordWriteOutputKeySource { serde_json::from_str("\"anonymous\"").expect("schema default") } -fn default_1843() -> std::collections::HashMap { +fn default_1845() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1844() -> String { +fn default_1846() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1845() -> Integer { +fn default_1847() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1846() -> bool { +fn default_1848() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1847() -> Option { +fn default_1849() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1848() -> Integer { +fn default_1850() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1849() -> Integer { +fn default_1851() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1850() -> Option { +fn default_1852() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1851() -> String { +fn default_1853() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1852() -> Integer { +fn default_1854() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1853() -> Integer { +fn default_1855() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1854() -> bool { +fn default_1856() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1855() -> Vec { +fn default_1857() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1856() -> Option { +fn default_1858() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1857() -> Option { +fn default_1859() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1858() -> bool { +fn default_1860() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1859() -> bool { +fn default_1861() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1860() -> String { +fn default_1862() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1861() -> f64 { +fn default_1863() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_1862() -> String { +fn default_1864() -> String { serde_json::from_str("\"fact\"").expect("schema default") } -fn default_1863() -> String { +fn default_1865() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1864() -> std::collections::HashMap { +fn default_1866() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1865() -> bool { +fn default_1867() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1866() -> Integer { +fn default_1868() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1867() -> String { +fn default_1869() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1868() -> Vec { +fn default_1870() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1869() -> Vec { +fn default_1871() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1870() -> Integer { +fn default_1872() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1871() -> Integer { +fn default_1873() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1872() -> String { +fn default_1874() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1873() -> String { +fn default_1875() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1874() -> Integer { +fn default_1876() -> Integer { serde_json::from_str("1").expect("schema default") } -fn default_1875() -> Integer { +fn default_1877() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1876() -> Integer { +fn default_1878() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1877() -> Vec { +fn default_1879() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1878() -> Integer { +fn default_1880() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1879() -> Integer { +fn default_1881() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1880() -> Integer { +fn default_1882() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1881() -> Integer { +fn default_1883() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1882() -> Vec { +fn default_1884() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1883() -> String { +fn default_1885() -> String { serde_json::from_str("\"whole\"").expect("schema default") } -fn default_1884() -> Integer { +fn default_1886() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1885() -> Vec { +fn default_1887() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1886() -> Vec { +fn default_1888() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1887() -> Integer { +fn default_1889() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1888() -> Vec { +fn default_1890() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1889() -> Integer { +fn default_1891() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1890() -> Vec { +fn default_1892() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1891() -> Vec { +fn default_1893() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1892() -> bool { +fn default_1894() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1893() -> String { +fn default_1895() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1894() -> String { +fn default_1896() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1895() -> std::collections::HashMap { +fn default_1897() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1896() -> String { +fn default_1898() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1897() -> bool { +fn default_1899() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1898() -> Vec { +fn default_1900() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1899() -> Integer { +fn default_1901() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1900() -> Integer { +fn default_1902() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1901() -> String { +fn default_1903() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1902() -> String { +fn default_1904() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1903() -> String { +fn default_1905() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1904() -> bool { +fn default_1906() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1905() -> Integer { +fn default_1907() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1906() -> Option { +fn default_1908() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1907() -> String { +fn default_1909() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1908() -> String { +fn default_1910() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1909() -> String { +fn default_1911() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1910() -> Vec { +fn default_1912() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1911() -> Integer { - serde_json::from_str("0").expect("schema default") -} -fn default_1912() -> Integer { - serde_json::from_str("0").expect("schema default") -} fn default_1913() -> Integer { serde_json::from_str("0").expect("schema default") } @@ -66519,56 +66545,56 @@ fn default_1915() -> Integer { fn default_1916() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1917() -> bool { +fn default_1917() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1918() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_1919() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1918() -> Vec> { +fn default_1920() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_1919() -> Vec { +fn default_1921() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1920() -> Option { +fn default_1922() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1921() -> String { +fn default_1923() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1922() -> Integer { +fn default_1924() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1923() -> Option { +fn default_1925() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1924() -> Option { +fn default_1926() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1925() -> Option { +fn default_1927() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1926() -> Option { +fn default_1928() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1927() -> Vec { +fn default_1929() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1928() -> Integer { +fn default_1930() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1929() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_1930() -> String { +fn default_1931() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1931() -> Option { - serde_json::from_str("null").expect("schema default") -} fn default_1932() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1933() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1933() -> Option { + serde_json::from_str("null").expect("schema default") } fn default_1934() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -66576,23 +66602,23 @@ fn default_1934() -> String { fn default_1935() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1936() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_1936() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1937() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1938() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1938() -> Option { + serde_json::from_str("null").expect("schema default") } -fn default_1939() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1939() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1940() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1941() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1941() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_1942() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -66603,20 +66629,20 @@ fn default_1943() -> String { fn default_1944() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1945() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1945() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1946() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1947() -> Vec { - serde_json::from_str("[]").expect("schema default") +fn default_1947() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_1948() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1949() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_1949() -> Vec { + serde_json::from_str("[]").expect("schema default") } fn default_1950() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -66627,23 +66653,23 @@ fn default_1951() -> Integer { fn default_1952() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1953() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_1954() -> Integer { +fn default_1953() -> Integer { serde_json::from_str("0").expect("schema default") } +fn default_1954() -> String { + serde_json::from_str("\"\"").expect("schema default") +} fn default_1955() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1956() -> bool { - serde_json::from_str("false").expect("schema default") +fn default_1956() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_1957() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1958() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_1958() -> bool { + serde_json::from_str("false").expect("schema default") } fn default_1959() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -66651,108 +66677,108 @@ fn default_1959() -> String { fn default_1960() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1961() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_1961() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_1962() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_1963() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_1964() -> String { serde_json::from_str("\"none\"").expect("schema default") } -fn default_1963() -> Integer { +fn default_1965() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1964() -> String { +fn default_1966() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1965() -> String { +fn default_1967() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1966() -> String { +fn default_1968() -> String { serde_json::from_str("\"active\"").expect("schema default") } -fn default_1967() -> bool { +fn default_1969() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1968() -> Vec { +fn default_1970() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1969() -> std::collections::HashMap { +fn default_1971() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1970() -> String { +fn default_1972() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1971() -> Vec { +fn default_1973() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1972() -> std::collections::HashMap { +fn default_1974() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1973() -> Integer { +fn default_1975() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1974() -> Option { +fn default_1976() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1975() -> String { +fn default_1977() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_1976() -> bool { +fn default_1978() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1977() -> Vec { +fn default_1979() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1978() -> Vec { +fn default_1980() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1979() -> std::collections::HashMap { +fn default_1981() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_1980() -> Option { +fn default_1982() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1981() -> Vec { +fn default_1983() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1982() -> Integer { +fn default_1984() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1983() -> Integer { +fn default_1985() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_1984() -> Vec { +fn default_1986() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1985() -> Option { +fn default_1987() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1986() -> Vec { +fn default_1988() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1987() -> Option { +fn default_1989() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1988() -> Option { +fn default_1990() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_1989() -> Vec { +fn default_1991() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1990() -> bool { +fn default_1992() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_1991() -> Vec { +fn default_1993() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_1992() -> bool { +fn default_1994() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_1993() -> Integer { - serde_json::from_str("0").expect("schema default") -} -fn default_1994() -> Integer { - serde_json::from_str("0").expect("schema default") -} fn default_1995() -> Integer { serde_json::from_str("0").expect("schema default") } @@ -66774,14 +66800,14 @@ fn default_2000() -> Integer { fn default_2001() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2002() -> f64 { - serde_json::from_str("0.0").expect("schema default") +fn default_2002() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_2003() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2004() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_2004() -> f64 { + serde_json::from_str("0.0").expect("schema default") } fn default_2005() -> Integer { serde_json::from_str("0").expect("schema default") @@ -66789,85 +66815,85 @@ fn default_2005() -> Integer { fn default_2006() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2007() -> Option { +fn default_2007() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_2008() -> Integer { + serde_json::from_str("0").expect("schema default") +} +fn default_2009() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2008() -> Option { +fn default_2010() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2009() -> Vec { +fn default_2011() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2010() -> String { +fn default_2012() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2011() -> String { +fn default_2013() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2012() -> Integer { +fn default_2014() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2013() -> Vec> { +fn default_2015() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2014() -> Vec { +fn default_2016() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2015() -> String { +fn default_2017() -> String { serde_json::from_str("\"memory\"").expect("schema default") } -fn default_2016() -> bool { +fn default_2018() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2017() -> String { +fn default_2019() -> String { serde_json::from_str("\"approval\"").expect("schema default") } -fn default_2018() -> String { +fn default_2020() -> String { serde_json::from_str("\"public\"").expect("schema default") } -fn default_2019() -> BrowseEntryMyStatus { +fn default_2021() -> BrowseEntryMyStatus { serde_json::from_str("\"none\"").expect("schema default") } -fn default_2020() -> String { +fn default_2022() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2021() -> String { +fn default_2023() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2022() -> String { +fn default_2024() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2023() -> Integer { +fn default_2025() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2024() -> String { +fn default_2026() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2025() -> Option { +fn default_2027() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2026() -> Option { - serde_json::from_str("null").expect("schema default") -} -fn default_2027() -> Vec { - serde_json::from_str("[]").expect("schema default") -} fn default_2028() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2029() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_2029() -> Vec { + serde_json::from_str("[]").expect("schema default") } fn default_2030() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2031() -> Option> { +fn default_2031() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2032() -> Option { +fn default_2032() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2033() -> Option { +fn default_2033() -> Option> { serde_json::from_str("null").expect("schema default") } fn default_2034() -> Option { @@ -66879,344 +66905,344 @@ fn default_2035() -> Option { fn default_2036() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2037() -> Option { +fn default_2037() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2038() -> Option { +fn default_2038() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2039() -> Option { +fn default_2039() -> Option { serde_json::from_str("null").expect("schema default") } fn default_2040() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2041() -> Option { +fn default_2041() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2042() -> Option { +fn default_2042() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2043() -> Option { +fn default_2043() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2044() -> Option { +fn default_2044() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2045() -> Option { +fn default_2045() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2046() -> Option { +fn default_2046() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2047() -> Option> { +fn default_2047() -> Option { serde_json::from_str("null").expect("schema default") } fn default_2048() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2049() -> Option { +fn default_2049() -> Option> { serde_json::from_str("null").expect("schema default") } fn default_2050() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2051() -> Option { +fn default_2051() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2052() -> Option { +fn default_2052() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2053() -> Option>> { +fn default_2053() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2054() -> Option { +fn default_2054() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2055() -> Option { +fn default_2055() -> Option>> { serde_json::from_str("null").expect("schema default") } -fn default_2056() -> Option { +fn default_2056() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2057() -> Option { +fn default_2057() -> Option { serde_json::from_str("null").expect("schema default") } fn default_2058() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2059() -> Integer { +fn default_2059() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_2060() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_2061() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2060() -> String { +fn default_2062() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2061() -> String { +fn default_2063() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2062() -> String { +fn default_2064() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2063() -> String { +fn default_2065() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2064() -> Option { +fn default_2066() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2065() -> bool { +fn default_2067() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2066() -> Integer { +fn default_2068() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2067() -> String { +fn default_2069() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2068() -> String { +fn default_2070() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2069() -> String { +fn default_2071() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2070() -> String { +fn default_2072() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2071() -> Option { +fn default_2073() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2072() -> Option { +fn default_2074() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2073() -> String { +fn default_2075() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2074() -> Vec { +fn default_2076() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2075() -> String { +fn default_2077() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2076() -> String { +fn default_2078() -> String { serde_json::from_str("\"active\"").expect("schema default") } -fn default_2077() -> Option { +fn default_2079() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2078() -> Vec { +fn default_2080() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2079() -> Option { +fn default_2081() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2080() -> String { +fn default_2082() -> String { serde_json::from_str("\"memory\"").expect("schema default") } -fn default_2081() -> bool { +fn default_2083() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2082() -> f64 { +fn default_2084() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2083() -> f64 { +fn default_2085() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2084() -> String { +fn default_2086() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2085() -> Option { +fn default_2087() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2086() -> Integer { +fn default_2088() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2087() -> Integer { +fn default_2089() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2088() -> NamespaceEntryVisibility { +fn default_2090() -> NamespaceEntryVisibility { serde_json::from_str("\"private\"").expect("schema default") } -fn default_2089() -> String { +fn default_2091() -> String { serde_json::from_str("\"active\"").expect("schema default") } -fn default_2090() -> Option { +fn default_2092() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2091() -> Option { +fn default_2093() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2092() -> Vec { +fn default_2094() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2093() -> MineEntryVisibility { +fn default_2095() -> MineEntryVisibility { serde_json::from_str("\"private\"").expect("schema default") } -fn default_2094() -> String { +fn default_2096() -> String { serde_json::from_str("\"memory\"").expect("schema default") } -fn default_2095() -> String { +fn default_2097() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2096() -> String { +fn default_2098() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2097() -> Option { +fn default_2099() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2098() -> bool { +fn default_2100() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2099() -> bool { +fn default_2101() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2100() -> String { +fn default_2102() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2101() -> NamespaceRegisterOutputVisibility { +fn default_2103() -> NamespaceRegisterOutputVisibility { serde_json::from_str("\"private\"").expect("schema default") } -fn default_2102() -> bool { +fn default_2104() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2103() -> Integer { +fn default_2105() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2104() -> Integer { +fn default_2106() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2105() -> bool { +fn default_2107() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2106() -> Vec> { +fn default_2108() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2107() -> Option { +fn default_2109() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2108() -> Option { +fn default_2110() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2109() -> Vec { +fn default_2111() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2110() -> Integer { +fn default_2112() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2111() -> String { +fn default_2113() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2112() -> String { +fn default_2114() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2113() -> String { +fn default_2115() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2114() -> String { +fn default_2116() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2115() -> String { +fn default_2117() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2116() -> Option { +fn default_2118() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2117() -> String { +fn default_2119() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2118() -> String { +fn default_2120() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2119() -> String { +fn default_2121() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2120() -> Vec { +fn default_2122() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2121() -> Option { +fn default_2123() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2122() -> Option { +fn default_2124() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2123() -> Option { +fn default_2125() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2124() -> Option { +fn default_2126() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2125() -> String { +fn default_2127() -> String { serde_json::from_str("\"{}\"").expect("schema default") } -fn default_2126() -> NamespaceSnapshotOutputSnapshotMemoryRowStatus { +fn default_2128() -> NamespaceSnapshotOutputSnapshotMemoryRowStatus { serde_json::from_str("\"active\"").expect("schema default") } -fn default_2127() -> Option { +fn default_2129() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2128() -> Vec { +fn default_2130() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2129() -> String { +fn default_2131() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2130() -> Integer { +fn default_2132() -> Integer { serde_json::from_str("1").expect("schema default") } -fn default_2131() -> Integer { +fn default_2133() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2132() -> Option { +fn default_2134() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2133() -> String { +fn default_2135() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2134() -> String { +fn default_2136() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2135() -> String { +fn default_2137() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2136() -> String { +fn default_2138() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2137() -> Option { +fn default_2139() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2138() -> f64 { +fn default_2140() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2139() -> Option { +fn default_2141() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2140() -> Option { +fn default_2142() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2141() -> Integer { +fn default_2143() -> Integer { serde_json::from_str("1").expect("schema default") } -fn default_2142() -> Option { +fn default_2144() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2143() -> Option { - serde_json::from_str("null").expect("schema default") -} -fn default_2144() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_2145() -> Option { serde_json::from_str("null").expect("schema default") } fn default_2146() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2147() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_2147() -> Option { + serde_json::from_str("null").expect("schema default") } fn default_2148() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2149() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_2149() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_2150() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -67227,608 +67253,608 @@ fn default_2151() -> Option { fn default_2152() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2153() -> String { +fn default_2153() -> Option { + serde_json::from_str("null").expect("schema default") +} +fn default_2154() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_2155() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2154() -> Vec { +fn default_2156() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2155() -> Vec { +fn default_2157() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2156() -> Option { +fn default_2158() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2157() -> Integer { +fn default_2159() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2158() -> String { +fn default_2160() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2159() -> Vec { +fn default_2161() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2160() -> Vec { +fn default_2162() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2161() -> String { +fn default_2163() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2162() -> Option { +fn default_2164() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2163() -> Vec { +fn default_2165() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2164() -> Integer { +fn default_2166() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2165() -> Vec { +fn default_2167() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2166() -> Option { +fn default_2168() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2167() -> Vec { +fn default_2169() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2168() -> Vec { +fn default_2170() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2169() -> Option { +fn default_2171() -> Option { serde_json::from_str("0").expect("schema default") } -fn default_2170() -> TuneProposalEffect { +fn default_2172() -> TuneProposalEffect { serde_json::from_str("\"future\"").expect("schema default") } -fn default_2171() -> TuneApplyVia { +fn default_2173() -> TuneApplyVia { serde_json::from_str("\"op\"").expect("schema default") } -fn default_2172() -> bool { +fn default_2174() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_2173() -> Vec { +fn default_2175() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2174() -> Option { +fn default_2176() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2175() -> Option { +fn default_2177() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2176() -> String { +fn default_2178() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2177() -> Vec { +fn default_2179() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2178() -> Vec { +fn default_2180() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2179() -> Option { +fn default_2181() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2180() -> Option { +fn default_2182() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2181() -> Option { +fn default_2183() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2182() -> String { +fn default_2184() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2183() -> Option { +fn default_2185() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2184() -> Option { +fn default_2186() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2185() -> Option { +fn default_2187() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2186() -> Vec { +fn default_2188() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2187() -> bool { +fn default_2189() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2188() -> Option { +fn default_2190() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2189() -> Option { +fn default_2191() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2190() -> Vec { +fn default_2192() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2191() -> String { +fn default_2193() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2192() -> String { +fn default_2194() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2193() -> Vec> { +fn default_2195() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2194() -> std::collections::HashMap { +fn default_2196() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2195() -> Vec { +fn default_2197() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2196() -> Integer { +fn default_2198() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2197() -> Integer { +fn default_2199() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2198() -> String { +fn default_2200() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2199() -> String { +fn default_2201() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2200() -> String { +fn default_2202() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2201() -> Vec { +fn default_2203() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2202() -> Vec { +fn default_2204() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2203() -> String { +fn default_2205() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2204() -> String { +fn default_2206() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2205() -> bool { +fn default_2207() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2206() -> Integer { +fn default_2208() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2207() -> String { +fn default_2209() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2208() -> String { +fn default_2210() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2209() -> String { +fn default_2211() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2210() -> String { +fn default_2212() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2211() -> Vec { +fn default_2213() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2212() -> String { +fn default_2214() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2213() -> String { +fn default_2215() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2214() -> std::collections::HashMap { +fn default_2216() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2215() -> String { +fn default_2217() -> String { serde_json::from_str("\"active\"").expect("schema default") } -fn default_2216() -> Option { +fn default_2218() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2217() -> Option { +fn default_2219() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2218() -> bool { +fn default_2220() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2219() -> String { +fn default_2221() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2220() -> String { +fn default_2222() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2221() -> Vec { +fn default_2223() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2222() -> Integer { +fn default_2224() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2223() -> String { +fn default_2225() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2224() -> String { +fn default_2226() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2225() -> Option { +fn default_2227() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2226() -> bool { +fn default_2228() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2227() -> String { +fn default_2229() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2228() -> bool { +fn default_2230() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2229() -> String { +fn default_2231() -> String { serde_json::from_str("\"inherit\"").expect("schema default") } -fn default_2230() -> Option { +fn default_2232() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2231() -> Option { +fn default_2233() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2232() -> bool { +fn default_2234() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2233() -> Vec { +fn default_2235() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2234() -> Integer { +fn default_2236() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2235() -> ProcedureEvolveOutputGate { +fn default_2237() -> ProcedureEvolveOutputGate { serde_json::from_str("\"none\"").expect("schema default") } -fn default_2236() -> String { +fn default_2238() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2237() -> f64 { +fn default_2239() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2238() -> std::collections::HashMap { +fn default_2240() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2239() -> std::collections::HashMap { +fn default_2241() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2240() -> std::collections::HashMap { +fn default_2242() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2241() -> std::collections::HashMap { +fn default_2243() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2242() -> String { +fn default_2244() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2243() -> Vec { +fn default_2245() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2244() -> Vec { +fn default_2246() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2245() -> Vec { +fn default_2247() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2246() -> std::collections::HashMap { +fn default_2248() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2247() -> Integer { +fn default_2249() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2248() -> bool { +fn default_2250() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2249() -> std::collections::HashMap { +fn default_2251() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2250() -> Vec { +fn default_2252() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2251() -> std::collections::HashMap { +fn default_2253() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2252() -> String { +fn default_2254() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2253() -> ProcedureLocateOutputStatus { +fn default_2255() -> ProcedureLocateOutputStatus { serde_json::from_str("\"authored\"").expect("schema default") } -fn default_2254() -> Option> { +fn default_2256() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_2255() -> Vec>> { +fn default_2257() -> Vec>> { serde_json::from_str("[]").expect("schema default") } -fn default_2256() -> Vec { +fn default_2258() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2257() -> Vec { +fn default_2259() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2258() -> std::collections::HashMap { +fn default_2260() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2259() -> bool { +fn default_2261() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2260() -> Vec { +fn default_2262() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2261() -> Vec> { +fn default_2263() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2262() -> String { +fn default_2264() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2263() -> std::collections::HashMap { +fn default_2265() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2264() -> std::collections::HashMap { +fn default_2266() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2265() -> Vec { +fn default_2267() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2266() -> std::collections::HashMap { +fn default_2268() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2267() -> Option> { +fn default_2269() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_2268() -> bool { +fn default_2270() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2269() -> std::collections::HashMap { +fn default_2271() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2270() -> ProcedureMatchStatus { +fn default_2272() -> ProcedureMatchStatus { serde_json::from_str("\"authored\"").expect("schema default") } -fn default_2271() -> Option> { +fn default_2273() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_2272() -> Vec { +fn default_2274() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2273() -> Integer { +fn default_2275() -> Integer { serde_json::from_str("1").expect("schema default") } -fn default_2274() -> Vec> { +fn default_2276() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2275() -> f64 { +fn default_2277() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2276() -> f64 { +fn default_2278() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2277() -> f64 { +fn default_2279() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2278() -> Option { +fn default_2280() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2279() -> std::collections::HashMap { +fn default_2281() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2280() -> std::collections::HashMap> { +fn default_2282() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_2281() -> String { +fn default_2283() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2282() -> Integer { +fn default_2284() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2283() -> String { +fn default_2285() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2284() -> f64 { +fn default_2286() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2285() -> Vec { +fn default_2287() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2286() -> ProcedureReviseOutputOutcome { +fn default_2288() -> ProcedureReviseOutputOutcome { serde_json::from_str("\"opened\"").expect("schema default") } -fn default_2287() -> Vec { +fn default_2289() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2288() -> Vec { +fn default_2290() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2289() -> String { +fn default_2291() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2290() -> String { +fn default_2292() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2291() -> String { +fn default_2293() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2292() -> String { +fn default_2294() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2293() -> Option { +fn default_2295() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2294() -> Integer { +fn default_2296() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2295() -> Vec { +fn default_2297() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2296() -> std::collections::HashMap { +fn default_2298() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2297() -> Option { +fn default_2299() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2298() -> String { +fn default_2300() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2299() -> Integer { +fn default_2301() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2300() -> String { +fn default_2302() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2301() -> String { +fn default_2303() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2302() -> std::collections::HashMap { +fn default_2304() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2303() -> String { +fn default_2305() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2304() -> String { +fn default_2306() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2305() -> Option { +fn default_2307() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2306() -> RunBeginOutputStatus { +fn default_2308() -> RunBeginOutputStatus { serde_json::from_str("\"active\"").expect("schema default") } -fn default_2307() -> String { +fn default_2309() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2308() -> Integer { +fn default_2310() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2309() -> Integer { +fn default_2311() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2310() -> Integer { +fn default_2312() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2311() -> Vec { +fn default_2313() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2312() -> Integer { +fn default_2314() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_2313() -> Integer { +fn default_2315() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2314() -> Integer { +fn default_2316() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2315() -> String { +fn default_2317() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2316() -> String { +fn default_2318() -> String { serde_json::from_str("\"keep\"").expect("schema default") } -fn default_2317() -> Integer { +fn default_2319() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2318() -> Integer { +fn default_2320() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2319() -> Integer { +fn default_2321() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2320() -> Option { +fn default_2322() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2321() -> Integer { +fn default_2323() -> Integer { serde_json::from_str("-1").expect("schema default") } -fn default_2322() -> Vec { +fn default_2324() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2323() -> Vec { +fn default_2325() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2324() -> Integer { +fn default_2326() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2325() -> Integer { +fn default_2327() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2326() -> Integer { +fn default_2328() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2327() -> f64 { +fn default_2329() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2328() -> Integer { +fn default_2330() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2329() -> Vec { +fn default_2331() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2330() -> Integer { +fn default_2332() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2331() -> Vec { +fn default_2333() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2332() -> Integer { +fn default_2334() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2333() -> Integer { +fn default_2335() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2334() -> Integer { +fn default_2336() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2335() -> Vec { +fn default_2337() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2336() -> Option { +fn default_2338() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2337() -> Option> { +fn default_2339() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_2338() -> LiveSearchResultsLive { +fn default_2340() -> LiveSearchResultsLive { serde_json::from_str("true").expect("schema default") } -fn default_2339() -> String { +fn default_2341() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2340() -> LiveSearchHitLive { +fn default_2342() -> LiveSearchHitLive { serde_json::from_str("true").expect("schema default") } -fn default_2341() -> Vec { +fn default_2343() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2342() -> Option { +fn default_2344() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2343() -> std::collections::HashMap { +fn default_2345() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2344() -> std::collections::HashMap { +fn default_2346() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2345() -> std::collections::HashMap { +fn default_2347() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2346() -> std::collections::HashMap { +fn default_2348() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2347() -> Option> { +fn default_2349() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_2348() -> Vec { +fn default_2350() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2349() -> Integer { - serde_json::from_str("0").expect("schema default") -} -fn default_2350() -> String { - serde_json::from_str("\"\"").expect("schema default") -} fn default_2351() -> Integer { serde_json::from_str("0").expect("schema default") } fn default_2352() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2353() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_2353() -> Integer { + serde_json::from_str("0").expect("schema default") } fn default_2354() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -67848,62 +67874,62 @@ fn default_2358() -> String { fn default_2359() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2360() -> Vec { - serde_json::from_str("[]").expect("schema default") +fn default_2360() -> String { + serde_json::from_str("\"\"").expect("schema default") } fn default_2361() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2362() -> String { +fn default_2362() -> Vec { + serde_json::from_str("[]").expect("schema default") +} +fn default_2363() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_2364() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2363() -> Vec { +fn default_2365() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2364() -> String { +fn default_2366() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2365() -> String { +fn default_2367() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2366() -> Vec { +fn default_2368() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2367() -> Vec { +fn default_2369() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2368() -> Vec { +fn default_2370() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2369() -> String { +fn default_2371() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2370() -> String { +fn default_2372() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2371() -> Vec { +fn default_2373() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2372() -> Vec { +fn default_2374() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2373() -> Vec { +fn default_2375() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2374() -> String { - serde_json::from_str("\"\"").expect("schema default") -} -fn default_2375() -> String { +fn default_2376() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2376() -> Option { - serde_json::from_str("null").expect("schema default") -} fn default_2377() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2378() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_2378() -> Option { + serde_json::from_str("null").expect("schema default") } fn default_2379() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -67917,17 +67943,17 @@ fn default_2381() -> String { fn default_2382() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2383() -> Vec { - serde_json::from_str("[]").expect("schema default") +fn default_2383() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_2384() -> Option { - serde_json::from_str("null").expect("schema default") +fn default_2384() -> String { + serde_json::from_str("\"\"").expect("schema default") } -fn default_2385() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_2385() -> Vec { + serde_json::from_str("[]").expect("schema default") } -fn default_2386() -> Integer { - serde_json::from_str("0").expect("schema default") +fn default_2386() -> Option { + serde_json::from_str("null").expect("schema default") } fn default_2387() -> Integer { serde_json::from_str("0").expect("schema default") @@ -67938,14 +67964,14 @@ fn default_2388() -> Integer { fn default_2389() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2390() -> bool { - serde_json::from_str("false").expect("schema default") +fn default_2390() -> Integer { + serde_json::from_str("0").expect("schema default") } -fn default_2391() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_2391() -> Integer { + serde_json::from_str("0").expect("schema default") } -fn default_2392() -> String { - serde_json::from_str("\"\"").expect("schema default") +fn default_2392() -> bool { + serde_json::from_str("false").expect("schema default") } fn default_2393() -> String { serde_json::from_str("\"\"").expect("schema default") @@ -67962,537 +67988,543 @@ fn default_2396() -> String { fn default_2397() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2398() -> Option { +fn default_2398() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_2399() -> String { + serde_json::from_str("\"\"").expect("schema default") +} +fn default_2400() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2399() -> Integer { +fn default_2401() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2400() -> Integer { +fn default_2402() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2401() -> Vec { +fn default_2403() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2402() -> String { +fn default_2404() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2403() -> String { +fn default_2405() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2404() -> String { +fn default_2406() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2405() -> String { +fn default_2407() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2406() -> Integer { +fn default_2408() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2407() -> Integer { +fn default_2409() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2408() -> Integer { +fn default_2410() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2409() -> Integer { +fn default_2411() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2410() -> Integer { +fn default_2412() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2411() -> f64 { +fn default_2413() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2412() -> Integer { +fn default_2414() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2413() -> Integer { +fn default_2415() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2414() -> Integer { +fn default_2416() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2415() -> String { +fn default_2417() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2416() -> SessionBriefStats { +fn default_2418() -> SessionBriefStats { serde_json::from_str("{\"events_in\":0,\"windows\":0,\"events_total\":0,\"source_chars\":0,\"brief_chars\":0,\"compression_ratio\":0.0,\"dropped_ungrounded\":0,\"tokens_in\":0,\"tokens_out\":0,\"llm_model\":\"\"}").expect("schema default") } -fn default_2417() -> String { +fn default_2419() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2418() -> String { +fn default_2420() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2419() -> Option { +fn default_2421() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2420() -> Option { +fn default_2422() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2421() -> Option { +fn default_2423() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2422() -> Integer { +fn default_2424() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2423() -> std::collections::HashMap { +fn default_2425() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2424() -> String { +fn default_2426() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2425() -> String { +fn default_2427() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2426() -> Option { +fn default_2428() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2427() -> String { +fn default_2429() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2428() -> Integer { +fn default_2430() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2429() -> Integer { +fn default_2431() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2430() -> Option { +fn default_2432() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2431() -> std::collections::HashMap { +fn default_2433() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2432() -> String { +fn default_2434() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2433() -> Integer { +fn default_2435() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2434() -> String { +fn default_2436() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2435() -> Option { +fn default_2437() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2436() -> String { +fn default_2438() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2437() -> Option { +fn default_2439() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2438() -> String { +fn default_2440() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2439() -> String { +fn default_2441() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2440() -> String { +fn default_2442() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2441() -> String { +fn default_2443() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2442() -> Integer { +fn default_2444() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2443() -> Integer { +fn default_2445() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2444() -> String { +fn default_2446() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2445() -> std::collections::HashMap { +fn default_2447() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2446() -> String { +fn default_2448() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2447() -> String { +fn default_2449() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2448() -> bool { +fn default_2450() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2449() -> String { +fn default_2451() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2450() -> std::collections::HashMap { +fn default_2452() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2451() -> Vec> { +fn default_2453() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2452() -> Vec { +fn default_2454() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2453() -> Vec { +fn default_2455() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2454() -> bool { +fn default_2456() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2455() -> String { +fn default_2457() -> String { serde_json::from_str("\"unknown\"").expect("schema default") } -fn default_2456() -> String { +fn default_2458() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2457() -> Vec { +fn default_2459() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2458() -> bool { +fn default_2460() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2459() -> String { +fn default_2461() -> String { serde_json::from_str("\"none\"").expect("schema default") } -fn default_2460() -> bool { +fn default_2462() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2461() -> Vec { +fn default_2463() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2462() -> std::collections::HashMap { +fn default_2464() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2463() -> Vec> { +fn default_2465() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2464() -> bool { +fn default_2466() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2465() -> bool { +fn default_2467() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2466() -> Vec> { +fn default_2468() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2467() -> std::collections::HashMap { +fn default_2469() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2468() -> String { +fn default_2470() -> String { serde_json::from_str("\"none\"").expect("schema default") } -fn default_2469() -> Vec> { +fn default_2471() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2470() -> bool { +fn default_2472() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2471() -> String { +fn default_2473() -> String { serde_json::from_str("\"calibrated\"").expect("schema default") } -fn default_2472() -> std::collections::HashMap { +fn default_2474() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2473() -> std::collections::HashMap { +fn default_2475() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2474() -> String { +fn default_2476() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2475() -> std::collections::HashMap { +fn default_2477() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2476() -> std::collections::HashMap { +fn default_2478() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2477() -> std::collections::HashMap { +fn default_2479() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2478() -> String { +fn default_2480() -> String { serde_json::from_str("\"ok\"").expect("schema default") } -fn default_2479() -> String { +fn default_2481() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2480() -> String { +fn default_2482() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2481() -> bool { +fn default_2483() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2482() -> Integer { +fn default_2484() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2483() -> String { +fn default_2485() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2484() -> String { +fn default_2486() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2485() -> Vec { +fn default_2487() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2486() -> bool { +fn default_2488() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2487() -> Vec { +fn default_2489() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2488() -> std::collections::HashMap> { +fn default_2490() -> std::collections::HashMap> { serde_json::from_str("{}").expect("schema default") } -fn default_2489() -> Vec> { +fn default_2491() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2490() -> Vec> { +fn default_2492() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2491() -> String { +fn default_2493() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2492() -> Vec> { +fn default_2494() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2493() -> std::collections::HashMap { +fn default_2495() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2494() -> String { +fn default_2496() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2495() -> Vec> { +fn default_2497() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2496() -> bool { +fn default_2498() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2497() -> Integer { +fn default_2499() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2498() -> Vec> { +fn default_2500() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2499() -> String { +fn default_2501() -> String { serde_json::from_str("\"no_flaky_signal\"").expect("schema default") } -fn default_2500() -> bool { +fn default_2502() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2501() -> Option> { +fn default_2503() -> Option> { serde_json::from_str("null").expect("schema default") } -fn default_2502() -> Vec { +fn default_2504() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2503() -> bool { +fn default_2505() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2504() -> std::collections::HashMap { +fn default_2506() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2505() -> String { +fn default_2507() -> String { serde_json::from_str("\"not_computed\"").expect("schema default") } -fn default_2506() -> Vec> { +fn default_2508() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2507() -> String { +fn default_2509() -> String { serde_json::from_str("\"candidate\"").expect("schema default") } -fn default_2508() -> std::collections::HashMap { +fn default_2510() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2509() -> String { +fn default_2511() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2510() -> bool { +fn default_2512() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2511() -> Integer { +fn default_2513() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2512() -> std::collections::HashMap { +fn default_2514() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2513() -> bool { +fn default_2515() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2514() -> Vec> { +fn default_2516() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2515() -> std::collections::HashMap { +fn default_2517() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2516() -> std::collections::HashMap { +fn default_2518() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2517() -> String { +fn default_2519() -> String { serde_json::from_str("\"lower_bound\"").expect("schema default") } -fn default_2518() -> bool { +fn default_2520() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2519() -> Vec { +fn default_2521() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2520() -> Vec> { +fn default_2522() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2521() -> std::collections::HashMap { +fn default_2523() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2522() -> Vec { +fn default_2524() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2523() -> String { +fn default_2525() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2524() -> bool { +fn default_2526() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2525() -> bool { +fn default_2527() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_2526() -> std::collections::HashMap { +fn default_2528() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2527() -> String { +fn default_2529() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2528() -> bool { +fn default_2530() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_2529() -> std::collections::HashMap { +fn default_2531() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2530() -> std::collections::HashMap { +fn default_2532() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2531() -> Vec> { +fn default_2533() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2532() -> Vec { +fn default_2534() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2533() -> std::collections::HashMap { +fn default_2535() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2534() -> Vec> { +fn default_2536() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2535() -> bool { +fn default_2537() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_2536() -> bool { +fn default_2538() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2537() -> Vec { +fn default_2539() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2538() -> std::collections::HashMap { +fn default_2540() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2539() -> String { +fn default_2541() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2540() -> std::collections::HashMap { +fn default_2542() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2541() -> bool { +fn default_2543() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2542() -> bool { +fn default_2544() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_2543() -> String { +fn default_2545() -> String { serde_json::from_str("\"no_signal\"").expect("schema default") } -fn default_2544() -> Vec { +fn default_2546() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2545() -> f64 { +fn default_2547() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2546() -> Integer { +fn default_2548() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2547() -> String { +fn default_2549() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2548() -> std::collections::HashMap { +fn default_2550() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2549() -> std::collections::HashMap { +fn default_2551() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2550() -> std::collections::HashMap { +fn default_2552() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2551() -> std::collections::HashMap { +fn default_2553() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2552() -> String { +fn default_2554() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2553() -> std::collections::HashMap { +fn default_2555() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2554() -> bool { +fn default_2556() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2555() -> std::collections::HashMap { +fn default_2557() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2556() -> std::collections::HashMap { +fn default_2558() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2557() -> std::collections::HashMap { +fn default_2559() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2558() -> std::collections::HashMap { +fn default_2560() -> std::collections::HashMap { serde_json::from_str("{}").expect("schema default") } -fn default_2559() -> String { +fn default_2561() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2560() -> Vec> { +fn default_2562() -> Vec> { serde_json::from_str("[]").expect("schema default") } -fn default_2561() -> Integer { +fn default_2563() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2562() -> String { +fn default_2564() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2563() -> bool { +fn default_2565() -> bool { serde_json::from_str("true").expect("schema default") } -fn default_2564() -> String { +fn default_2566() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2565() -> Vec { +fn default_2567() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2566() -> bool { +fn default_2568() -> bool { serde_json::from_str("false").expect("schema default") } -fn default_2567() -> Vec { +fn default_2569() -> Vec { serde_json::from_str("[]").expect("schema default") } -fn default_2568() -> f64 { +fn default_2570() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2569() -> String { +fn default_2571() -> String { serde_json::from_str("\"\"").expect("schema default") } -fn default_2570() -> Integer { +fn default_2572() -> Integer { serde_json::from_str("4096").expect("schema default") } -fn default_2571() -> Integer { +fn default_2573() -> Integer { serde_json::from_str("0").expect("schema default") } -fn default_2572() -> Option { +fn default_2574() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2573() -> f64 { +fn default_2575() -> f64 { serde_json::from_str("0.0").expect("schema default") } -fn default_2574() -> Option { +fn default_2576() -> Option { serde_json::from_str("null").expect("schema default") } -fn default_2575() -> Vec { +fn default_2577() -> Vec { serde_json::from_str("[]").expect("schema default") } diff --git a/sdk/rust/tests/registry_contracts.rs b/sdk/rust/tests/registry_contracts.rs index fea0abf1bf0..7356c1e071c 100644 --- a/sdk/rust/tests/registry_contracts.rs +++ b/sdk/rust/tests/registry_contracts.rs @@ -8708,6 +8708,11 @@ fn code_symbol() { serde_json::from_str("{\"definitions\":[]}").unwrap(); let encoded = serde_json::to_value(value).unwrap(); assert!(encoded.is_object()); + assert_eq!( + encoded["lead"], + serde_json::from_str::("[]").unwrap(), + "code.symbol:lead" + ); assert_eq!( encoded["lessons_left_out"], serde_json::from_str::("0").unwrap(), @@ -8818,6 +8823,11 @@ fn code_edit_context() { serde_json::from_str("{\"definitions\":[]}").unwrap(); let encoded = serde_json::to_value(value).unwrap(); assert!(encoded.is_object()); + assert_eq!( + encoded["lead"], + serde_json::from_str::("[]").unwrap(), + "code.edit_context:lead" + ); assert_eq!( encoded["lessons_left_out"], serde_json::from_str::("0").unwrap(), @@ -10412,6 +10422,11 @@ fn code_grep() { serde_json::from_str::("0").unwrap(), "code.grep:lessons_left_out" ); + assert_eq!( + encoded["lead"], + serde_json::from_str::("[]").unwrap(), + "code.grep:lead" + ); assert_eq!( encoded["related"], serde_json::from_str::("null").unwrap(), diff --git a/sdk/typescript/src/generated/ops.ts b/sdk/typescript/src/generated/ops.ts index af2789778bc..68bd54989a5 100644 --- a/sdk/typescript/src/generated/ops.ts +++ b/sdk/typescript/src/generated/ops.ts @@ -843,6 +843,7 @@ export interface CodeEditReadSite { } export interface CodeSymbolOutput { + lead?: Array>; definitions: CodeUnit[]; lessons_left_out?: number; ambiguous?: boolean; @@ -1019,6 +1020,8 @@ export interface CodeGrepInput { neighbours?: boolean | null; neighbour_k?: number; deadline_ms?: number | null; + /** Lead with callers through overrides, test coverage and changing PRs of up to three enclosing definitions; default true. */ + lead?: boolean; } export interface RelatedGrepEvidence { @@ -1044,6 +1047,7 @@ export interface GrepDependency { export interface CodeGrepOutput { lessons?: Array>; lessons_left_out?: number; + lead?: Array>; matches: Array>; related?: RelatedGrepEvidence | null; contexts?: Array>; @@ -1879,6 +1883,8 @@ export interface CodeSymbolInput { presence?: boolean; neighbours?: boolean | null; neighbour_k?: number; + /** Lead with callers through overrides, test coverage and changing PRs of up to three definitions; default true. */ + lead?: boolean; } export interface CodeSymbolHistoryInput { diff --git a/server/code/api/models_common.py b/server/code/api/models_common.py index a8df7dbab87..c0b126ef2b1 100644 --- a/server/code/api/models_common.py +++ b/server/code/api/models_common.py @@ -181,6 +181,13 @@ def _drop_empty_presence_keys(data: dict[str, Any]) -> dict[str, Any]: return data +def _lead_first(data: dict[str, Any]) -> dict[str, Any]: + """The `lead` block first on the wire when it holds an entry, off it otherwise: an + agent reads the answers a text search cannot give before the source.""" + lead = data.pop("lead", None) + return {"lead": lead, **data} if lead else data + + def _drop_unfired_symbol_blocks(data: dict[str, Any]) -> dict[str, Any]: """The neighbours block and the citing documents ride only when they fired, so a plain lookup's payload carries neither.""" diff --git a/server/code/api/models_grep.py b/server/code/api/models_grep.py index 14b01e83b42..3ccf7f071f3 100644 --- a/server/code/api/models_grep.py +++ b/server/code/api/models_grep.py @@ -21,6 +21,7 @@ _drop_empty_lessons, _drop_empty_presence_keys, _drop_unfired_symbol_blocks, + _lead_first, _lead_namespaces, _LessonsOut, _ResultLessons, @@ -165,6 +166,12 @@ class CodeGrepInput(_CodeIdentity, _ResultLessons): # The scan stops at what is left and returns the hits it read so far, with `partial: # true` and `partial_reason`, instead of timing out. None or 0 = no budget. deadline_ms: int | None = Field(default=None, ge=0, le=60000) + lead: bool = Field( + default=True, + description="Lead with callers through overrides, test coverage and changing PRs " + "of up to three enclosing definitions; default true.", + json_schema_extra=MCP_HIDDEN, + ) @field_validator("namespaces") @classmethod @@ -257,8 +264,13 @@ def _drop_unfired_mode_fields(self, handler: SerializerFunctionWrapHandler) -> d data.pop(k, None) if data.get("related") is None: data.pop("related", None) - return _drop_empty_lessons(data) + return _lead_first(_drop_empty_lessons(data)) + # First on the wire when `lead` read it: the block code.symbol leads with, for the + # first three distinct `definitions` of a first page outside test files. Absent on a + # continuation page, with `include_body` false or `lead` false, and outside matches + # mode. + lead: list[dict[str, Any]] = Field(default_factory=list) # {path, line, text, scope, scope_start_line, scope_end_line} per matching # LINE, path/line ordered except when prioritize_patterns gives different literals # first-page slots. scope_* is the span of the enclosing unit named diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index 6fca2c5c199..460ce7caffd 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -25,6 +25,7 @@ _drop_unset_overlay, _drop_unset_resolved_by, _drop_unset_symbol_context, + _lead_first, _lead_namespaces, _LessonsOut, _PrPostImage, @@ -173,6 +174,12 @@ class CodeSymbolInput(_CodeIdentity): # How many callers, callees, tests and citing documents (each) the `neighbours` # block lists per definition. neighbour_k: int = Field(default=5, ge=1, le=20) + lead: bool = Field( + default=True, + description="Lead with callers through overrides, test coverage and changing PRs " + "of up to three definitions; default true.", + json_schema_extra=MCP_HIDDEN, + ) @field_validator("namespaces") @classmethod @@ -246,8 +253,19 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s data.pop("edit_targets", None) if not data.get("read_sources"): data.pop("read_sources", None) - return data - + return _lead_first(data) + + # First on the wire when `lead` read it: per definition (the first three distinct + # ones outside test files), what a text search cannot answer. {symbol, path, line, + # callers, tested, changed_by}: `callers` {count, files, through_overrides, dispatch, + # top: [{path, line, caller, via_override, via}] (<= 3), truncated, epistemic} is + # code.callers one hop across virtual dispatch; `tested` {verdict, tests, + # strongest_tier, measured: executed | unexecuted, top: [{test_path, tier}]} is + # code.coverage_claim; `changed_by` {prs, level: function | file, fixes, reverts, top: + # [{pr_number, title, merged_at, touches_symbol, is_fix, is_revert}]} is + # code.symbol_history. A leg that did not answer is {unread: deadline | failed | + # ambiguous | unresolved}. Absent when `lead` is false or no definition qualifies. + lead: list[dict[str, Any]] = Field(default_factory=list) # Up to 10 name matches, or the members matched by file clues, fitted to # `token_budget`. Empty when only candidates or presence were found. definitions: list[CodeUnit] diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 76f4cd3237c..03fc5254d8f 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -7,6 +7,7 @@ import hashlib import json import logging +import math import re import time from collections import defaultdict @@ -59,6 +60,7 @@ from server.code.domain.index.grep_plan import ascii_lower from server.code.domain.search_scope import SearchScope from server.code.domain.symbol_body import retained_source_lines +from server.code.domain.units import estimate_json_tokens from server.code.store.index import CodeRepo from server.core.caller_regex import compile_caller_regex from server.core.ch import caller_shaped, class_timeout_s @@ -635,6 +637,7 @@ async def _grep_lines( match_commits=scan.match_commits, scope=scope, ) + lead = await _grep_lead(org, ns, input, bodies, started, page_budget, offset, related_pattern) # one entry per matched FILE (ids and paths alike — grep has no unit ids, # so the outcome fold skips this op; the paths still feed opened_file) returned = matches + (extra_related.matches if extra_related is not None else []) @@ -659,7 +662,8 @@ async def _grep_lines( + _context_tokens(context) + related_chars // 4 + neighbour_tokens - + definitions_tokens(bodies), + + definitions_tokens(bodies) + + estimate_json_tokens(lead), abstain=not returned, retrieval_risk=risk, embedding_model="", @@ -696,6 +700,7 @@ async def _grep_lines( "a pattern list, code.symbol for a known name, or code.search for behavior." ) output = CodeGrepOutput( + lead=lead, matches=[] if related_pattern else matches, related=related, next_cursor=next_cursor, @@ -716,6 +721,36 @@ async def _grep_lines( return output +async def _grep_lead( + org: str, + ns: str, + input: CodeGrepInput, + bodies: dict[str, Any], + started: float, + budget: code_deadline.Budget | None, + offset: int, + related_pattern: str, +) -> list[dict[str, Any]]: + """The `lead` block (`server.code.app.lead`) of a first page's enclosing definitions, + read once the page's other reads are done, within what the op's `lead` budget and the + caller's `deadline_ms` leave. [] on a continuation page (`offset`), a related answer + (`related_pattern`), a page without bodies, or `lead: false`.""" + definitions = bodies.get("definitions") or [] + if not (input.lead and definitions) or offset or related_pattern: + return [] + from server.code.app import lead as code_lead + from server.observability.budget_shape import note_budget_shape + + cap_s = budget.left_ms() / 1000.0 if budget is not None else math.inf + with code_span("grep.lead", results=len(definitions)): + lead = await code_lead.definition_leads( + "code.grep", org, ns, input, definitions, started=started, cap_s=cap_s + ) + if lead: + note_budget_shape(code_lead.LEAD_SHAPE) + return lead + + def _label_related( pattern: str, matches: list[dict[str, Any]], diff --git a/server/code/app/lead.py b/server/code/app/lead.py new file mode 100644 index 00000000000..1eda58ff830 --- /dev/null +++ b/server/code/app/lead.py @@ -0,0 +1,298 @@ +"""The `lead` block of code.symbol and code.grep: for the first definitions an answer +resolves, the three answers a text search cannot give, read beside the answer so an agent +does not have to think of a second call. + +- `callers`: code.callers one hop, which walks virtual dispatch (an override's callers + bind to its base declaration; a base's overrides join the walk, tagged `via_override`). +- `tested`: code.coverage_claim, the test evidence classes and what an imported coverage + run measured of the definition. +- `changed_by`: code.symbol_history, the merged PRs that touched the definition, function + level where the bound tracker answers and file level otherwise. + +Each leg is its op's own handler, called in-process as the consumer `_lead` +(`symbol_lead`, `grep_lead`), so the numbers are the ones the op gives and its trace row +is attributable. Every leg of every definition runs at once under one wall: what the op's +latency budget for its `lead` shape leaves after the time already spent, less a reserve +for the rest of the answer. A leg still running at the wall is cancelled and says +`unread: deadline`; one that raised says `unread: failed`; both are noted on the request's +degradations. The block is small by construction: per leg a few counts and at most +`LEAD_ROWS` rows, each with a path. +""" + +from __future__ import annotations + +import asyncio +import logging +import math +import time +from collections.abc import Awaitable, Callable +from typing import Any + +from server.code.app.spans import code_span +from server.code.app.symbol.neighbours import is_doc_path +from server.code.domain.index.test_gate import is_test_path +from server.core import request_work +from server.core.errors import NotFoundError +from server.observability import degradations +from server.observability.budgets import effective_budget_ms +from server.settings.catalog import OP_SHAPE_BUDGETS_P99_MS + +logger = logging.getLogger(__name__) + +# The budget shape a request that served the block is priced by (OP_SHAPE_BUDGETS_P99_MS). +LEAD_SHAPE = "lead" +# Definitions the block covers: the first distinct ones of the answer. +LEAD_DEFINITIONS = 3 +# Rows per leg: where to look first; the counts carry the totals. +LEAD_ROWS = 3 +# Callers one hop reads before it says `truncated` (code.callers' `max_nodes`). +_CALLER_NODES = 50 +# PR rows the history leg reads to pick `LEAD_ROWS` that touch the definition. +_HISTORY_ROWS = 10 +_TITLE_CHARS = 80 +# Left of the budget for the answer after the wall: the trims, serialization and, for +# code.grep, the lessons read that runs after the handler. +_RESERVE_S = 0.1 +# Kinds a caller, a test or a PR can reach. Variables, fields, macros and document +# sections are left out, as are definitions in test files and documents. +LEAD_KINDS = frozenset( + { + "function", + "method", + "constructor", + "fixture", + "class", + "struct", + "interface", + "trait", + "enum", + "union", + "type", + } +) + +Leg = Callable[[dict[str, Any], dict[str, Any]], Awaitable[dict[str, Any]]] + + +def lead_definitions(rows: list[dict[str, Any]]) -> list[dict[str, Any]]: + """The first `LEAD_DEFINITIONS` distinct qualified names of `rows` (resolved symbol rows + or a grep page's enclosing definitions) that a caller, a test or a PR can reach.""" + out: list[dict[str, Any]] = [] + seen: set[str] = set() + for r in rows: + name = str(r.get("qualified_name") or "") + path = str(r.get("path") or "") + kind = str(r.get("kind") or "function") + if not name or name in seen or kind not in LEAD_KINDS: + continue + if is_test_path(path) or is_doc_path(path): + continue + seen.add(name) + out.append({"symbol": name, "path": path, "line": int(r.get("start_line") or 0)}) + if len(out) >= LEAD_DEFINITIONS: + break + return out + + +def wall_s(op_name: str, started: float) -> float: + """Seconds the legs may run: the op's effective budget for the `lead` shape (runtime and + per-consumer overrides and the deployment multiplier applied) less the time the request + has spent and the reserve. `started` is the handler's monotonic start, the clock when no + transport bound the request.""" + declared = OP_SHAPE_BUDGETS_P99_MS[op_name][LEAD_SHAPE] + budget_s = effective_budget_ms(op_name, declared) / 1000.0 + spent = max(request_work.age_s(), time.monotonic() - started) + return max(0.0, budget_s - spent - _RESERVE_S) + + +def callers_entry(out: Any) -> dict[str, Any]: + """The compact callers answer from a code.callers output: call sites, their files, the + ones reached through an override and the dispatch seeds walked, then the first sites, + those reached through dispatch first and registrations last.""" + if out.ambiguous: + return {"unread": "ambiguous"} + edges = list(out.edges) + through = [e for e in edges if e.via_override] + ordered = sorted(edges, key=lambda e: (not e.via_override, e.via == "registration")) + entry: dict[str, Any] = {"count": len(edges), "files": len({e.path for e in edges})} + if through: + entry["through_overrides"] = len(through) + if out.dispatch_seeds: + entry["dispatch"] = [str(s.get("symbol") or "") for s in out.dispatch_seeds[:LEAD_ROWS]] + entry["top"] = [_edge_row(e) for e in ordered[:LEAD_ROWS]] + if out.truncated: + entry["truncated"] = True + entry["epistemic"] = out.epistemic + return entry + + +def _edge_row(e: Any) -> dict[str, Any]: + row: dict[str, Any] = {"path": e.path, "line": e.line, "caller": e.from_symbol} + if e.via_override: + row["via_override"] = e.via_override + if e.via: + row["via"] = e.via + return row + + +def measured_state(measured: dict[str, Any]) -> str: + """`executed` when a verified coverage run executed the definition's lines; `unexecuted` + when a verified run at the index head measured its file and executed none of them (the + rule code.coverage_claim's `uncovered` reads); '' with no such run.""" + if measured.get("executed"): + return "executed" + if ( + measured.get("measured") + and measured.get("run_current") + and measured.get("freshness") == "verified" + ): + return "unexecuted" + return "" + + +def tested_entry(out: Any) -> dict[str, Any]: + """The compact coverage answer from a code.coverage_claim output.""" + entry: dict[str, Any] = {"verdict": out.verdict, "tests": out.tests_total} + if out.strongest_tier: + entry["strongest_tier"] = out.strongest_tier + if state := measured_state(out.measured): + entry["measured"] = state + entry["top"] = [ + {"test_path": str(t.get("test_path") or ""), "tier": str(t.get("tier") or "")} + for t in out.tests[:LEAD_ROWS] + ] + return entry + + +def changed_entry(out: Any) -> dict[str, Any]: + """The compact history answer from a code.symbol_history output: the PRs that touched + the definition (`level: function` when the tracker read the diffs, `file` otherwise), + fixes and reverts among them, and the newest PRs, those that name it first. A PR whose + diff the tracker read and found not naming the definition is left out.""" + if out.ambiguous: + return {"unread": "ambiguous"} + if "symbol_unresolved" in out.causes: + return {"unread": "unresolved"} + summary = out.summary + rows = [p for p in out.prs if p.get("touches_symbol") != "false"] + rows.sort(key=lambda p: p.get("touches_symbol") not in ("true", "named")) + level = "function" if out.tracker_namespace and not out.tracker_unavailable else "file" + entry: dict[str, Any] = {"prs": int(summary.get("prs_total") or 0), "level": level} + for key, field in (("fixes", "fix_prs"), ("reverts", "reverts")): + if n := int(summary.get(field) or 0): + entry[key] = n + entry["top"] = [_pr_row(p) for p in rows[:LEAD_ROWS]] + return entry + + +def _pr_row(p: dict[str, Any]) -> dict[str, Any]: + row: dict[str, Any] = { + "pr_number": int(p.get("pr_number") or 0), + "title": str(p.get("title") or "")[:_TITLE_CHARS], + "merged_at": str(p.get("merged_at") or "")[:10], + } + if p.get("touches_symbol") in ("true", "named"): + row["touches_symbol"] = p["touches_symbol"] + for flag in ("is_fix", "is_revert"): + if p.get(flag): + row[flag] = True + return row + + +async def _callers(base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: + from server.code.api.models_symbol import CodeCallersInput + from server.code.app.symbol import handle_code_callers + + query = CodeCallersInput(**base, name=d["symbol"], depth=1, max_nodes=_CALLER_NODES) + try: + out = await handle_code_callers(query) + except NotFoundError: + return {"unread": "unresolved"} + return callers_entry(out) + + +async def _tested(base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: + from server.code.api.models_testing import CodeCoverageClaimInput + from server.code.app.coverage import handle_code_coverage_claim + + query = CodeCoverageClaimInput(**base, symbol=d["symbol"], limit=LEAD_ROWS) + return tested_entry(await handle_code_coverage_claim(query)) + + +async def _changed_by(base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: + from server.code.api.models_history import CodeSymbolHistoryInput + from server.code.app.symbol_history import handle_code_symbol_history + + query = CodeSymbolHistoryInput(**base, name=d["symbol"], limit=_HISTORY_ROWS) + return changed_entry(await handle_code_symbol_history(query)) + + +# The legs in the order the block lists them. +LEGS: dict[str, Leg] = {"callers": _callers, "tested": _tested, "changed_by": _changed_by} + + +async def _leg(name: str, fn: Leg, base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: + with code_span(f"lead.{name}"): + return await fn(base, d) + + +def _answer(task: asyncio.Future[dict[str, Any]] | None) -> tuple[dict[str, Any], str]: + """(the leg's entry, why it did not answer: '' when it did).""" + if task is None or task.cancelled(): + return {"unread": "deadline"}, "deadline" + error = task.exception() + if error is not None: + logger.info("code lead leg failed", exc_info=error) + return {"unread": "failed"}, type(error).__name__ + return task.result(), "" + + +async def definition_leads( + op_name: str, + org: str, + ns: str, + identity: Any, + rows: list[dict[str, Any]], + *, + started: float, + cap_s: float = math.inf, +) -> list[dict[str, Any]]: + """The block for `rows`: one entry per `lead_definitions` row with each leg's answer. + `identity` carries the request's `agent` and `user_id`; `cap_s` is a caller's own + deadline. Never raises but on cancellation, which cancels every leg.""" + picked = lead_definitions(rows) + if not picked: + return [] + wall = min(wall_s(op_name, started), cap_s) + base = { + "org": org, + "namespace": ns, + "agent": identity.agent, + "user_id": identity.user_id, + "consumer": f"{op_name.removeprefix('code.')}_lead", + } + tasks: dict[tuple[int, str], asyncio.Future[dict[str, Any]]] = {} + if wall > 0: + for i, d in enumerate(picked): + for name, fn in LEGS.items(): + tasks[(i, name)] = asyncio.ensure_future(_leg(name, fn, base, d)) + try: + if tasks: + await asyncio.wait(tasks.values(), timeout=wall) + finally: + for task in tasks.values(): + task.cancel() + if tasks: + await asyncio.gather(*tasks.values(), return_exceptions=True) + unread: dict[str, str] = {} + out: list[dict[str, Any]] = [] + for i, d in enumerate(picked): + entry = dict(d) + for name in LEGS: + entry[name], why = _answer(tasks.get((i, name))) + if why: + unread.setdefault(name, why) + out.append(entry) + for name, why in unread.items(): + degradations.note(op_name, f"lead_{name}_unread", why, health=False) + return out diff --git a/server/code/app/presence.py b/server/code/app/presence.py index 22da3aa6d32..4ec1e26c2e3 100644 --- a/server/code/app/presence.py +++ b/server/code/app/presence.py @@ -65,6 +65,7 @@ def sub_for(ns: str) -> CodeSymbolInput: "include_examples": False, "include_lessons": False, "uses": False, + "lead": False, } ) diff --git a/server/code/app/symbol/edit_target.py b/server/code/app/symbol/edit_target.py index 1de4b63e484..6ebf4a2656c 100644 --- a/server/code/app/symbol/edit_target.py +++ b/server/code/app/symbol/edit_target.py @@ -54,6 +54,7 @@ async def locate_edit_target(input: CodeEditContextInput) -> EditTarget: context_lines=0, related_on_miss=isinstance(pattern, str), include_lessons=False, + lead=False, ), exact_path=path, ) diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index 811992fab0a..952c6796170 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -17,6 +17,7 @@ CodeSymbolInput, CodeSymbolOutput, ) +from server.code.app import lead as code_lead from server.code.app import symbol_uses as _uses_brief from server.code.app.common import ( answer_args, @@ -136,6 +137,7 @@ def sub_for(dep: str) -> CodeSymbolInput: "include_examples": False, "include_lessons": False, "uses": False, + "lead": False, } ) @@ -179,9 +181,24 @@ def __init__( for_edit: bool, matched_members: bool, related_test_names: tuple[str, ...], + started: float, ) -> None: head = rows if matched_members else rows[:MAX_DEFINITIONS] self.hashes = asyncio.ensure_future(_chunk_hashes(repo, org, ns, head)) + # the lead block (callers through overrides, coverage, the PRs that changed it) + # under the `lead` shape's wall; an edit's read leads with its own tests + self.lead = ( + asyncio.ensure_future( + _staged( + "symbol.lead", + code_lead.definition_leads( + "code.symbol", org, ns, input, head, started=started + ), + ) + ) + if input.lead and not for_edit + else None + ) # uses leg: the grep for the name's mentions runs beside the body reads, never # after them; additive, never fatal. self.uses = ( @@ -232,6 +249,7 @@ def __init__( def cancel(self) -> None: for t in ( self.hashes, + self.lead, self.uses, self.brief, self.enrich, @@ -975,6 +993,7 @@ async def handle_code_symbol( for_edit=op_name == "code.edit_context", matched_members=matched_members, related_test_names=related_test_names, + started=started, ) try: with code_span("symbol.bodies", results=len(head)): @@ -1010,6 +1029,7 @@ async def handle_code_symbol( hierarchy = await legs.hierarchy # the neighbours block on the definitions themselves block, block_tokens = await legs.block + lead = await legs.lead if legs.lead is not None else [] uses_leg = legs.uses uses_read = await uses_leg if uses_leg is not None else (None, False, "") except BaseException: @@ -1059,13 +1079,9 @@ async def handle_code_symbol( ) if matched_members: route = "edit_context_members" - # The shape this call served prices its budget and is written on the trace row, so the - # ranked lookup's own p99 is measurable. - - shape = "ranked" if (input.near_paths or input.pr_number) else ("uses_brief" if brief else "") + shape = _served_shape(input, brief, lead) note_budget_shape(shape) - - tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 + tokens += (estimate_json_tokens(hierarchy) if hierarchy else 0) + estimate_json_tokens(lead) trace_run_id = _symbol_trace( input, org, @@ -1102,6 +1118,7 @@ async def handle_code_symbol( consumer=input.consumer, ) return CodeSymbolOutput( + lead=lead, definitions=budgeted, read_sources=read_sources or None, lessons_left_out=lessons_left_out, @@ -1123,6 +1140,17 @@ async def handle_code_symbol( ) +def _served_shape(input: CodeSymbolInput, brief: dict[str, Any], lead: list[Any]) -> str: + """The shape this call served: it prices the request's budget and is written on the + trace row, so each shape's p99 is measurable. A ranked lookup and the compact uses + block keep their own budgets, which cover the lead block they may carry.""" + if input.near_paths or input.pr_number: + return "ranked" + if brief: + return "uses_brief" + return code_lead.LEAD_SHAPE if lead else "" + + def _symbol_trace( input: Any, org: str, diff --git a/server/memory/app/code_grounding.py b/server/memory/app/code_grounding.py index 586c2c317b9..31efa012748 100644 --- a/server/memory/app/code_grounding.py +++ b/server/memory/app/code_grounding.py @@ -230,6 +230,7 @@ async def _symbol(sym: str) -> Any | None: include_history=False, include_examples=False, include_lessons=False, + lead=False, token_budget=settings.memory_ask_code_symbol_token_budget, consumer=GROUNDING_CONSUMER, ) diff --git a/server/memory/app/decision_extract.py b/server/memory/app/decision_extract.py index d62c4741e41..076454d685f 100644 --- a/server/memory/app/decision_extract.py +++ b/server/memory/app/decision_extract.py @@ -1493,6 +1493,7 @@ async def symbol_definitions(org: str, namespace: str, name: str) -> list[tuple[ include_history=False, include_examples=False, include_lessons=False, + lead=False, consumer=EXTRACTOR_AGENT, ) ) diff --git a/server/settings/catalog.py b/server/settings/catalog.py index 545d66d279d..e6b0c47b629 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -6911,8 +6911,14 @@ class TrackerSettings(BaseModel): # Budgets for the request shapes an op prices separately: a handler that notes a # shape (`server.observability.budget_shape`) is held to that shape's budget. OP_SHAPE_BUDGETS_P99_MS: dict[str, dict[str, int]] = { + # "lead" (code.grep and code.symbol): the answer with its `lead` block, whose legs + # (code.callers, code.coverage_claim, code.symbol_history, run together) get what + # the budget leaves after the time spent. Priced as the base plus the 1200 ms of + # code.coverage_claim, the slowest leg without a tracker read, rounded up; a leg + # still running then says `unread: deadline`. "code.grep": { "files": 600, + "lead": 1800, "message": 2000, }, "code.search": { @@ -6923,6 +6929,7 @@ class TrackerSettings(BaseModel): # PR's files and the candidates' neighbourhoods; the compact uses block adds a # mention leg. Each is priced from its served p99. "code.symbol": { + "lead": 1500, "ranked": 3000, "uses_brief": 1500, }, diff --git a/server/transport/mcp_descriptions.py b/server/transport/mcp_descriptions.py index 90c1b730bac..0c5862e734c 100644 --- a/server/transport/mcp_descriptions.py +++ b/server/transport/mcp_descriptions.py @@ -1380,6 +1380,8 @@ def revision_policy(update: str) -> str: "Find indexed text. Batch code and test prefixes in `pattern`. " "Path filters scope the batch. Bodies are on by default. " "Set `include_body: false` for excerpts, `context_lines: 0` for locations. " + "Bodies lead with the callers, tests and changing PRs of up to three definitions " + "(`lead: false` drops them). " "Omitted match text is in its excerpt at the same path and line. " "Use code.search for behavior. " "Use literal strings or one RE2 string with `regex: true`. " @@ -1444,7 +1446,9 @@ def revision_policy(update: str) -> str: "tree. If it abstains, trust it and grep." ), "code.symbol": ( - "Find an exact definition by name or path:line. Get signature, doc comment " + "Find an exact definition by name or path:line. Leads with its callers through " + "overrides, test coverage and the PRs that changed it (`lead: false` drops them). " + "Get signature, doc comment " "and body, with compiler precision where SCIP is available. Includes recent " "PRs, tested usage examples and linked lessons. `example_context_lines` adds " "source around usage sites. " @@ -2179,19 +2183,21 @@ def revision_policy(update: str) -> str: # derived from core text so revision and memory guidance stay consistent. CODING_TOOL_DESCRIPTIONS: dict[str, str] = { "code.symbol": ( - "Inspect a definition by name, path:symbol, or path:line. Includes source and links. " - "For an edit, use code.edit_context. Set `include_examples: false` to omit examples. " - "`uses_brief: true` summarizes callers. Check freshness and source elision." + "Inspect a definition by name, path:symbol, or path:line. Callers via overrides, " + "tests and changing PRs lead, then source and links. " + "For an edit, use code.edit_context. `include_examples: false` omits examples. " + "Check freshness and source elision." ), "code.grep": ( - "Batch exact code and test literals with path_globs. Keep default bodies for edits. " + "Batch exact code and test literals with path_globs. Keep default bodies for edits; " + "they lead with callers, tests and PRs. " "For excerpts, set `include_body: false` and `context_lines`. " - "Omitted match text is in its excerpt at the same path and line. " + "Omitted match text is in its excerpt. " "Use mode=files for paths only and regex=true for RE2.\n\n" "Scope with `path_prefix` or `path_globs`. " "For locations, set `include_body: false`, `context_lines: 0`. " "Use code.search for behavior, code.edit_context for a known definition. " - "Prefixes and misses can return related source and notes. " + "Prefixes and misses can return related source. " "`definitions_partial` flags missing source. Check coverage." ), # The coding tier lists blast radius with the sentences a coding session @@ -2350,8 +2356,8 @@ def coding_search_description(core_text: str) -> str: ), "code.symbol": ( "Exact lookup of a function, class or enum by (qualified) name: definition, " - "signature, doc comment and body, with the PRs that last touched it. Cite the " - "path and span it returns. `uses_brief: true` adds the top call sites." + "signature, doc comment and body, led by its callers, test coverage and the PRs " + "that changed it. Cite the path and span it returns." ), } diff --git a/tests/integration/test_code_plane.py b/tests/integration/test_code_plane.py index de72db3c786..f53960d0bff 100644 --- a/tests/integration/test_code_plane.py +++ b/tests/integration/test_code_plane.py @@ -209,6 +209,7 @@ async def test_grep_returns_distinct_retained_enclosing_bodies_by_default( ch_client, monkeypatch ) -> None: from server.code.api.models_grep import CodeGrepInput + from server.code.app import lead from server.code.app.grep import handle_code_grep from server.code.app.index.repo_registry import read_registry from server.code.store.index import CodeRepo @@ -220,6 +221,8 @@ async def test_grep_returns_distinct_retained_enclosing_bodies_by_default( assert await read_registry(get_client()) org, ns = unique_org("grep-bodies"), "source" monkeypatch.setattr(settings, "code_intel_enabled", True) + # the block's content, not its wall (tests/unit/test_code_lead.py holds the wall) + monkeypatch.setattr(lead, "wall_s", lambda op_name, started: 30.0) await _ingest(CodeRepo(), org, ns) plain = await handle_code_grep( CodeGrepInput(org=org, namespace=ns, pattern="squashImpl", include_body=False) @@ -230,6 +233,14 @@ async def test_grep_returns_distinct_retained_enclosing_bodies_by_default( assert not rich.definitions_partial assert len(rich.definitions) == len({row["symbol_id"] for row in rich.definitions}) == 2 assert all("squashImpl" in row["body"] and not row["body_elided"] for row in rich.definitions) + # the bodies' definitions lead, each with its callers, coverage and history answered + assert not plain.lead + assert [entry["symbol"] for entry in rich.lead] == [ + row["qualified_name"] for row in rich.definitions + ] + impl = next(entry for entry in rich.lead if entry["symbol"] == "DB::Squasher::squashImpl") + assert any(row["caller"] == "DB::Squasher::flush" for row in impl["callers"]["top"]) + assert all("unread" not in entry[leg] for entry in rich.lead for leg in lead.LEGS) nearby = await handle_code_grep( CodeGrepInput( org=org, namespace=ns, pattern="squashImpl", context_lines=1, include_body=False @@ -414,6 +425,7 @@ async def test_scip_ingest_op_roundtrip(code_env, monkeypatch) -> None: async def test_read_ops_and_abstain(code_env, monkeypatch) -> None: from server.code.api.models_search import CodeSearchInput from server.code.api.models_symbol import CodeCallersInput, CodeSymbolInput + from server.code.app import lead from server.code.app.search.handler import handle_code_search from server.code.app.symbol import handle_code_callers, handle_code_symbol from server.code.domain.units import _card_of, estimate_unit_tokens @@ -464,8 +476,16 @@ async def test_read_ops_and_abstain(code_env, monkeypatch) -> None: include_history=False, include_lessons=False, ) + monkeypatch.setattr(lead, "wall_s", lambda op_name, started: 30.0) plain_response = await handle_code_symbol(query) plain = plain_response.definitions[0].examples + # the definition leads with its caller, its coverage and its history + (entry,) = plain_response.lead + assert entry["symbol"] == "DB::Squasher::squashImpl" + assert entry["callers"]["count"] >= 1 + assert any(row["caller"] == "DB::Squasher::flush" for row in entry["callers"]["top"]) + assert "verdict" in entry["tested"] and "prs" in entry["changed_by"] + assert list(plain_response.model_dump())[0] == "lead" examples = await handle_code_symbol(query.model_copy(update={"example_context_lines": 2})) sites = examples.definitions[0].examples assert plain and [{k: v for k, v in site.items() if k != "context"} for site in sites] == plain diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 111b6e2ea8c..58622da1a76 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -489,6 +489,26 @@ async def _none_deleted(*_a: object) -> bool: pipeline._any_deleted = before +@pytest.fixture(autouse=True) +def _no_code_lead(request: pytest.FixtureRequest) -> Iterator[None]: + """code.symbol and code.grep lead with three op reads per definition, each run + in-process through its own handler and repository (`server.code.app.lead`). A unit + fake stands in for one handler's repository, so those reads would reach a ClickHouse + listening on this host: the block is empty unless a test is marked `code_lead`.""" + if request.node.get_closest_marker("code_lead"): + yield + return + from server.code.app import lead + + async def _none(*_a: object, **_k: object) -> list[dict[str, Any]]: + return [] + + original = lead.definition_leads + lead.definition_leads = _none # type: ignore[assignment] + yield + lead.definition_leads = original + + @pytest.fixture(autouse=True) def _no_doctor_tier_read(request: pytest.FixtureRequest) -> Iterator[None]: """`loom doctor` reads the failing code-index tiers from ClickHouse with the server's diff --git a/tests/unit/test_code_grep_scan.py b/tests/unit/test_code_grep_scan.py index 61d6303f241..9d6ea61b486 100644 --- a/tests/unit/test_code_grep_scan.py +++ b/tests/unit/test_code_grep_scan.py @@ -276,12 +276,12 @@ def test_empty_files_answer_is_zero_total() -> None: # ------------------------------------------------------------------ budgets -def test_code_grep_prices_files_and_message() -> None: +def test_code_grep_prices_files_message_and_lead() -> None: from server.operations.registry import OPERATIONS_BY_NAME op = OPERATIONS_BY_NAME["code.grep"] assert op.budget_p99_ms == 600 - assert op.shape_budgets_p99_ms == {"files": 600, "message": 2000} + assert op.shape_budgets_p99_ms == {"files": 600, "lead": 1800, "message": 2000} @pytest.mark.parametrize("mode,shape", [("files", "files"), ("matches", "")]) diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py new file mode 100644 index 00000000000..d27e0d7500a --- /dev/null +++ b/tests/unit/test_code_lead.py @@ -0,0 +1,430 @@ +"""The `lead` block of code.symbol and code.grep (`server.code.app.lead`): per definition, +callers through overrides, test coverage and the PRs that changed it, compacted from +code.callers, code.coverage_claim and code.symbol_history. Every leg runs at once under +the op's `lead` budget; a leg that did not answer says why and notes a degradation.""" + +from __future__ import annotations + +import asyncio +from typing import Any +from unittest.mock import patch + +import pytest + +from server.code.api.models_grep import CodeGrepInput, CodeGrepOutput +from server.code.api.models_history import CodeSymbolHistoryOutput +from server.code.api.models_symbol import ( + CodeCallersOutput, + CodeEdgeWire, + CodeSymbolOutput, +) +from server.code.api.models_testing import CodeCoverageClaimOutput +from server.code.app import lead +from server.observability import degradations +from server.settings import settings + +pytestmark = pytest.mark.code_lead + + +def _edge(caller: str, path: str, line: int, **kw: Any) -> CodeEdgeWire: + return CodeEdgeWire( + edge_kind="calls", + from_symbol=caller, + to_symbol="DB::IStorage::read", + from_symbol_id=caller, + to_symbol_id="t", + path=path, + line=line, + tier="scip", + confidence=1.0, + **kw, + ) + + +# ------------------------------------------------------------------ definitions + + +def test_the_block_covers_the_first_three_distinct_reachable_definitions(): + rows = [ + {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "kind": "function"}, + {"qualified_name": "A::f", "path": "src/a.h", "start_line": 1, "kind": "function"}, + {"qualified_name": "A::k", "path": "src/a.h", "start_line": 9, "kind": "variable"}, + {"qualified_name": "test_f", "path": "tests/test_a.py", "start_line": 1}, + {"qualified_name": "Intro", "path": "docs/a.md", "start_line": 1, "kind": "class"}, + {"qualified_name": "A::B", "path": "src/b.cpp", "start_line": 5, "kind": "class"}, + {"qualified_name": "g", "path": "src/g.py", "start_line": 7}, + {"qualified_name": "h", "path": "src/h.py", "start_line": 2, "kind": "method"}, + ] + assert lead.lead_definitions(rows) == [ + {"symbol": "A::f", "path": "src/a.cpp", "line": 3}, + {"symbol": "A::B", "path": "src/b.cpp", "line": 5}, + {"symbol": "g", "path": "src/g.py", "line": 7}, + ] + + +# ------------------------------------------------------------------ compaction + + +def test_callers_lead_with_dispatch_and_put_registrations_last(): + out = CodeCallersOutput( + edges=[ + _edge("DB::registerStorages", "src/register.cpp", 4, via="registration"), + _edge("DB::select", "src/select.cpp", 10), + _edge("DB::merge", "src/merge.cpp", 20, via_override="DB::MergeTree::read"), + _edge("DB::select2", "src/select.cpp", 30), + ], + seed_symbols=["DB::IStorage::read"], + dispatch_seeds=[{"symbol": "DB::MergeTree::read", "relation": "override"}], + truncated=True, + ) + entry = lead.callers_entry(out) + assert entry["count"] == 4 and entry["files"] == 3 + assert entry["through_overrides"] == 1 + assert entry["dispatch"] == ["DB::MergeTree::read"] + assert entry["top"] == [ + { + "path": "src/merge.cpp", + "line": 20, + "caller": "DB::merge", + "via_override": "DB::MergeTree::read", + }, + {"path": "src/select.cpp", "line": 10, "caller": "DB::select"}, + {"path": "src/select.cpp", "line": 30, "caller": "DB::select2"}, + ] + assert entry["truncated"] is True + assert entry["epistemic"] == out.epistemic + refused = CodeCallersOutput(edges=[], seed_symbols=[], ambiguous=True) + assert lead.callers_entry(refused) == {"unread": "ambiguous"} + + +@pytest.mark.parametrize( + ("measured", "state"), + [ + ({"measured": True, "executed": True, "freshness": "verified"}, "executed"), + ( + {"measured": True, "executed": False, "run_current": True, "freshness": "verified"}, + "unexecuted", + ), + # a run behind the index head, or one whose file changed, proves nothing unexecuted + ({"measured": True, "executed": False, "run_current": False, "freshness": "verified"}, ""), + ({"measured": True, "executed": False, "run_current": True, "freshness": "stale"}, ""), + ({}, ""), + ], +) +def test_coverage_says_what_a_verified_run_measured(measured, state): + out = CodeCoverageClaimOutput( + verdict="covered_by", + strongest_tier="names_symbol", + tests_total=5, + tests=[ + {"test_path": "tests/a.py", "tier": "names_symbol", "evidence": "x"}, + {"test_path": "tests/b.py", "tier": "imports_file"}, + ], + measured=measured, + ) + entry = lead.tested_entry(out) + assert entry["verdict"] == "covered_by" and entry["tests"] == 5 + assert entry["strongest_tier"] == "names_symbol" + assert entry.get("measured", "") == state + assert entry["top"] == [ + {"test_path": "tests/a.py", "tier": "names_symbol"}, + {"test_path": "tests/b.py", "tier": "imports_file"}, + ] + + +def test_history_drops_prs_whose_diff_does_not_name_the_definition(): + prs = [ + { + "pr_number": 9, + "title": "Refactor", + "merged_at": "2026-11-02T10:00:00", + "touches_symbol": "unknown", + }, + { + "pr_number": 8, + "title": "Unrelated", + "merged_at": "2026-11-01", + "touches_symbol": "false", + }, + { + "pr_number": 7, + "title": "Fix read " + "x" * 100, + "merged_at": "2026-10-01", + "touches_symbol": "true", + "is_fix": True, + }, + ] + out = CodeSymbolHistoryOutput( + prs=prs, + summary={"prs_total": 3, "fix_prs": 1, "reverts": 0}, + tracker_namespace="tracker", + ) + entry = lead.changed_entry(out) + assert entry["prs"] == 3 and entry["level"] == "function" and entry["fixes"] == 1 + assert "reverts" not in entry + assert [p["pr_number"] for p in entry["top"]] == [7, 9] + assert entry["top"][0]["touches_symbol"] == "true" and entry["top"][0]["is_fix"] is True + assert len(entry["top"][0]["title"]) == 80 + assert entry["top"][1] == {"pr_number": 9, "title": "Refactor", "merged_at": "2026-11-02"} + # without a readable tracker the PRs are the file's + file_level = CodeSymbolHistoryOutput(prs=prs, tracker_namespace="t", tracker_unavailable=True) + assert lead.changed_entry(file_level)["level"] == "file" + assert lead.changed_entry(CodeSymbolHistoryOutput(ambiguous=True)) == {"unread": "ambiguous"} + unresolved = CodeSymbolHistoryOutput(causes=["symbol_unresolved"]) + assert lead.changed_entry(unresolved) == {"unread": "unresolved"} + + +# ------------------------------------------------------------------ the wall + + +class _Identity: + agent = "a" + user_id = "-" + + +_ROWS = [ + {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "kind": "function"}, + {"qualified_name": "A::g", "path": "src/a.cpp", "start_line": 9, "kind": "function"}, +] + + +def _legs(calls: list[tuple[str, str, str]]) -> dict[str, lead.Leg]: + async def callers(base, d): + calls.append(("callers", d["symbol"], base["consumer"])) + return {"count": 1} + + async def tested(base, d): + calls.append(("tested", d["symbol"], base["consumer"])) + raise RuntimeError("coverage table unavailable") + + async def changed_by(base, d): + calls.append(("changed_by", d["symbol"], base["consumer"])) + await asyncio.sleep(30) + return {"prs": 1} + + return {"callers": callers, "tested": tested, "changed_by": changed_by} + + +def test_a_leg_past_the_wall_or_failed_says_so_and_notes_a_degradation(monkeypatch): + calls: list[tuple[str, str, str]] = [] + monkeypatch.setattr(lead, "LEGS", _legs(calls)) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 0.2) + + async def go() -> tuple[list[dict[str, Any]], list[str]]: + degradations.begin() + out = await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + return out, degradations.current() + + out, notes = asyncio.run(go()) + assert len(calls) == 6, "every leg of every definition starts at once" + assert {c[2] for c in calls} == {"symbol_lead"} + assert [e["symbol"] for e in out] == ["A::f", "A::g"] + for entry in out: + assert list(entry) == ["symbol", "path", "line", "callers", "tested", "changed_by"] + assert entry["callers"] == {"count": 1} + assert entry["tested"] == {"unread": "failed"} + assert entry["changed_by"] == {"unread": "deadline"} + assert notes == [ + "code.symbol: lead_tested_unread (RuntimeError)", + "code.symbol: lead_changed_by_unread (deadline)", + ] + + +def test_no_time_left_starts_no_leg(monkeypatch): + calls: list[tuple[str, str, str]] = [] + monkeypatch.setattr(lead, "LEGS", _legs(calls)) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 0.0) + + out = asyncio.run( + lead.definition_leads("code.grep", "o", "n", _Identity(), _ROWS[:1], started=0) + ) + assert calls == [] + assert out[0]["callers"] == out[0]["tested"] == out[0]["changed_by"] == {"unread": "deadline"} + + +def test_a_caller_deadline_caps_the_wall(monkeypatch): + calls: list[tuple[str, str, str]] = [] + monkeypatch.setattr(lead, "LEGS", _legs(calls)) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 60.0) + + out = asyncio.run( + lead.definition_leads("code.grep", "o", "n", _Identity(), _ROWS[:1], started=0, cap_s=0.1) + ) + assert {c[2] for c in calls} == {"grep_lead"} + assert out[0]["changed_by"] == {"unread": "deadline"} + + +def test_the_wall_is_the_lead_budget_less_the_time_spent(monkeypatch): + monkeypatch.setattr(lead.time, "monotonic", lambda: 100.5) + monkeypatch.setattr(lead.request_work, "age_s", lambda: 0.0) + monkeypatch.setattr(lead, "effective_budget_ms", lambda op, declared: declared) + assert lead.wall_s("code.symbol", 100.0) == pytest.approx(1.5 - 0.5 - 0.1) + assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.8 - 0.5 - 0.1) + assert lead.wall_s("code.symbol", 98.0) == 0.0 + + +# ------------------------------------------------------------------ the wire + + +def test_the_block_is_first_on_the_wire_and_off_it_when_empty(): + block = [{"symbol": "A::f", "path": "src/a.cpp", "line": 3}] + assert list(CodeSymbolOutput(definitions=[], lead=block).model_dump())[0] == "lead" + assert "lead" not in CodeSymbolOutput(definitions=[]).model_dump() + grep = CodeGrepOutput(matches=[], chunks_matched=0, lead=block) + assert list(grep.model_dump())[0] == "lead" + assert "lead" not in CodeGrepOutput(matches=[], chunks_matched=0).model_dump() + + +# ------------------------------------------------------------------ the handlers + + +_DEF = { + "symbol_id": "f1", + "qualified_name": "DB::Foo::bar", + "name": "bar", + "signature": "void bar(int)", + "path": "src/Foo.cpp", + "start_line": 10, + "end_line": 20, + "tier": "treesitter", + "kind": "method", +} + + +class _Repo: + async def symbols_by_name(self, org, ns, name, limit=10): + return [dict(_DEF)] + + async def symbols_by_ids(self, org, ns, ids): + return [dict(_DEF)] if "f1" in ids else [] + + async def symbols_fuzzy(self, org, ns, needle, *, limit=25): + return [] + + async def functions_for_paths(self, org, ns, paths, *, limit=400, **_kw): + return [dict(_DEF)] if "src/Foo.cpp" in paths else [] + + async def grep_chunks(self, org, ns, pattern, **kw): + return [] + + async def all_state(self, org, ns): + return {} + + async def chunk_hashes_for_symbols(self, org, ns, ids, **_kw): + return {} + + async def symbol_stats(self, org, ns, ids, **_kw): + return {} + + async def edges_for_symbols(self, org, ns, ids, **_kw): + return [] + + async def test_map_for(self, org, ns, paths, **_kw): + return [] + + +@pytest.fixture +def _intel_on(monkeypatch): + monkeypatch.setattr(settings, "code_intel_enabled", True) + monkeypatch.setattr(settings, "code_org", "o") + monkeypatch.setattr(settings, "code_namespace", "n") + + +def _symbol(monkeypatch, *, edit: bool = False, **fields: Any) -> tuple[Any, list[Any], str]: + from server.code.api.models_symbol import CodeEditContextInput, CodeSymbolInput + from server.code.app.symbol import outline + from server.code.app.symbol import symbol as h + from server.observability.budget_shape import current_budget_shape + + seen: list[Any] = [] + + async def leads(op_name, org, ns, identity, rows, *, started, cap_s=0): + seen.append((op_name, [r["qualified_name"] for r in rows])) + return [{"symbol": rows[0]["qualified_name"], "callers": {"count": 2}}] + + async def body(r, org, ns, sym): + return f"" + + monkeypatch.setattr(lead, "definition_leads", leads) + + async def go() -> tuple[Any, str]: + with ( + patch.object(h, "CodeRepo", return_value=_Repo()), + patch.object(h, "symbol_body", new=body), + patch.object(outline, "symbol_body", new=body), + patch.object(h, "schedule_code_trace", new=lambda **k: None), + ): + if edit: + out = await h.handle_code_edit_context( + CodeEditContextInput(include_lessons=False, **fields) + ) + else: + out = await h.handle_code_symbol( + CodeSymbolInput( + include_history=False, + include_examples=False, + include_lessons=False, + **fields, + ) + ) + return out, current_budget_shape() + + out, shape = asyncio.run(go()) + return out, seen, shape + + +@pytest.mark.usefixtures("_intel_on") +def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar") + assert seen == [("code.symbol", ["DB::Foo::bar"])] + dump = out.model_dump() + assert list(dump)[0] == "lead" + assert dump["lead"] == [{"symbol": "DB::Foo::bar", "callers": {"count": 2}}] + assert shape == lead.LEAD_SHAPE + + +@pytest.mark.usefixtures("_intel_on") +def test_lead_false_and_the_edit_read_run_no_leg(monkeypatch): + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", lead=False) + assert seen == [] and "lead" not in out.model_dump() and shape == "" + out, seen, _ = _symbol(monkeypatch, edit=True, name="DB::Foo::bar") + assert seen == [] and "lead" not in out.model_dump() + + +def _grep_lead( + monkeypatch, *, offset: int = 0, related: str = "", **fields: Any +) -> tuple[Any, list[Any]]: + from server.code.app import grep + + seen: list[Any] = [] + + async def leads(op_name, org, ns, identity, rows, *, started, cap_s=0): + seen.append((op_name, [r["qualified_name"] for r in rows], cap_s)) + return [{"symbol": rows[0]["qualified_name"]}] + + monkeypatch.setattr(lead, "definition_leads", leads) + bodies = {"definitions": [dict(_DEF)]} + if fields.pop("no_bodies", False): + bodies = {} + out = asyncio.run( + grep._grep_lead( + "o", + "n", + CodeGrepInput(org="o", namespace="n", pattern="bar", **fields), + bodies, + 0.0, + None, + offset, + related, + ) + ) + return out, seen + + +def test_code_grep_leads_a_first_page_with_its_definitions(monkeypatch): + out, seen = _grep_lead(monkeypatch) + assert out == [{"symbol": "DB::Foo::bar"}] + assert seen == [("code.grep", ["DB::Foo::bar"], float("inf"))] + for kw in ({"offset": 10}, {"related": "bar"}, {"lead": False}, {"no_bodies": True}): + out, seen = _grep_lead(monkeypatch, **kw) + assert out == [] and seen == [], kw diff --git a/tests/unit/test_shape_budgets.py b/tests/unit/test_shape_budgets.py index 2d3ed3c0bb3..d3621ca64f8 100644 --- a/tests/unit/test_shape_budgets.py +++ b/tests/unit/test_shape_budgets.py @@ -51,9 +51,9 @@ def test_note_is_bounded_and_clears(): assert current_budget_shape() == "" -def test_code_symbol_prices_the_ranked_and_brief_shapes(): +def test_code_symbol_prices_the_ranked_brief_and_lead_shapes(): op = next(o for o in ALL_OPERATIONS if o.name == "code.symbol") - assert op.shape_budgets_p99_ms == {"ranked": 3000, "uses_brief": 1500} + assert op.shape_budgets_p99_ms == {"lead": 1500, "ranked": 3000, "uses_brief": 1500} @pytest.mark.parametrize( @@ -100,7 +100,11 @@ async def test_catalogue_lists_shape_budgets(): from server.main import list_operations rows = {r["name"]: r for r in await list_operations()} - assert rows["code.symbol"]["shape_budgets_p99_ms"] == {"ranked": 3000, "uses_brief": 1500} + assert rows["code.symbol"]["shape_budgets_p99_ms"] == { + "lead": 1500, + "ranked": 3000, + "uses_brief": 1500, + } assert rows["memory.search"]["shape_budgets_p99_ms"] == {} @@ -135,4 +139,8 @@ def test_capabilities_catalogue_lists_shape_budgets(): from server.operations.capabilities import capability_snapshot ops = capability_snapshot()["ops"] - assert ops["code.symbol"]["shape_budgets_p99_ms"] == {"ranked": 3000, "uses_brief": 1500} + assert ops["code.symbol"]["shape_budgets_p99_ms"] == { + "lead": 1500, + "ranked": 3000, + "uses_brief": 1500, + } From 40dce7973c0367e307c4dc977d856faf0ec52781 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 00:49:30 +0530 Subject: [PATCH 02/30] The lead block is best effort: one definition, a bounded share of the pool The lead's statements run in a new best-effort lane of the ClickHouse client: between them they hold at most an eighth of `ch_pool_maxsize` (8 of the default 64) process-wide, and a statement that finds no slot free at once raises BusyError before it is sent instead of waiting, so the request's own reads keep the pool. A leg refused that way reads `unread: busy`. The block covers one definition (three legs a call, not nine). The callers and history legs read it by symbol id. Each leg passes the history policy gate its op has (`unread: policy` on a deny). The legs start inside a statement bound at the wall plus a margin and outside code.grep's caller-shaped block. code.grep subtracts the reserve from the caller's deadline and leads with the definition its pattern names. A leg another block of the answer reads (callers and tests beside `neighbours`, callers beside a uses brief) is left out. A `token_budget` the block does not fit beside the uses block withholds it whole. Legs that did not answer are named in `lead_unread` on the trace row and the span. The plugins' code shunt and prompt pack and the dashboard send `lead: false`; both plugin manifests move to 1.2.151. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 40 +- docs/reference/operations/code.md | 14 +- frontend/src/api/code.ts | 1 + .../.claude-plugin/plugin.json | 2 +- .../hooks/loom-code-shunt.mjs | 1 + .../claude-code-plugin/lib/prompt-pack.mjs | 1 + .../tests/fixtures/code-query-wire.json | 6 +- .../codex-plugin/.codex-plugin/plugin.json | 2 +- .../codex-plugin/hooks/loom-code-shunt.mjs | 1 + integrations/codex-plugin/lib/prompt-pack.mjs | 1 + sdk/go/wire/models.gen.go | 2 +- sdk/typescript/src/generated/ops.ts | 4 +- server/code/api/models_grep.py | 10 +- server/code/api/models_symbol.py | 29 +- server/code/app/grep.py | 35 +- server/code/app/lead.py | 251 ++++++++--- server/code/app/spans.py | 1 + server/code/app/symbol/symbol.py | 43 +- server/core/ch.py | 55 +++ server/settings/catalog.py | 9 +- server/transport/mcp_defaults.py | 12 +- server/transport/mcp_descriptions.py | 7 +- tests/integration/test_code_plane.py | 10 +- tests/unit/test_ch_client_hygiene.py | 52 ++- tests/unit/test_code_lead.py | 391 +++++++++++++----- 25 files changed, 734 insertions(+), 246 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 572c5660bac..a2fc86410c4 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -91,10 +91,11 @@ underscores. Toolsets: [MCP reference](../../reference/mcp.md#toolsets). | `code.trace` | you have a stack trace: each frame resolved to its unit | `code.symbol` and `code.grep` start their answer with a `lead` block: what a -text search cannot answer about the definitions they found. It covers the first -three distinct definitions outside test files and documents (for `code.grep`, -the enclosing definitions of a first page's bodies). Each entry carries -`symbol`, `path` and `line` and three answers: +text search cannot answer about the definition they found. It covers one +definition outside test files and documents: for `code.symbol` the first one +served, for `code.grep` the enclosing definition of a first page's bodies that +the pattern names, else the first. Its entry carries `symbol`, `path` and +`line` and three answers: | Key | From | Holds | | ------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -102,14 +103,29 @@ the enclosing definitions of a first page's bodies). Each entry carries | `tested` | [`code.coverage_claim`](../../reference/operations/code.md#codecoverage_claim) | `verdict`, `tests`, `strongest_tier`, `measured` (`executed` or `unexecuted` by a verified coverage run) and the first three test files | | `changed_by` | [`code.symbol_history`](../../reference/operations/code.md#codesymbol_history) | `prs`, `level` (`function` when the tracker read the diffs, `file` otherwise), `fixes`, `reverts` and the first three PRs, those naming the definition first | -Every answer of every entry runs at once, beside the op's own reads. They share -what the op's `lead` latency budget leaves after the time already spent. An -answer still running at that point, or one that failed, reads -`{"unread": "deadline"}` or `{"unread": "failed"}` and the rest of the response -is served; an ambiguous or unresolved name reads `ambiguous` or `unresolved`. -Under `deadline_ms` the block also stops at the caller's deadline. -`lead: false` leaves the block out. `code.edit_context` has no `lead` block; -it reads the definition's tests itself. +The three answers run at once: in `code.symbol` beside the op's own reads, in +`code.grep` once the page's reads are done. Each passes the history policy gate +its op has. They share what the op's `lead` latency budget leaves after the time +already spent (under `deadline_ms`, at most the caller's deadline), and +ClickHouse stops their statements soon after. The block is best effort: its +statements hold at most an eighth of the server's ClickHouse pool +(`ch_pool_maxsize`) and never wait for a slot. An answer that does not come back +reads `{"unread": why}`, and the rest of the response is served: + +| `unread` | Why | +| ------------ | --------------------------------------------------------- | +| `deadline` | still running when the budget ran out | +| `busy` | no ClickHouse slot was free at once for best-effort reads | +| `failed` | the op raised | +| `policy` | a history policy rule denies the op | +| `ambiguous` | the op refused an ambiguous name | +| `unresolved` | the op did not resolve the definition | + +An answer another block of the same response reads is left out: with `neighbours`, the +`callers` and `tested` keys; with a `uses_brief` block, `callers`. A +`token_budget` the block does not fit beside the uses block withholds it whole. +`lead: false` leaves the block out. `code.edit_context` has no `lead` block; it +reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For example, `["parse(", "parse_async("]` matches both fragments without escaping diff --git a/docs/reference/operations/code.md b/docs/reference/operations/code.md index 60108e696eb..adf499f6478 100644 --- a/docs/reference/operations/code.md +++ b/docs/reference/operations/code.md @@ -598,13 +598,13 @@ Before editing, read source, tests and notes. | Output field | Type | Meaning | | --- | --- | --- | -| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: per definition (the first three distinct ones outside test files), what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides… | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides, dispatch, top: [{path… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | | `hierarchy` | `dict[str, list[dict[str, Any]]]` | For a class / interface / enum definition, its type hierarchy from the `inherits` edges of both tiers, folded by qualified name: {"supertypes": [...], "subtypes": [...]} of {symbol, kind, via (extends \| implements), tier, confidence, path… | | `candidates` | `list[dict[str, Any]]` | Source pointers when nothing resolved, or other hits outside a file-clue target. | -| `tokens_returned` | `int` | Estimated tokens of the answer: definitions, uses, cited documents, neighbours and hierarchy blocks together. | +| `tokens_returned` | `int` | Estimated tokens of the answer: lead, definitions, uses, cited documents, neighbours and hierarchy blocks together. | | `trace_run_id` | `str` | Id of this call's trace row; pass it to `code.outcome`. | | `uses` | `list[dict[str, Any]] \| dict[str, Any] \| None` | The lines mentioning the symbol's bare name for `uses: true`, or the compact block of `uses_brief`; off the wire when no uses read answered, so an empty list says the read found no line. | | `uses_truncated` | `bool` | True when `uses_limit` shortened the list or the token cap withheld `uses_brief`. | @@ -789,13 +789,13 @@ Literal or regex search of indexed source with enclosing symbols and coverage. | `neighbours` | `bool \| None` | `None` | The neighbours graph block in the SAME call, matches mode only: the hits' enclosing functions become anchors (at most 20, first appearance) and each carries up to `neighbour_k` callers, callees and mapped tests at edge confidence >= 0.8… | | `neighbour_k` | `int` | `5` | With `neighbours`: at most this many callers and callees per anchor (1..20). | | `deadline_ms` | `int \| None` | `None` | The request's wall-clock budget in ms, from arrival (values under 200 read as 200). | -| `lead` | `bool` | `True` | Lead with callers through overrides, test coverage and changing PRs of up to three enclosing definitions; default true. | +| `lead` | `bool` | `True` | Lead with the callers through overrides, test coverage and changing PRs of the enclosing definition the pattern names; default true. | | Output field | Type | Meaning | | --- | --- | --- | | `lessons` | `list[dict[str, Any]]` | The memories about the answer's top files, best first, capped at `code_result_lessons_tokens`; each row {path, memory_key, namespace, excerpt, code_state}, with `rev`, `first_written`, `changed_since`, `code_moved` and `supersedes_key`… | | `lessons_left_out` | `int` | File lessons omitted by symbol focus, a token budget, truncation or supersession. | -| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: the block code.symbol leads with, for the first three distinct `definitions` of a first page outside test files. | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: the block code.symbol leads with, for the first page's `definitions` entry outside test files whose name the pattern holds, else the first. | | `matches` | `list[dict[str, Any]]` | {path, line, text, scope, scope_start_line, scope_end_line} per matching LINE, path/line ordered except when prioritize_patterns gives different literals first-page slots. scope_* is the span of the enclosing unit named by `scope` (0/0… | | `related` | `RelatedGrepEvidence \| None` | Related source for a qualified argument or member, separate from literal matches. | | `contexts` | `list[dict[str, Any]]` | Exact retained source windows for this page, with inclusive line bounds. | @@ -1668,17 +1668,17 @@ Find an exact definition by name or path:line. | `presence` | `bool` | `False` | Answer per namespace in `namespaces` whether the definition is there (the `presence` / `summary` blocks) instead of returning definitions. | | `neighbours` | `bool \| None` | `None` | The neighbours graph block for the resolved definitions themselves — k callers, callees, tests and citing documents per definition, in the same call. | | `neighbour_k` | `int` | `5` | How many callers, callees, tests and citing documents (each) the `neighbours` block lists per definition. | -| `lead` | `bool` | `True` | Lead with callers through overrides, test coverage and changing PRs of up to three definitions; default true. | +| `lead` | `bool` | `True` | Lead with the first definition's callers through overrides, test coverage and changing PRs; default true. | | Output field | Type | Meaning | | --- | --- | --- | -| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: per definition (the first three distinct ones outside test files), what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides… | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides, dispatch, top: [{path… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | | `hierarchy` | `dict[str, list[dict[str, Any]]]` | For a class / interface / enum definition, its type hierarchy from the `inherits` edges of both tiers, folded by qualified name: {"supertypes": [...], "subtypes": [...]} of {symbol, kind, via (extends \| implements), tier, confidence, path… | | `candidates` | `list[dict[str, Any]]` | Source pointers when nothing resolved, or other hits outside a file-clue target. | -| `tokens_returned` | `int` | Estimated tokens of the answer: definitions, uses, cited documents, neighbours and hierarchy blocks together. | +| `tokens_returned` | `int` | Estimated tokens of the answer: lead, definitions, uses, cited documents, neighbours and hierarchy blocks together. | | `trace_run_id` | `str` | Id of this call's trace row; pass it to `code.outcome`. | | `uses` | `list[dict[str, Any]] \| dict[str, Any] \| None` | The lines mentioning the symbol's bare name for `uses: true`, or the compact block of `uses_brief`; off the wire when no uses read answered, so an empty list says the read found no line. | | `uses_truncated` | `bool` | True when `uses_limit` shortened the list or the token cap withheld `uses_brief`. | diff --git a/frontend/src/api/code.ts b/frontend/src/api/code.ts index e2c0926a302..7b08c0dda57 100644 --- a/frontend/src/api/code.ts +++ b/frontend/src/api/code.ts @@ -336,6 +336,7 @@ export async function codeSymbol(id: CodeId, name: string): Promise d return _lead_first(_drop_empty_lessons(data)) # First on the wire when `lead` read it: the block code.symbol leads with, for the - # first three distinct `definitions` of a first page outside test files. Absent on a - # continuation page, with `include_body` false or `lead` false, and outside matches - # mode. + # first page's `definitions` entry outside test files whose name the pattern holds, + # else the first. Absent on a continuation page, with `include_body` false or `lead` + # false, and outside matches mode. lead: list[dict[str, Any]] = Field(default_factory=list) # {path, line, text, scope, scope_start_line, scope_end_line} per matching # LINE, path/line ordered except when prioritize_patterns gives different literals diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index 460ce7caffd..f54ef1d340d 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -176,8 +176,8 @@ class CodeSymbolInput(_CodeIdentity): neighbour_k: int = Field(default=5, ge=1, le=20) lead: bool = Field( default=True, - description="Lead with callers through overrides, test coverage and changing PRs " - "of up to three definitions; default true.", + description="Lead with the first definition's callers through overrides, test " + "coverage and changing PRs; default true.", json_schema_extra=MCP_HIDDEN, ) @@ -255,16 +255,17 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s data.pop("read_sources", None) return _lead_first(data) - # First on the wire when `lead` read it: per definition (the first three distinct - # ones outside test files), what a text search cannot answer. {symbol, path, line, - # callers, tested, changed_by}: `callers` {count, files, through_overrides, dispatch, - # top: [{path, line, caller, via_override, via}] (<= 3), truncated, epistemic} is - # code.callers one hop across virtual dispatch; `tested` {verdict, tests, - # strongest_tier, measured: executed | unexecuted, top: [{test_path, tier}]} is - # code.coverage_claim; `changed_by` {prs, level: function | file, fixes, reverts, top: - # [{pr_number, title, merged_at, touches_symbol, is_fix, is_revert}]} is - # code.symbol_history. A leg that did not answer is {unread: deadline | failed | - # ambiguous | unresolved}. Absent when `lead` is false or no definition qualifies. + # First on the wire when `lead` read it: for the first definition outside test files, + # what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: + # `callers` {count, files, through_overrides, dispatch, top: [{path, line, caller, + # via_override, via}] (<= 3), truncated, epistemic} is code.callers one hop across + # virtual dispatch; `tested` {verdict, tests, strongest_tier, measured: executed | + # unexecuted, top: [{test_path, tier}]} is code.coverage_claim; `changed_by` {prs, + # level: function | file, fixes, reverts, top: [{pr_number, title, merged_at, + # touches_symbol, is_fix, is_revert}]} is code.symbol_history. A leg that did not + # answer is {unread: deadline | busy | failed | policy | ambiguous | unresolved}; one + # the neighbours block or the uses brief reads is left out. Absent when `lead` is + # false, no definition qualifies or it does not fit `token_budget`. lead: list[dict[str, Any]] = Field(default_factory=list) # Up to 10 name matches, or the members matched by file clues, fitted to # `token_budget`. Empty when only candidates or presence were found. @@ -281,8 +282,8 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s hierarchy: dict[str, list[dict[str, Any]]] = Field(default_factory=dict) # Source pointers when nothing resolved, or other hits outside a file-clue target. candidates: list[dict[str, Any]] = Field(default_factory=list) - # Estimated tokens of the answer: definitions, uses, cited documents, neighbours - # and hierarchy blocks together. + # Estimated tokens of the answer: lead, definitions, uses, cited documents, + # neighbours and hierarchy blocks together. tokens_returned: int = 0 # Id of this call's trace row; pass it to `code.outcome`. Empty when no trace # row was written (a miss or a presence answer). diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 03fc5254d8f..60e3cda25f0 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -653,7 +653,7 @@ async def _grep_lines( op="code.grep", query=_grep_trace_query(input), route=route, - args=_grep_trace_args(input, context_lines=context_lines), + args=_grep_trace_args(input, context_lines=context_lines, lead=lead), returned_ids=files, returned_paths=files, returned_scores=[], @@ -685,6 +685,7 @@ async def _grep_lines( abstain=not returned, retrieval_risk=risk, consumer=input.consumer, + lead_unread=_lead_unread(lead), ) if ( not matches @@ -733,24 +734,37 @@ async def _grep_lead( ) -> list[dict[str, Any]]: """The `lead` block (`server.code.app.lead`) of a first page's enclosing definitions, read once the page's other reads are done, within what the op's `lead` budget and the - caller's `deadline_ms` leave. [] on a continuation page (`offset`), a related answer - (`related_pattern`), a page without bodies, or `lead: false`.""" + caller's `deadline_ms` leave less the reserve for the lessons read after the handler. + A definition the pattern names leads before one that only holds a match. [] on a + continuation page (`offset`), a related answer (`related_pattern`), a page without + bodies, or `lead: false`; the `neighbours` block's callers and tests are not read + twice.""" definitions = bodies.get("definitions") or [] if not (input.lead and definitions) or offset or related_pattern: return [] from server.code.app import lead as code_lead from server.observability.budget_shape import note_budget_shape - cap_s = budget.left_ms() / 1000.0 if budget is not None else math.inf + patterns = [input.pattern] if isinstance(input.pattern, str) else input.pattern + named = [r for r in definitions if r.get("symbol") and any(r["symbol"] in p for p in patterns)] + rows = named + [r for r in definitions if r not in named] + cap_s = budget.left_ms() / 1000.0 - code_lead.RESERVE_S if budget is not None else math.inf + legs = code_lead.legs_beside(neighbours=bool(input.neighbours), brief=False) with code_span("grep.lead", results=len(definitions)): lead = await code_lead.definition_leads( - "code.grep", org, ns, input, definitions, started=started, cap_s=cap_s + "code.grep", org, ns, input, rows, started=started, cap_s=cap_s, legs=legs ) if lead: note_budget_shape(code_lead.LEAD_SHAPE) return lead +def _lead_unread(lead: list[dict[str, Any]]) -> str: + from server.code.app.lead import unread_of + + return unread_of(lead) + + def _label_related( pattern: str, matches: list[dict[str, Any]], @@ -1348,9 +1362,15 @@ def _context_tokens(context: dict[str, Any]) -> int: return sum(len(row["text"]) for row in context.get("contexts", ())) // 4 -def _grep_trace_args(input: CodeGrepInput, *, context_lines: int | None = None) -> dict[str, Any]: +def _grep_trace_args( + input: CodeGrepInput, + *, + context_lines: int | None = None, + lead: list[dict[str, Any]] | None = None, +) -> dict[str, Any]: """The grep arguments that change the answer, for the trace row, so a flip between two - same-second calls (0 -> N matches) can be pinned on the argument that differed.""" + same-second calls (0 -> N matches) can be pinned on the argument that differed; with + the lead block's legs that did not answer (`lead_unread`).""" return answer_args( input, "mode", @@ -1371,6 +1391,7 @@ def _grep_trace_args(input: CodeGrepInput, *, context_lines: int | None = None) "prefer_complete_context", context_lines=context_lines, paged=bool(input.cursor) or None, + lead_unread=_lead_unread(lead or []) or None, ) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 1eda58ff830..107ef985bf3 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -1,6 +1,6 @@ -"""The `lead` block of code.symbol and code.grep: for the first definitions an answer -resolves, the three answers a text search cannot give, read beside the answer so an agent -does not have to think of a second call. +"""The `lead` block of code.symbol and code.grep: for the definition an answer resolves, +the three answers a text search cannot give, read beside the answer so an agent does not +have to think of a second call. - `callers`: code.callers one hop, which walks virtual dispatch (an override's callers bind to its base declaration; a base's overrides join the walk, tagged `via_override`). @@ -10,13 +10,26 @@ level where the bound tracker answers and file level otherwise. Each leg is its op's own handler, called in-process as the consumer `_lead` -(`symbol_lead`, `grep_lead`), so the numbers are the ones the op gives and its trace row -is attributable. Every leg of every definition runs at once under one wall: what the op's -latency budget for its `lead` shape leaves after the time already spent, less a reserve -for the rest of the answer. A leg still running at the wall is cancelled and says -`unread: deadline`; one that raised says `unread: failed`; both are noted on the request's -degradations. The block is small by construction: per leg a few counts and at most -`LEAD_ROWS` rows, each with a path. +(`symbol_lead`, `grep_lead`) after the history policy gate the transports run for that +op, so the numbers are the ones the op gives and its trace row is attributable. The +callers and history legs read the definition by its symbol id. + +The block is best effort and never competes with the request's own reads: + +- One definition, so a call runs at most three legs (`LEAD_DEFINITIONS`). +- Its statements hold at most `lead_slots()` ClickHouse pool slots between them, + process-wide, and never wait for one (`server.core.ch.best_effort`): a leg that finds + none free reads `unread: busy`. +- The legs share one wall: what the op's latency budget for its `lead` shape leaves after + the time already spent, less a reserve for the rest of the answer. Each statement is + bounded near the wall on the server (`statement_timeout`), so a leg cancelled at the + wall does not keep ClickHouse working; a cancelled leg reads `unread: deadline`, one + that raised `unread: failed`. +- The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. + +A leg that did not answer is noted on the request's degradations and named in the +`lead_unread` trace argument. The block is small by construction: per leg a few counts +and at most `LEAD_ROWS` rows, each with a path. """ from __future__ import annotations @@ -25,24 +38,30 @@ import logging import math import time -from collections.abc import Awaitable, Callable +from collections.abc import Awaitable, Callable, Iterator +from contextlib import contextmanager from typing import Any from server.code.app.spans import code_span from server.code.app.symbol.neighbours import is_doc_path from server.code.domain.index.test_gate import is_test_path -from server.core import request_work +from server.code.domain.units import estimate_json_tokens +from server.core import ch, request_work from server.core.errors import NotFoundError +from server.core.logging_config import request_id_var from server.observability import degradations from server.observability.budgets import effective_budget_ms +from server.settings import settings from server.settings.catalog import OP_SHAPE_BUDGETS_P99_MS logger = logging.getLogger(__name__) # The budget shape a request that served the block is priced by (OP_SHAPE_BUDGETS_P99_MS). LEAD_SHAPE = "lead" -# Definitions the block covers: the first distinct ones of the answer. -LEAD_DEFINITIONS = 3 +# Definitions the block covers. One: an exact name resolves one definition in the common +# case, and the other definitions an answer lists are a call away by path:line; each more +# would add three legs and their statements to every call. +LEAD_DEFINITIONS = 1 # Rows per leg: where to look first; the counts carry the totals. LEAD_ROWS = 3 # Callers one hop reads before it says `truncated` (code.callers' `max_nodes`). @@ -52,7 +71,10 @@ _TITLE_CHARS = 80 # Left of the budget for the answer after the wall: the trims, serialization and, for # code.grep, the lessons read that runs after the handler. -_RESERVE_S = 0.1 +RESERVE_S = 0.1 +# A leg's statements run at most this long past the wall on the server; the leg is +# cancelled at the wall, so the margin only keeps the server's bound from firing first. +_MARGIN_S = 0.25 # Kinds a caller, a test or a PR can reach. Variables, fields, macros and document # sections are left out, as are definitions in test files and documents. LEAD_KINDS = frozenset( @@ -70,13 +92,26 @@ "type", } ) +# Why a leg did not answer, when that is the request's shortfall (a degradation) rather +# than the index's answer about the name (`ambiguous`, `unresolved`). +_DEGRADED = frozenset({"deadline", "failed", "busy", "policy"}) -Leg = Callable[[dict[str, Any], dict[str, Any]], Awaitable[dict[str, Any]]] +# The pool slots the lead's statements hold between them, process-wide. +_SLOTS = ch.BestEffortSlots(limit=0) + + +def lead_slots() -> int: + """Pool slots the lead's statements hold at once, process-wide: an eighth of the + pool (8 of the default 64), so the requests' own reads keep the rest; 8 when the pool + is unbounded.""" + size = int(settings.ch_pool_maxsize) + return max(1, size // 8) if size > 0 else 8 def lead_definitions(rows: list[dict[str, Any]]) -> list[dict[str, Any]]: - """The first `LEAD_DEFINITIONS` distinct qualified names of `rows` (resolved symbol rows - or a grep page's enclosing definitions) that a caller, a test or a PR can reach.""" + """The first `LEAD_DEFINITIONS` distinct qualified names of `rows` (resolved symbol + rows or a grep page's enclosing definitions) that a caller, a test or a PR can reach, + each with its symbol id when the row has one.""" out: list[dict[str, Any]] = [] seen: set[str] = set() for r in rows: @@ -88,7 +123,14 @@ def lead_definitions(rows: list[dict[str, Any]]) -> list[dict[str, Any]]: if is_test_path(path) or is_doc_path(path): continue seen.add(name) - out.append({"symbol": name, "path": path, "line": int(r.get("start_line") or 0)}) + out.append( + { + "symbol": name, + "path": path, + "line": int(r.get("start_line") or 0), + "symbol_id": str(r.get("symbol_id") or ""), + } + ) if len(out) >= LEAD_DEFINITIONS: break return out @@ -102,7 +144,7 @@ def wall_s(op_name: str, started: float) -> float: declared = OP_SHAPE_BUDGETS_P99_MS[op_name][LEAD_SHAPE] budget_s = effective_budget_ms(op_name, declared) / 1000.0 spent = max(request_work.age_s(), time.monotonic() - started) - return max(0.0, budget_s - spent - _RESERVE_S) + return max(0.0, budget_s - spent - RESERVE_S) def callers_entry(out: Any) -> dict[str, Any]: @@ -199,52 +241,141 @@ def _pr_row(p: dict[str, Any]) -> dict[str, Any]: return row -async def _callers(base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: +def _by_id(d: dict[str, Any]) -> dict[str, Any]: + """The seed of a leg whose op takes a symbol id: the id when the row had one, so the + op reads that definition instead of resolving the name again.""" + return {"symbol_id": d["symbol_id"]} if d["symbol_id"] else {"name": d["symbol"]} + + +Query = Callable[[dict[str, Any]], dict[str, Any]] +# leg -> (op, its query fields for a definition, the compact answer of its output), in +# the order the block lists them. +LEGS: dict[str, tuple[str, Query, Callable[[Any], dict[str, Any]]]] = { + "callers": ( + "code.callers", + lambda d: {**_by_id(d), "depth": 1, "max_nodes": _CALLER_NODES}, + callers_entry, + ), + "tested": ( + "code.coverage_claim", + lambda d: {"symbol": d["symbol"], "limit": LEAD_ROWS}, + tested_entry, + ), + "changed_by": ( + "code.symbol_history", + lambda d: {**_by_id(d), "limit": _HISTORY_ROWS}, + changed_entry, + ), +} + + +def _ops() -> dict[str, tuple[Any, Callable[[Any], Awaitable[Any]]]]: + """op -> (input model, handler) for the legs.""" + from server.code.api.models_history import CodeSymbolHistoryInput from server.code.api.models_symbol import CodeCallersInput - from server.code.app.symbol import handle_code_callers - - query = CodeCallersInput(**base, name=d["symbol"], depth=1, max_nodes=_CALLER_NODES) - try: - out = await handle_code_callers(query) - except NotFoundError: - return {"unread": "unresolved"} - return callers_entry(out) - - -async def _tested(base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: from server.code.api.models_testing import CodeCoverageClaimInput from server.code.app.coverage import handle_code_coverage_claim - - query = CodeCoverageClaimInput(**base, symbol=d["symbol"], limit=LEAD_ROWS) - return tested_entry(await handle_code_coverage_claim(query)) - - -async def _changed_by(base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: - from server.code.api.models_history import CodeSymbolHistoryInput + from server.code.app.symbol import handle_code_callers from server.code.app.symbol_history import handle_code_symbol_history - query = CodeSymbolHistoryInput(**base, name=d["symbol"], limit=_HISTORY_ROWS) - return changed_entry(await handle_code_symbol_history(query)) - + return { + "code.callers": (CodeCallersInput, handle_code_callers), + "code.coverage_claim": (CodeCoverageClaimInput, handle_code_coverage_claim), + "code.symbol_history": (CodeSymbolHistoryInput, handle_code_symbol_history), + } -# The legs in the order the block lists them. -LEGS: dict[str, Leg] = {"callers": _callers, "tested": _tested, "changed_by": _changed_by} +async def _policy(op: str, query: Any) -> None: + """The history policy gate the transports run before `op`'s handler, on the leg's + identity; raises PolicyForbiddenError when an enforcing rule denies.""" + from server.identity.app.policy_gate import gate + from server.operations.registry import OPERATIONS_BY_NAME -async def _leg(name: str, fn: Leg, base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: - with code_span(f"lead.{name}"): - return await fn(base, d) + identity = { + "org": query.org or "-", + "namespace": query.namespace or "-", + "agent": query.agent or "-", + "user_id": query.user_id or "-", + "session_id": "-", + } + raw_args = query.model_dump(exclude_defaults=True) + await gate(OPERATIONS_BY_NAME[op], identity, raw_args, request_id=request_id_var.get() or "") + + +async def _leg(name: str, base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: + from server.identity.app.policy_gate import PolicyForbiddenError + + op, fields, compact = LEGS[name] + model, handler = _ops()[op] + query = model(**base, **fields(d)) + claim = ch.BestEffortClaim(_SLOTS) + with code_span(f"lead.{name}"), ch.best_effort(claim): + try: + await _policy(op, query) + out = await handler(query) + except ch.BusyError: + return {"unread": "busy"} + except PolicyForbiddenError: + return {"unread": "policy"} + except NotFoundError: + return {"unread": "unresolved"} + # an op that swallowed the refusal answered short + return {"unread": "busy"} if claim.refused else compact(out) + + +@contextmanager +def _leg_scope(wall: float) -> Iterator[None]: + """The context the legs start in, which their tasks copy: every statement bounded + near the wall on the server, and outside a caller-shaped block (code.grep's), since + the legs run their ops' own reads, not ones the caller's pattern shapes.""" + shaped = ch.caller_shaped_var.set(False) + try: + with ch.statement_timeout(wall + _MARGIN_S): + yield + finally: + ch.caller_shaped_var.reset(shaped) def _answer(task: asyncio.Future[dict[str, Any]] | None) -> tuple[dict[str, Any], str]: - """(the leg's entry, why it did not answer: '' when it did).""" + """(the leg's entry, why it did not answer when that is a degradation, else '').""" if task is None or task.cancelled(): return {"unread": "deadline"}, "deadline" error = task.exception() if error is not None: logger.info("code lead leg failed", exc_info=error) return {"unread": "failed"}, type(error).__name__ - return task.result(), "" + entry = task.result() + unread = str(entry.get("unread") or "") + return entry, unread if unread in _DEGRADED else "" + + +def legs_beside(*, neighbours: bool, brief: bool) -> tuple[str, ...]: + """The legs to read beside an answer's other blocks: the neighbours block already lists + the definition's callers and tests, the uses brief its callers, so the lead leaves + those legs out rather than read them twice.""" + skip = {"callers", "tested"} if neighbours else ({"callers"} if brief else set()) + return tuple(name for name in LEGS if name not in skip) + + +def fit(lead: list[dict[str, Any]], token_budget: int, spent: int) -> tuple[list[Any], int]: + """The block and its tokens within `token_budget` (0 = none) after `spent`: withheld + whole when it does not fit, as the uses brief is, so the answer stays in budget.""" + tokens = estimate_json_tokens(lead) if lead else 0 + if token_budget and spent + tokens > token_budget: + return [], 0 + return lead, tokens + + +def unread_of(lead: list[dict[str, Any]]) -> str: + """The legs of `lead` that did not answer, `leg:why` comma-joined in leg order, for the + trace row and the span; '' when every leg answered.""" + out = [] + for entry in lead: + for name in LEGS: + leg = entry.get(name) + if isinstance(leg, dict) and leg.get("unread"): + out.append(f"{name}:{leg['unread']}") + return ",".join(out) async def definition_leads( @@ -256,14 +387,17 @@ async def definition_leads( *, started: float, cap_s: float = math.inf, + legs: tuple[str, ...] = tuple(LEGS), ) -> list[dict[str, Any]]: - """The block for `rows`: one entry per `lead_definitions` row with each leg's answer. - `identity` carries the request's `agent` and `user_id`; `cap_s` is a caller's own - deadline. Never raises but on cancellation, which cancels every leg.""" + """The block for `rows`: one entry per `lead_definitions` row with each of `legs`' + answer (a leg another block of the same answer already reads is left out by the + caller). `identity` carries the request's `agent` and `user_id`; `cap_s` is a + caller's own deadline. Never raises but on cancellation, which cancels every leg.""" picked = lead_definitions(rows) - if not picked: + if not picked or not legs: return [] wall = min(wall_s(op_name, started), cap_s) + _SLOTS.limit = lead_slots() base = { "org": org, "namespace": ns, @@ -273,9 +407,10 @@ async def definition_leads( } tasks: dict[tuple[int, str], asyncio.Future[dict[str, Any]]] = {} if wall > 0: - for i, d in enumerate(picked): - for name, fn in LEGS.items(): - tasks[(i, name)] = asyncio.ensure_future(_leg(name, fn, base, d)) + with _leg_scope(wall): + for i, d in enumerate(picked): + for name in legs: + tasks[(i, name)] = asyncio.ensure_future(_leg(name, base, d)) try: if tasks: await asyncio.wait(tasks.values(), timeout=wall) @@ -287,8 +422,8 @@ async def definition_leads( unread: dict[str, str] = {} out: list[dict[str, Any]] = [] for i, d in enumerate(picked): - entry = dict(d) - for name in LEGS: + entry = {k: d[k] for k in ("symbol", "path", "line")} + for name in legs: entry[name], why = _answer(tasks.get((i, name))) if why: unread.setdefault(name, why) diff --git a/server/code/app/spans.py b/server/code/app/spans.py index 577b13cc2f6..f5951f23a26 100644 --- a/server/code/app/spans.py +++ b/server/code/app/spans.py @@ -59,6 +59,7 @@ "path_prefix", # the scope a code.grep ran under "fanout", "fanout_dropped", # namespaces fanned out / dropped + "lead_unread", # the lead block's legs that did not answer, `leg:why` } ) _MAX_STR = 64 diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index 952c6796170..7f9500301ed 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -185,20 +185,6 @@ def __init__( ) -> None: head = rows if matched_members else rows[:MAX_DEFINITIONS] self.hashes = asyncio.ensure_future(_chunk_hashes(repo, org, ns, head)) - # the lead block (callers through overrides, coverage, the PRs that changed it) - # under the `lead` shape's wall; an edit's read leads with its own tests - self.lead = ( - asyncio.ensure_future( - _staged( - "symbol.lead", - code_lead.definition_leads( - "code.symbol", org, ns, input, head, started=started - ), - ) - ) - if input.lead and not for_edit - else None - ) # uses leg: the grep for the name's mentions runs beside the body reads, never # after them; additive, never fatal. self.uses = ( @@ -223,6 +209,24 @@ def __init__( if want_brief and not self.brief_declined else None ) + # the lead block (callers through overrides, coverage, the PRs that changed it) + # under the `lead` shape's wall, less the legs the brief or the neighbours block + # already reads; an edit's read leads with its own tests + legs = code_lead.legs_beside( + neighbours=bool(input.neighbours), brief=self.brief is not None + ) + self.lead = ( + asyncio.ensure_future( + _staged( + "symbol.lead", + code_lead.definition_leads( + "code.symbol", org, ns, input, head, started=started, legs=legs + ), + ) + ) + if input.lead and not for_edit + else None + ) self.enrich = asyncio.ensure_future( _enrichment( repo, @@ -1041,16 +1045,17 @@ async def handle_code_symbol( from server.code.domain.units import estimate_json_tokens, remaining_token_budget - # the compact block is budgeted before the bodies are trimmed + # the compact block and the lead are budgeted before the bodies are trimmed uses_tokens = estimate_json_tokens(brief) if brief else 0 brief_omitted = bool(input.token_budget and uses_tokens > input.token_budget) if brief_omitted: brief, uses_tokens = {}, 0 + lead, lead_tokens = code_lead.fit(lead, input.token_budget, uses_tokens) with code_span("symbol.budget"): budgeted, tokens, lessons_left_out = _budget_definitions( - units, remaining_token_budget(input.token_budget, uses_tokens) + units, remaining_token_budget(input.token_budget, uses_tokens + lead_tokens) ) - tokens += uses_tokens + tokens += uses_tokens + lead_tokens if documented_in: tokens += estimate_json_tokens(documented_in) tokens += block_tokens @@ -1081,7 +1086,7 @@ async def handle_code_symbol( route = "edit_context_members" shape = _served_shape(input, brief, lead) note_budget_shape(shape) - tokens += (estimate_json_tokens(hierarchy) if hierarchy else 0) + estimate_json_tokens(lead) + tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 trace_run_id = _symbol_trace( input, org, @@ -1105,6 +1110,7 @@ async def handle_code_symbol( near_paths_n=len(input.near_paths) or None, picked_by=picked_by or None, shape=shape or None, + lead_unread=code_lead.unread_of(lead) or None, ), ) set_code_span_attributes( @@ -1116,6 +1122,7 @@ async def handle_code_symbol( abstain=not budgeted, retrieval_risk="low" if budgeted else "abstain", consumer=input.consumer, + lead_unread=code_lead.unread_of(lead), ) return CodeSymbolOutput( lead=lead, diff --git a/server/core/ch.py b/server/core/ch.py index 20144963601..0dabd1319dc 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -551,6 +551,44 @@ def count(self) -> int | None: STREAM_SLOTS = 4 +class BusyError(OverloadedError): + """A best-effort statement found no pool slot free at once (`best_effort()`).""" + + +@dataclass +class BestEffortSlots: + """The pool slots one kind of best-effort work holds at once, process-wide.""" + + limit: int + in_use: int = 0 + + +@dataclass +class BestEffortClaim: + """One best-effort task's share of its kind's slots. `refused` is set once one of its + statements found none, so a caller whose op swallowed the BusyError still knows the + answer is short.""" + + slots: BestEffortSlots + refused: bool = False + + +_best_effort_var: ContextVar[BestEffortClaim | None] = ContextVar("ch_best_effort", default=None) + + +@contextmanager +def best_effort(claim: BestEffortClaim) -> Iterator[None]: + """Every statement in this block is best effort: work a request adds beside its own + reads, such as the code ops' lead block. It takes a pool slot only when one is free at + once and its kind holds fewer than `claim.slots.limit`; otherwise it raises BusyError + before it is sent, so it never waits for a slot a request's own read could take.""" + token = _best_effort_var.set(claim) + try: + yield + finally: + _best_effort_var.reset(token) + + def _short_of_memory(op_name: str, e: BaseException) -> OverloadedError: """The 503 for a statement ClickHouse ran short of shared memory for, counted, with ClickHouse's line logged when one is due: the answer carries none of it.""" @@ -1232,6 +1270,7 @@ async def _with_retry( # type: ignore[no-untyped-def] retried batch lands once); a replica-bound server error gets up to two more connections; a class deadline and every other error raise at once.""" self._ensure_state() + held = self._hold_best_effort(op_name) session = _coordination_session.get() took = False if session is not None: @@ -1255,6 +1294,22 @@ async def _with_retry( # type: ignore[no-untyped-def] session.inflight -= 1 if took: self._release_slot() + if held is not None: + held.slots.in_use -= 1 + + def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: + """Count a statement of a `best_effort()` block against its kind's slots, or raise + BusyError, before it is sent, when they are held or the pool has no slot free at + once. None outside such a block.""" + claim = _best_effort_var.get() + if claim is None: + return None + pool = self._slots + if claim.slots.in_use >= claim.slots.limit or (pool is not None and pool.locked()): + claim.refused = True + raise BusyError(f"no ClickHouse slot free for best-effort work ({op_name})") + claim.slots.in_use += 1 + return claim async def _retry_ladder(self, op_name: str, fn, *, cls: str): # type: ignore[no-untyped-def] """`_attempts`, with a 241 against the server's or the user's memory (shared by diff --git a/server/settings/catalog.py b/server/settings/catalog.py index e6b0c47b629..ff97a8850be 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -6913,9 +6913,9 @@ class TrackerSettings(BaseModel): OP_SHAPE_BUDGETS_P99_MS: dict[str, dict[str, int]] = { # "lead" (code.grep and code.symbol): the answer with its `lead` block, whose legs # (code.callers, code.coverage_claim, code.symbol_history, run together) get what - # the budget leaves after the time spent. Priced as the base plus the 1200 ms of - # code.coverage_claim, the slowest leg without a tracker read, rounded up; a leg - # still running then says `unread: deadline`. + # the budget leaves after the time spent. Priced from the legs' declared budgets, not + # a served p99: the base plus the 1200 ms of code.coverage_claim, the slowest leg + # without a tracker read, rounded up; a leg still running then says `unread: deadline`. "code.grep": { "files": 600, "lead": 1800, @@ -6927,7 +6927,8 @@ class TrackerSettings(BaseModel): }, # A lookup ranked by the change at hand (near_paths / pr_number) reads the # PR's files and the candidates' neighbourhoods; the compact uses block adds a - # mention leg. Each is priced from its served p99. + # mention leg. Those two are priced from their served p99; `lead` (above) is + # priced from its legs' declared budgets until a served p99 replaces it. "code.symbol": { "lead": 1500, "ranked": 3000, diff --git a/server/transport/mcp_defaults.py b/server/transport/mcp_defaults.py index 5e7b68ca8a9..50cef084883 100644 --- a/server/transport/mcp_defaults.py +++ b/server/transport/mcp_defaults.py @@ -16,11 +16,13 @@ for that reply the op runs without a budget and the call's bounds the places (`server.transport.mcp_call._validated_input`). -`code.symbol` over MCP leaves out the recent PRs (about a third of a definition's -tokens): they serve a review, not a where/how lookup, and a model that wants them -passes `include_history`. The lessons stay: up to three complete memories linked to that -symbol within `code_result_lessons_tokens` (unlimited by default). `code.search`, `code.callers`, -`code.callees`, `code.impact`, `code.outline` and a task's `code.context_pack` carry +`code.symbol` over MCP leaves out each definition's `recent_prs` rows (about a third of +a definition's tokens): they serve a review, not a where/how lookup, and a model that +wants them passes `include_history`. The `lead` block still names the definition's +changing PRs, at most three with their titles and merge dates. The lessons stay: up to +three complete memories linked to that symbol within `code_result_lessons_tokens` +(unlimited by default). `code.search`, `code.callers`, `code.callees`, `code.impact`, +`code.outline` and a task's `code.context_pack` carry the memories of their top files (`server.code.app.result_lessons`): as many as fit in `code_result_lessons_tokens` (unlimited by default), each whole or left out. Coding connections also default to indexed tests with source excerpts at the definition. diff --git a/server/transport/mcp_descriptions.py b/server/transport/mcp_descriptions.py index 0c5862e734c..4a8d9febc2e 100644 --- a/server/transport/mcp_descriptions.py +++ b/server/transport/mcp_descriptions.py @@ -1380,8 +1380,8 @@ def revision_policy(update: str) -> str: "Find indexed text. Batch code and test prefixes in `pattern`. " "Path filters scope the batch. Bodies are on by default. " "Set `include_body: false` for excerpts, `context_lines: 0` for locations. " - "Bodies lead with the callers, tests and changing PRs of up to three definitions " - "(`lead: false` drops them). " + "Bodies lead with the callers, tests and changing PRs of the definition the " + "pattern names. " "Omitted match text is in its excerpt at the same path and line. " "Use code.search for behavior. " "Use literal strings or one RE2 string with `regex: true`. " @@ -1447,8 +1447,7 @@ def revision_policy(update: str) -> str: ), "code.symbol": ( "Find an exact definition by name or path:line. Leads with its callers through " - "overrides, test coverage and the PRs that changed it (`lead: false` drops them). " - "Get signature, doc comment " + "overrides, test coverage and the PRs that changed it. Get signature, doc comment " "and body, with compiler precision where SCIP is available. Includes recent " "PRs, tested usage examples and linked lessons. `example_context_lines` adds " "source around usage sites. " diff --git a/tests/integration/test_code_plane.py b/tests/integration/test_code_plane.py index f53960d0bff..76d75cc5a30 100644 --- a/tests/integration/test_code_plane.py +++ b/tests/integration/test_code_plane.py @@ -233,14 +233,12 @@ async def test_grep_returns_distinct_retained_enclosing_bodies_by_default( assert not rich.definitions_partial assert len(rich.definitions) == len({row["symbol_id"] for row in rich.definitions}) == 2 assert all("squashImpl" in row["body"] and not row["body_elided"] for row in rich.definitions) - # the bodies' definitions lead, each with its callers, coverage and history answered + # the definition the pattern names leads, with its callers, coverage and history assert not plain.lead - assert [entry["symbol"] for entry in rich.lead] == [ - row["qualified_name"] for row in rich.definitions - ] - impl = next(entry for entry in rich.lead if entry["symbol"] == "DB::Squasher::squashImpl") + (impl,) = rich.lead + assert impl["symbol"] == "DB::Squasher::squashImpl" assert any(row["caller"] == "DB::Squasher::flush" for row in impl["callers"]["top"]) - assert all("unread" not in entry[leg] for entry in rich.lead for leg in lead.LEGS) + assert all("unread" not in impl[leg] for leg in lead.LEGS) nearby = await handle_code_grep( CodeGrepInput( org=org, namespace=ns, pattern="squashImpl", context_lines=1, include_body=False diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index c8c4e0eb25a..4ef615f9883 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -4,7 +4,8 @@ dropped socket only under a per-batch deduplication token; a reconnect is a generation change that no task can trigger twice and that never closes a client under a statement still running on it; the pool has a slot gate that -fails fast with 503 OVERLOADED and reports its waiters. +fails fast with 503 OVERLOADED and reports its waiters, and best-effort work +never waits for a slot. """ from __future__ import annotations @@ -402,6 +403,55 @@ async def _watch() -> None: assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow 1"] +async def test_best_effort_work_holds_its_share_and_never_waits( + monkeypatch: pytest.MonkeyPatch, +) -> None: + """A best-effort statement (the code ops' lead block) past its kind's share is refused + at once with BusyError, before it is sent, while a request's own read still runs.""" + fake = _FakeAsync(plan={"SELECT slow": [0.3]}) + c = _client(monkeypatch, fake, ch_pool_maxsize=4, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) + slots = ch_mod.BestEffortSlots(limit=1) + first, second = ch_mod.BestEffortClaim(slots), ch_mod.BestEffortClaim(slots) + + async def _held() -> None: + with ch_mod.best_effort(first): + await c.query_all("SELECT slow") + + holder = asyncio.create_task(_held()) + await asyncio.sleep(0.02) + assert slots.in_use == 1 + with ch_mod.best_effort(second), pytest.raises(ch_mod.BusyError) as ei: + await c.query_all("SELECT refused") + assert ei.value.status_code == 503 + assert second.refused and not first.refused + await c.query_all("SELECT own") + await holder + assert slots.in_use == 0 + assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow", "SELECT own"] + + +async def test_best_effort_work_is_refused_at_once_when_the_pool_is_full( + monkeypatch: pytest.MonkeyPatch, +) -> None: + """A full pool refuses a best-effort statement without the `ch_pool_wait_ms` wait a + request's own read takes, so it never queues for the slot that read is waiting on.""" + fake = _FakeAsync(plan={"SELECT slow": [0.3]}) + c = _client(monkeypatch, fake, ch_pool_maxsize=1, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) + holder = asyncio.create_task(c.query_all("SELECT slow")) + await asyncio.sleep(0.02) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=8)) + t0 = time.perf_counter() + with ch_mod.best_effort(claim), pytest.raises(ch_mod.BusyError): + await c.query_all("SELECT refused") + assert time.perf_counter() - t0 < 0.25 + assert ch_mod.pool_reading()["waiters"] == 0 + await holder + with ch_mod.best_effort(claim): + await c.query_all("SELECT later") + assert claim.slots.in_use == 0 + assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow", "SELECT later"] + + async def test_an_open_stream_holds_no_pool_slot_and_streams_have_their_own_gate( monkeypatch: pytest.MonkeyPatch, ) -> None: diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index d27e0d7500a..88ac61e62de 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -1,11 +1,13 @@ -"""The `lead` block of code.symbol and code.grep (`server.code.app.lead`): per definition, -callers through overrides, test coverage and the PRs that changed it, compacted from -code.callers, code.coverage_claim and code.symbol_history. Every leg runs at once under -the op's `lead` budget; a leg that did not answer says why and notes a degradation.""" +"""The `lead` block of code.symbol and code.grep (`server.code.app.lead`): for one +definition, callers through overrides, test coverage and the PRs that changed it, +compacted from code.callers, code.coverage_claim and code.symbol_history. The legs run at +once under the op's `lead` budget as best-effort ClickHouse work; a leg that did not +answer says why and notes a degradation.""" from __future__ import annotations import asyncio +import math from typing import Any from unittest.mock import patch @@ -20,6 +22,7 @@ ) from server.code.api.models_testing import CodeCoverageClaimOutput from server.code.app import lead +from server.core import ch from server.observability import degradations from server.settings import settings @@ -44,24 +47,40 @@ def _edge(caller: str, path: str, line: int, **kw: Any) -> CodeEdgeWire: # ------------------------------------------------------------------ definitions -def test_the_block_covers_the_first_three_distinct_reachable_definitions(): +def test_the_block_covers_the_first_reachable_definition_with_its_id(): rows = [ - {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "kind": "function"}, - {"qualified_name": "A::f", "path": "src/a.h", "start_line": 1, "kind": "function"}, {"qualified_name": "A::k", "path": "src/a.h", "start_line": 9, "kind": "variable"}, {"qualified_name": "test_f", "path": "tests/test_a.py", "start_line": 1}, {"qualified_name": "Intro", "path": "docs/a.md", "start_line": 1, "kind": "class"}, + {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "symbol_id": "s1"}, {"qualified_name": "A::B", "path": "src/b.cpp", "start_line": 5, "kind": "class"}, - {"qualified_name": "g", "path": "src/g.py", "start_line": 7}, - {"qualified_name": "h", "path": "src/h.py", "start_line": 2, "kind": "method"}, ] assert lead.lead_definitions(rows) == [ - {"symbol": "A::f", "path": "src/a.cpp", "line": 3}, - {"symbol": "A::B", "path": "src/b.cpp", "line": 5}, - {"symbol": "g", "path": "src/g.py", "line": 7}, + {"symbol": "A::f", "path": "src/a.cpp", "line": 3, "symbol_id": "s1"}, ] +def test_the_pool_share_is_an_eighth_of_the_pool(monkeypatch): + for size, share in ((64, 8), (16, 2), (4, 1), (0, 8)): + monkeypatch.setattr(settings, "ch_pool_maxsize", size) + assert lead.lead_slots() == share + + +def test_a_leg_another_block_reads_is_left_out(): + assert lead.legs_beside(neighbours=False, brief=False) == ("callers", "tested", "changed_by") + assert lead.legs_beside(neighbours=False, brief=True) == ("tested", "changed_by") + assert lead.legs_beside(neighbours=True, brief=True) == ("changed_by",) + + +def test_the_block_is_withheld_whole_past_the_token_budget(): + block = [{"symbol": "A::f", "callers": {"count": 1}}] + tokens = lead.fit(block, 0, 0)[1] + assert tokens > 0 + assert lead.fit(block, tokens + 10, 10) == (block, tokens) + assert lead.fit(block, tokens + 10, 11) == ([], 0) + assert lead.fit([], 5, 0) == ([], 0) + + # ------------------------------------------------------------------ compaction @@ -174,7 +193,7 @@ def test_history_drops_prs_whose_diff_does_not_name_the_definition(): assert lead.changed_entry(unresolved) == {"unread": "unresolved"} -# ------------------------------------------------------------------ the wall +# ------------------------------------------------------------------ the legs class _Identity: @@ -183,74 +202,161 @@ class _Identity: _ROWS = [ - {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "kind": "function"}, - {"qualified_name": "A::g", "path": "src/a.cpp", "start_line": 9, "kind": "function"}, + {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "symbol_id": "s1"}, ] -def _legs(calls: list[tuple[str, str, str]]) -> dict[str, lead.Leg]: - async def callers(base, d): - calls.append(("callers", d["symbol"], base["consumer"])) - return {"count": 1} +class _Ops: + """The legs' handlers: each records its query, then answers, raises or hangs.""" - async def tested(base, d): - calls.append(("tested", d["symbol"], base["consumer"])) - raise RuntimeError("coverage table unavailable") + def __init__(self, **behaviour: Any) -> None: + self.queries: dict[str, Any] = {} + self.behaviour = behaviour + self.models = {op: model for op, (model, _h) in lead._ops().items()} - async def changed_by(base, d): - calls.append(("changed_by", d["symbol"], base["consumer"])) - await asyncio.sleep(30) - return {"prs": 1} + def __call__(self) -> dict[str, tuple[Any, Any]]: + real = { + "code.callers": (CodeCallersOutput, {"edges": [], "seed_symbols": []}), + "code.coverage_claim": (CodeCoverageClaimOutput, {"verdict": "unknown"}), + "code.symbol_history": (CodeSymbolHistoryOutput, {}), + } - return {"callers": callers, "tested": tested, "changed_by": changed_by} + def handler(op: str) -> Any: + async def run(query: Any) -> Any: + self.queries[op] = query + how = self.behaviour.get(op) + if isinstance(how, BaseException): + raise how + if how == "hang": + await asyncio.sleep(30) + if callable(how): + return how(query) + out_model, fields = real[op] + return out_model(**fields) + return run + + return {op: (self.models[op], handler(op)) for op in real} -def test_a_leg_past_the_wall_or_failed_says_so_and_notes_a_degradation(monkeypatch): - calls: list[tuple[str, str, str]] = [] - monkeypatch.setattr(lead, "LEGS", _legs(calls)) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 0.2) + +def _run_leads(monkeypatch, ops: _Ops, *, wall: float = 5.0, **kw: Any) -> tuple[Any, list[str]]: + monkeypatch.setattr(lead, "_ops", ops) + monkeypatch.setattr(lead, "wall_s", lambda op, started: wall) async def go() -> tuple[list[dict[str, Any]], list[str]]: degradations.begin() - out = await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + out = await lead.definition_leads( + kw.pop("op_name", "code.symbol"), "o", "n", _Identity(), _ROWS, started=0, **kw + ) return out, degradations.current() - out, notes = asyncio.run(go()) - assert len(calls) == 6, "every leg of every definition starts at once" - assert {c[2] for c in calls} == {"symbol_lead"} - assert [e["symbol"] for e in out] == ["A::f", "A::g"] - for entry in out: - assert list(entry) == ["symbol", "path", "line", "callers", "tested", "changed_by"] - assert entry["callers"] == {"count": 1} - assert entry["tested"] == {"unread": "failed"} - assert entry["changed_by"] == {"unread": "deadline"} + return asyncio.run(go()) + + +def test_the_legs_read_the_definition_by_id_as_the_ops_lead_consumer(monkeypatch): + ops = _Ops() + out, notes = _run_leads(monkeypatch, ops) + callers, coverage, history = ( + ops.queries[op] for op in ("code.callers", "code.coverage_claim", "code.symbol_history") + ) + assert (callers.symbol_id, callers.name, callers.depth) == ("s1", "", 1) + assert (history.symbol_id, history.name) == ("s1", "") + assert coverage.symbol == "A::f" + assert {q.consumer for q in ops.queries.values()} == {"symbol_lead"} + (entry,) = out + assert list(entry) == ["symbol", "path", "line", "callers", "tested", "changed_by"] + assert entry["callers"]["count"] == 0 and entry["tested"]["verdict"] == "unknown" + assert notes == [] + + +def test_a_leg_past_the_wall_or_failed_says_so_and_notes_a_degradation(monkeypatch): + ops = _Ops(**{"code.coverage_claim": RuntimeError("down"), "code.symbol_history": "hang"}) + out, notes = _run_leads(monkeypatch, ops, wall=0.2) + (entry,) = out + assert entry["tested"] == {"unread": "failed"} + assert entry["changed_by"] == {"unread": "deadline"} assert notes == [ "code.symbol: lead_tested_unread (RuntimeError)", "code.symbol: lead_changed_by_unread (deadline)", ] + assert lead.unread_of(out) == "tested:failed,changed_by:deadline" -def test_no_time_left_starts_no_leg(monkeypatch): - calls: list[tuple[str, str, str]] = [] - monkeypatch.setattr(lead, "LEGS", _legs(calls)) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 0.0) +def test_a_leg_with_no_slot_free_reads_busy_even_when_its_op_swallowed_it(monkeypatch): + def swallowed(query: Any) -> Any: + # an op that caught the BusyError and answered without the read + claim = ch._best_effort_var.get() + assert claim is not None + claim.refused = True + return CodeCoverageClaimOutput(verdict="unknown") - out = asyncio.run( - lead.definition_leads("code.grep", "o", "n", _Identity(), _ROWS[:1], started=0) - ) - assert calls == [] + ops = _Ops(**{"code.callers": ch.BusyError("full"), "code.coverage_claim": swallowed}) + out, notes = _run_leads(monkeypatch, ops) + assert out[0]["callers"] == out[0]["tested"] == {"unread": "busy"} + assert notes == [ + "code.symbol: lead_callers_unread (busy)", + "code.symbol: lead_tested_unread (busy)", + ] + + +def test_a_leg_the_history_policy_denies_reads_policy(monkeypatch): + from server.identity.app import policy_gate + from server.identity.domain.policy_rules import PolicyDecision + + gated: list[tuple[str, dict[str, Any]]] = [] + + async def gate(op, identity, raw_args, *, request_id=""): + gated.append((op.name, identity)) + if op.name == "code.symbol_history": + denied = PolicyDecision("deny", ["r"], [], [], enforcing_rules=["r"]) + raise policy_gate.PolicyForbiddenError("denied", denied) + + monkeypatch.setattr(policy_gate, "gate", gate) + out, notes = _run_leads(monkeypatch, _Ops()) + assert {name for name, _ in gated} == { + "code.callers", + "code.coverage_claim", + "code.symbol_history", + } + assert all(i["org"] == "o" and i["namespace"] == "n" and i["agent"] == "a" for _, i in gated) + assert out[0]["changed_by"] == {"unread": "policy"} + assert "callers" in out[0] and "unread" not in out[0]["callers"] + assert notes == ["code.symbol: lead_changed_by_unread (policy)"] + + +def test_the_legs_statements_stop_near_the_wall_outside_caller_shaped_ceilings(monkeypatch): + seen: dict[str, dict[str, Any]] = {} + + def record(query: Any) -> Any: + seen["settings"] = ch.statement_settings("SELECT 1", {}, cls="read") + return CodeCallersOutput(edges=[], seed_symbols=[]) + + monkeypatch.setattr(settings, "ch_caller_shaped_max_execution_s", 5.0) + ops = _Ops(**{"code.callers": record}) + with ch.caller_shaped(): + _run_leads(monkeypatch, ops, wall=0.5) + assert seen["settings"]["max_execution_time"] == pytest.approx(0.75) + assert "read_overflow_mode" not in seen["settings"] + + +def test_only_the_legs_asked_for_run(monkeypatch): + ops = _Ops() + out, _ = _run_leads(monkeypatch, ops, legs=("changed_by",)) + assert set(ops.queries) == {"code.symbol_history"} + assert list(out[0]) == ["symbol", "path", "line", "changed_by"] + + +def test_no_time_left_starts_no_leg(monkeypatch): + ops = _Ops() + out, _ = _run_leads(monkeypatch, ops, wall=0.0, op_name="code.grep") + assert ops.queries == {} assert out[0]["callers"] == out[0]["tested"] == out[0]["changed_by"] == {"unread": "deadline"} def test_a_caller_deadline_caps_the_wall(monkeypatch): - calls: list[tuple[str, str, str]] = [] - monkeypatch.setattr(lead, "LEGS", _legs(calls)) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 60.0) - - out = asyncio.run( - lead.definition_leads("code.grep", "o", "n", _Identity(), _ROWS[:1], started=0, cap_s=0.1) - ) - assert {c[2] for c in calls} == {"grep_lead"} + ops = _Ops(**{"code.symbol_history": "hang"}) + out, _ = _run_leads(monkeypatch, ops, wall=60.0, op_name="code.grep", cap_s=0.1) + assert {q.consumer for q in ops.queries.values()} == {"grep_lead"} assert out[0]["changed_by"] == {"unread": "deadline"} @@ -322,6 +428,15 @@ async def edges_for_symbols(self, org, ns, ids, **_kw): async def test_map_for(self, org, ns, paths, **_kw): return [] + async def test_files_calling(self, org, ns, names, **_kw): + return [] + + async def call_misses_for_names(self, org, ns, names): + return {} + + async def live_call_misses_for_names(self, org, ns, names, **_kw): + return {} + @pytest.fixture def _intel_on(monkeypatch): @@ -330,22 +445,28 @@ def _intel_on(monkeypatch): monkeypatch.setattr(settings, "code_namespace", "n") +def _recorder(seen: list[dict[str, Any]]) -> Any: + async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf, legs=()): + seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows], "legs": legs}) + seen[-1]["cap_s"] = cap_s + first = rows[0] + return [{"symbol": first["qualified_name"], "callers": {"count": 2, "top": []}}] + + return leads + + def _symbol(monkeypatch, *, edit: bool = False, **fields: Any) -> tuple[Any, list[Any], str]: from server.code.api.models_symbol import CodeEditContextInput, CodeSymbolInput from server.code.app.symbol import outline from server.code.app.symbol import symbol as h from server.observability.budget_shape import current_budget_shape - seen: list[Any] = [] - - async def leads(op_name, org, ns, identity, rows, *, started, cap_s=0): - seen.append((op_name, [r["qualified_name"] for r in rows])) - return [{"symbol": rows[0]["qualified_name"], "callers": {"count": 2}}] + seen: list[dict[str, Any]] = [] async def body(r, org, ns, sym): return f"" - monkeypatch.setattr(lead, "definition_leads", leads) + monkeypatch.setattr(lead, "definition_leads", _recorder(seen)) async def go() -> tuple[Any, str]: with ( @@ -376,10 +497,12 @@ async def go() -> tuple[Any, str]: @pytest.mark.usefixtures("_intel_on") def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar") - assert seen == [("code.symbol", ["DB::Foo::bar"])] + assert [(s["op"], s["rows"], s["legs"]) for s in seen] == [ + ("code.symbol", ["DB::Foo::bar"], ("callers", "tested", "changed_by")), + ] dump = out.model_dump() assert list(dump)[0] == "lead" - assert dump["lead"] == [{"symbol": "DB::Foo::bar", "callers": {"count": 2}}] + assert dump["lead"] == [{"symbol": "DB::Foo::bar", "callers": {"count": 2, "top": []}}] assert shape == lead.LEAD_SHAPE @@ -391,40 +514,112 @@ def test_lead_false_and_the_edit_read_run_no_leg(monkeypatch): assert seen == [] and "lead" not in out.model_dump() -def _grep_lead( - monkeypatch, *, offset: int = 0, related: str = "", **fields: Any -) -> tuple[Any, list[Any]]: +@pytest.mark.usefixtures("_intel_on") +def test_code_symbol_reads_no_leg_its_other_blocks_read(monkeypatch): + _, seen, _ = _symbol(monkeypatch, name="DB::Foo::bar", neighbours=True) + assert seen[0]["legs"] == ("changed_by",) + _, seen, _ = _symbol(monkeypatch, name="DB::Foo::bar", uses_brief=True) + assert seen[0]["legs"] == ("tested", "changed_by") + + +@pytest.mark.usefixtures("_intel_on") +def test_a_token_budget_the_block_does_not_fit_withholds_it(monkeypatch): + tokens = lead.fit([{"symbol": "DB::Foo::bar", "callers": {"count": 2, "top": []}}], 0, 0)[1] + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=tokens - 1) + assert len(seen) == 1 and "lead" not in out.model_dump() and shape == "" + assert out.tokens_returned <= tokens - 1 + out, _, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=600) + assert "lead" in out.model_dump() and shape == lead.LEAD_SHAPE + assert out.tokens_returned <= 600 + + +def _grep(monkeypatch, **fields: Any) -> tuple[Any, list[dict[str, Any]], str]: + """code.grep through its handler over the scan fixture, with two enclosing bodies of + the match: the first one holds it, the second one is the definition it names.""" from server.code.app import grep + from server.code.store.index import CodeRepo + from server.observability.budget_shape import current_budget_shape + from tests.unit.test_code_grep_scan import _CH, NS, ORG - seen: list[Any] = [] - - async def leads(op_name, org, ns, identity, rows, *, started, cap_s=0): - seen.append((op_name, [r["qualified_name"] for r in rows], cap_s)) - return [{"symbol": rows[0]["qualified_name"]}] - - monkeypatch.setattr(lead, "definition_leads", leads) - bodies = {"definitions": [dict(_DEF)]} - if fields.pop("no_bodies", False): - bodies = {} - out = asyncio.run( - grep._grep_lead( - "o", - "n", - CodeGrepInput(org="o", namespace="n", pattern="bar", **fields), - bodies, - 0.0, - None, - offset, - related, - ) - ) - return out, seen + monkeypatch.setattr(settings, "code_intel_enabled", True) + monkeypatch.setattr(settings, "code_org", ORG) + monkeypatch.setattr(settings, "code_namespace", NS) + seen: list[dict[str, Any]] = [] + monkeypatch.setattr(lead, "definition_leads", _recorder(seen)) + + def _body(name: str, qualified: str, start: int, line: int) -> dict[str, Any]: + return { + "symbol": name, + "qualified_name": qualified, + "symbol_id": qualified, + "kind": "function", + "tier": "treesitter", + "path": "src/B.cpp", + "start_line": start, + "end_line": start + 4, + "body": "parseInput(x); // cannot parse input", + "lines": [line], + } + + async def bodies(input, matches, budget, **kw): + if not input.include_body: + return {} + return { + "definitions": [ + _body("h", "B::h", 105, 105), + _body("parseInput", "B::parseInput", 1, 2), + ] + } + + async def _empty(*a, **k): + return {} + async def go() -> tuple[Any, str]: + with ( + patch.object(grep, "CodeRepo", return_value=CodeRepo(_CH())), + patch.object(grep, "index_as_of", new=_empty), + patch.object(grep, "definitions_for", new=bodies), + ): + out = await grep.handle_code_grep( + CodeGrepInput(org=ORG, namespace=NS, pattern="parseInput", **fields) + ) + return out, current_budget_shape() + + out, shape = asyncio.run(go()) + return out, seen, shape + + +def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): + out, seen, shape = _grep(monkeypatch) + assert [(s["op"], s["rows"], s["legs"]) for s in seen] == [ + ("code.grep", ["B::parseInput", "B::h"], ("callers", "tested", "changed_by")), + ] + assert seen[0]["cap_s"] == math.inf + dump = out.model_dump() + assert list(dump)[0] == "lead" and dump["lead"][0]["symbol"] == "B::parseInput" + assert shape == lead.LEAD_SHAPE + + +def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkeypatch): + _, seen, _ = _grep(monkeypatch, deadline_ms=5000, neighbours=True) + assert 0 < seen[0]["cap_s"] <= 5.0 - lead.RESERVE_S + assert seen[0]["legs"] == ("changed_by",) + + +def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): + for kw in ({"lead": False}, {"include_body": False}): + out, seen, shape = _grep(monkeypatch, **kw) + assert seen == [] and "lead" not in out.model_dump() and shape == "", kw + + +def test_code_grep_leads_no_continuation_or_related_answer(monkeypatch): + from server.code.app import grep -def test_code_grep_leads_a_first_page_with_its_definitions(monkeypatch): - out, seen = _grep_lead(monkeypatch) - assert out == [{"symbol": "DB::Foo::bar"}] - assert seen == [("code.grep", ["DB::Foo::bar"], float("inf"))] - for kw in ({"offset": 10}, {"related": "bar"}, {"lead": False}, {"no_bodies": True}): - out, seen = _grep_lead(monkeypatch, **kw) - assert out == [] and seen == [], kw + seen: list[dict[str, Any]] = [] + monkeypatch.setattr(lead, "definition_leads", _recorder(seen)) + bodies = {"definitions": [dict(_DEF, symbol="bar")]} + query = CodeGrepInput(org="o", namespace="n", pattern="bar") + for offset, related in ((10, ""), (0, "bar")): + args = ("o", "n", query, bodies, 0.0, None, offset, related) + assert asyncio.run(grep._grep_lead(*args)) == [] + assert seen == [] From d9e8d69069daf7bb42cf879515fbf458f462c7b8 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 01:42:56 +0530 Subject: [PATCH 03/30] The lead's legs leave shared work outside their lane and add a few hundred ms The best-effort lane now carries the wall's deadline, so a leg's statements stop near the wall on ClickHouse and in the client. Work a leg starts for others leaves the lane and that deadline: a grant-cache load other requests join, and tasks from TaskSet.spawn and create_deferred_task (`ch.shared_context`). A statement_timeout() around the block, such as a lease's bound, still reaches them. The history policy gate runs before the leg enters the lane and runs to its end when the wall cancels the leg, so a flush of the process's queued events is never cut. The `lead` budgets are the op's own plus a few hundred ms: code.symbol 600 ms, code.grep 1000 ms. They are priced, not measured, and the budget overrides raise them. When no leg can start, the block is left out and nothing is noted. code.symbol fits the block after the first definition's card and leaves it out when the answer does not serve its definition. code.grep picks the definition whose name the pattern holds as a whole identifier. The lead module handles one definition only, sizes its pool share once and retrieves a leg that raised after its call was cancelled. The assistant's first code lookup sends lead: false, and a test requires every caller inside Loom to pass `lead`. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 9 + docs/features/code-index/operations.md | 30 ++-- server/assistant/domain/context.py | 2 + server/code/app/grep.py | 7 +- server/code/app/lead.py | 183 +++++++++++--------- server/code/app/symbol/symbol.py | 23 ++- server/code/domain/units.py | 8 +- server/core/background.py | 15 +- server/core/ch.py | 30 +++- server/core/grant_cache.py | 9 +- server/settings/catalog.py | 14 +- server/transport/mcp_descriptions.py | 6 +- tests/unit/test_ch_client_hygiene.py | 39 +++++ tests/unit/test_code_grep_scan.py | 2 +- tests/unit/test_code_lead.py | 224 +++++++++++++++++++++---- tests/unit/test_shape_budgets.py | 6 +- 16 files changed, 453 insertions(+), 154 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 53a5ac28b4b..07223ed6410 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -874,6 +874,15 @@ errors get the one reconnect-retry. A statement that gets no pool slot within `LOOM_CH_POOL_WAIT_MS` fails with 503 `OVERLOADED` (`LOOM_CH_POOL_MAXSIZE` slots per process). +Best-effort work a request adds beside its own reads, such as the code ops' `lead` +block, runs in a lane of its own (`best_effort()`). Its statements hold at most their +kind's share of the pool (an eighth of `LOOM_CH_POOL_MAXSIZE` for the `lead` block) and +never wait for a slot: a statement past the share, or one that finds no slot free at +once, raises `BusyError` before it is sent and the work reads as not done. The lane's +deadline bounds each of its statements like a `statement_timeout()`. Work such a block +starts for others (a load other requests join, a deferred write, a flush of the +process's queued events) runs outside the lane and its deadline (`shared_context()`). + Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` (`production`, `interactive`, `bench`, `background`): `priority`, `max_threads`, and for background work a filesystem-cache bypass. They apply only to `SELECT`/`WITH` and never diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index a2fc86410c4..e7525fd19e7 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -92,9 +92,11 @@ underscores. Toolsets: [MCP reference](../../reference/mcp.md#toolsets). `code.symbol` and `code.grep` start their answer with a `lead` block: what a text search cannot answer about the definition they found. It covers one -definition outside test files and documents: for `code.symbol` the first one -served, for `code.grep` the enclosing definition of a first page's bodies that -the pattern names, else the first. Its entry carries `symbol`, `path` and +definition outside test files and documents. For `code.symbol` it is the first +definition the name resolves to, and the block is left out when the answer does +not serve that definition (`min_fan_in`, `token_budget`). For `code.grep` it is +the enclosing definition of a first page's bodies whose name the pattern holds +as a whole identifier, else the first. Its entry carries `symbol`, `path` and `line` and three answers: | Key | From | Holds | @@ -107,10 +109,17 @@ The three answers run at once: in `code.symbol` beside the op's own reads, in `code.grep` once the page's reads are done. Each passes the history policy gate its op has. They share what the op's `lead` latency budget leaves after the time already spent (under `deadline_ms`, at most the caller's deadline), and -ClickHouse stops their statements soon after. The block is best effort: its -statements hold at most an eighth of the server's ClickHouse pool -(`ch_pool_maxsize`) and never wait for a slot. An answer that does not come back -reads `{"unread": why}`, and the rest of the response is served: +ClickHouse stops their statements soon after. The `lead` budget is the op's own +plus a few hundred milliseconds: 600 ms for `code.symbol` and 1000 ms for +`code.grep`. These values are not measured. They let `code.callers` answer in +the common case, while `code.coverage_claim` and `code.symbol_history` answer +when they are fast and read `deadline` otherwise. A deployment whose answers need +longer raises the op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example +`{"code.symbol": "2x"}`, which scales the `lead` budget too) or +`POST /v1/admin/budget.set`. The block is best effort: its statements hold at +most an eighth of the server's ClickHouse pool (`ch_pool_maxsize`) and never +wait for a slot. An answer that does not come back reads `{"unread": why}`, and +the rest of the response is served: | `unread` | Why | | ------------ | --------------------------------------------------------- | @@ -123,9 +132,10 @@ reads `{"unread": why}`, and the rest of the response is served: An answer another block of the same response reads is left out: with `neighbours`, the `callers` and `tested` keys; with a `uses_brief` block, `callers`. A -`token_budget` the block does not fit beside the uses block withholds it whole. -`lead: false` leaves the block out. `code.edit_context` has no `lead` block; it -reads the definition's tests itself. +`token_budget` the block does not fit beside the uses block and the first +definition's card withholds it whole. When no answer can start in time the +block is left out. `lead: false` leaves the block out. `code.edit_context` has +no `lead` block; it reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For example, `["parse(", "parse_async("]` matches both fragments without escaping diff --git a/server/assistant/domain/context.py b/server/assistant/domain/context.py index f30e8378c01..106b07d6d3e 100644 --- a/server/assistant/domain/context.py +++ b/server/assistant/domain/context.py @@ -27,6 +27,8 @@ def initial(question: str) -> list[tuple[str, dict[str, object]]]: "name": named[1].split("(", 1)[0], "include_history": False, "include_examples": False, + # the first answer opens the prompt: no wait for the lead's legs + "lead": False, }, ) ] diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 60e3cda25f0..50639190b2e 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -737,8 +737,8 @@ async def _grep_lead( caller's `deadline_ms` leave less the reserve for the lessons read after the handler. A definition the pattern names leads before one that only holds a match. [] on a continuation page (`offset`), a related answer (`related_pattern`), a page without - bodies, or `lead: false`; the `neighbours` block's callers and tests are not read - twice.""" + bodies, `lead: false`, or when no leg started; the `neighbours` block's callers and + tests are not read twice.""" definitions = bodies.get("definitions") or [] if not (input.lead and definitions) or offset or related_pattern: return [] @@ -746,8 +746,7 @@ async def _grep_lead( from server.observability.budget_shape import note_budget_shape patterns = [input.pattern] if isinstance(input.pattern, str) else input.pattern - named = [r for r in definitions if r.get("symbol") and any(r["symbol"] in p for p in patterns)] - rows = named + [r for r in definitions if r not in named] + rows = code_lead.named_first(definitions, patterns) cap_s = budget.left_ms() / 1000.0 - code_lead.RESERVE_S if budget is not None else math.inf legs = code_lead.legs_beside(neighbours=bool(input.neighbours), brief=False) with code_span("grep.lead", results=len(definitions)): diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 107ef985bf3..34be5218ac8 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -14,17 +14,21 @@ op, so the numbers are the ones the op gives and its trace row is attributable. The callers and history legs read the definition by its symbol id. -The block is best effort and never competes with the request's own reads: +The block is best effort, and its share of the request's resources is bounded: -- One definition, so a call runs at most three legs (`LEAD_DEFINITIONS`). +- One definition, so a call runs at most three legs. - Its statements hold at most `lead_slots()` ClickHouse pool slots between them, process-wide, and never wait for one (`server.core.ch.best_effort`): a leg that finds none free reads `unread: busy`. - The legs share one wall: what the op's latency budget for its `lead` shape leaves after the time already spent, less a reserve for the rest of the answer. Each statement is - bounded near the wall on the server (`statement_timeout`), so a leg cancelled at the - wall does not keep ClickHouse working; a cancelled leg reads `unread: deadline`, one - that raised `unread: failed`. + bounded near the wall on the server and in the client (the lane's deadline), so a leg + cancelled at the wall does not keep ClickHouse working; a cancelled leg reads + `unread: deadline`, one that raised `unread: failed`. +- The policy gate runs outside the lane and its deadline, and runs to its end when the + wall cancels its leg: it may flush the process's queued events, which are every + request's. Work a leg starts for others (a shared load, a deferred write) leaves the + lane too (`server.core.ch.shared_context`). - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. A leg that did not answer is noted on the request's degradations and named in the @@ -35,20 +39,25 @@ from __future__ import annotations import asyncio +import functools import logging import math +import re import time from collections.abc import Awaitable, Callable, Iterator from contextlib import contextmanager from typing import Any +from server.code.api.models_grep import CodeGrepInput +from server.code.api.models_symbol import CodeSymbolInput from server.code.app.spans import code_span from server.code.app.symbol.neighbours import is_doc_path from server.code.domain.index.test_gate import is_test_path -from server.code.domain.units import estimate_json_tokens +from server.code.domain.units import estimate_json_tokens, head_tokens from server.core import ch, request_work from server.core.errors import NotFoundError from server.core.logging_config import request_id_var +from server.core.shielded import shielded from server.observability import degradations from server.observability.budgets import effective_budget_ms from server.settings import settings @@ -56,12 +65,8 @@ logger = logging.getLogger(__name__) -# The budget shape a request that served the block is priced by (OP_SHAPE_BUDGETS_P99_MS). +# The budget shape a request whose legs ran is priced by (OP_SHAPE_BUDGETS_P99_MS). LEAD_SHAPE = "lead" -# Definitions the block covers. One: an exact name resolves one definition in the common -# case, and the other definitions an answer lists are a call away by path:line; each more -# would add three legs and their statements to every call. -LEAD_DEFINITIONS = 1 # Rows per leg: where to look first; the counts carry the totals. LEAD_ROWS = 3 # Callers one hop reads before it says `truncated` (code.callers' `max_nodes`). @@ -96,8 +101,7 @@ # than the index's answer about the name (`ambiguous`, `unresolved`). _DEGRADED = frozenset({"deadline", "failed", "busy", "policy"}) -# The pool slots the lead's statements hold between them, process-wide. -_SLOTS = ch.BestEffortSlots(limit=0) +Identity = CodeSymbolInput | CodeGrepInput def lead_slots() -> int: @@ -108,32 +112,40 @@ def lead_slots() -> int: return max(1, size // 8) if size > 0 else 8 -def lead_definitions(rows: list[dict[str, Any]]) -> list[dict[str, Any]]: - """The first `LEAD_DEFINITIONS` distinct qualified names of `rows` (resolved symbol - rows or a grep page's enclosing definitions) that a caller, a test or a PR can reach, - each with its symbol id when the row has one.""" - out: list[dict[str, Any]] = [] - seen: set[str] = set() +@functools.cache +def _slots() -> ch.BestEffortSlots: + """The lead's share of the pool, sized once: the pool's size is read at startup.""" + return ch.BestEffortSlots(limit=lead_slots()) + + +def lead_definition(rows: list[dict[str, Any]]) -> dict[str, Any] | None: + """The first of `rows` (resolved symbol rows or a grep page's enclosing definitions) + that a caller, a test or a PR can reach, with its symbol id when the row has one.""" for r in rows: name = str(r.get("qualified_name") or "") path = str(r.get("path") or "") kind = str(r.get("kind") or "function") - if not name or name in seen or kind not in LEAD_KINDS: - continue - if is_test_path(path) or is_doc_path(path): - continue - seen.add(name) - out.append( - { + if name and kind in LEAD_KINDS and not (is_test_path(path) or is_doc_path(path)): + return { "symbol": name, "path": path, "line": int(r.get("start_line") or 0), "symbol_id": str(r.get("symbol_id") or ""), } - ) - if len(out) >= LEAD_DEFINITIONS: - break - return out + return None + + +def named_first(rows: list[dict[str, Any]], patterns: list[str]) -> list[dict[str, Any]]: + """`rows` (enclosing definitions, each with its short name as `symbol`) with those a + pattern names as a whole identifier first: `read_all` for `reader.read_all(`, not + `read`.""" + + def named(r: dict[str, Any]) -> bool: + name = str(r.get("symbol") or "") + word = re.compile(rf"(? float: @@ -302,43 +314,48 @@ async def _policy(op: str, query: Any) -> None: await gate(OPERATIONS_BY_NAME[op], identity, raw_args, request_id=request_id_var.get() or "") -async def _leg(name: str, base: dict[str, Any], d: dict[str, Any]) -> dict[str, Any]: +async def _leg( + name: str, base: dict[str, Any], d: dict[str, Any], deadline_s: float +) -> dict[str, Any]: from server.identity.app.policy_gate import PolicyForbiddenError op, fields, compact = LEGS[name] model, handler = _ops()[op] query = model(**base, **fields(d)) - claim = ch.BestEffortClaim(_SLOTS) - with code_span(f"lead.{name}"), ch.best_effort(claim): + claim = ch.BestEffortClaim(_slots(), deadline_s=deadline_s) + with code_span(f"lead.{name}"): try: - await _policy(op, query) - out = await handler(query) + # outside the lane, and to its end if the wall cancels the leg: the gate + # may flush every request's queued events + await shielded(_policy(op, query), name=f"lead-{name}-policy") + with ch.best_effort(claim): + out = await handler(query) except ch.BusyError: return {"unread": "busy"} except PolicyForbiddenError: return {"unread": "policy"} except NotFoundError: return {"unread": "unresolved"} - # an op that swallowed the refusal answered short + # An op that swallowed a refused read answers as if the read found nothing (no + # callers, untested), so its answer is not shown. return {"unread": "busy"} if claim.refused else compact(out) @contextmanager -def _leg_scope(wall: float) -> Iterator[None]: - """The context the legs start in, which their tasks copy: every statement bounded - near the wall on the server, and outside a caller-shaped block (code.grep's), since - the legs run their ops' own reads, not ones the caller's pattern shapes.""" +def _unshaped() -> Iterator[None]: + """The context the legs start in, which their tasks copy: outside a caller-shaped + block (code.grep's), since the legs run their ops' own reads, not ones the caller's + pattern shapes.""" shaped = ch.caller_shaped_var.set(False) try: - with ch.statement_timeout(wall + _MARGIN_S): - yield + yield finally: ch.caller_shaped_var.reset(shaped) -def _answer(task: asyncio.Future[dict[str, Any]] | None) -> tuple[dict[str, Any], str]: +def _answer(task: asyncio.Future[dict[str, Any]]) -> tuple[dict[str, Any], str]: """(the leg's entry, why it did not answer when that is a degradation, else '').""" - if task is None or task.cancelled(): + if task.cancelled(): return {"unread": "deadline"}, "deadline" error = task.exception() if error is not None: @@ -349,6 +366,12 @@ def _answer(task: asyncio.Future[dict[str, Any]] | None) -> tuple[dict[str, Any] return entry, unread if unread in _DEGRADED else "" +def _retrieved(task: asyncio.Future[Any]) -> None: + # read here, so a leg that raised after its call was cancelled is not logged as lost + if not task.cancelled(): + task.exception() + + def legs_beside(*, neighbours: bool, brief: bool) -> tuple[str, ...]: """The legs to read beside an answer's other blocks: the neighbours block already lists the definition's callers and tests, the uses brief its callers, so the lead leaves @@ -357,15 +380,28 @@ def legs_beside(*, neighbours: bool, brief: bool) -> tuple[str, ...]: return tuple(name for name in LEGS if name not in skip) -def fit(lead: list[dict[str, Any]], token_budget: int, spent: int) -> tuple[list[Any], int]: - """The block and its tokens within `token_budget` (0 = none) after `spent`: withheld - whole when it does not fit, as the uses brief is, so the answer stays in budget.""" +def fit( + lead: list[dict[str, Any]], units: list[Any], token_budget: int, spent: int +) -> tuple[list[Any], int]: + """The block and its tokens within `token_budget` (0 = none) after `spent` and the + card of the first of `units` (the definitions before the budget trims them): withheld + whole when it does not fit, as the uses brief is, so it never takes a definition's + place; [] when the answer does not serve its definition (`served`).""" + lead = served(lead, units) tokens = estimate_json_tokens(lead) if lead else 0 - if token_budget and spent + tokens > token_budget: + card = head_tokens(units[0]) if token_budget and units else 0 + if token_budget and spent + card + tokens > token_budget: return [], 0 return lead, tokens +def served(lead: list[dict[str, Any]], units: list[Any]) -> list[dict[str, Any]]: + """The block when the answer serves its definition, else []: the legs start with the + body reads, before `min_fan_in` and `token_budget` pick the definitions served.""" + at = [(e["symbol"], e["path"], e["line"]) for e in lead] + return lead if any((u.symbol, u.path, u.start_line) in at for u in units) else [] + + def unread_of(lead: list[dict[str, Any]]) -> str: """The legs of `lead` that did not answer, `leg:why` comma-joined in leg order, for the trace row and the span; '' when every leg answered.""" @@ -382,22 +418,22 @@ async def definition_leads( op_name: str, org: str, ns: str, - identity: Any, + identity: Identity, rows: list[dict[str, Any]], *, started: float, cap_s: float = math.inf, legs: tuple[str, ...] = tuple(LEGS), ) -> list[dict[str, Any]]: - """The block for `rows`: one entry per `lead_definitions` row with each of `legs`' + """The block for `rows`: one entry, for their `lead_definition`, with each of `legs`' answer (a leg another block of the same answer already reads is left out by the - caller). `identity` carries the request's `agent` and `user_id`; `cap_s` is a - caller's own deadline. Never raises but on cancellation, which cancels every leg.""" - picked = lead_definitions(rows) - if not picked or not legs: - return [] + caller); [] when no leg starts. `identity` is the op's input, whose `agent` and + `user_id` the legs carry; `cap_s` is a caller's own deadline. Never raises but on + cancellation, which cancels every leg.""" + picked = lead_definition(rows) wall = min(wall_s(op_name, started), cap_s) - _SLOTS.limit = lead_slots() + if picked is None or not legs or wall <= 0: + return [] base = { "org": org, "namespace": ns, @@ -405,29 +441,20 @@ async def definition_leads( "user_id": identity.user_id, "consumer": f"{op_name.removeprefix('code.')}_lead", } - tasks: dict[tuple[int, str], asyncio.Future[dict[str, Any]]] = {} - if wall > 0: - with _leg_scope(wall): - for i, d in enumerate(picked): - for name in legs: - tasks[(i, name)] = asyncio.ensure_future(_leg(name, base, d)) + tasks: dict[str, asyncio.Future[dict[str, Any]]] = {} + with _unshaped(): + for name in legs: + tasks[name] = asyncio.ensure_future(_leg(name, base, picked, wall + _MARGIN_S)) + tasks[name].add_done_callback(_retrieved) try: - if tasks: - await asyncio.wait(tasks.values(), timeout=wall) + await asyncio.wait(tasks.values(), timeout=wall) finally: for task in tasks.values(): task.cancel() - if tasks: - await asyncio.gather(*tasks.values(), return_exceptions=True) - unread: dict[str, str] = {} - out: list[dict[str, Any]] = [] - for i, d in enumerate(picked): - entry = {k: d[k] for k in ("symbol", "path", "line")} - for name in legs: - entry[name], why = _answer(tasks.get((i, name))) - if why: - unread.setdefault(name, why) - out.append(entry) - for name, why in unread.items(): - degradations.note(op_name, f"lead_{name}_unread", why, health=False) - return out + await asyncio.gather(*tasks.values(), return_exceptions=True) + entry = {k: picked[k] for k in ("symbol", "path", "line")} + for name, task in tasks.items(): + entry[name], why = _answer(task) + if why: + degradations.note(op_name, f"lead_{name}_unread", why, health=False) + return [entry] diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index 7f9500301ed..b65fc32ef61 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -657,6 +657,7 @@ async def _edit_context_for_target( **input.model_dump(exclude={"name", "clues", "names", "include_related_source"}), name=target.name, include_history=False, + lead=False, test_examples_only=True, example_context_lines=EDIT_TEST_CONTEXT_LINES, ), @@ -1045,17 +1046,20 @@ async def handle_code_symbol( from server.code.domain.units import estimate_json_tokens, remaining_token_budget - # the compact block and the lead are budgeted before the bodies are trimmed + # the compact block and the lead are budgeted before the bodies are trimmed, the + # lead after the first definition's card uses_tokens = estimate_json_tokens(brief) if brief else 0 brief_omitted = bool(input.token_budget and uses_tokens > input.token_budget) if brief_omitted: brief, uses_tokens = {}, 0 - lead, lead_tokens = code_lead.fit(lead, input.token_budget, uses_tokens) + ran = lead + lead, lead_tokens = code_lead.fit(lead, units, input.token_budget, uses_tokens) with code_span("symbol.budget"): budgeted, tokens, lessons_left_out = _budget_definitions( units, remaining_token_budget(input.token_budget, uses_tokens + lead_tokens) ) - tokens += uses_tokens + lead_tokens + lead = code_lead.served(lead, budgeted) + tokens += uses_tokens + (lead_tokens if lead else 0) if documented_in: tokens += estimate_json_tokens(documented_in) tokens += block_tokens @@ -1084,7 +1088,7 @@ async def handle_code_symbol( ) if matched_members: route = "edit_context_members" - shape = _served_shape(input, brief, lead) + shape = _served_shape(input, brief, ran) note_budget_shape(shape) tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 trace_run_id = _symbol_trace( @@ -1110,7 +1114,7 @@ async def handle_code_symbol( near_paths_n=len(input.near_paths) or None, picked_by=picked_by or None, shape=shape or None, - lead_unread=code_lead.unread_of(lead) or None, + lead_unread=code_lead.unread_of(ran) or None, ), ) set_code_span_attributes( @@ -1122,7 +1126,7 @@ async def handle_code_symbol( abstain=not budgeted, retrieval_risk="low" if budgeted else "abstain", consumer=input.consumer, - lead_unread=code_lead.unread_of(lead), + lead_unread=code_lead.unread_of(ran), ) return CodeSymbolOutput( lead=lead, @@ -1147,15 +1151,16 @@ async def handle_code_symbol( ) -def _served_shape(input: CodeSymbolInput, brief: dict[str, Any], lead: list[Any]) -> str: +def _served_shape(input: CodeSymbolInput, brief: dict[str, Any], ran: list[Any]) -> str: """The shape this call served: it prices the request's budget and is written on the trace row, so each shape's p99 is measurable. A ranked lookup and the compact uses - block keep their own budgets, which cover the lead block they may carry.""" + block keep their own budgets, which cover the lead legs they may run; `ran` is the + lead block before a token budget or the served definitions withheld it.""" if input.near_paths or input.pr_number: return "ranked" if brief: return "uses_brief" - return code_lead.LEAD_SHAPE if lead else "" + return code_lead.LEAD_SHAPE if ran else "" def _symbol_trace( diff --git a/server/code/domain/units.py b/server/code/domain/units.py index 066de3ae2e8..1d97b9b766b 100644 --- a/server/code/domain/units.py +++ b/server/code/domain/units.py @@ -385,7 +385,7 @@ def budget_units( # Bodyless cards already carry the pointer the caller will receive. if bodies != "none": units = [_without_repeated_context(u) for u in units] - heads = [estimate_unit_tokens(_card_of(u) if u.body else u) for u in units] + heads = [head_tokens(u) for u in units] kept = 0 reserved = 0 for h in heads: @@ -408,6 +408,12 @@ def budget_units( return out, used +def head_tokens(u: CodeUnit) -> int: + """What `budget_units` reserves for `u` before any body: its elided card, or the + unit whole when it has no body.""" + return estimate_unit_tokens(_card_of(u) if u.body else u) + + def _card_of(u: CodeUnit) -> CodeUnit: """The unit as an elided card: signature + doc + pointer, body dropped, plus the one pasteable escalation (measured to reduce agent flailing diff --git a/server/core/background.py b/server/core/background.py index 7d263dd6d0c..5b7e7f6e768 100644 --- a/server/core/background.py +++ b/server/core/background.py @@ -9,7 +9,10 @@ `detached_task` is `create_task` with a fresh `contextvars.Context()`, so a task started this way belongs to the process, not to the request that -happened to start it. +happened to start it. A deferred task keeps the request's context but not +its ClickHouse best-effort block (`server.core.ch.shared_context`): it +outlives the block, so it takes neither the block's share of the pool nor +its deadline. The event loop keeps only a weak reference to a task, so a fire-and-forget task nobody holds can be collected mid-flight. `TaskSet.spawn` holds each task @@ -55,7 +58,7 @@ def create_deferred_task[T]( coro: Coroutine[Any, Any, T], *, name: str | None = None ) -> asyncio.Task[T]: """A finite child of a request/pass, visible after its parent returns.""" - return register_deferred_task(asyncio.create_task(coro, name=name)) + return register_deferred_task(asyncio.create_task(coro, name=name, context=_deferred())) def detached_task[T](coro: Coroutine[Any, Any, T], *, name: str) -> asyncio.Task[T]: @@ -65,6 +68,12 @@ def detached_task[T](coro: Coroutine[Any, Any, T], *, name: str) -> asyncio.Task return asyncio.get_running_loop().create_task(coro, name=name, context=contextvars.Context()) +def _deferred() -> contextvars.Context: + from server.core.ch import shared_context # deferred: ch loads the driver + + return shared_context() + + async def gather_or_cancel[T](*aws: Awaitable[T]) -> list[T]: """`asyncio.gather`, except that the first awaitable to raise cancels the others, and its error (unwrapped, unlike a TaskGroup's) escapes only once @@ -93,7 +102,7 @@ def spawn[T]( if detached: t = detached_task(coro, name=name) else: - t = asyncio.get_running_loop().create_task(coro, name=name) + t = asyncio.get_running_loop().create_task(coro, name=name, context=_deferred()) self._tasks.add(t) t.add_done_callback(self._tasks.discard) # Keep the task visible even if its short-lived TaskSet owner is collected. diff --git a/server/core/ch.py b/server/core/ch.py index 0dabd1319dc..a163c44e865 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -18,7 +18,7 @@ import uuid from collections.abc import AsyncIterator, Awaitable, Callable, Iterator, Set from contextlib import asynccontextmanager, contextmanager -from contextvars import ContextVar +from contextvars import Context, ContextVar, copy_context from dataclasses import dataclass from datetime import UTC, datetime from types import FrameType @@ -475,8 +475,12 @@ def statement_class(sql: str) -> str: def class_timeout_s(cls: str) -> float: """The deadline for `cls` in seconds; 0 means unbounded. A - `statement_timeout()` scope wins over the class default.""" + `statement_timeout()` scope wins over the class default, and a `best_effort()` + block's deadline lowers either.""" scoped = statement_timeout_var.get() + claim = _best_effort_var.get() + if claim is not None and claim.deadline_s > 0: + scoped = min(scoped, claim.deadline_s) if scoped > 0 else claim.deadline_s if scoped > 0: return scoped if cls == "write": @@ -552,7 +556,8 @@ def count(self) -> int | None: class BusyError(OverloadedError): - """A best-effort statement found no pool slot free at once (`best_effort()`).""" + """A best-effort statement was refused before it was sent (`best_effort()`): its kind + already held its share of the pool, or the pool had no slot free at once.""" @dataclass @@ -565,11 +570,13 @@ class BestEffortSlots: @dataclass class BestEffortClaim: - """One best-effort task's share of its kind's slots. `refused` is set once one of its - statements found none, so a caller whose op swallowed the BusyError still knows the - answer is short.""" + """One best-effort task's share of its kind's slots. `deadline_s` (0 = none) bounds + each of its statements on the server and in the client, so work cut at its caller's + wall stops on ClickHouse too. `refused` is set once one of its statements found no + slot, so a caller whose op swallowed the BusyError still knows the answer is short.""" slots: BestEffortSlots + deadline_s: float = 0.0 refused: bool = False @@ -589,6 +596,17 @@ def best_effort(claim: BestEffortClaim) -> Iterator[None]: _best_effort_var.reset(token) +def shared_context() -> Context: + """A copy of the current context without its `best_effort()` block, for work that + outlives the block or is shared beyond it: a load other requests join, a deferred + write, a flush of the process's queue. Its statements hold no slot of the block's + share, are never refused for it and keep no deadline of the block's; a + `statement_timeout()` around the block (a claim's bound) still applies.""" + ctx = copy_context() + ctx.run(_best_effort_var.set, None) + return ctx + + def _short_of_memory(op_name: str, e: BaseException) -> OverloadedError: """The 503 for a statement ClickHouse ran short of shared memory for, counted, with ClickHouse's line logged when one is due: the answer carries none of it.""" diff --git a/server/core/grant_cache.py b/server/core/grant_cache.py index 4838461cd94..f2a6186e414 100644 --- a/server/core/grant_cache.py +++ b/server/core/grant_cache.py @@ -29,7 +29,7 @@ import logging import time from collections import OrderedDict, defaultdict -from collections.abc import AsyncIterator, Awaitable, Callable, Iterable +from collections.abc import AsyncIterator, Awaitable, Callable, Coroutine, Iterable from contextlib import asynccontextmanager from dataclasses import dataclass from datetime import UTC, datetime @@ -127,7 +127,7 @@ def _served(hit: _Entry, writes: int | None) -> bool: async def _shared_load( - loading: _Loading, key: _Key, writes: int | None, start: Callable[[], Awaitable[Any]] + loading: _Loading, key: _Key, writes: int | None, start: Callable[[], Coroutine[Any, Any, Any]] ) -> Any: """One read per key at a time. A request joins the read in flight when it began at the mark the request reads at; a stale watermark (a negative mark) @@ -138,7 +138,10 @@ async def _shared_load( if pending is not None and (pending[1] == writes or (_unread(writes) and _unread(pending[1]))): task = pending[0] else: - task = asyncio.ensure_future(start()) + from server.core.ch import shared_context + + # shared: the read runs outside the starter's best-effort block + task = asyncio.get_running_loop().create_task(start(), context=shared_context()) loading[key] = (task, writes) _running.add(task) task.add_done_callback(functools.partial(_loaded, loading, key)) diff --git a/server/settings/catalog.py b/server/settings/catalog.py index ff97a8850be..1289e48a598 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -6913,12 +6913,16 @@ class TrackerSettings(BaseModel): OP_SHAPE_BUDGETS_P99_MS: dict[str, dict[str, int]] = { # "lead" (code.grep and code.symbol): the answer with its `lead` block, whose legs # (code.callers, code.coverage_claim, code.symbol_history, run together) get what - # the budget leaves after the time spent. Priced from the legs' declared budgets, not - # a served p99: the base plus the 1200 ms of code.coverage_claim, the slowest leg - # without a tracker read, rounded up; a leg still running then says `unread: deadline`. + # the budget leaves after the time spent. Not measured: each adds to the base about + # what code.callers (400 ms) takes, so the block costs a few hundred ms. code.symbol's + # legs start with its body reads (+350 ms), code.grep's once its page is read + # (+400 ms). code.coverage_claim (1200 ms) and code.symbol_history (1800 ms) answer + # when they are fast and say `unread: deadline` otherwise. A deployment whose legs + # need longer raises the op's budget: `latency_budget_overrides` ("2x" scales the + # base and the shapes) or `admin/budget.set`. "code.grep": { "files": 600, - "lead": 1800, + "lead": 1000, "message": 2000, }, "code.search": { @@ -6930,7 +6934,7 @@ class TrackerSettings(BaseModel): # mention leg. Those two are priced from their served p99; `lead` (above) is # priced from its legs' declared budgets until a served p99 replaces it. "code.symbol": { - "lead": 1500, + "lead": 600, "ranked": 3000, "uses_brief": 1500, }, diff --git a/server/transport/mcp_descriptions.py b/server/transport/mcp_descriptions.py index 4a8d9febc2e..9867f0d7251 100644 --- a/server/transport/mcp_descriptions.py +++ b/server/transport/mcp_descriptions.py @@ -1380,8 +1380,8 @@ def revision_policy(update: str) -> str: "Find indexed text. Batch code and test prefixes in `pattern`. " "Path filters scope the batch. Bodies are on by default. " "Set `include_body: false` for excerpts, `context_lines: 0` for locations. " - "Bodies lead with the callers, tests and changing PRs of the definition the " - "pattern names. " + "With bodies, a `lead` block first names the callers, tests and changing PRs of " + "the definition the pattern names. " "Omitted match text is in its excerpt at the same path and line. " "Use code.search for behavior. " "Use literal strings or one RE2 string with `regex: true`. " @@ -2189,7 +2189,7 @@ def revision_policy(update: str) -> str: ), "code.grep": ( "Batch exact code and test literals with path_globs. Keep default bodies for edits; " - "they lead with callers, tests and PRs. " + "the `lead` lists callers, tests, PRs. " "For excerpts, set `include_body: false` and `context_lines`. " "Omitted match text is in its excerpt. " "Use mode=files for paths only and regex=true for RE2.\n\n" diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index 4ef615f9883..c477e099230 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -452,6 +452,45 @@ async def test_best_effort_work_is_refused_at_once_when_the_pool_is_full( assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow", "SELECT later"] +async def test_a_cancelled_best_effort_statement_gives_its_slots_back( + monkeypatch: pytest.MonkeyPatch, +) -> None: + fake = _FakeAsync(plan={"SELECT slow": [5.0]}) + c = _client(monkeypatch, fake, ch_pool_maxsize=2, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1)) + + async def _leg() -> None: + with ch_mod.best_effort(claim): + await c.query_all("SELECT slow") + + leg = asyncio.create_task(_leg()) + await asyncio.sleep(0.02) + assert claim.slots.in_use == 1 and ch_mod.pool_reading()["in_use"] == 1 + leg.cancel() + with pytest.raises(asyncio.CancelledError): + await leg + assert claim.slots.in_use == 0 and ch_mod.pool_reading()["in_use"] == 0 + assert not claim.refused + + +async def test_work_shared_beyond_a_best_effort_block_runs_outside_it() -> None: + """A deferred write or a held task a best-effort block starts outlives it: it takes + neither the block's share of the pool nor its deadline, while a `statement_timeout()` + around the block (a claim's bound) still reaches it.""" + from server.core.background import TaskSet, create_deferred_task + + async def _scope() -> tuple[Any, float]: + return ch_mod._best_effort_var.get(), ch_mod.class_timeout_s("write") + + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), deadline_s=0.3) + with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): + inside = await asyncio.ensure_future(_scope()) + held = await TaskSet().spawn(_scope(), name="t") + deferred = await create_deferred_task(_scope(), name="d") + assert inside == (claim, 0.3) + assert held == deferred == (None, 5.0) + + async def test_an_open_stream_holds_no_pool_slot_and_streams_have_their_own_gate( monkeypatch: pytest.MonkeyPatch, ) -> None: diff --git a/tests/unit/test_code_grep_scan.py b/tests/unit/test_code_grep_scan.py index 9d6ea61b486..63a53b22ef2 100644 --- a/tests/unit/test_code_grep_scan.py +++ b/tests/unit/test_code_grep_scan.py @@ -281,7 +281,7 @@ def test_code_grep_prices_files_message_and_lead() -> None: op = OPERATIONS_BY_NAME["code.grep"] assert op.budget_p99_ms == 600 - assert op.shape_budgets_p99_ms == {"files": 600, "lead": 1800, "message": 2000} + assert op.shape_budgets_p99_ms == {"files": 600, "lead": 1000, "message": 2000} @pytest.mark.parametrize("mode,shape", [("files", "files"), ("matches", "")]) diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 88ac61e62de..d067c5ff772 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -6,8 +6,10 @@ from __future__ import annotations +import ast import asyncio import math +from pathlib import Path from typing import Any from unittest.mock import patch @@ -22,6 +24,7 @@ ) from server.code.api.models_testing import CodeCoverageClaimOutput from server.code.app import lead +from server.code.domain.units import CodeUnit, head_tokens from server.core import ch from server.observability import degradations from server.settings import settings @@ -55,9 +58,21 @@ def test_the_block_covers_the_first_reachable_definition_with_its_id(): {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "symbol_id": "s1"}, {"qualified_name": "A::B", "path": "src/b.cpp", "start_line": 5, "kind": "class"}, ] - assert lead.lead_definitions(rows) == [ - {"symbol": "A::f", "path": "src/a.cpp", "line": 3, "symbol_id": "s1"}, - ] + assert lead.lead_definition(rows) == { + "symbol": "A::f", + "path": "src/a.cpp", + "line": 3, + "symbol_id": "s1", + } + assert lead.lead_definition(rows[:3]) is None + + +def test_a_grep_leads_with_the_definition_its_pattern_names_as_a_whole_identifier(): + rows = [{"symbol": "read"}, {"symbol": "get"}, {"symbol": "read_all"}, {"symbol": ""}] + picked = lead.named_first(rows, ["reader.read_all(", "cache.get_or_load("]) + assert [r["symbol"] for r in picked] == ["read_all", "read", "get", ""] + picked = lead.named_first(rows, ["x = get(key)"]) + assert [r["symbol"] for r in picked] == ["get", "read", "read_all", ""] def test_the_pool_share_is_an_eighth_of_the_pool(monkeypatch): @@ -72,13 +87,25 @@ def test_a_leg_another_block_reads_is_left_out(): assert lead.legs_beside(neighbours=True, brief=True) == ("changed_by",) -def test_the_block_is_withheld_whole_past_the_token_budget(): - block = [{"symbol": "A::f", "callers": {"count": 1}}] - tokens = lead.fit(block, 0, 0)[1] - assert tokens > 0 - assert lead.fit(block, tokens + 10, 10) == (block, tokens) - assert lead.fit(block, tokens + 10, 11) == ([], 0) - assert lead.fit([], 5, 0) == ([], 0) +def _unit(symbol: str, line: int) -> CodeUnit: + return CodeUnit(path="src/a.cpp", start_line=line, symbol=symbol, body="void f() {}\n" * 20) + + +def test_the_block_never_takes_the_first_definitions_place(): + block = [{"symbol": "A::f", "path": "src/a.cpp", "line": 3, "callers": {"count": 1}}] + units = [_unit("A::f", 3), _unit("A::g", 9)] + tokens, card = lead.fit(block, units, 0, 0)[1], head_tokens(units[0]) + assert tokens > 0 and card > 0 + assert lead.fit(block, units, tokens + card + 10, 10) == (block, tokens) + assert lead.fit(block, units, tokens + card + 10, 11) == ([], 0) + assert lead.fit([], units, 5, 0) == ([], 0) + + +def test_the_block_rides_only_beside_its_definition(): + block = [{"symbol": "A::f", "path": "src/a.cpp", "line": 3}] + assert lead.served(block, [_unit("A::g", 9), _unit("A::f", 3)]) == block + assert lead.served(block, [_unit("A::g", 9)]) == [] + assert lead.fit(block, [_unit("A::g", 9)], 0, 0) == ([], 0) # ------------------------------------------------------------------ compaction @@ -230,7 +257,8 @@ async def run(query: Any) -> Any: if how == "hang": await asyncio.sleep(30) if callable(how): - return how(query) + answer = how(query) + return await answer if asyncio.iscoroutine(answer) else answer out_model, fields = real[op] return out_model(**fields) @@ -346,11 +374,88 @@ def test_only_the_legs_asked_for_run(monkeypatch): assert list(out[0]) == ["symbol", "path", "line", "changed_by"] -def test_no_time_left_starts_no_leg(monkeypatch): +def test_no_time_left_starts_no_leg_and_serves_no_block(monkeypatch): ops = _Ops() - out, _ = _run_leads(monkeypatch, ops, wall=0.0, op_name="code.grep") - assert ops.queries == {} - assert out[0]["callers"] == out[0]["tested"] == out[0]["changed_by"] == {"unread": "deadline"} + out, notes = _run_leads(monkeypatch, ops, wall=0.0, op_name="code.grep") + assert ops.queries == {} and out == [] and notes == [] + + +def test_the_policy_gate_runs_outside_the_lane_and_to_its_end(monkeypatch): + """The gate may flush the process's queued events (every request's): it takes no + best-effort slot, keeps the class deadlines, and is not cut at the wall.""" + from server.identity.app import policy_gate + + seen: list[tuple[Any, ...]] = [] + + async def gate(op, identity, raw_args, *, request_id=""): + seen.append(("start", ch._best_effort_var.get(), ch.class_timeout_s("write"))) + await asyncio.sleep(0.3) + seen.append(("end",)) + + monkeypatch.setattr(policy_gate, "gate", gate) + monkeypatch.setattr(lead, "_ops", _Ops()) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 0.1) + + async def go() -> list[dict[str, Any]]: + out = await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + await asyncio.sleep(0.4) + return out + + (entry,) = asyncio.run(go()) + assert entry["callers"] == entry["tested"] == entry["changed_by"] == {"unread": "deadline"} + unbounded = ("start", None, settings.ch_timeout_write_s) + assert seen.count(unbounded) == 3 and seen.count(("end",)) == 3 + + +def test_a_load_a_leg_starts_for_others_runs_outside_the_lane(monkeypatch): + """A shared grant read a leg happens to start runs as every joiner's read would: a + refusal or the wall's short bound would fail the requests that join it.""" + from server.core import grant_cache + + seen: dict[str, tuple[Any, ...]] = {} + + async def load() -> dict[str, Any]: + seen["load"] = (ch._best_effort_var.get(), ch.class_timeout_s("read")) + return {} + + async def callers(query: Any) -> Any: + seen["leg"] = (ch._best_effort_var.get() is not None, ch.class_timeout_s("read")) + await grant_cache._shared_load({}, ("o", "k"), 0, load) + return CodeCallersOutput(edges=[], seed_symbols=[]) + + _run_leads(monkeypatch, _Ops(**{"code.callers": callers}), wall=0.5) + assert seen["leg"] == (True, pytest.approx(0.75)) + assert seen["load"] == (None, settings.ch_timeout_read_s) + + +def test_a_cancelled_block_retrieves_a_leg_that_raised(monkeypatch): + import gc + + ops = _Ops( + **{ + "code.callers": RuntimeError("down"), + "code.coverage_claim": "hang", + "code.symbol_history": "hang", + } + ) + monkeypatch.setattr(lead, "_ops", ops) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + lost: list[dict[str, Any]] = [] + + async def go() -> None: + asyncio.get_running_loop().set_exception_handler(lambda loop, ctx: lost.append(ctx)) + task = asyncio.ensure_future( + lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + ) + await asyncio.sleep(0.05) + task.cancel() + with pytest.raises(asyncio.CancelledError): + await task + await asyncio.sleep(0.05) + gc.collect() + + asyncio.run(go()) + assert "code.callers" in ops.queries and lost == [] def test_a_caller_deadline_caps_the_wall(monkeypatch): @@ -361,12 +466,12 @@ def test_a_caller_deadline_caps_the_wall(monkeypatch): def test_the_wall_is_the_lead_budget_less_the_time_spent(monkeypatch): - monkeypatch.setattr(lead.time, "monotonic", lambda: 100.5) + monkeypatch.setattr(lead.time, "monotonic", lambda: 100.2) monkeypatch.setattr(lead.request_work, "age_s", lambda: 0.0) monkeypatch.setattr(lead, "effective_budget_ms", lambda op, declared: declared) - assert lead.wall_s("code.symbol", 100.0) == pytest.approx(1.5 - 0.5 - 0.1) - assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.8 - 0.5 - 0.1) - assert lead.wall_s("code.symbol", 98.0) == 0.0 + assert lead.wall_s("code.symbol", 100.0) == pytest.approx(0.6 - 0.2 - 0.1) + assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.0 - 0.2 - 0.1) + assert lead.wall_s("code.symbol", 99.0) == 0.0 # ------------------------------------------------------------------ the wire @@ -445,12 +550,27 @@ def _intel_on(monkeypatch): monkeypatch.setattr(settings, "code_namespace", "n") +_LED = { + "symbol": "DB::Foo::bar", + "path": "src/Foo.cpp", + "line": 10, + "callers": {"count": 2, "top": []}, +} + + def _recorder(seen: list[dict[str, Any]]) -> Any: async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf, legs=()): seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows], "legs": legs}) seen[-1]["cap_s"] = cap_s first = rows[0] - return [{"symbol": first["qualified_name"], "callers": {"count": 2, "top": []}}] + return [ + { + "symbol": first["qualified_name"], + "path": first["path"], + "line": first["start_line"], + "callers": {"count": 2, "top": []}, + } + ] return leads @@ -502,7 +622,7 @@ def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): ] dump = out.model_dump() assert list(dump)[0] == "lead" - assert dump["lead"] == [{"symbol": "DB::Foo::bar", "callers": {"count": 2, "top": []}}] + assert dump["lead"] == [_LED] assert shape == lead.LEAD_SHAPE @@ -524,13 +644,26 @@ def test_code_symbol_reads_no_leg_its_other_blocks_read(monkeypatch): @pytest.mark.usefixtures("_intel_on") def test_a_token_budget_the_block_does_not_fit_withholds_it(monkeypatch): - tokens = lead.fit([{"symbol": "DB::Foo::bar", "callers": {"count": 2, "top": []}}], 0, 0)[1] - out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=tokens - 1) - assert len(seen) == 1 and "lead" not in out.model_dump() and shape == "" - assert out.tokens_returned <= tokens - 1 - out, _, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=600) - assert "lead" in out.model_dump() and shape == lead.LEAD_SHAPE - assert out.tokens_returned <= 600 + from server.code.domain.units import estimate_json_tokens + + whole, _, _ = _symbol(monkeypatch, name="DB::Foo::bar") + block, card = estimate_json_tokens([_LED]), head_tokens(whole.definitions[0]) + # room for the block but not for the block and the definition's card: the + # definition is served and the block withheld, though its legs ran + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=block + card - 1) + assert len(seen) == 1 and "lead" not in out.model_dump() and shape == lead.LEAD_SHAPE + assert [d.symbol for d in out.definitions] == ["DB::Foo::bar"] + assert out.tokens_returned <= block + card - 1 + out, _, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=block + card + 50) + assert out.model_dump()["lead"] == [_LED] and out.definitions + assert out.tokens_returned <= block + card + 50 + + +@pytest.mark.usefixtures("_intel_on") +def test_a_block_whose_definition_is_not_served_is_left_out(monkeypatch): + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", min_fan_in=5) + assert len(seen) == 1 and not out.definitions and "lead" not in out.model_dump() + assert shape == lead.LEAD_SHAPE def _grep(monkeypatch, **fields: Any) -> tuple[Any, list[dict[str, Any]], str]: @@ -623,3 +756,38 @@ def test_code_grep_leads_no_continuation_or_related_answer(monkeypatch): args = ("o", "n", query, bodies, 0.0, None, offset, related) assert asyncio.run(grep._grep_lead(*args)) == [] assert seen == [] + + +# ------------------------------------------------------------------ callers inside Loom + +_INPUTS = {"CodeSymbolInput": "code.symbol", "CodeGrepInput": "code.grep"} + + +def _call_name(node: ast.expr) -> str: + return node.attr if isinstance(node, ast.Attribute) else getattr(node, "id", "") + + +def test_every_caller_inside_loom_says_whether_it_wants_the_block(): + """A unit test stubs the legs out (tests/unit/conftest.py), so a caller inside Loom + that forgot `lead` would pass and run three legs a call in production: every input it + builds for code.symbol or code.grep, and every by-name call of them with literal + arguments, names `lead`.""" + missing = [] + for path in sorted(Path("server").rglob("*.py")): + if path.parts[1] == "transport": + continue + for node in ast.walk(ast.parse(path.read_text(), str(path))): + if isinstance(node, ast.Call) and _call_name(node.func) in _INPUTS: + if not any(k.arg == "lead" for k in node.keywords): + missing.append(f"{path}:{node.lineno}") + elif ( + isinstance(node, ast.Tuple) + and len(node.elts) == 2 + and isinstance(node.elts[0], ast.Constant) + and node.elts[0].value in _INPUTS.values() + and isinstance(node.elts[1], ast.Dict) + ): + keys = {k.value for k in node.elts[1].keys if isinstance(k, ast.Constant)} + if "lead" not in keys: + missing.append(f"{path}:{node.lineno}") + assert missing == [] diff --git a/tests/unit/test_shape_budgets.py b/tests/unit/test_shape_budgets.py index d3621ca64f8..937b85c3246 100644 --- a/tests/unit/test_shape_budgets.py +++ b/tests/unit/test_shape_budgets.py @@ -53,7 +53,7 @@ def test_note_is_bounded_and_clears(): def test_code_symbol_prices_the_ranked_brief_and_lead_shapes(): op = next(o for o in ALL_OPERATIONS if o.name == "code.symbol") - assert op.shape_budgets_p99_ms == {"lead": 1500, "ranked": 3000, "uses_brief": 1500} + assert op.shape_budgets_p99_ms == {"lead": 600, "ranked": 3000, "uses_brief": 1500} @pytest.mark.parametrize( @@ -101,7 +101,7 @@ async def test_catalogue_lists_shape_budgets(): rows = {r["name"]: r for r in await list_operations()} assert rows["code.symbol"]["shape_budgets_p99_ms"] == { - "lead": 1500, + "lead": 600, "ranked": 3000, "uses_brief": 1500, } @@ -140,7 +140,7 @@ def test_capabilities_catalogue_lists_shape_budgets(): ops = capability_snapshot()["ops"] assert ops["code.symbol"]["shape_budgets_p99_ms"] == { - "lead": 1500, + "lead": 600, "ranked": 3000, "uses_brief": 1500, } From 7971e65091a6d56bf1a36fcf9eb9bb70499fc482 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 02:48:47 +0530 Subject: [PATCH 04/30] One lead call holds half its lane, and process-wide fills run outside it One call's legs gathered 9 reads at once over an index that resolves the definition and holds nothing else, more than the 8-slot lane, so a single call read `busy`. A call's legs now share a width of half the lane; a statement past it waits for its own call's slot, never for the pool's, and two calls fit. A refused read inside a leg could be kept as every request's answer: the schema guard's ledger refresh, the override-edge and constructor-edge probes, and the tracker-link snapshot ran in the lane. They run outside it (`ch.shared_work`). The lane deadline is an instant: each statement is bounded by what is left of it. The block is fitted after the definitions, so it takes only what they leave of `token_budget`. A leg another block serves is dropped when that block serves it: code.grep skips it when its neighbours block has the definition, code.symbol drops it at assembly. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 14 +- docs/features/code-index/operations.md | 46 +-- docs/reference/operations/code.md | 4 +- server/code/api/models_symbol.py | 24 +- server/code/app/grep.py | 12 +- server/code/app/lead.py | 104 ++++--- server/code/app/presence.py | 1 + server/code/app/symbol/coverage.py | 7 +- server/code/app/symbol/dispatch.py | 7 +- server/code/app/symbol/symbol.py | 22 +- server/code/domain/units.py | 8 +- server/core/background.py | 12 +- server/core/ch.py | 82 +++-- server/settings/catalog.py | 15 +- server/tracker/app/binding.py | 7 +- tests/unit/test_ch_client_hygiene.py | 57 +++- tests/unit/test_code_lead.py | 415 +++++++++++++++++++++---- 17 files changed, 620 insertions(+), 217 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 07223ed6410..5ab2bbd20f0 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -877,11 +877,15 @@ process). Best-effort work a request adds beside its own reads, such as the code ops' `lead` block, runs in a lane of its own (`best_effort()`). Its statements hold at most their kind's share of the pool (an eighth of `LOOM_CH_POOL_MAXSIZE` for the `lead` block) and -never wait for a slot: a statement past the share, or one that finds no slot free at -once, raises `BusyError` before it is sent and the work reads as not done. The lane's -deadline bounds each of its statements like a `statement_timeout()`. Work such a block -starts for others (a load other requests join, a deferred write, a flush of the -process's queued events) runs outside the lane and its deadline (`shared_context()`). +never wait for a pool slot: a statement past the share, or one that finds no slot free +at once, raises `BusyError` before it is sent and the work reads as not done. A caller +may also cap the slots its own statements hold at once (`width`, half the share for one +`lead` call); a statement past that waits for one of its caller's slots. What is left of +the lane's deadline bounds each of its statements like a `statement_timeout()`. Work +such a block does for others runs outside the lane and its deadline: a task that +outlives it, such as a load other requests join or a deferred write +(`shared_context()`), and a fill of a process-wide cache or snapshot awaited inline, +such as the schema guard's ledger read (`shared_work()`). Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` (`production`, `interactive`, `bench`, `background`): `priority`, `max_threads`, and for diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index e7525fd19e7..cbfd2b1970c 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -116,26 +116,32 @@ the common case, while `code.coverage_claim` and `code.symbol_history` answer when they are fast and read `deadline` otherwise. A deployment whose answers need longer raises the op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example `{"code.symbol": "2x"}`, which scales the `lead` budget too) or -`POST /v1/admin/budget.set`. The block is best effort: its statements hold at -most an eighth of the server's ClickHouse pool (`ch_pool_maxsize`) and never -wait for a slot. An answer that does not come back reads `{"unread": why}`, and -the rest of the response is served: - -| `unread` | Why | -| ------------ | --------------------------------------------------------- | -| `deadline` | still running when the budget ran out | -| `busy` | no ClickHouse slot was free at once for best-effort reads | -| `failed` | the op raised | -| `policy` | a history policy rule denies the op | -| `ambiguous` | the op refused an ambiguous name | -| `unresolved` | the op did not resolve the definition | - -An answer another block of the same response reads is left out: with `neighbours`, the -`callers` and `tested` keys; with a `uses_brief` block, `callers`. A -`token_budget` the block does not fit beside the uses block and the first -definition's card withholds it whole. When no answer can start in time the -block is left out. `lead: false` leaves the block out. `code.edit_context` has -no `lead` block; it reads the definition's tests itself. +`POST /v1/admin/budget.set`. The block is best effort: the three answers' +statements hold at most an eighth of the server's ClickHouse pool +(`ch_pool_maxsize`) between all calls and never wait for a pool slot. One +call's answers hold at most half of that share at once and wait for their own +call's slots past it, so two calls fit. The history policy gate's statements +and the reads whose answer the whole process keeps (a shared grant load, the +schema guard's ledger read, a namespace's probe) run outside that share and are +not counted in it. An answer that does not come back reads `{"unread": why}`, +and the rest of the response is served: + +| `unread` | Why | +| ------------ | --------------------------------------------------------------------------- | +| `deadline` | still running when the budget ran out | +| `busy` | other calls held the share, or the pool had no slot free at once | +| `failed` | the op raised | +| `policy` | a history policy rule denies the op | +| `ambiguous` | the op refused an ambiguous name | +| `unresolved` | the op did not resolve the definition | + +An answer another block of the same response serves for the definition is left +out: the `callers` and `tested` keys when the `neighbours` block has an entry +for it, `callers` when a `uses_brief` block is served and its read did not fail. +The definitions are fitted to `token_budget` first; a block that does not fit +what they leave is withheld whole. When no answer can start in time the block is +left out. `lead: false` leaves the block out. `code.edit_context` has no `lead` +block; it reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For example, `["parse(", "parse_async("]` matches both fragments without escaping diff --git a/docs/reference/operations/code.md b/docs/reference/operations/code.md index adf499f6478..01789d7a087 100644 --- a/docs/reference/operations/code.md +++ b/docs/reference/operations/code.md @@ -598,7 +598,7 @@ Before editing, read source, tests and notes. | Output field | Type | Meaning | | --- | --- | --- | -| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides, dispatch, top: [{path… | +| `lead` | `list[dict[str, Any]]` | code.symbol only (code.edit_context never reads it), first on the wire: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | @@ -1672,7 +1672,7 @@ Find an exact definition by name or path:line. | Output field | Type | Meaning | | --- | --- | --- | -| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files, through_overrides, dispatch, top: [{path… | +| `lead` | `list[dict[str, Any]]` | code.symbol only (code.edit_context never reads it), first on the wire: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index f54ef1d340d..f9ed9136ac3 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -255,17 +255,19 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s data.pop("read_sources", None) return _lead_first(data) - # First on the wire when `lead` read it: for the first definition outside test files, - # what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: - # `callers` {count, files, through_overrides, dispatch, top: [{path, line, caller, - # via_override, via}] (<= 3), truncated, epistemic} is code.callers one hop across - # virtual dispatch; `tested` {verdict, tests, strongest_tier, measured: executed | - # unexecuted, top: [{test_path, tier}]} is code.coverage_claim; `changed_by` {prs, - # level: function | file, fixes, reverts, top: [{pr_number, title, merged_at, - # touches_symbol, is_fix, is_revert}]} is code.symbol_history. A leg that did not - # answer is {unread: deadline | busy | failed | policy | ambiguous | unresolved}; one - # the neighbours block or the uses brief reads is left out. Absent when `lead` is - # false, no definition qualifies or it does not fit `token_budget`. + # code.symbol only (code.edit_context never reads it), first on the wire: for the + # first definition outside test files, what a text search cannot answer. {symbol, + # path, line, callers, tested, changed_by}: `callers` {count, files, + # through_overrides, dispatch, top: [{path, line, caller, via_override, via}] (<= 3), + # truncated, epistemic} is code.callers one hop across virtual dispatch; `tested` + # {verdict, tests, strongest_tier, measured: executed | unexecuted, top: [{test_path, + # tier}]} is code.coverage_claim; `changed_by` {prs, level: function | file, fixes, + # reverts, top: [{pr_number, title, merged_at, touches_symbol, is_fix, is_revert}]} + # is code.symbol_history. A leg that did not answer is {unread: deadline | busy | + # failed | policy | ambiguous | unresolved}; one the neighbours block or a uses brief + # serves for the definition is left out. Absent when `lead` is false, no definition + # qualifies, the answer does not serve it, or the block does not fit what the + # definitions leave of `token_budget`. lead: list[dict[str, Any]] = Field(default_factory=list) # Up to 10 name matches, or the members matched by file clues, fitted to # `token_budget`. Empty when only candidates or presence were found. diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 50639190b2e..dd579e827cb 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -637,7 +637,9 @@ async def _grep_lines( match_commits=scan.match_commits, scope=scope, ) - lead = await _grep_lead(org, ns, input, bodies, started, page_budget, offset, related_pattern) + lead = await _grep_lead( + org, ns, input, bodies, started, page_budget, offset, related_pattern, neighbours + ) # one entry per matched FILE (ids and paths alike — grep has no unit ids, # so the outcome fold skips this op; the paths still feed opened_file) returned = matches + (extra_related.matches if extra_related is not None else []) @@ -731,14 +733,15 @@ async def _grep_lead( budget: code_deadline.Budget | None, offset: int, related_pattern: str, + neighbours: list[dict[str, Any]], ) -> list[dict[str, Any]]: """The `lead` block (`server.code.app.lead`) of a first page's enclosing definitions, read once the page's other reads are done, within what the op's `lead` budget and the caller's `deadline_ms` leave less the reserve for the lessons read after the handler. A definition the pattern names leads before one that only holds a match. [] on a continuation page (`offset`), a related answer (`related_pattern`), a page without - bodies, `lead: false`, or when no leg started; the `neighbours` block's callers and - tests are not read twice.""" + bodies, `lead: false`, or when no leg started; the callers and tests the `neighbours` + block lists for the definition are not read twice.""" definitions = bodies.get("definitions") or [] if not (input.lead and definitions) or offset or related_pattern: return [] @@ -748,10 +751,9 @@ async def _grep_lead( patterns = [input.pattern] if isinstance(input.pattern, str) else input.pattern rows = code_lead.named_first(definitions, patterns) cap_s = budget.left_ms() / 1000.0 - code_lead.RESERVE_S if budget is not None else math.inf - legs = code_lead.legs_beside(neighbours=bool(input.neighbours), brief=False) with code_span("grep.lead", results=len(definitions)): lead = await code_lead.definition_leads( - "code.grep", org, ns, input, rows, started=started, cap_s=cap_s, legs=legs + "code.grep", org, ns, input, rows, started=started, cap_s=cap_s, neighbours=neighbours ) if lead: note_budget_shape(code_lead.LEAD_SHAPE) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 34be5218ac8..b2d4c3ff5a8 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -17,18 +17,22 @@ The block is best effort, and its share of the request's resources is bounded: - One definition, so a call runs at most three legs. -- Its statements hold at most `lead_slots()` ClickHouse pool slots between them, - process-wide, and never wait for one (`server.core.ch.best_effort`): a leg that finds - none free reads `unread: busy`. +- The legs' statements hold at most `lead_slots()` ClickHouse pool slots, process-wide, + and never wait for a pool slot (`server.core.ch.best_effort`). One call's legs hold at + most half of them at once (`call_slots`), a statement past that waiting for one of its + own call's, so two calls fit: a leg reads `unread: busy` when other calls hold the lane + or the pool has no slot free. - The legs share one wall: what the op's latency budget for its `lead` shape leaves after the time already spent, less a reserve for the rest of the answer. Each statement is - bounded near the wall on the server and in the client (the lane's deadline), so a leg - cancelled at the wall does not keep ClickHouse working; a cancelled leg reads + bounded on the server and in the client by what is left of the wall and a margin, so a + leg cancelled at the wall does not keep ClickHouse working; a cancelled leg reads `unread: deadline`, one that raised `unread: failed`. -- The policy gate runs outside the lane and its deadline, and runs to its end when the - wall cancels its leg: it may flush the process's queued events, which are every - request's. Work a leg starts for others (a shared load, a deferred write) leaves the - lane too (`server.core.ch.shared_context`). +- The policy gate runs before its leg enters the lane: its statements hold ordinary + slots and are not counted in the lane, since an authorization step is never refused for + best-effort work. It runs to its end when the wall cancels its leg, since it may flush + the process's queued events, which are every request's. Work a leg does for others (a + shared load, a deferred write, a fill of a process-wide cache) runs outside the lane too + (`server.core.ch.shared_context`, `shared_work`). - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. A leg that did not answer is noted on the request's degradations and named in the @@ -53,7 +57,7 @@ from server.code.app.spans import code_span from server.code.app.symbol.neighbours import is_doc_path from server.code.domain.index.test_gate import is_test_path -from server.code.domain.units import estimate_json_tokens, head_tokens +from server.code.domain.units import estimate_json_tokens from server.core import ch, request_work from server.core.errors import NotFoundError from server.core.logging_config import request_id_var @@ -112,6 +116,13 @@ def lead_slots() -> int: return max(1, size // 8) if size > 0 else 8 +def call_slots() -> int: + """The slots one call's legs hold at once: half the lane, so two calls fit in it. The + legs gather more reads than that (9 at once for a definition with no callers, tests or + PRs), so the rest wait for their own call's slots.""" + return max(1, lead_slots() // 2) + + @functools.cache def _slots() -> ch.BestEffortSlots: """The lead's share of the pool, sized once: the pool's size is read at startup.""" @@ -315,14 +326,14 @@ async def _policy(op: str, query: Any) -> None: async def _leg( - name: str, base: dict[str, Any], d: dict[str, Any], deadline_s: float + name: str, base: dict[str, Any], d: dict[str, Any], deadline: float, width: asyncio.Semaphore ) -> dict[str, Any]: from server.identity.app.policy_gate import PolicyForbiddenError op, fields, compact = LEGS[name] model, handler = _ops()[op] query = model(**base, **fields(d)) - claim = ch.BestEffortClaim(_slots(), deadline_s=deadline_s) + claim = ch.BestEffortClaim(_slots(), deadline=deadline, width=width) with code_span(f"lead.{name}"): try: # outside the lane, and to its end if the wall cancels the leg: the gate @@ -372,32 +383,52 @@ def _retrieved(task: asyncio.Future[Any]) -> None: task.exception() -def legs_beside(*, neighbours: bool, brief: bool) -> tuple[str, ...]: - """The legs to read beside an answer's other blocks: the neighbours block already lists - the definition's callers and tests, the uses brief its callers, so the lead leaves - those legs out rather than read them twice.""" - skip = {"callers", "tested"} if neighbours else ({"callers"} if brief else set()) - return tuple(name for name in LEGS if name not in skip) +def served_beside( + d: dict[str, Any], *, neighbours: list[dict[str, Any]], brief: dict[str, Any] | None +) -> set[str]: + """The legs another block of the same answer serves for definition `d`: the neighbours + block its callers and tests when it holds an entry for `d`, a served uses brief its + callers unless its read failed (a `note`).""" + out: set[str] = set() + if any( + n.get("qualified_name") == d["symbol"] and n.get("path") == d["path"] for n in neighbours + ): + out |= {"callers", "tested"} + if brief and "note" not in brief: + out.add("callers") + return out + + +def beside( + lead: list[dict[str, Any]], *, neighbours: list[dict[str, Any]], brief: dict[str, Any] | None +) -> list[dict[str, Any]]: + """`lead` without the legs another block of the answer serves (`served_beside`), for an + answer whose other blocks were read beside the legs.""" + out = [] + for entry in lead: + skip = served_beside(entry, neighbours=neighbours, brief=brief) + out.append({k: v for k, v in entry.items() if k not in skip}) + return out def fit( - lead: list[dict[str, Any]], units: list[Any], token_budget: int, spent: int + lead: list[dict[str, Any]], served_units: list[Any], token_budget: int, spent: int ) -> tuple[list[Any], int]: - """The block and its tokens within `token_budget` (0 = none) after `spent` and the - card of the first of `units` (the definitions before the budget trims them): withheld - whole when it does not fit, as the uses brief is, so it never takes a definition's - place; [] when the answer does not serve its definition (`served`).""" - lead = served(lead, units) + """The block and its tokens when the answer serves its definition (`served`) and the + block fits what `token_budget` (0 = none) leaves after `spent`: the tokens of the + definitions served and of the blocks budgeted before it. Else [], withheld whole as the + uses brief is. The definitions are budgeted first, so the block takes only what they + leave.""" + lead = served(lead, served_units) tokens = estimate_json_tokens(lead) if lead else 0 - card = head_tokens(units[0]) if token_budget and units else 0 - if token_budget and spent + card + tokens > token_budget: + if token_budget and spent + tokens > token_budget: return [], 0 return lead, tokens def served(lead: list[dict[str, Any]], units: list[Any]) -> list[dict[str, Any]]: - """The block when the answer serves its definition, else []: the legs start with the - body reads, before `min_fan_in` and `token_budget` pick the definitions served.""" + """The block when `units`, the definitions served, hold its definition, else []: the + legs start with the body reads, before `min_fan_in` and `token_budget` pick them.""" at = [(e["symbol"], e["path"], e["line"]) for e in lead] return lead if any((u.symbol, u.path, u.start_line) in at for u in units) else [] @@ -423,17 +454,18 @@ async def definition_leads( *, started: float, cap_s: float = math.inf, - legs: tuple[str, ...] = tuple(LEGS), + neighbours: list[dict[str, Any]] | None = None, ) -> list[dict[str, Any]]: - """The block for `rows`: one entry, for their `lead_definition`, with each of `legs`' - answer (a leg another block of the same answer already reads is left out by the - caller); [] when no leg starts. `identity` is the op's input, whose `agent` and + """The block for `rows`: one entry, for their `lead_definition`, with each leg's + answer but those `neighbours` serves (the answer's neighbours block, when it was read + first); [] when no leg starts. `identity` is the op's input, whose `agent` and `user_id` the legs carry; `cap_s` is a caller's own deadline. Never raises but on cancellation, which cancels every leg.""" picked = lead_definition(rows) wall = min(wall_s(op_name, started), cap_s) - if picked is None or not legs or wall <= 0: + if picked is None or wall <= 0: return [] + skip = served_beside(picked, neighbours=neighbours or [], brief=None) base = { "org": org, "namespace": ns, @@ -442,9 +474,11 @@ async def definition_leads( "consumer": f"{op_name.removeprefix('code.')}_lead", } tasks: dict[str, asyncio.Future[dict[str, Any]]] = {} + deadline = time.monotonic() + wall + _MARGIN_S + width = asyncio.Semaphore(call_slots()) with _unshaped(): - for name in legs: - tasks[name] = asyncio.ensure_future(_leg(name, base, picked, wall + _MARGIN_S)) + for name in (name for name in LEGS if name not in skip): + tasks[name] = asyncio.ensure_future(_leg(name, base, picked, deadline, width)) tasks[name].add_done_callback(_retrieved) try: await asyncio.wait(tasks.values(), timeout=wall) diff --git a/server/code/app/presence.py b/server/code/app/presence.py index 4ec1e26c2e3..0eda93935bd 100644 --- a/server/code/app/presence.py +++ b/server/code/app/presence.py @@ -98,6 +98,7 @@ def sub_for(ns: str) -> CodeGrepInput: "namespaces": [], "mode": "files", "limit": 1, + "lead": False, } ) diff --git a/server/code/app/symbol/coverage.py b/server/code/app/symbol/coverage.py index 2fc24b9a6a7..a5e3ed632c7 100644 --- a/server/code/app/symbol/coverage.py +++ b/server/code/app/symbol/coverage.py @@ -16,6 +16,7 @@ from server.code.domain.index.epistemic import Envelope, scip_coverage_from_rows from server.code.domain.index.verdicts import GRAPHED_LANGS as _GRAPHED_LANGS from server.code.store.index import CodeRepo +from server.core.ch import shared_work logger = logging.getLogger(__name__) @@ -152,7 +153,8 @@ async def _ctor_edge_coverage(repo: CodeRepo, org: str, ns: str) -> tuple[bool, compiler tier says so when a full index converted with its source was applied (`scip_ctor_calls`); the parser tier when the namespace's edge stage has converged on the running extractor stamp (or was indexed by it). Fail closed to (False, False): an - error can only lower an answer, and that answer is kept only PROBE_ERROR_TTL_S.""" + error can only lower an answer, and that answer is kept only PROBE_ERROR_TTL_S. The + read is every request's, so it runs outside a best-effort block.""" hit = _CTOR_CACHE.get((org, ns)) if hit is not None: return hit @@ -161,7 +163,8 @@ async def _ctor_edge_coverage(repo: CodeRepo, org: str, ns: str) -> tuple[bool, from server.code.app.index.scip_delta import STATE_SCIP_CTOR_CALLS from server.code.domain.extract.extractor_stamp import stage_stamps - state = await repo.all_state(org, ns) + with shared_work(): + state = await repo.all_state(org, ns) scip_ok = state_value(state, STATE_SCIP_CTOR_CALLS) == "1" edge_stamp = state_value(state, "extractor_stamp_edge") ts_ok = bool(edge_stamp) and edge_stamp == stage_stamps()["edge"] diff --git a/server/code/app/symbol/dispatch.py b/server/code/app/symbol/dispatch.py index e986d466e9b..8ecab595083 100644 --- a/server/code/app/symbol/dispatch.py +++ b/server/code/app/symbol/dispatch.py @@ -10,6 +10,7 @@ from server.code.app.candidates import overrides_of from server.code.app.ttl_cache import TtlCache from server.code.store.index import CodeRepo +from server.core.ch import shared_work async def _widen_dispatch( @@ -91,13 +92,15 @@ async def _namespace_has_override_edges(repo: CodeRepo, org: str, ns: str) -> bo """Cached (1h) per namespace: does the compiler tier carry live `overrides` edges at all? Fail-closed to False so a query error keeps the heuristics; that answer is kept only `PROBE_ERROR_TTL_S`, so one transient error does not hold the - namespace on the slow heuristics for the hour.""" + namespace on the slow heuristics for the hour. The probe is every request's, so it + runs outside a best-effort block.""" hit = _OVR_CACHE.get((org, ns)) if hit is not None: return hit ttl: float | None = None try: - has = await repo.has_live_scip_override_edges(org, ns) + with shared_work(): + has = await repo.has_live_scip_override_edges(org, ns) except Exception: # noqa: BLE001 — fail closed to False: the heuristics stay on has, ttl = False, PROBE_ERROR_TTL_S _OVR_CACHE.put((org, ns), has, ttl_s=ttl) diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index b65fc32ef61..d6fb938520e 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -210,17 +210,14 @@ def __init__( else None ) # the lead block (callers through overrides, coverage, the PRs that changed it) - # under the `lead` shape's wall, less the legs the brief or the neighbours block - # already reads; an edit's read leads with its own tests - legs = code_lead.legs_beside( - neighbours=bool(input.neighbours), brief=self.brief is not None - ) + # under the `lead` shape's wall; the legs the brief or the neighbours block serve + # are dropped once those are read. An edit read builds no block. self.lead = ( asyncio.ensure_future( _staged( "symbol.lead", code_lead.definition_leads( - "code.symbol", org, ns, input, head, started=started, legs=legs + "code.symbol", org, ns, input, head, started=started ), ) ) @@ -1046,20 +1043,19 @@ async def handle_code_symbol( from server.code.domain.units import estimate_json_tokens, remaining_token_budget - # the compact block and the lead are budgeted before the bodies are trimmed, the - # lead after the first definition's card + # the compact block is budgeted before the bodies are trimmed, the lead block after + # them, in what the definitions leave uses_tokens = estimate_json_tokens(brief) if brief else 0 brief_omitted = bool(input.token_budget and uses_tokens > input.token_budget) if brief_omitted: brief, uses_tokens = {}, 0 - ran = lead - lead, lead_tokens = code_lead.fit(lead, units, input.token_budget, uses_tokens) + ran = code_lead.beside(lead, neighbours=block, brief=brief) with code_span("symbol.budget"): budgeted, tokens, lessons_left_out = _budget_definitions( - units, remaining_token_budget(input.token_budget, uses_tokens + lead_tokens) + units, remaining_token_budget(input.token_budget, uses_tokens) ) - lead = code_lead.served(lead, budgeted) - tokens += uses_tokens + (lead_tokens if lead else 0) + lead, lead_tokens = code_lead.fit(ran, budgeted, input.token_budget, uses_tokens + tokens) + tokens += uses_tokens + lead_tokens if documented_in: tokens += estimate_json_tokens(documented_in) tokens += block_tokens diff --git a/server/code/domain/units.py b/server/code/domain/units.py index 1d97b9b766b..066de3ae2e8 100644 --- a/server/code/domain/units.py +++ b/server/code/domain/units.py @@ -385,7 +385,7 @@ def budget_units( # Bodyless cards already carry the pointer the caller will receive. if bodies != "none": units = [_without_repeated_context(u) for u in units] - heads = [head_tokens(u) for u in units] + heads = [estimate_unit_tokens(_card_of(u) if u.body else u) for u in units] kept = 0 reserved = 0 for h in heads: @@ -408,12 +408,6 @@ def budget_units( return out, used -def head_tokens(u: CodeUnit) -> int: - """What `budget_units` reserves for `u` before any body: its elided card, or the - unit whole when it has no body.""" - return estimate_unit_tokens(_card_of(u) if u.body else u) - - def _card_of(u: CodeUnit) -> CodeUnit: """The unit as an elided card: signature + doc + pointer, body dropped, plus the one pasteable escalation (measured to reduce agent flailing diff --git a/server/core/background.py b/server/core/background.py index 5b7e7f6e768..103712727ff 100644 --- a/server/core/background.py +++ b/server/core/background.py @@ -58,18 +58,20 @@ def create_deferred_task[T]( coro: Coroutine[Any, Any, T], *, name: str | None = None ) -> asyncio.Task[T]: """A finite child of a request/pass, visible after its parent returns.""" - return register_deferred_task(asyncio.create_task(coro, name=name, context=_deferred())) + return register_deferred_task(asyncio.create_task(coro, name=name, context=_outside_lane())) def detached_task[T](coro: Coroutine[Any, Any, T], *, name: str) -> asyncio.Task[T]: """Schedule `coro` on the running loop with an empty context: no query tag, no request id, no auth, no capture level inherited from the caller. - For process-lifetime tasks only; a per-request write keeps `create_task`.""" + For process-lifetime tasks only; a per-request write is `create_deferred_task` or + `TaskSet.spawn`, which keep the request's context outside a best-effort block (a bare + `create_task` would keep the block too).""" return asyncio.get_running_loop().create_task(coro, name=name, context=contextvars.Context()) -def _deferred() -> contextvars.Context: - from server.core.ch import shared_context # deferred: ch loads the driver +def _outside_lane() -> contextvars.Context: + from server.core.ch import shared_context # imported here: ch loads the driver return shared_context() @@ -102,7 +104,7 @@ def spawn[T]( if detached: t = detached_task(coro, name=name) else: - t = asyncio.get_running_loop().create_task(coro, name=name, context=_deferred()) + t = asyncio.get_running_loop().create_task(coro, name=name, context=_outside_lane()) self._tasks.add(t) t.add_done_callback(self._tasks.discard) # Keep the task visible even if its short-lived TaskSet owner is collected. diff --git a/server/core/ch.py b/server/core/ch.py index a163c44e865..822cfab6d0e 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -475,12 +475,13 @@ def statement_class(sql: str) -> str: def class_timeout_s(cls: str) -> float: """The deadline for `cls` in seconds; 0 means unbounded. A - `statement_timeout()` scope wins over the class default, and a `best_effort()` - block's deadline lowers either.""" + `statement_timeout()` scope wins over the class default, and what is left of a + `best_effort()` block's deadline lowers either.""" scoped = statement_timeout_var.get() claim = _best_effort_var.get() - if claim is not None and claim.deadline_s > 0: - scoped = min(scoped, claim.deadline_s) if scoped > 0 else claim.deadline_s + if claim is not None and claim.deadline > 0: + left = max(claim.deadline - time.monotonic(), _PAST_DEADLINE_S) + scoped = min(scoped, left) if scoped > 0 else left if scoped > 0: return scoped if cls == "write": @@ -560,6 +561,10 @@ class BusyError(OverloadedError): already held its share of the pool, or the pool had no slot free at once.""" +# The bound of a best-effort statement sent once its block's deadline has passed. +_PAST_DEADLINE_S = 0.001 + + @dataclass class BestEffortSlots: """The pool slots one kind of best-effort work holds at once, process-wide.""" @@ -570,13 +575,19 @@ class BestEffortSlots: @dataclass class BestEffortClaim: - """One best-effort task's share of its kind's slots. `deadline_s` (0 = none) bounds - each of its statements on the server and in the client, so work cut at its caller's - wall stops on ClickHouse too. `refused` is set once one of its statements found no - slot, so a caller whose op swallowed the BusyError still knows the answer is short.""" + """One best-effort task's share of its kind's slots. + + - `deadline` (a `time.monotonic()` instant, 0 = none): each statement is bounded on + the server and in the client by what is left of it, so work cut at its caller's wall + stops on ClickHouse too. + - `width`: shared by the claims of one caller, the slots they hold at once; a + statement past it waits for one of them, never for the pool's. + - `refused` is set once one of its statements found no slot, so a caller whose op + swallowed the BusyError still knows the answer is short.""" slots: BestEffortSlots - deadline_s: float = 0.0 + deadline: float = 0.0 + width: asyncio.Semaphore | None = None refused: bool = False @@ -586,9 +597,10 @@ class BestEffortClaim: @contextmanager def best_effort(claim: BestEffortClaim) -> Iterator[None]: """Every statement in this block is best effort: work a request adds beside its own - reads, such as the code ops' lead block. It takes a pool slot only when one is free at - once and its kind holds fewer than `claim.slots.limit`; otherwise it raises BusyError - before it is sent, so it never waits for a slot a request's own read could take.""" + reads, such as the code ops' lead block. Once one of its caller's slots is free + (`claim.width`), it takes a pool slot only when one is free at once and its kind holds + fewer than `claim.slots.limit`; otherwise it raises BusyError before it is sent, so it + never waits for a slot a request's own read could take.""" token = _best_effort_var.set(claim) try: yield @@ -597,16 +609,28 @@ def best_effort(claim: BestEffortClaim) -> Iterator[None]: def shared_context() -> Context: - """A copy of the current context without its `best_effort()` block, for work that - outlives the block or is shared beyond it: a load other requests join, a deferred - write, a flush of the process's queue. Its statements hold no slot of the block's - share, are never refused for it and keep no deadline of the block's; a - `statement_timeout()` around the block (a claim's bound) still applies.""" + """A copy of the current context without its `best_effort()` block, for a task whose + work outlives the block or is shared beyond it: a load other requests join, a + deferred write. Its statements hold no slot of the block's share, are never refused + for it and keep no deadline of the block's; a `statement_timeout()` around the block + (a claim's bound) still applies.""" ctx = copy_context() ctx.run(_best_effort_var.set, None) return ctx +@contextmanager +def shared_work() -> Iterator[None]: + """`shared_context()` for work awaited inline: a fill of a process-wide cache or + snapshot, whose answer every request reads. Its statements run outside the + `best_effort()` block, so a refusal is never kept as everyone's answer.""" + token = _best_effort_var.set(None) + try: + yield + finally: + _best_effort_var.reset(token) + + def _short_of_memory(op_name: str, e: BaseException) -> OverloadedError: """The 503 for a statement ClickHouse ran short of shared memory for, counted, with ClickHouse's line logged when one is due: the answer carries none of it.""" @@ -1258,16 +1282,20 @@ def _release_slot(self) -> None: async def _guard_schema( self, op_name: str, sql: str, cls: str, *, insert_table: str | None = None ) -> None: + # The pending set's ledger refresh is the process's: outside a best-effort block, + # whose refusal would leave the guard idle for every request until its next refresh. session = _coordination_session.get() if session is None: - await guard_pending_schema(op_name, sql, cls, insert_table=insert_table) + with shared_work(): + await guard_pending_schema(op_name, sql, cls, insert_table=insert_table) return try: session.check(self) # The advisory ledger refresh uses the global client, outside the proof. token = _coordination_session.set(None) try: - await guard_pending_schema(op_name, sql, cls, insert_table=insert_table) + with shared_work(): + await guard_pending_schema(op_name, sql, cls, insert_table=insert_table) finally: _coordination_session.reset(token) session.check(self) @@ -1288,7 +1316,7 @@ async def _with_retry( # type: ignore[no-untyped-def] retried batch lands once); a replica-bound server error gets up to two more connections; a class deadline and every other error raise at once.""" self._ensure_state() - held = self._hold_best_effort(op_name) + held = await self._hold_best_effort(op_name) session = _coordination_session.get() took = False if session is not None: @@ -1314,16 +1342,22 @@ async def _with_retry( # type: ignore[no-untyped-def] self._release_slot() if held is not None: held.slots.in_use -= 1 + if held.width is not None: + held.width.release() - def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: - """Count a statement of a `best_effort()` block against its kind's slots, or raise - BusyError, before it is sent, when they are held or the pool has no slot free at - once. None outside such a block.""" + async def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: + """Count a statement of a `best_effort()` block against its kind's slots, once one + of its caller's (`width`) is free, or raise BusyError, before it is sent, when its + kind's are held or the pool has no slot free at once. None outside such a block.""" claim = _best_effort_var.get() if claim is None: return None + if claim.width is not None: + await claim.width.acquire() pool = self._slots if claim.slots.in_use >= claim.slots.limit or (pool is not None and pool.locked()): + if claim.width is not None: + claim.width.release() claim.refused = True raise BusyError(f"no ClickHouse slot free for best-effort work ({op_name})") claim.slots.in_use += 1 diff --git a/server/settings/catalog.py b/server/settings/catalog.py index 1289e48a598..77cd5a90138 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -6911,15 +6911,9 @@ class TrackerSettings(BaseModel): # Budgets for the request shapes an op prices separately: a handler that notes a # shape (`server.observability.budget_shape`) is held to that shape's budget. OP_SHAPE_BUDGETS_P99_MS: dict[str, dict[str, int]] = { - # "lead" (code.grep and code.symbol): the answer with its `lead` block, whose legs - # (code.callers, code.coverage_claim, code.symbol_history, run together) get what - # the budget leaves after the time spent. Not measured: each adds to the base about - # what code.callers (400 ms) takes, so the block costs a few hundred ms. code.symbol's - # legs start with its body reads (+350 ms), code.grep's once its page is read - # (+400 ms). code.coverage_claim (1200 ms) and code.symbol_history (1800 ms) answer - # when they are fast and say `unread: deadline` otherwise. A deployment whose legs - # need longer raises the op's budget: `latency_budget_overrides` ("2x" scales the - # base and the shapes) or `admin/budget.set`. + # "lead": the answer with its `lead` block (docs/features/code-index/operations.md). + # Not measured; a leg past it reads `unread: deadline`. Raise it with + # `latency_budget_overrides` or `admin/budget.set`. "code.grep": { "files": 600, "lead": 1000, @@ -6931,8 +6925,7 @@ class TrackerSettings(BaseModel): }, # A lookup ranked by the change at hand (near_paths / pr_number) reads the # PR's files and the candidates' neighbourhoods; the compact uses block adds a - # mention leg. Those two are priced from their served p99; `lead` (above) is - # priced from its legs' declared budgets until a served p99 replaces it. + # mention leg. Each is priced from its served p99; `lead` is described above. "code.symbol": { "lead": 600, "ranked": 3000, diff --git a/server/tracker/app/binding.py b/server/tracker/app/binding.py index 6b9b6a67d62..b85f10a972f 100644 --- a/server/tracker/app/binding.py +++ b/server/tracker/app/binding.py @@ -107,20 +107,21 @@ async def refresh_overrides(*, force: bool = False) -> None: older than `code_repos_refresh_seconds` (or `force`, which callers pass right after their own write, so it reads with sequential consistency, and reads once more when `forget_links` discards the first read); never raises — a directory that cannot be - read keeps the last snapshot.""" + read keeps the last snapshot. The snapshot is every request's, so the read runs outside + a best-effort block.""" global _OVERRIDES, _BRANCH_OF, _OVERRIDES_AT, _AFTER_WRITE now = time.monotonic() if not force and now - _OVERRIDES_AT < float(settings.code_repos_refresh_seconds): return try: from server.code.app.reads import code_index - from server.core.ch import get_client, own_write_reads + from server.core.ch import get_client, own_write_reads, shared_work if getattr(get_client(), "_client", "absent") is None: return for _attempt in range(2 if force else 1): forgotten, after_write = _FORGOTTEN, force or _AFTER_WRITE - with own_write_reads() if after_write else contextlib.nullcontext(): + with shared_work(), own_write_reads() if after_write else contextlib.nullcontext(): rows = await code_index().state_values_for_keys([OVERRIDE_KEY, BRANCH_OF_KEY]) if forgotten != _FORGOTTEN: _OVERRIDES_AT = -math.inf # the next call reads again diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index c477e099230..a70969c4b5e 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -473,22 +473,67 @@ async def _leg() -> None: assert not claim.refused +async def test_a_callers_statements_past_its_width_wait_for_its_own_slots( + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Claims sharing a `width` hold at most that many slots at once: a statement past it + waits for one of them and is not refused, so one caller's own gather never reads busy.""" + fake = _FakeAsync(plan={"SELECT slow": [0.1, 0.1]}) + c = _client(monkeypatch, fake, ch_pool_maxsize=8, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) + slots, width = ch_mod.BestEffortSlots(limit=2), asyncio.Semaphore(1) + claims = [ch_mod.BestEffortClaim(slots, width=width) for _ in range(2)] + peak = 0 + + async def _leg(claim: Any) -> None: + nonlocal peak + with ch_mod.best_effort(claim): + await asyncio.sleep(0) + peak = max(peak, slots.in_use) + await c.query_all("SELECT slow") + + async def _watch() -> None: + nonlocal peak + for _ in range(20): + peak = max(peak, slots.in_use) + await asyncio.sleep(0.01) + + await asyncio.gather(*(_leg(claim) for claim in claims), _watch()) + assert peak == 1 and slots.in_use == 0 and not any(cl.refused for cl in claims) + assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow"] * 2 + + +async def test_a_best_effort_statement_is_bounded_by_what_is_left_of_its_deadline() -> None: + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1)) + with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): + claim.deadline = time.monotonic() + 0.3 + assert ch_mod.class_timeout_s("read") == pytest.approx(0.3, abs=0.05) + await asyncio.sleep(0.1) + assert ch_mod.class_timeout_s("read") == pytest.approx(0.2, abs=0.05) + claim.deadline = time.monotonic() - 1.0 + assert ch_mod.class_timeout_s("read") == ch_mod._PAST_DEADLINE_S + + async def test_work_shared_beyond_a_best_effort_block_runs_outside_it() -> None: - """A deferred write or a held task a best-effort block starts outlives it: it takes - neither the block's share of the pool nor its deadline, while a `statement_timeout()` - around the block (a claim's bound) still reaches it.""" + """A deferred write or a held task a best-effort block starts outlives it, and a + process-wide cache it fills inline is every request's: none takes the block's share of + the pool or its deadline, while a `statement_timeout()` around the block (a claim's + bound) still reaches them.""" from server.core.background import TaskSet, create_deferred_task async def _scope() -> tuple[Any, float]: return ch_mod._best_effort_var.get(), ch_mod.class_timeout_s("write") - claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), deadline_s=0.3) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), deadline=time.monotonic() + 0.3) with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): inside = await asyncio.ensure_future(_scope()) held = await TaskSet().spawn(_scope(), name="t") deferred = await create_deferred_task(_scope(), name="d") - assert inside == (claim, 0.3) - assert held == deferred == (None, 5.0) + with ch_mod.shared_work(): + inline = await _scope() + after = ch_mod._best_effort_var.get() + assert inside[0] is claim and inside[1] == pytest.approx(0.3, abs=0.05) + assert held == deferred == inline == (None, 5.0) + assert after is claim async def test_an_open_stream_holds_no_pool_slot_and_streams_have_their_own_gate( diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index d067c5ff772..6a8764dfa5e 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -8,7 +8,9 @@ import ast import asyncio +import functools import math +import re from pathlib import Path from typing import Any from unittest.mock import patch @@ -24,7 +26,7 @@ ) from server.code.api.models_testing import CodeCoverageClaimOutput from server.code.app import lead -from server.code.domain.units import CodeUnit, head_tokens +from server.code.domain.units import CodeUnit, estimate_json_tokens from server.core import ch from server.observability import degradations from server.settings import settings @@ -81,23 +83,35 @@ def test_the_pool_share_is_an_eighth_of_the_pool(monkeypatch): assert lead.lead_slots() == share -def test_a_leg_another_block_reads_is_left_out(): - assert lead.legs_beside(neighbours=False, brief=False) == ("callers", "tested", "changed_by") - assert lead.legs_beside(neighbours=False, brief=True) == ("tested", "changed_by") - assert lead.legs_beside(neighbours=True, brief=True) == ("changed_by",) +def test_a_leg_another_block_serves_is_left_out(): + from server.code.app.symbol_uses import unread_block + + d = {"symbol": "A::f", "path": "src/a.cpp", "line": 3} + anchor = {"qualified_name": "A::f", "path": "src/a.cpp", "callers": [], "tests": []} + other = {"qualified_name": "A::g", "path": "src/a.cpp", "callers": ["x"], "tests": []} + brief = {"count": 0, "files": 0, "top": [], "epistemic": "lower_bound"} + assert lead.served_beside(d, neighbours=[], brief=None) == set() + assert lead.served_beside(d, neighbours=[other], brief={}) == set() + assert lead.served_beside(d, neighbours=[anchor], brief=None) == {"callers", "tested"} + assert lead.served_beside(d, neighbours=[], brief=brief) == {"callers"} + assert lead.served_beside(d, neighbours=[], brief=unread_block()) == set() + entry = {**d, "callers": {"count": 1}, "tested": {"tests": 0}, "changed_by": {"prs": 0}} + (kept,) = lead.beside([entry], neighbours=[anchor], brief=brief) + assert list(kept) == ["symbol", "path", "line", "changed_by"] + assert lead.beside([entry], neighbours=[other], brief={}) == [entry] def _unit(symbol: str, line: int) -> CodeUnit: return CodeUnit(path="src/a.cpp", start_line=line, symbol=symbol, body="void f() {}\n" * 20) -def test_the_block_never_takes_the_first_definitions_place(): +def test_the_block_takes_only_what_the_definitions_leave(): block = [{"symbol": "A::f", "path": "src/a.cpp", "line": 3, "callers": {"count": 1}}] - units = [_unit("A::f", 3), _unit("A::g", 9)] - tokens, card = lead.fit(block, units, 0, 0)[1], head_tokens(units[0]) - assert tokens > 0 and card > 0 - assert lead.fit(block, units, tokens + card + 10, 10) == (block, tokens) - assert lead.fit(block, units, tokens + card + 10, 11) == ([], 0) + units = [_unit("A::g", 9), _unit("A::f", 3)] + tokens = lead.fit(block, units, 0, 0)[1] + assert tokens == estimate_json_tokens(block) > 0 + assert lead.fit(block, units, tokens + 100, 100) == (block, tokens) + assert lead.fit(block, units, tokens + 100, 101) == ([], 0) assert lead.fit([], units, 5, 0) == ([], 0) @@ -363,15 +377,19 @@ def record(query: Any) -> Any: ops = _Ops(**{"code.callers": record}) with ch.caller_shaped(): _run_leads(monkeypatch, ops, wall=0.5) - assert seen["settings"]["max_execution_time"] == pytest.approx(0.75) + assert seen["settings"]["max_execution_time"] == pytest.approx(0.75, abs=0.05) assert "read_overflow_mode" not in seen["settings"] -def test_only_the_legs_asked_for_run(monkeypatch): +def test_a_neighbours_block_read_first_spares_the_legs_it_serves(monkeypatch): ops = _Ops() - out, _ = _run_leads(monkeypatch, ops, legs=("changed_by",)) + served = [{"qualified_name": "A::f", "path": "src/a.cpp", "callers": [], "tests": []}] + out, _ = _run_leads(monkeypatch, ops, neighbours=served) assert set(ops.queries) == {"code.symbol_history"} assert list(out[0]) == ["symbol", "path", "line", "changed_by"] + ops = _Ops() + _run_leads(monkeypatch, ops, neighbours=[{**served[0], "qualified_name": "A::g"}]) + assert len(ops.queries) == 3 def test_no_time_left_starts_no_leg_and_serves_no_block(monkeypatch): @@ -424,7 +442,7 @@ async def callers(query: Any) -> Any: return CodeCallersOutput(edges=[], seed_symbols=[]) _run_leads(monkeypatch, _Ops(**{"code.callers": callers}), wall=0.5) - assert seen["leg"] == (True, pytest.approx(0.75)) + assert seen["leg"] == (True, pytest.approx(0.75, abs=0.05)) assert seen["load"] == (None, settings.ch_timeout_read_s) @@ -550,32 +568,58 @@ def _intel_on(monkeypatch): monkeypatch.setattr(settings, "code_namespace", "n") -_LED = { - "symbol": "DB::Foo::bar", - "path": "src/Foo.cpp", - "line": 10, +_LEGS = { "callers": {"count": 2, "top": []}, + "tested": {"verdict": "covered", "tests": 1, "top": []}, + "changed_by": {"prs": 0, "level": "file", "top": []}, } +_LED = {"symbol": "DB::Foo::bar", "path": "src/Foo.cpp", "line": 10, **_LEGS} def _recorder(seen: list[dict[str, Any]]) -> Any: - async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf, legs=()): - seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows], "legs": legs}) - seen[-1]["cap_s"] = cap_s + async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf, neighbours=None): + names = [n["qualified_name"] for n in neighbours] if neighbours is not None else None + seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows]}) + seen[-1].update(cap_s=cap_s, neighbours=names) first = rows[0] return [ { "symbol": first["qualified_name"], "path": first["path"], "line": first["start_line"], - "callers": {"count": 2, "top": []}, + **_LEGS, } ] return leads -def _symbol(monkeypatch, *, edit: bool = False, **fields: Any) -> tuple[Any, list[Any], str]: +class _TwoRepo(_Repo): + """Two definitions of the name, the second in another file and called more.""" + + _OTHER = dict(_DEF, symbol_id="f2", path="src/Foo2.cpp", start_line=30, end_line=40) + + async def symbols_by_name(self, org, ns, name, limit=10): + return [dict(_DEF), dict(self._OTHER)] + + async def symbols_by_ids(self, org, ns, ids): + return [dict(r) for r in (_DEF, self._OTHER) if r["symbol_id"] in ids] + + async def functions_for_paths(self, org, ns, paths, *, limit=400, **_kw): + return [dict(r) for r in (_DEF, self._OTHER) if r["path"] in paths] + + async def symbol_stats(self, org, ns, ids, **_kw): + fan_in = {"f1": 1, "f2": 9} + return { + sid: {"qualified_name": "DB::Foo::bar", "fan_in_nontest": fan_in[sid]} + for sid in ids + if sid in fan_in + } + + +def _symbol( + monkeypatch, *, edit: bool = False, repo: Any = None, **fields: Any +) -> tuple[Any, list[Any], str]: from server.code.api.models_symbol import CodeEditContextInput, CodeSymbolInput from server.code.app.symbol import outline from server.code.app.symbol import symbol as h @@ -590,7 +634,7 @@ async def body(r, org, ns, sym): async def go() -> tuple[Any, str]: with ( - patch.object(h, "CodeRepo", return_value=_Repo()), + patch.object(h, "CodeRepo", return_value=repo or _Repo()), patch.object(h, "symbol_body", new=body), patch.object(outline, "symbol_body", new=body), patch.object(h, "schedule_code_trace", new=lambda **k: None), @@ -617,8 +661,8 @@ async def go() -> tuple[Any, str]: @pytest.mark.usefixtures("_intel_on") def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar") - assert [(s["op"], s["rows"], s["legs"]) for s in seen] == [ - ("code.symbol", ["DB::Foo::bar"], ("callers", "tested", "changed_by")), + assert [(s["op"], s["rows"], s["neighbours"]) for s in seen] == [ + ("code.symbol", ["DB::Foo::bar"], None), ] dump = out.model_dump() assert list(dump)[0] == "lead" @@ -635,28 +679,66 @@ def test_lead_false_and_the_edit_read_run_no_leg(monkeypatch): @pytest.mark.usefixtures("_intel_on") -def test_code_symbol_reads_no_leg_its_other_blocks_read(monkeypatch): - _, seen, _ = _symbol(monkeypatch, name="DB::Foo::bar", neighbours=True) - assert seen[0]["legs"] == ("changed_by",) - _, seen, _ = _symbol(monkeypatch, name="DB::Foo::bar", uses_brief=True) - assert seen[0]["legs"] == ("tested", "changed_by") +def test_code_symbol_drops_a_leg_only_when_another_block_serves_it(monkeypatch): + from server.code.app import symbol_uses + from server.code.app.symbol import symbol as h + + def legs(**fields: Any) -> list[str]: + out, seen, _ = _symbol(monkeypatch, name="DB::Foo::bar", **fields) + assert len(seen) == 1 and seen[0]["neighbours"] is None + return [k for k in out.model_dump()["lead"][0] if k in _LEGS] + + assert legs(neighbours=True) == ["changed_by"] + assert legs(uses_brief=True) == ["tested", "changed_by"] + + async def no_neighbours(*_a: Any) -> tuple[list[Any], int]: + return [], 0 + + async def failed_brief(*_a: Any, **_k: Any) -> tuple[dict[str, Any], dict[str, Any]]: + return symbol_uses.unread_block(), {} + + monkeypatch.setattr(h, "_symbol_neighbours", no_neighbours) + monkeypatch.setattr(h._uses_brief, "uses_brief", failed_brief) + assert legs(neighbours=True) == list(_LEGS) + assert legs(uses_brief=True) == list(_LEGS) @pytest.mark.usefixtures("_intel_on") def test_a_token_budget_the_block_does_not_fit_withholds_it(monkeypatch): - from server.code.domain.units import estimate_json_tokens - - whole, _, _ = _symbol(monkeypatch, name="DB::Foo::bar") - block, card = estimate_json_tokens([_LED]), head_tokens(whole.definitions[0]) - # room for the block but not for the block and the definition's card: the - # definition is served and the block withheld, though its legs ran - out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=block + card - 1) + whole, _, _ = _symbol(monkeypatch, name="DB::Foo::bar", lead=False) + block, defs = estimate_json_tokens([_LED]), whole.tokens_returned + # room for the definition but not for the block beside it: the definition is served + # whole and the block withheld, though its legs ran + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=defs + block - 1) assert len(seen) == 1 and "lead" not in out.model_dump() and shape == lead.LEAD_SHAPE - assert [d.symbol for d in out.definitions] == ["DB::Foo::bar"] - assert out.tokens_returned <= block + card - 1 - out, _, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=block + card + 50) - assert out.model_dump()["lead"] == [_LED] and out.definitions - assert out.tokens_returned <= block + card + 50 + assert [d.body for d in out.definitions] == [d.body for d in whole.definitions] + out, _, shape = _symbol(monkeypatch, name="DB::Foo::bar", token_budget=defs + block) + assert out.model_dump()["lead"] == [_LED] and out.tokens_returned <= defs + block + + +@pytest.mark.usefixtures("_intel_on") +@pytest.mark.parametrize("sort_by", ["score", "fan_in"]) +def test_every_budget_serves_the_definitions_lead_false_serves(monkeypatch, sort_by): + """The block is fitted after the definitions, so it never takes a definition's place: + whether its definition comes first or, sorted by fan-in, second, each budget serves the + definitions (and their bodies) `lead: false` serves, and the block only beside them.""" + kw: dict[str, Any] = {"name": "DB::Foo::bar", "sort_by": sort_by, "repo": _TwoRepo()} + whole, _, _ = _symbol(monkeypatch, lead=False, **kw) + first = ["src/Foo2.cpp", "src/Foo.cpp"] if sort_by == "fan_in" else ["src/Foo.cpp"] + assert [d.path for d in whole.definitions][: len(first)] == first + assert len(whole.definitions) == 2 + block = estimate_json_tokens([_LED]) + led_at = [] + for budget in range(40, whole.tokens_returned + block + 40, 25): + plain, _, _ = _symbol(monkeypatch, lead=False, token_budget=budget, **kw) + out, _, _ = _symbol(monkeypatch, token_budget=budget, **kw) + assert [(d.path, d.body) for d in out.definitions] == [ + (d.path, d.body) for d in plain.definitions + ], budget + if out.lead: + led_at.append(budget) + assert out.tokens_returned <= budget + assert led_at and led_at[-1] >= whole.tokens_returned + block @pytest.mark.usefixtures("_intel_on") @@ -666,6 +748,152 @@ def test_a_block_whose_definition_is_not_served_is_left_out(monkeypatch): assert shape == lead.LEAD_SHAPE +# ------------------------------------------------------------------ the lane + + +class _Result: + def __init__(self, rows: list[dict[str, Any]]) -> None: + self.column_names = tuple(rows[0]) if rows else () + self.result_rows = [tuple(r.values()) for r in rows] + + +class _Driver: + """The driver under a real `CHClient`: each statement takes a few ms and answers + `rows(sql)`. It records each statement, whether it ran in a best-effort block, and the + most of the lead's slots held while one ran.""" + + def __init__(self, rows: Any) -> None: + self.rows = rows + self.seen: list[tuple[str, bool]] = [] + self.peak = 0 + + async def query(self, sql: str, parameters: Any = None, settings: Any = None, **_k: Any): + self.seen.append((" ".join(sql.split()), ch._best_effort_var.get() is not None)) + self.peak = max(self.peak, lead._slots().in_use) + await asyncio.sleep(0.005) + return _Result([dict(r) for r in self.rows(sql)]) + + async def command(self, sql: str, parameters: Any = None, settings: Any = None, **_k: Any): + await self.query(sql) + + async def insert(self, *_a: Any, **_k: Any) -> None: + return None + + async def close(self) -> None: + return None + + +@pytest.fixture +def real_client(monkeypatch, _intel_on): + """Installs a real CHClient over a `_Driver` as the process's client, with the default + pool and a fresh lead lane and schema caches.""" + from server.core.schema import status + + monkeypatch.setattr(settings, "ch_pool_maxsize", 64) + lead._slots.cache_clear() + status.reset_cache() + + def install(rows: Any) -> _Driver: + driver = _Driver(rows) + client = ch.CHClient() + client._client = driver + monkeypatch.setattr(ch, "_ch", client) + return driver + + yield install + lead._slots.cache_clear() + status.reset_cache() + + +def _resolved_only(sql: str) -> list[dict[str, Any]]: + """An index that resolves `_DEF` and holds no caller, test or PR of it.""" + if re.search(r"FROM loom\.code_symbol_(ids|names)\b", sql): + return [{"tier": "treesitter", "qualified_name": _DEF["qualified_name"], "symbol_id": "f1"}] + if "FROM loom.code_symbols" in sql and "count(" not in sql: + return [_DEF] + return [] + + +def _unread_of_calls(n: int) -> list[str]: + """`n` code.symbol blocks for `_DEF` at once, each one's `unread_of`.""" + one = functools.partial( + lead.definition_leads, "code.symbol", "o", "n", _Identity(), [_DEF], started=0 + ) + + async def go() -> list[list[dict[str, Any]]]: + return list(await asyncio.gather(*(one() for _ in range(n)))) + + return [lead.unread_of(block) for block in asyncio.run(go())] + + +def test_one_calls_legs_hold_half_the_lane_so_two_calls_fit(monkeypatch, real_client): + """Over the real leg handlers: one call's legs gather more reads at once than half the + lane (9 for a definition with no callers, tests or PRs), so past `call_slots()` they + wait for their own call's slots, and two calls at once both answer: `busy` means other + calls hold the lane.""" + driver = real_client(_resolved_only) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + assert _unread_of_calls(1) == [""] + assert driver.peak == lead.call_slots() == 4 + driver.peak = 0 + assert _unread_of_calls(2) == ["", ""] + assert driver.peak <= lead.lead_slots() == 8 + # uncapped, in a lane wide enough, one call alone holds more than half the default lane + monkeypatch.setattr(settings, "ch_pool_maxsize", 800) + monkeypatch.setattr(lead, "call_slots", lambda: 100) + lead._slots.cache_clear() + driver.peak = 0 + assert _unread_of_calls(1) == [""] + assert driver.peak > 4 + + +def test_reads_every_request_keeps_run_outside_a_full_lane(monkeypatch, real_client): + """With the lane full, a leg's reads still run the schema guard's ledger refresh, the + namespace probes and the tracker-link snapshot refresh, outside the lane: a refusal is + never kept as every request's answer (an idle guard, a namespace held on the dispatch + heuristics, an empty snapshot).""" + from server.code.app.symbol import coverage as symbol_coverage + from server.code.app.symbol import dispatch + from server.code.store.index import CodeRepo + from server.core import ch_schema_guard + from server.core.schema import status + from server.tracker.app import binding + + ledger = [{"filename": f} for f in status.repo_migrations()] + ctor = {"state_key": "scip_ctor_calls", "state_value": "1", "detail": "", "updated_at": None} + + def rows(sql: str) -> list[dict[str, Any]]: + if "loom._migrations" in sql: + return ledger + if "SELECT 1 AS one" in sql: + return [{"one": 1}] + if "FROM loom.code_index_state" in sql and "state_key IN" not in sql: + return [ctor] + return [] + + driver = real_client(rows) + monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) + full = ch.BestEffortClaim(ch.BestEffortSlots(limit=0)) + + async def go() -> tuple[bool, tuple[bool, bool]]: + with ch.best_effort(full): + with pytest.raises(ch.BusyError): + await CodeRepo().symbols_by_ids("o", "n", ["f1"]) + await binding.refresh_overrides() + repo = CodeRepo() + return ( + await dispatch._namespace_has_override_edges(repo, "o", "n"), + await symbol_coverage._ctor_edge_coverage(repo, "o", "n"), + ) + + has_overrides, (scip_ctor, _) = asyncio.run(go()) + assert has_overrides and scip_ctor + assert status._cache["value"]["pending"] == [] and "error" not in status._cache["value"] + assert ch_schema_guard._schema_guard["at"] is not None + assert binding._OVERRIDES_AT > -math.inf + assert len(driver.seen) == 4 and not any(in_lane for _sql, in_lane in driver.seen) + + def _grep(monkeypatch, **fields: Any) -> tuple[Any, list[dict[str, Any]], str]: """code.grep through its handler over the scan fixture, with two enclosing bodies of the match: the first one holds it, the second one is the definition it names.""" @@ -724,8 +952,8 @@ async def go() -> tuple[Any, str]: def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): out, seen, shape = _grep(monkeypatch) - assert [(s["op"], s["rows"], s["legs"]) for s in seen] == [ - ("code.grep", ["B::parseInput", "B::h"], ("callers", "tested", "changed_by")), + assert [(s["op"], s["rows"], s["neighbours"]) for s in seen] == [ + ("code.grep", ["B::parseInput", "B::h"], []), ] assert seen[0]["cap_s"] == math.inf dump = out.model_dump() @@ -734,9 +962,10 @@ def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkeypatch): - _, seen, _ = _grep(monkeypatch, deadline_ms=5000, neighbours=True) + out, seen, _ = _grep(monkeypatch, deadline_ms=5000, neighbours=True) assert 0 < seen[0]["cap_s"] <= 5.0 - lead.RESERVE_S - assert seen[0]["legs"] == ("changed_by",) + # the neighbours block is read first, so the legs it serves never start + assert seen[0]["neighbours"] == [n["qualified_name"] for n in out.neighbours] def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): @@ -753,7 +982,7 @@ def test_code_grep_leads_no_continuation_or_related_answer(monkeypatch): bodies = {"definitions": [dict(_DEF, symbol="bar")]} query = CodeGrepInput(org="o", namespace="n", pattern="bar") for offset, related in ((10, ""), (0, "bar")): - args = ("o", "n", query, bodies, 0.0, None, offset, related) + args = ("o", "n", query, bodies, 0.0, None, offset, related, []) assert asyncio.run(grep._grep_lead(*args)) == [] assert seen == [] @@ -767,27 +996,81 @@ def _call_name(node: ast.expr) -> str: return node.attr if isinstance(node, ast.Attribute) else getattr(node, "id", "") +def _keys(d: ast.Dict) -> set[Any]: + return {k.value for k in d.keys if isinstance(k, ast.Constant)} + + +def _inputs_of(fn: ast.FunctionDef | ast.AsyncFunctionDef) -> set[str]: + """`fn`'s parameters annotated as an input of either op.""" + args = [*fn.args.posonlyargs, *fn.args.args, *fn.args.kwonlyargs] + return { + a.arg + for a in args + if a.annotation is not None + and any(_call_name(n) in _INPUTS for n in ast.walk(a.annotation)) # type: ignore[arg-type] + } + + +def _built_inputs(tree: ast.AST) -> list[tuple[int, set[Any]]]: + """(line, the fields it names) of every input built for either op: a constructor call, + `CodeSymbolInput.model_validate({...})`, a by-name call `("code.symbol", {...})`, and a + copy of an input parameter sent to another namespace (`model_copy(update={"namespace": + ...})`, a request of its own; a copy that keeps the namespace continues its caller's).""" + out: list[tuple[int, set[Any]]] = [] + + def visit(node: ast.AST, inputs: frozenset[str]) -> None: + if isinstance(node, ast.FunctionDef | ast.AsyncFunctionDef): + inputs = inputs | _inputs_of(node) + if isinstance(node, ast.Call): + func, update = ( + node.func, + next((k.value for k in node.keywords if k.arg == "update"), None), + ) + if _call_name(func) in _INPUTS: + out.append((node.lineno, {k.arg for k in node.keywords})) + elif isinstance(func, ast.Attribute) and _call_name(func.value) in _INPUTS: + if ( + func.attr == "model_validate" + and node.args + and isinstance(node.args[0], ast.Dict) + ): + out.append((node.lineno, _keys(node.args[0]))) + elif ( + isinstance(func, ast.Attribute) + and func.attr == "model_copy" + and isinstance(func.value, ast.Name) + and func.value.id in inputs + and isinstance(update, ast.Dict) + and "namespace" in _keys(update) + ): + out.append((node.lineno, _keys(update))) + elif ( + isinstance(node, ast.Tuple) + and len(node.elts) == 2 + and isinstance(node.elts[0], ast.Constant) + and node.elts[0].value in _INPUTS.values() + and isinstance(node.elts[1], ast.Dict) + ): + out.append((node.lineno, _keys(node.elts[1]))) + for child in ast.iter_child_nodes(node): + visit(child, inputs) + + visit(tree, frozenset()) + return out + + def test_every_caller_inside_loom_says_whether_it_wants_the_block(): """A unit test stubs the legs out (tests/unit/conftest.py), so a caller inside Loom that forgot `lead` would pass and run three legs a call in production: every input it - builds for code.symbol or code.grep, and every by-name call of them with literal - arguments, names `lead`.""" - missing = [] + builds for code.symbol or code.grep (`_built_inputs`) names `lead`.""" + built, missing = 0, [] for path in sorted(Path("server").rglob("*.py")): if path.parts[1] == "transport": continue - for node in ast.walk(ast.parse(path.read_text(), str(path))): - if isinstance(node, ast.Call) and _call_name(node.func) in _INPUTS: - if not any(k.arg == "lead" for k in node.keywords): - missing.append(f"{path}:{node.lineno}") - elif ( - isinstance(node, ast.Tuple) - and len(node.elts) == 2 - and isinstance(node.elts[0], ast.Constant) - and node.elts[0].value in _INPUTS.values() - and isinstance(node.elts[1], ast.Dict) - ): - keys = {k.value for k in node.elts[1].keys if isinstance(k, ast.Constant)} - if "lead" not in keys: - missing.append(f"{path}:{node.lineno}") + for line, fields in _built_inputs(ast.parse(path.read_text(), str(path))): + built += 1 + if "lead" not in fields: + missing.append(f"{path}:{line}") assert missing == [] + # the presence fan-outs' copies and the callers' own inputs are all seen + assert built >= 6 From 801e3b21d9f737b639a682eae0607748aa0c25a0 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 02:58:23 +0530 Subject: [PATCH 05/30] Format the code-index operations table Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index cbfd2b1970c..8a784248cf6 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -126,14 +126,14 @@ schema guard's ledger read, a namespace's probe) run outside that share and are not counted in it. An answer that does not come back reads `{"unread": why}`, and the rest of the response is served: -| `unread` | Why | -| ------------ | --------------------------------------------------------------------------- | -| `deadline` | still running when the budget ran out | -| `busy` | other calls held the share, or the pool had no slot free at once | -| `failed` | the op raised | -| `policy` | a history policy rule denies the op | -| `ambiguous` | the op refused an ambiguous name | -| `unresolved` | the op did not resolve the definition | +| `unread` | Why | +| ------------ | ---------------------------------------------------------------- | +| `deadline` | still running when the budget ran out | +| `busy` | other calls held the share, or the pool had no slot free at once | +| `failed` | the op raised | +| `policy` | a history policy rule denies the op | +| `ambiguous` | the op refused an ambiguous name | +| `unresolved` | the op did not resolve the definition | An answer another block of the same response serves for the definition is left out: the `callers` and `tested` keys when the `neighbours` block has an entry From 5d378ae81eadc219aa6c0446075a1e0cd2631c4f Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 03:43:45 +0530 Subject: [PATCH 06/30] The lead block serves its three legs beside every other block A leg was dropped when the neighbours block or the uses brief seemed to serve it, but neither does: the brief holds direct edges only and a hub brief none, so an override's callers through its base were lost, and a neighbours entry has neither dispatch callers nor a coverage verdict. The overlap is at most three caller rows. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 7 +-- server/code/api/models_symbol.py | 7 ++- server/code/app/grep.py | 10 ++-- server/code/app/lead.py | 35 +------------ server/code/app/symbol/symbol.py | 10 ++-- tests/unit/test_code_lead.py | 71 +++----------------------- 6 files changed, 22 insertions(+), 118 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 8a784248cf6..66c80a93ac5 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -135,11 +135,8 @@ and the rest of the response is served: | `ambiguous` | the op refused an ambiguous name | | `unresolved` | the op did not resolve the definition | -An answer another block of the same response serves for the definition is left -out: the `callers` and `tested` keys when the `neighbours` block has an entry -for it, `callers` when a `uses_brief` block is served and its read did not fail. -The definitions are fitted to `token_budget` first; a block that does not fit -what they leave is withheld whole. When no answer can start in time the block is +The uses brief and the definitions are fitted to `token_budget` first; a block +that does not fit what they leave is withheld whole. When no answer can start in time the block is left out. `lead: false` leaves the block out. `code.edit_context` has no `lead` block; it reads the definition's tests itself. diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index f9ed9136ac3..7c10ac30189 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -264,10 +264,9 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s # tier}]} is code.coverage_claim; `changed_by` {prs, level: function | file, fixes, # reverts, top: [{pr_number, title, merged_at, touches_symbol, is_fix, is_revert}]} # is code.symbol_history. A leg that did not answer is {unread: deadline | busy | - # failed | policy | ambiguous | unresolved}; one the neighbours block or a uses brief - # serves for the definition is left out. Absent when `lead` is false, no definition - # qualifies, the answer does not serve it, or the block does not fit what the - # definitions leave of `token_budget`. + # failed | policy | ambiguous | unresolved}. Absent when `lead` is false, no definition + # qualifies, the answer does not serve it, or the block does not fit what the uses + # brief and the definitions leave of `token_budget`. lead: list[dict[str, Any]] = Field(default_factory=list) # Up to 10 name matches, or the members matched by file clues, fitted to # `token_budget`. Empty when only candidates or presence were found. diff --git a/server/code/app/grep.py b/server/code/app/grep.py index dd579e827cb..22c396d369b 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -637,9 +637,7 @@ async def _grep_lines( match_commits=scan.match_commits, scope=scope, ) - lead = await _grep_lead( - org, ns, input, bodies, started, page_budget, offset, related_pattern, neighbours - ) + lead = await _grep_lead(org, ns, input, bodies, started, page_budget, offset, related_pattern) # one entry per matched FILE (ids and paths alike — grep has no unit ids, # so the outcome fold skips this op; the paths still feed opened_file) returned = matches + (extra_related.matches if extra_related is not None else []) @@ -733,15 +731,13 @@ async def _grep_lead( budget: code_deadline.Budget | None, offset: int, related_pattern: str, - neighbours: list[dict[str, Any]], ) -> list[dict[str, Any]]: """The `lead` block (`server.code.app.lead`) of a first page's enclosing definitions, read once the page's other reads are done, within what the op's `lead` budget and the caller's `deadline_ms` leave less the reserve for the lessons read after the handler. A definition the pattern names leads before one that only holds a match. [] on a continuation page (`offset`), a related answer (`related_pattern`), a page without - bodies, `lead: false`, or when no leg started; the callers and tests the `neighbours` - block lists for the definition are not read twice.""" + bodies, `lead: false`, or when no leg started.""" definitions = bodies.get("definitions") or [] if not (input.lead and definitions) or offset or related_pattern: return [] @@ -753,7 +749,7 @@ async def _grep_lead( cap_s = budget.left_ms() / 1000.0 - code_lead.RESERVE_S if budget is not None else math.inf with code_span("grep.lead", results=len(definitions)): lead = await code_lead.definition_leads( - "code.grep", org, ns, input, rows, started=started, cap_s=cap_s, neighbours=neighbours + "code.grep", org, ns, input, rows, started=started, cap_s=cap_s ) if lead: note_budget_shape(code_lead.LEAD_SHAPE) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index b2d4c3ff5a8..3f8568190ce 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -383,34 +383,6 @@ def _retrieved(task: asyncio.Future[Any]) -> None: task.exception() -def served_beside( - d: dict[str, Any], *, neighbours: list[dict[str, Any]], brief: dict[str, Any] | None -) -> set[str]: - """The legs another block of the same answer serves for definition `d`: the neighbours - block its callers and tests when it holds an entry for `d`, a served uses brief its - callers unless its read failed (a `note`).""" - out: set[str] = set() - if any( - n.get("qualified_name") == d["symbol"] and n.get("path") == d["path"] for n in neighbours - ): - out |= {"callers", "tested"} - if brief and "note" not in brief: - out.add("callers") - return out - - -def beside( - lead: list[dict[str, Any]], *, neighbours: list[dict[str, Any]], brief: dict[str, Any] | None -) -> list[dict[str, Any]]: - """`lead` without the legs another block of the answer serves (`served_beside`), for an - answer whose other blocks were read beside the legs.""" - out = [] - for entry in lead: - skip = served_beside(entry, neighbours=neighbours, brief=brief) - out.append({k: v for k, v in entry.items() if k not in skip}) - return out - - def fit( lead: list[dict[str, Any]], served_units: list[Any], token_budget: int, spent: int ) -> tuple[list[Any], int]: @@ -454,18 +426,15 @@ async def definition_leads( *, started: float, cap_s: float = math.inf, - neighbours: list[dict[str, Any]] | None = None, ) -> list[dict[str, Any]]: """The block for `rows`: one entry, for their `lead_definition`, with each leg's - answer but those `neighbours` serves (the answer's neighbours block, when it was read - first); [] when no leg starts. `identity` is the op's input, whose `agent` and + answer; [] when no leg starts. `identity` is the op's input, whose `agent` and `user_id` the legs carry; `cap_s` is a caller's own deadline. Never raises but on cancellation, which cancels every leg.""" picked = lead_definition(rows) wall = min(wall_s(op_name, started), cap_s) if picked is None or wall <= 0: return [] - skip = served_beside(picked, neighbours=neighbours or [], brief=None) base = { "org": org, "namespace": ns, @@ -477,7 +446,7 @@ async def definition_leads( deadline = time.monotonic() + wall + _MARGIN_S width = asyncio.Semaphore(call_slots()) with _unshaped(): - for name in (name for name in LEGS if name not in skip): + for name in LEGS: tasks[name] = asyncio.ensure_future(_leg(name, base, picked, deadline, width)) tasks[name].add_done_callback(_retrieved) try: diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index d6fb938520e..0e53818e01e 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -210,8 +210,7 @@ def __init__( else None ) # the lead block (callers through overrides, coverage, the PRs that changed it) - # under the `lead` shape's wall; the legs the brief or the neighbours block serve - # are dropped once those are read. An edit read builds no block. + # under the `lead` shape's wall. An edit read builds no block. self.lead = ( asyncio.ensure_future( _staged( @@ -1031,7 +1030,7 @@ async def handle_code_symbol( hierarchy = await legs.hierarchy # the neighbours block on the definitions themselves block, block_tokens = await legs.block - lead = await legs.lead if legs.lead is not None else [] + ran = await legs.lead if legs.lead is not None else [] uses_leg = legs.uses uses_read = await uses_leg if uses_leg is not None else (None, False, "") except BaseException: @@ -1043,13 +1042,12 @@ async def handle_code_symbol( from server.code.domain.units import estimate_json_tokens, remaining_token_budget - # the compact block is budgeted before the bodies are trimmed, the lead block after - # them, in what the definitions leave + # the uses brief is budgeted first, the definitions in what it leaves and the lead + # block in what both leave uses_tokens = estimate_json_tokens(brief) if brief else 0 brief_omitted = bool(input.token_budget and uses_tokens > input.token_budget) if brief_omitted: brief, uses_tokens = {}, 0 - ran = code_lead.beside(lead, neighbours=block, brief=brief) with code_span("symbol.budget"): budgeted, tokens, lessons_left_out = _budget_definitions( units, remaining_token_budget(input.token_budget, uses_tokens) diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 6a8764dfa5e..271144977a3 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -83,24 +83,6 @@ def test_the_pool_share_is_an_eighth_of_the_pool(monkeypatch): assert lead.lead_slots() == share -def test_a_leg_another_block_serves_is_left_out(): - from server.code.app.symbol_uses import unread_block - - d = {"symbol": "A::f", "path": "src/a.cpp", "line": 3} - anchor = {"qualified_name": "A::f", "path": "src/a.cpp", "callers": [], "tests": []} - other = {"qualified_name": "A::g", "path": "src/a.cpp", "callers": ["x"], "tests": []} - brief = {"count": 0, "files": 0, "top": [], "epistemic": "lower_bound"} - assert lead.served_beside(d, neighbours=[], brief=None) == set() - assert lead.served_beside(d, neighbours=[other], brief={}) == set() - assert lead.served_beside(d, neighbours=[anchor], brief=None) == {"callers", "tested"} - assert lead.served_beside(d, neighbours=[], brief=brief) == {"callers"} - assert lead.served_beside(d, neighbours=[], brief=unread_block()) == set() - entry = {**d, "callers": {"count": 1}, "tested": {"tests": 0}, "changed_by": {"prs": 0}} - (kept,) = lead.beside([entry], neighbours=[anchor], brief=brief) - assert list(kept) == ["symbol", "path", "line", "changed_by"] - assert lead.beside([entry], neighbours=[other], brief={}) == [entry] - - def _unit(symbol: str, line: int) -> CodeUnit: return CodeUnit(path="src/a.cpp", start_line=line, symbol=symbol, body="void f() {}\n" * 20) @@ -381,17 +363,6 @@ def record(query: Any) -> Any: assert "read_overflow_mode" not in seen["settings"] -def test_a_neighbours_block_read_first_spares_the_legs_it_serves(monkeypatch): - ops = _Ops() - served = [{"qualified_name": "A::f", "path": "src/a.cpp", "callers": [], "tests": []}] - out, _ = _run_leads(monkeypatch, ops, neighbours=served) - assert set(ops.queries) == {"code.symbol_history"} - assert list(out[0]) == ["symbol", "path", "line", "changed_by"] - ops = _Ops() - _run_leads(monkeypatch, ops, neighbours=[{**served[0], "qualified_name": "A::g"}]) - assert len(ops.queries) == 3 - - def test_no_time_left_starts_no_leg_and_serves_no_block(monkeypatch): ops = _Ops() out, notes = _run_leads(monkeypatch, ops, wall=0.0, op_name="code.grep") @@ -577,10 +548,8 @@ def _intel_on(monkeypatch): def _recorder(seen: list[dict[str, Any]]) -> Any: - async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf, neighbours=None): - names = [n["qualified_name"] for n in neighbours] if neighbours is not None else None - seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows]}) - seen[-1].update(cap_s=cap_s, neighbours=names) + async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf): + seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows], "cap_s": cap_s}) first = rows[0] return [ { @@ -661,9 +630,7 @@ async def go() -> tuple[Any, str]: @pytest.mark.usefixtures("_intel_on") def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar") - assert [(s["op"], s["rows"], s["neighbours"]) for s in seen] == [ - ("code.symbol", ["DB::Foo::bar"], None), - ] + assert [(s["op"], s["rows"]) for s in seen] == [("code.symbol", ["DB::Foo::bar"])] dump = out.model_dump() assert list(dump)[0] == "lead" assert dump["lead"] == [_LED] @@ -679,28 +646,10 @@ def test_lead_false_and_the_edit_read_run_no_leg(monkeypatch): @pytest.mark.usefixtures("_intel_on") -def test_code_symbol_drops_a_leg_only_when_another_block_serves_it(monkeypatch): - from server.code.app import symbol_uses - from server.code.app.symbol import symbol as h - - def legs(**fields: Any) -> list[str]: +def test_code_symbol_serves_every_leg_beside_its_other_blocks(monkeypatch): + for fields in ({"neighbours": True}, {"uses_brief": True}): out, seen, _ = _symbol(monkeypatch, name="DB::Foo::bar", **fields) - assert len(seen) == 1 and seen[0]["neighbours"] is None - return [k for k in out.model_dump()["lead"][0] if k in _LEGS] - - assert legs(neighbours=True) == ["changed_by"] - assert legs(uses_brief=True) == ["tested", "changed_by"] - - async def no_neighbours(*_a: Any) -> tuple[list[Any], int]: - return [], 0 - - async def failed_brief(*_a: Any, **_k: Any) -> tuple[dict[str, Any], dict[str, Any]]: - return symbol_uses.unread_block(), {} - - monkeypatch.setattr(h, "_symbol_neighbours", no_neighbours) - monkeypatch.setattr(h._uses_brief, "uses_brief", failed_brief) - assert legs(neighbours=True) == list(_LEGS) - assert legs(uses_brief=True) == list(_LEGS) + assert len(seen) == 1 and out.model_dump()["lead"] == [_LED], fields @pytest.mark.usefixtures("_intel_on") @@ -952,9 +901,7 @@ async def go() -> tuple[Any, str]: def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): out, seen, shape = _grep(monkeypatch) - assert [(s["op"], s["rows"], s["neighbours"]) for s in seen] == [ - ("code.grep", ["B::parseInput", "B::h"], []), - ] + assert [(s["op"], s["rows"]) for s in seen] == [("code.grep", ["B::parseInput", "B::h"])] assert seen[0]["cap_s"] == math.inf dump = out.model_dump() assert list(dump)[0] == "lead" and dump["lead"][0]["symbol"] == "B::parseInput" @@ -964,8 +911,6 @@ def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkeypatch): out, seen, _ = _grep(monkeypatch, deadline_ms=5000, neighbours=True) assert 0 < seen[0]["cap_s"] <= 5.0 - lead.RESERVE_S - # the neighbours block is read first, so the legs it serves never start - assert seen[0]["neighbours"] == [n["qualified_name"] for n in out.neighbours] def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): @@ -982,7 +927,7 @@ def test_code_grep_leads_no_continuation_or_related_answer(monkeypatch): bodies = {"definitions": [dict(_DEF, symbol="bar")]} query = CodeGrepInput(org="o", namespace="n", pattern="bar") for offset, related in ((10, ""), (0, "bar")): - args = ("o", "n", query, bodies, 0.0, None, offset, related, []) + args = ("o", "n", query, bodies, 0.0, None, offset, related) assert asyncio.run(grep._grep_lead(*args)) == [] assert seen == [] From b32c2f13f3b48b7bb4871ffc42277438d3cc2de5 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 03:45:09 +0530 Subject: [PATCH 07/30] The history leg reads past PRs that miss the definition, and a leg's spans stay out of its op's stages The history leg read 10 PR rows and dropped those whose diff does not name the definition, while `prs` counts the whole window, so it could answer 37 PRs and no row. It now reads the op's most, 60. The legs reported into the op's stage wall, so coverage_claim's and symbol_history's resolve spans added to code.symbol's `resolve`. Each leg starts a wall of its own; the op's table holds the leg under its name. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/code/app/lead.py | 10 +++++--- server/core/request_work.py | 4 +++- tests/unit/test_code_lead.py | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 3f8568190ce..b3df4335832 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -54,7 +54,7 @@ from server.code.api.models_grep import CodeGrepInput from server.code.api.models_symbol import CodeSymbolInput -from server.code.app.spans import code_span +from server.code.app.spans import code_span, start_stage_wall from server.code.app.symbol.neighbours import is_doc_path from server.code.domain.index.test_gate import is_test_path from server.code.domain.units import estimate_json_tokens @@ -75,8 +75,9 @@ LEAD_ROWS = 3 # Callers one hop reads before it says `truncated` (code.callers' `max_nodes`). _CALLER_NODES = 50 -# PR rows the history leg reads to pick `LEAD_ROWS` that touch the definition. -_HISTORY_ROWS = 10 +# PR rows the history leg reads to pick `LEAD_ROWS` that touch the definition: the op's +# most, since `prs` counts every PR of its window and the newest may not touch it. +_HISTORY_ROWS = 60 _TITLE_CHARS = 80 # Left of the budget for the answer after the wall: the trims, serialization and, for # code.grep, the lessons read that runs after the handler. @@ -335,6 +336,9 @@ async def _leg( query = model(**base, **fields(d)) claim = ch.BestEffortClaim(_slots(), deadline=deadline, width=width) with code_span(f"lead.{name}"): + # the leg's spans report into a wall of its own, so the op's stage table holds the + # leg once, as its name + start_stage_wall() try: # outside the lane, and to its end if the wall cancels the leg: the gate # may flush every request's queued events diff --git a/server/core/request_work.py b/server/core/request_work.py index 248f355ae76..e11bd59026f 100644 --- a/server/core/request_work.py +++ b/server/core/request_work.py @@ -43,7 +43,9 @@ class RequestWork: # Ask-side stage partition: wall charged to named stages # from one origin, the way `StageClock` does for memory.search. stage_ms: dict[str, float] = field(default_factory=dict) - # Exclusive time per observed code span. Concurrent spans can overlap. + # Exclusive time per observed code span, those of in-process calls included: a code + # lead leg's time is under its name and again under its op's own spans. Concurrent + # spans can overlap. code_stage_ms: dict[str, float] = field(default_factory=dict) # ClickHouse cost from the response summary header, summed per request. ch_statements: int = 0 diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 271144977a3..06453ac03ea 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -293,6 +293,50 @@ def test_the_legs_read_the_definition_by_id_as_the_ops_lead_consumer(monkeypatch assert notes == [] +def test_the_history_leg_reads_past_the_newest_prs_that_miss_the_definition(monkeypatch): + """`prs` counts the window's PRs that touch the definition, so the rows the leg shows + come from past the newest ones whose diff does not name it.""" + window = [ + { + "pr_number": 100 - i, + "title": f"PR {i}", + "merged_at": "2026-11-01", + "touches_symbol": "false" if i < 12 else "true", + } + for i in range(40) + ] + + def history(query: Any) -> CodeSymbolHistoryOutput: + return CodeSymbolHistoryOutput( + prs=window[: query.limit], summary={"prs_total": 28}, tracker_namespace="t" + ) + + out, _ = _run_leads(monkeypatch, _Ops(**{"code.symbol_history": history})) + changed = out[0]["changed_by"] + assert (changed["prs"], changed["level"]) == (28, "function") + assert [p["pr_number"] for p in changed["top"]] == [88, 87, 86] + + +def test_the_ops_stage_table_holds_each_leg_once_under_its_name(monkeypatch): + from server.code.app.spans import code_span, current_stage_ms, start_stage_wall + + async def coverage(query: Any) -> CodeCoverageClaimOutput: + with code_span("coverage_claim.resolve"): + await asyncio.sleep(0.05) + return CodeCoverageClaimOutput(verdict="unknown") + + monkeypatch.setattr(lead, "_ops", _Ops(**{"code.coverage_claim": coverage})) + monkeypatch.setattr(lead, "wall_s", lambda op, started: 5.0) + + async def go() -> dict[str, int]: + start_stage_wall() + await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + return current_stage_ms() + + stages = asyncio.run(go()) + assert "resolve" not in stages and stages["tested"] >= 45 + + def test_a_leg_past_the_wall_or_failed_says_so_and_notes_a_degradation(monkeypatch): ops = _Ops(**{"code.coverage_claim": RuntimeError("down"), "code.symbol_history": "hang"}) out, notes = _run_leads(monkeypatch, ops, wall=0.2) From 02cf25b8b602baa7d192b271491e8e99ac8edc72 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 03:47:08 +0530 Subject: [PATCH 08/30] A best-effort deadline caps a statement's class bound, and every claim has a width With no statement_timeout() scope, what was left of the lane's deadline replaced the class default instead of capping it, so a read class bound below the wall was raised to it. An unbounded class still takes what is left. `width` is required: the one caller sets it, and the tests now take the path it takes. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/core/ch.py | 31 ++++++++------- tests/unit/test_ch_client_hygiene.py | 57 +++++++++++++++++++++++++--- tests/unit/test_code_lead.py | 2 +- 3 files changed, 67 insertions(+), 23 deletions(-) diff --git a/server/core/ch.py b/server/core/ch.py index 822cfab6d0e..c0b6e4ee641 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -476,19 +476,21 @@ def statement_class(sql: str) -> str: def class_timeout_s(cls: str) -> float: """The deadline for `cls` in seconds; 0 means unbounded. A `statement_timeout()` scope wins over the class default, and what is left of a - `best_effort()` block's deadline lowers either.""" + `best_effort()` block's deadline caps either (an unbounded one included).""" scoped = statement_timeout_var.get() + if scoped > 0: + bound = scoped + elif cls == "write": + bound = float(settings.ch_timeout_write_s) + elif cls == "ddl": + bound = float(settings.ch_timeout_ddl_s) + else: + bound = float(settings.ch_timeout_read_s) claim = _best_effort_var.get() if claim is not None and claim.deadline > 0: left = max(claim.deadline - time.monotonic(), _PAST_DEADLINE_S) - scoped = min(scoped, left) if scoped > 0 else left - if scoped > 0: - return scoped - if cls == "write": - return float(settings.ch_timeout_write_s) - if cls == "ddl": - return float(settings.ch_timeout_ddl_s) - return float(settings.ch_timeout_read_s) + bound = min(bound, left) if bound > 0 else left + return bound _DRIVER_DEFAULT_READ_TIMEOUT_S = 300 # not a setting: clickhouse-connect's own default @@ -586,8 +588,8 @@ class BestEffortClaim: swallowed the BusyError still knows the answer is short.""" slots: BestEffortSlots + width: asyncio.Semaphore deadline: float = 0.0 - width: asyncio.Semaphore | None = None refused: bool = False @@ -1342,8 +1344,7 @@ async def _with_retry( # type: ignore[no-untyped-def] self._release_slot() if held is not None: held.slots.in_use -= 1 - if held.width is not None: - held.width.release() + held.width.release() async def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: """Count a statement of a `best_effort()` block against its kind's slots, once one @@ -1352,12 +1353,10 @@ async def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: claim = _best_effort_var.get() if claim is None: return None - if claim.width is not None: - await claim.width.acquire() + await claim.width.acquire() pool = self._slots if claim.slots.in_use >= claim.slots.limit or (pool is not None and pool.locked()): - if claim.width is not None: - claim.width.release() + claim.width.release() claim.refused = True raise BusyError(f"no ClickHouse slot free for best-effort work ({op_name})") claim.slots.in_use += 1 diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index a70969c4b5e..db180ec6b1d 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -411,7 +411,7 @@ async def test_best_effort_work_holds_its_share_and_never_waits( fake = _FakeAsync(plan={"SELECT slow": [0.3]}) c = _client(monkeypatch, fake, ch_pool_maxsize=4, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) slots = ch_mod.BestEffortSlots(limit=1) - first, second = ch_mod.BestEffortClaim(slots), ch_mod.BestEffortClaim(slots) + first, second = (ch_mod.BestEffortClaim(slots, asyncio.Semaphore(1)) for _ in range(2)) async def _held() -> None: with ch_mod.best_effort(first): @@ -439,7 +439,7 @@ async def test_best_effort_work_is_refused_at_once_when_the_pool_is_full( c = _client(monkeypatch, fake, ch_pool_maxsize=1, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) holder = asyncio.create_task(c.query_all("SELECT slow")) await asyncio.sleep(0.02) - claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=8)) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=8), asyncio.Semaphore(4)) t0 = time.perf_counter() with ch_mod.best_effort(claim), pytest.raises(ch_mod.BusyError): await c.query_all("SELECT refused") @@ -457,7 +457,7 @@ async def test_a_cancelled_best_effort_statement_gives_its_slots_back( ) -> None: fake = _FakeAsync(plan={"SELECT slow": [5.0]}) c = _client(monkeypatch, fake, ch_pool_maxsize=2, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) - claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1)) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1)) async def _leg() -> None: with ch_mod.best_effort(claim): @@ -473,6 +473,36 @@ async def _leg() -> None: assert not claim.refused +async def test_a_cancelled_statement_gives_back_only_the_width_it_took( + monkeypatch: pytest.MonkeyPatch, +) -> None: + """A statement cancelled while it waits for its caller's width releases nothing; one + cancelled in flight gives its width back with its share.""" + fake = _FakeAsync(plan={"SELECT slow": [5.0]}) + c = _client(monkeypatch, fake, ch_pool_maxsize=4, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) + slots, width = ch_mod.BestEffortSlots(limit=4), asyncio.Semaphore(1) + + async def _leg(sql: str) -> None: + with ch_mod.best_effort(ch_mod.BestEffortClaim(slots, width)): + await c.query_all(sql) + + running = asyncio.create_task(_leg("SELECT slow")) + await asyncio.sleep(0.02) + waiting = asyncio.create_task(_leg("SELECT waits")) + await asyncio.sleep(0.02) + assert width.locked() and slots.in_use == 1 + waiting.cancel() + with pytest.raises(asyncio.CancelledError): + await waiting + assert width.locked() and slots.in_use == 1 + running.cancel() + with pytest.raises(asyncio.CancelledError): + await running + assert not width.locked() and slots.in_use == 0 + assert ch_mod.pool_reading()["in_use"] == 0 + assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow"] + + async def test_a_callers_statements_past_its_width_wait_for_its_own_slots( monkeypatch: pytest.MonkeyPatch, ) -> None: @@ -481,7 +511,7 @@ async def test_a_callers_statements_past_its_width_wait_for_its_own_slots( fake = _FakeAsync(plan={"SELECT slow": [0.1, 0.1]}) c = _client(monkeypatch, fake, ch_pool_maxsize=8, ch_pool_wait_ms=500, ch_timeout_read_s=30.0) slots, width = ch_mod.BestEffortSlots(limit=2), asyncio.Semaphore(1) - claims = [ch_mod.BestEffortClaim(slots, width=width) for _ in range(2)] + claims = [ch_mod.BestEffortClaim(slots, width) for _ in range(2)] peak = 0 async def _leg(claim: Any) -> None: @@ -503,7 +533,7 @@ async def _watch() -> None: async def test_a_best_effort_statement_is_bounded_by_what_is_left_of_its_deadline() -> None: - claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1)) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1)) with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): claim.deadline = time.monotonic() + 0.3 assert ch_mod.class_timeout_s("read") == pytest.approx(0.3, abs=0.05) @@ -513,6 +543,19 @@ async def test_a_best_effort_statement_is_bounded_by_what_is_left_of_its_deadlin assert ch_mod.class_timeout_s("read") == ch_mod._PAST_DEADLINE_S +async def test_a_best_effort_deadline_caps_the_class_default_and_never_raises_it( + monkeypatch: pytest.MonkeyPatch, +) -> None: + claim = ch_mod.BestEffortClaim( + ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), deadline=time.monotonic() + 5.0 + ) + with ch_mod.best_effort(claim): + monkeypatch.setattr(settings, "ch_timeout_read_s", 0.2) + assert ch_mod.class_timeout_s("read") == 0.2 + monkeypatch.setattr(settings, "ch_timeout_read_s", 0.0) + assert ch_mod.class_timeout_s("read") == pytest.approx(5.0, abs=0.1) + + async def test_work_shared_beyond_a_best_effort_block_runs_outside_it() -> None: """A deferred write or a held task a best-effort block starts outlives it, and a process-wide cache it fills inline is every request's: none takes the block's share of @@ -523,7 +566,9 @@ async def test_work_shared_beyond_a_best_effort_block_runs_outside_it() -> None: async def _scope() -> tuple[Any, float]: return ch_mod._best_effort_var.get(), ch_mod.class_timeout_s("write") - claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), deadline=time.monotonic() + 0.3) + claim = ch_mod.BestEffortClaim( + ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), deadline=time.monotonic() + 0.3 + ) with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): inside = await asyncio.ensure_future(_scope()) held = await TaskSet().spawn(_scope(), name="t") diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 06453ac03ea..bf4838589f8 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -866,7 +866,7 @@ def rows(sql: str) -> list[dict[str, Any]]: driver = real_client(rows) monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) - full = ch.BestEffortClaim(ch.BestEffortSlots(limit=0)) + full = ch.BestEffortClaim(ch.BestEffortSlots(limit=0), asyncio.Semaphore(1)) async def go() -> tuple[bool, tuple[bool, bool]]: with ch.best_effort(full): From a80aa15904885cac140336bd01d0f656dac84644 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 03:48:16 +0530 Subject: [PATCH 09/30] Name the fills that leave the best-effort lane and the tracker reads' own limits The pages said every process-wide fill leaves the lane, but the coverage positive control fills inside it, safely, since it keeps only reads that answered. They also said every leg statement stops near the wall, but the history leg's tracker reads go through the tracker source's own client and keep its limits. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 12 +++++++----- docs/features/code-index/operations.md | 17 ++++++++++++----- server/code/app/lead.py | 7 ++++--- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 5ab2bbd20f0..ee4ed4d2f09 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -881,11 +881,13 @@ never wait for a pool slot: a statement past the share, or one that finds no slo at once, raises `BusyError` before it is sent and the work reads as not done. A caller may also cap the slots its own statements hold at once (`width`, half the share for one `lead` call); a statement past that waits for one of its caller's slots. What is left of -the lane's deadline bounds each of its statements like a `statement_timeout()`. Work -such a block does for others runs outside the lane and its deadline: a task that -outlives it, such as a load other requests join or a deferred write -(`shared_context()`), and a fill of a process-wide cache or snapshot awaited inline, -such as the schema guard's ledger read (`shared_work()`). +the lane's deadline bounds each of its statements like a `statement_timeout()`. A +task that outlives the block, such as a load other requests join or a deferred write, +runs outside the lane and its deadline (`shared_context()`). So do the fills awaited +inline of the caches whose refused read every request would then read: the schema +guard's ledger read, the code index's override-edge and constructor-edge probes and +the tracker-link snapshot (`shared_work()`). A cache that keeps only reads that +answered, such as the code index's coverage positive control, fills inside the lane. Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` (`production`, `interactive`, `bench`, `background`): `priority`, `max_threads`, and for diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 66c80a93ac5..85d654a7832 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -109,7 +109,11 @@ The three answers run at once: in `code.symbol` beside the op's own reads, in `code.grep` once the page's reads are done. Each passes the history policy gate its op has. They share what the op's `lead` latency budget leaves after the time already spent (under `deadline_ms`, at most the caller's deadline), and -ClickHouse stops their statements soon after. The `lead` budget is the op's own +ClickHouse stops their statements soon after. The tracker reads of the +`changed_by` answer are the exception: they go through the tracker source's own +client and keep its limits (300 ms for a point read, 900 ms for a text read, +and `LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s, on the tracker's server), so one can +run there after the budget ends. The `lead` budget is the op's own plus a few hundred milliseconds: 600 ms for `code.symbol` and 1000 ms for `code.grep`. These values are not measured. They let `code.callers` answer in the common case, while `code.coverage_claim` and `code.symbol_history` answer @@ -120,10 +124,13 @@ longer raises the op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example statements hold at most an eighth of the server's ClickHouse pool (`ch_pool_maxsize`) between all calls and never wait for a pool slot. One call's answers hold at most half of that share at once and wait for their own -call's slots past it, so two calls fit. The history policy gate's statements -and the reads whose answer the whole process keeps (a shared grant load, the -schema guard's ledger read, a namespace's probe) run outside that share and are -not counted in it. An answer that does not come back reads `{"unread": why}`, +call's slots past it, so two calls fit. Outside that share, and not counted in +it, run the history policy gate's statements, a grant load other requests +join, and the fills of four caches every request reads: the schema guard's +ledger read, the override-edge and constructor-edge probes and the tracker-link +snapshot. The coverage positive control keeps only a read that answered, so it +fills inside the share. The tracker reads above hold none of its slots. An +answer that does not come back reads `{"unread": why}`, and the rest of the response is served: | `unread` | Why | diff --git a/server/code/app/lead.py b/server/code/app/lead.py index b3df4335832..dac0b3e3ec4 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -26,13 +26,14 @@ the time already spent, less a reserve for the rest of the answer. Each statement is bounded on the server and in the client by what is left of the wall and a margin, so a leg cancelled at the wall does not keep ClickHouse working; a cancelled leg reads - `unread: deadline`, one that raised `unread: failed`. + `unread: deadline`, one that raised `unread: failed`. The history leg's tracker reads + go through the tracker source's own client and keep its limits. - The policy gate runs before its leg enters the lane: its statements hold ordinary slots and are not counted in the lane, since an authorization step is never refused for best-effort work. It runs to its end when the wall cancels its leg, since it may flush the process's queued events, which are every request's. Work a leg does for others (a - shared load, a deferred write, a fill of a process-wide cache) runs outside the lane too - (`server.core.ch.shared_context`, `shared_work`). + shared load, a deferred write, the fill of a cache whose refused read every request + would read) runs outside the lane too (`server.core.ch.shared_context`, `shared_work`). - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. A leg that did not answer is noted on the request's degradations and named in the From eb299df52b9e3560fc7b623786c177c6c8dff4d0 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 03:56:32 +0530 Subject: [PATCH 10/30] Test that no refused lane statement is kept, and that the shunt and dashboard ask for no lead block Each of one call's 27 lane statements is refused in turn, over an index whose probes answer yes, and every process-wide cache must then hold what a call with no refusal leaves, or nothing. It runs in about a second and fails when the schema guard or the override-edge probe fills inside the lane. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- frontend/src/api/code.test.ts | 8 +- .../tests/code-shunt-hook.test.mjs | 4 +- tests/unit/test_code_lead.py | 80 ++++++++++++++++++- 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/code.test.ts b/frontend/src/api/code.test.ts index 19299517ca8..d10e2bf0001 100644 --- a/frontend/src/api/code.test.ts +++ b/frontend/src/api/code.test.ts @@ -3,7 +3,7 @@ import { afterEach, describe, expect, it, vi } from "vitest"; // The dashboard renders only the code results, so its code reads ask for no lessons. const post = vi.hoisted(() => vi.fn()); vi.mock("../api", async (importOriginal) => ({ ...(await importOriginal()), post })); -import { codeCallees, codeCallers, codeSearch } from "./code"; +import { codeCallees, codeCallers, codeSearch, codeSymbol } from "./code"; const id = { org: "acme", namespace: "code-repo" }; @@ -21,4 +21,10 @@ describe("code client", () => { ["/v1/code.callees", false], ]); }); + + it("asks code.symbol for no lead block, which the dashboard does not show", async () => { + post.mockResolvedValue({}); + await codeSymbol(id, "f"); + expect(post.mock.calls.map(([op, body]) => [op, body.lead])).toEqual([["/v1/code.symbol", false]]); + }); }); diff --git a/integrations/claude-code-plugin/tests/code-shunt-hook.test.mjs b/integrations/claude-code-plugin/tests/code-shunt-hook.test.mjs index 43f276af6d8..da7ef34ec99 100644 --- a/integrations/claude-code-plugin/tests/code-shunt-hook.test.mjs +++ b/integrations/claude-code-plugin/tests/code-shunt-hook.test.mjs @@ -489,8 +489,10 @@ test("a symbol grep the index answers with several definitions, or with local li assert.equal(r.deny, null); assert.match(r.log, /\tpass\tGrep\t\d+\t\tindex_unanswered\t/); }); - await withServer(SYMBOL, async (url) => { + await withServer(SYMBOL, async (url, seen) => { assert.match((await runHook(grep("one"), { tmp: seed(dir), url })).deny, /Index answer: DB::renameTempPartAndAdd/); + // The refusal shows no lead block, so the lookup does not wait for one. + assert.equal(seen.find((s) => s.url === "/v1/code.symbol").body.lead, false); fs.appendFileSync(path.join(dir, "src/a.h"), many); const r = await runHook(bashOf(dir, "grep -n renameTempPartAndAdd src/a.cpp src/a.h", "long"), { tmp: seed(dir), diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index bf4838589f8..1d03615b25a 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -759,11 +759,12 @@ def __init__(self, rows: Any) -> None: self.rows = rows self.seen: list[tuple[str, bool]] = [] self.peak = 0 + self.delay = 0.005 async def query(self, sql: str, parameters: Any = None, settings: Any = None, **_k: Any): self.seen.append((" ".join(sql.split()), ch._best_effort_var.get() is not None)) self.peak = max(self.peak, lead._slots().in_use) - await asyncio.sleep(0.005) + await asyncio.sleep(self.delay) return _Result([dict(r) for r in self.rows(sql)]) async def command(self, sql: str, parameters: Any = None, settings: Any = None, **_k: Any): @@ -887,6 +888,83 @@ async def go() -> tuple[bool, tuple[bool, bool]]: assert len(driver.seen) == 4 and not any(in_lane for _sql, in_lane in driver.seen) +def test_no_refused_lane_statement_is_kept_by_a_cache_every_request_reads(monkeypatch, real_client): + """Refuse each of one call's lane statements in turn: every process-wide cache then + holds what it holds after a call with no refusal, or nothing, so the next request reads + again rather than taking the refusal as its answer.""" + from server.code.app import coverage as code_coverage + from server.code.app import ttl_cache + from server.core import ch_schema_guard + from server.core.schema import status + from server.tracker.app import binding + + ledger = [{"filename": f} for f in status.repo_migrations()] + ctor = {"state_key": "scip_ctor_calls", "state_value": "1", "detail": "", "updated_at": None} + + def rows(sql: str) -> list[dict[str, Any]]: + # the probes answer yes, so a refusal kept as their answer (no) would show + if "loom._migrations" in sql: + return ledger + if "SELECT 1 AS one" in sql: + return [{"one": 1}] + if "FROM loom.code_index_state" in sql and "state_key IN" not in sql: + return [ctor] + return _resolved_only(sql) + + driver = real_client(rows) + driver.delay = 0.0 + monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + monkeypatch.setattr(settings, "code_coverage_control_symbol", _DEF["qualified_name"]) + monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) + refuse = {"at": 0, "count": 0} + hold = ch.CHClient._hold_best_effort + + async def refusing(self: Any, op_name: str) -> Any: + claim = ch._best_effort_var.get() + if claim is not None: + refuse["count"] += 1 + if refuse["count"] == refuse["at"]: + claim.refused = True + raise ch.BusyError("refused") + return await hold(self, op_name) + + monkeypatch.setattr(ch.CHClient, "_hold_best_effort", refusing) + + def reset() -> None: + ttl_cache.clear_all() + status.reset_cache() + code_coverage.reset_control_cache() + binding._OVERRIDES_AT = -math.inf + + def kept_after(at: int) -> dict[str, Any]: + reset() + refuse.update(at=at, count=0) + _unread_of_calls(1) + kept = { + f"ttl{i}:{key}": value + for i, cache in enumerate(ttl_cache._CACHES) + for key, (_exp, value) in cache._items.items() + } + kept |= {f"control:{k}": v[:2] for k, v in code_coverage._control_cache.items()} + if status._cache["value"] is not None: + kept["status"] = status._cache["value"] + if ch_schema_guard._schema_guard["at"] is not None: + kept["guard"] = ch_schema_guard._schema_guard["tables"] + if binding._OVERRIDES_AT > -math.inf: + kept["overrides"] = (binding._OVERRIDES, binding._BRANCH_OF) + return kept + + try: + clean = kept_after(0) + statements = refuse["count"] + assert statements > 20 and {"status", "guard", "overrides"} <= set(clean) + for at in range(1, statements + 1): + kept = kept_after(at) + assert {k: v for k, v in kept.items() if clean.get(k) != v} == {}, at + finally: + reset() + + def _grep(monkeypatch, **fields: Any) -> tuple[Any, list[dict[str, Any]], str]: """code.grep through its handler over the scan fixture, with two enclosing bodies of the match: the first one holds it, the second one is the definition it names.""" From a8680a1fe28d77e73dfa5729d54cb519f4ca2f51 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 04:46:59 +0530 Subject: [PATCH 11/30] Say which definitions a lead block covers and how the lane's deadline caps a bound The block covers the first function, method, class or type definition outside test files and documents; code.grep's field names every case with no block. The lane page says every claim has a width, that the deadline caps a statement's bound rather than acting as a statement_timeout(), and that the tracker-link snapshot keeps no refused read: it refreshes outside the lane so a refusal neither logs a warning nor leaves its call on the previous snapshot. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 23 +++++++++++++---------- docs/features/code-index/operations.md | 25 ++++++++++++++----------- docs/reference/operations/code.md | 6 +++--- server/code/api/models_grep.py | 8 +++++--- server/code/api/models_symbol.py | 16 ++++++++-------- 5 files changed, 43 insertions(+), 35 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index ee4ed4d2f09..17385a8170e 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -878,16 +878,19 @@ Best-effort work a request adds beside its own reads, such as the code ops' `lea block, runs in a lane of its own (`best_effort()`). Its statements hold at most their kind's share of the pool (an eighth of `LOOM_CH_POOL_MAXSIZE` for the `lead` block) and never wait for a pool slot: a statement past the share, or one that finds no slot free -at once, raises `BusyError` before it is sent and the work reads as not done. A caller -may also cap the slots its own statements hold at once (`width`, half the share for one -`lead` call); a statement past that waits for one of its caller's slots. What is left of -the lane's deadline bounds each of its statements like a `statement_timeout()`. A -task that outlives the block, such as a load other requests join or a deferred write, -runs outside the lane and its deadline (`shared_context()`). So do the fills awaited -inline of the caches whose refused read every request would then read: the schema -guard's ledger read, the code index's override-edge and constructor-edge probes and -the tracker-link snapshot (`shared_work()`). A cache that keeps only reads that -answered, such as the code index's coverage positive control, fills inside the lane. +at once, raises `BusyError` before it is sent and the work reads as not done. Every +claim caps the slots its caller's statements hold at once (`width`, half the share for +one `lead` call); a statement past that waits for one of its caller's slots. What is +left of the lane's deadline caps each statement's bound (the class default or a +`statement_timeout()`; an unbounded class gets what is left), on the server and in the +client. A task that outlives the block, such as a load other requests join or a +deferred write, runs outside the lane and its deadline (`shared_context()`). So do the +fills awaited inline of three caches that would keep a refused read as every request's +answer: the schema guard's ledger read and the code index's override-edge and +constructor-edge probes (`shared_work()`). The tracker-link snapshot refreshes outside +the lane too: a refused refresh keeps nothing, but it would log a warning each time and +leave its call on the previous snapshot. A cache that keeps only reads that answered, +such as the code index's coverage positive control, fills inside the lane. Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` (`production`, `interactive`, `bench`, `background`): `priority`, `max_threads`, and for diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 85d654a7832..5c02dd0ee9a 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -92,11 +92,13 @@ underscores. Toolsets: [MCP reference](../../reference/mcp.md#toolsets). `code.symbol` and `code.grep` start their answer with a `lead` block: what a text search cannot answer about the definition they found. It covers one -definition outside test files and documents. For `code.symbol` it is the first -definition the name resolves to, and the block is left out when the answer does -not serve that definition (`min_fan_in`, `token_budget`). For `code.grep` it is -the enclosing definition of a first page's bodies whose name the pattern holds -as a whole identifier, else the first. Its entry carries `symbol`, `path` and +definition: the first function, method, class or type definition outside test +files and documents (variables, fields, macros and document sections are +skipped). For `code.symbol` it is the first such definition the name resolves +to, and the block is left out when the answer does not serve that definition +(`min_fan_in`, `token_budget`). For `code.grep` it is the first such enclosing +definition of a first page's bodies whose name the pattern holds as a whole +identifier, else the first such one. Its entry carries `symbol`, `path` and `line` and three answers: | Key | From | Holds | @@ -126,12 +128,13 @@ statements hold at most an eighth of the server's ClickHouse pool call's answers hold at most half of that share at once and wait for their own call's slots past it, so two calls fit. Outside that share, and not counted in it, run the history policy gate's statements, a grant load other requests -join, and the fills of four caches every request reads: the schema guard's -ledger read, the override-edge and constructor-edge probes and the tracker-link -snapshot. The coverage positive control keeps only a read that answered, so it -fills inside the share. The tracker reads above hold none of its slots. An -answer that does not come back reads `{"unread": why}`, -and the rest of the response is served: +join, the fills of three caches that would keep a refused read as every +request's answer (the schema guard's ledger read and the override-edge and +constructor-edge probes) and the tracker-link snapshot's refresh, which keeps +no refusal but would log a warning for each. The coverage positive control +keeps only a read that answered, so it fills inside the share. The tracker +reads above hold none of its slots. An answer that does not come back reads +`{"unread": why}`, and the rest of the response is served: | `unread` | Why | | ------------ | ---------------------------------------------------------------- | diff --git a/docs/reference/operations/code.md b/docs/reference/operations/code.md index 01789d7a087..594ef195f7b 100644 --- a/docs/reference/operations/code.md +++ b/docs/reference/operations/code.md @@ -598,7 +598,7 @@ Before editing, read source, tests and notes. | Output field | Type | Meaning | | --- | --- | --- | -| `lead` | `list[dict[str, Any]]` | code.symbol only (code.edit_context never reads it), first on the wire: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files… | +| `lead` | `list[dict[str, Any]]` | code.symbol only (code.edit_context never reads it), first on the wire: for the first function, method, class or type definition outside test files and documents, what a text search cannot answer. {symbol, path, line, callers, tested… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | @@ -795,7 +795,7 @@ Literal or regex search of indexed source with enclosing symbols and coverage. | --- | --- | --- | | `lessons` | `list[dict[str, Any]]` | The memories about the answer's top files, best first, capped at `code_result_lessons_tokens`; each row {path, memory_key, namespace, excerpt, code_state}, with `rev`, `first_written`, `changed_since`, `code_moved` and `supersedes_key`… | | `lessons_left_out` | `int` | File lessons omitted by symbol focus, a token budget, truncation or supersession. | -| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: the block code.symbol leads with, for the first page's `definitions` entry outside test files whose name the pattern holds, else the first. | +| `lead` | `list[dict[str, Any]]` | First on the wire when `lead` read it: the block code.symbol leads with, for the first page's first function, method, class or type definition outside test files and documents whose name the pattern holds, else the first such one. | | `matches` | `list[dict[str, Any]]` | {path, line, text, scope, scope_start_line, scope_end_line} per matching LINE, path/line ordered except when prioritize_patterns gives different literals first-page slots. scope_* is the span of the enclosing unit named by `scope` (0/0… | | `related` | `RelatedGrepEvidence \| None` | Related source for a qualified argument or member, separate from literal matches. | | `contexts` | `list[dict[str, Any]]` | Exact retained source windows for this page, with inclusive line bounds. | @@ -1672,7 +1672,7 @@ Find an exact definition by name or path:line. | Output field | Type | Meaning | | --- | --- | --- | -| `lead` | `list[dict[str, Any]]` | code.symbol only (code.edit_context never reads it), first on the wire: for the first definition outside test files, what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: `callers` {count, files… | +| `lead` | `list[dict[str, Any]]` | code.symbol only (code.edit_context never reads it), first on the wire: for the first function, method, class or type definition outside test files and documents, what a text search cannot answer. {symbol, path, line, callers, tested… | | `definitions` | `list[CodeUnit]` | Up to 10 name matches, or the members matched by file clues, fitted to `token_budget`. | | `lessons_left_out` | `int` | Whole linked lessons omitted to preserve definitions within an explicit request budget. | | `ambiguous` | `bool` | True when the served definitions carry more than one distinct name/signature pair. | diff --git a/server/code/api/models_grep.py b/server/code/api/models_grep.py index dc14a1e42ac..42d71498c4f 100644 --- a/server/code/api/models_grep.py +++ b/server/code/api/models_grep.py @@ -267,9 +267,11 @@ def _drop_unfired_mode_fields(self, handler: SerializerFunctionWrapHandler) -> d return _lead_first(_drop_empty_lessons(data)) # First on the wire when `lead` read it: the block code.symbol leads with, for the - # first page's `definitions` entry outside test files whose name the pattern holds, - # else the first. Absent on a continuation page, with `include_body` false or `lead` - # false, and outside matches mode. + # first page's first function, method, class or type definition outside test files + # and documents whose name the pattern holds, else the first such one. Absent on a + # continuation page, for a related answer (a qualified argument or member the + # pattern found no line for), with `include_body` false or `lead` false, outside + # matches mode, when no definition qualifies, and when no time is left to start a leg. lead: list[dict[str, Any]] = Field(default_factory=list) # {path, line, text, scope, scope_start_line, scope_end_line} per matching # LINE, path/line ordered except when prioritize_patterns gives different literals diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index 7c10ac30189..7a8b633ff61 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -256,14 +256,14 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s return _lead_first(data) # code.symbol only (code.edit_context never reads it), first on the wire: for the - # first definition outside test files, what a text search cannot answer. {symbol, - # path, line, callers, tested, changed_by}: `callers` {count, files, - # through_overrides, dispatch, top: [{path, line, caller, via_override, via}] (<= 3), - # truncated, epistemic} is code.callers one hop across virtual dispatch; `tested` - # {verdict, tests, strongest_tier, measured: executed | unexecuted, top: [{test_path, - # tier}]} is code.coverage_claim; `changed_by` {prs, level: function | file, fixes, - # reverts, top: [{pr_number, title, merged_at, touches_symbol, is_fix, is_revert}]} - # is code.symbol_history. A leg that did not answer is {unread: deadline | busy | + # first function, method, class or type definition outside test files and documents, + # what a text search cannot answer. {symbol, path, line, callers, tested, changed_by}: + # `callers` {count, files, through_overrides, dispatch, top: [{path, line, caller, + # via_override, via}] (<= 3), truncated, epistemic} is code.callers one hop across + # virtual dispatch; `tested` {verdict, tests, strongest_tier, measured: executed | + # unexecuted, top: [{test_path, tier}]} is code.coverage_claim; `changed_by` {prs, + # level: function | file, fixes, reverts, top: [{pr_number, title, merged_at, + # touches_symbol, is_fix, is_revert}]} is code.symbol_history. A leg that did not answer is {unread: deadline | busy | # failed | policy | ambiguous | unresolved}. Absent when `lead` is false, no definition # qualifies, the answer does not serve it, or the block does not fit what the uses # brief and the definitions leave of `token_budget`. From d50bec1b17f16d4849060bafd311419e5344d6aa Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 04:47:10 +0530 Subject: [PATCH 12/30] Deadline tests run on a manual clock; every refused lane statement reads busy end to end The deadline tests read `time.monotonic` from a ManualClock and assert exact bounds instead of racing the wall clock. The refusal sweep now also requires each run to read exactly one leg as busy, through the real handlers, whether the op swallowed the refusal or not. A handler that fails before joining its legs cancels the lead task with the others. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- tests/unit/test_ch_client_hygiene.py | 43 ++++++++-------- tests/unit/test_code_lead.py | 73 +++++++++++++++++++++++----- 2 files changed, 86 insertions(+), 30 deletions(-) diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index db180ec6b1d..1b6a446cdd7 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -22,6 +22,7 @@ from server.core import ch_errors, ch_writes from server.core.errors import BackendTimeoutError, BackendUnavailableError, OverloadedError from server.settings import settings +from tests.unit.clock_fake import ManualClock _NET = "Network Error: Server disconnected" @@ -532,31 +533,36 @@ async def _watch() -> None: assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow"] * 2 -async def test_a_best_effort_statement_is_bounded_by_what_is_left_of_its_deadline() -> None: - claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1)) +def test_a_best_effort_statement_is_bounded_by_what_is_left_of_its_deadline( + monkeypatch: pytest.MonkeyPatch, +) -> None: + clock = ManualClock() + monkeypatch.setattr(ch_mod.time, "monotonic", clock.monotonic) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), 0.75) with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): - claim.deadline = time.monotonic() + 0.3 - assert ch_mod.class_timeout_s("read") == pytest.approx(0.3, abs=0.05) - await asyncio.sleep(0.1) - assert ch_mod.class_timeout_s("read") == pytest.approx(0.2, abs=0.05) - claim.deadline = time.monotonic() - 1.0 + assert ch_mod.class_timeout_s("read") == 0.75 + clock.advance(0.25) + assert ch_mod.class_timeout_s("read") == 0.5 + clock.advance(1.0) assert ch_mod.class_timeout_s("read") == ch_mod._PAST_DEADLINE_S -async def test_a_best_effort_deadline_caps_the_class_default_and_never_raises_it( +def test_a_best_effort_deadline_caps_the_class_default_and_never_raises_it( monkeypatch: pytest.MonkeyPatch, ) -> None: - claim = ch_mod.BestEffortClaim( - ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), deadline=time.monotonic() + 5.0 - ) + clock = ManualClock() + monkeypatch.setattr(ch_mod.time, "monotonic", clock.monotonic) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), 5.0) with ch_mod.best_effort(claim): - monkeypatch.setattr(settings, "ch_timeout_read_s", 0.2) - assert ch_mod.class_timeout_s("read") == 0.2 + monkeypatch.setattr(settings, "ch_timeout_read_s", 0.25) + assert ch_mod.class_timeout_s("read") == 0.25 monkeypatch.setattr(settings, "ch_timeout_read_s", 0.0) - assert ch_mod.class_timeout_s("read") == pytest.approx(5.0, abs=0.1) + assert ch_mod.class_timeout_s("read") == 5.0 -async def test_work_shared_beyond_a_best_effort_block_runs_outside_it() -> None: +async def test_work_shared_beyond_a_best_effort_block_runs_outside_it( + monkeypatch: pytest.MonkeyPatch, +) -> None: """A deferred write or a held task a best-effort block starts outlives it, and a process-wide cache it fills inline is every request's: none takes the block's share of the pool or its deadline, while a `statement_timeout()` around the block (a claim's @@ -566,9 +572,8 @@ async def test_work_shared_beyond_a_best_effort_block_runs_outside_it() -> None: async def _scope() -> tuple[Any, float]: return ch_mod._best_effort_var.get(), ch_mod.class_timeout_s("write") - claim = ch_mod.BestEffortClaim( - ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), deadline=time.monotonic() + 0.3 - ) + monkeypatch.setattr(ch_mod.time, "monotonic", ManualClock().monotonic) + claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=1), asyncio.Semaphore(1), 0.75) with ch_mod.statement_timeout(5.0), ch_mod.best_effort(claim): inside = await asyncio.ensure_future(_scope()) held = await TaskSet().spawn(_scope(), name="t") @@ -576,7 +581,7 @@ async def _scope() -> tuple[Any, float]: with ch_mod.shared_work(): inline = await _scope() after = ch_mod._best_effort_var.get() - assert inside[0] is claim and inside[1] == pytest.approx(0.3, abs=0.05) + assert inside == (claim, 0.75) assert held == deferred == inline == (None, 5.0) assert after is claim diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 1d03615b25a..f472031f605 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -30,6 +30,7 @@ from server.core import ch from server.observability import degradations from server.settings import settings +from tests.unit.clock_fake import ManualClock pytestmark = pytest.mark.code_lead @@ -400,10 +401,11 @@ def record(query: Any) -> Any: return CodeCallersOutput(edges=[], seed_symbols=[]) monkeypatch.setattr(settings, "ch_caller_shaped_max_execution_s", 5.0) + monkeypatch.setattr(ch.time, "monotonic", ManualClock().monotonic) ops = _Ops(**{"code.callers": record}) with ch.caller_shaped(): _run_leads(monkeypatch, ops, wall=0.5) - assert seen["settings"]["max_execution_time"] == pytest.approx(0.75, abs=0.05) + assert seen["settings"]["max_execution_time"] == 0.75 assert "read_overflow_mode" not in seen["settings"] @@ -456,8 +458,9 @@ async def callers(query: Any) -> Any: await grant_cache._shared_load({}, ("o", "k"), 0, load) return CodeCallersOutput(edges=[], seed_symbols=[]) + monkeypatch.setattr(ch.time, "monotonic", ManualClock().monotonic) _run_leads(monkeypatch, _Ops(**{"code.callers": callers}), wall=0.5) - assert seen["leg"] == (True, pytest.approx(0.75, abs=0.05)) + assert seen["leg"] == (True, 0.75) assert seen["load"] == (None, settings.ch_timeout_read_s) @@ -696,6 +699,49 @@ def test_code_symbol_serves_every_leg_beside_its_other_blocks(monkeypatch): assert len(seen) == 1 and out.model_dump()["lead"] == [_LED], fields +@pytest.mark.usefixtures("_intel_on") +def test_a_handler_that_fails_before_its_joins_cancels_the_lead_task(monkeypatch): + """`_SymbolLegs.cancel()` reaps the lead task when a read beside it raises, so its legs + do not run on after the request has failed.""" + from server.code.api.models_symbol import CodeSymbolInput + from server.code.app.symbol import outline + from server.code.app.symbol import symbol as h + + seen: list[str] = [] + + async def leads(*_a: Any, **_k: Any) -> list[dict[str, Any]]: + seen.append("started") + try: + await asyncio.sleep(30) + except asyncio.CancelledError: + seen.append("cancelled") + raise + return [] + + async def rank(*_a: Any, **_k: Any) -> Any: + raise RuntimeError("fan-in read failed") + + async def body(*_a: Any) -> str: + return "" + + monkeypatch.setattr(lead, "definition_leads", leads) + monkeypatch.setattr(h, "_rank_by_fan_in", rank) + + async def go() -> list[str]: + with ( + patch.object(h, "CodeRepo", return_value=_Repo()), + patch.object(h, "symbol_body", new=body), + patch.object(outline, "symbol_body", new=body), + patch.object(h, "schedule_code_trace", new=lambda **k: None), + pytest.raises(RuntimeError, match="fan-in"), + ): + await h.handle_code_symbol(CodeSymbolInput(name="DB::Foo::bar", include_lessons=False)) + await asyncio.sleep(0) # the cancellation lands; without it the task sleeps on + return list(seen) + + assert asyncio.run(go()) == ["started", "cancelled"] + + @pytest.mark.usefixtures("_intel_on") def test_a_token_budget_the_block_does_not_fit_withholds_it(monkeypatch): whole, _, _ = _symbol(monkeypatch, name="DB::Foo::bar", lead=False) @@ -889,9 +935,10 @@ async def go() -> tuple[bool, tuple[bool, bool]]: def test_no_refused_lane_statement_is_kept_by_a_cache_every_request_reads(monkeypatch, real_client): - """Refuse each of one call's lane statements in turn: every process-wide cache then - holds what it holds after a call with no refusal, or nothing, so the next request reads - again rather than taking the refusal as its answer.""" + """Refuse each of one call's lane statements in turn: the leg that sent it reads busy, + and every process-wide cache holds what it holds after a call with no refusal, or + nothing, so the next request reads again rather than taking the refusal as its + answer.""" from server.code.app import coverage as code_coverage from server.code.app import ttl_cache from server.core import ch_schema_guard @@ -936,10 +983,10 @@ def reset() -> None: code_coverage.reset_control_cache() binding._OVERRIDES_AT = -math.inf - def kept_after(at: int) -> dict[str, Any]: + def kept_after(at: int) -> tuple[str, dict[str, Any]]: reset() refuse.update(at=at, count=0) - _unread_of_calls(1) + (unread,) = _unread_of_calls(1) kept = { f"ttl{i}:{key}": value for i, cache in enumerate(ttl_cache._CACHES) @@ -952,14 +999,18 @@ def kept_after(at: int) -> dict[str, Any]: kept["guard"] = ch_schema_guard._schema_guard["tables"] if binding._OVERRIDES_AT > -math.inf: kept["overrides"] = (binding._OVERRIDES, binding._BRANCH_OF) - return kept + return unread, kept try: - clean = kept_after(0) + unread, clean = kept_after(0) statements = refuse["count"] - assert statements > 20 and {"status", "guard", "overrides"} <= set(clean) + assert unread == "" and statements > 20 + assert {"status", "guard", "overrides"} <= set(clean) for at in range(1, statements + 1): - kept = kept_after(at) + unread, kept = kept_after(at) + # the refused leg reads busy, its op's handler having swallowed the refusal or + # not, and the other two answer + assert re.fullmatch(r"(callers|tested|changed_by):busy", unread), (at, unread) assert {k: v for k, v in kept.items() if clean.get(k) != v} == {}, at finally: reset() From 9140dee4b60540f2ef1611374d8557d7171c92e3 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 04:52:23 +0530 Subject: [PATCH 13/30] Wrap the code.symbol lead field comment Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/code/api/models_symbol.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index 7a8b633ff61..4e1376475c5 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -263,10 +263,11 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s # virtual dispatch; `tested` {verdict, tests, strongest_tier, measured: executed | # unexecuted, top: [{test_path, tier}]} is code.coverage_claim; `changed_by` {prs, # level: function | file, fixes, reverts, top: [{pr_number, title, merged_at, - # touches_symbol, is_fix, is_revert}]} is code.symbol_history. A leg that did not answer is {unread: deadline | busy | - # failed | policy | ambiguous | unresolved}. Absent when `lead` is false, no definition - # qualifies, the answer does not serve it, or the block does not fit what the uses - # brief and the definitions leave of `token_budget`. + # touches_symbol, is_fix, is_revert}]} is code.symbol_history. A leg that did not + # answer is {unread: deadline | busy | failed | policy | ambiguous | unresolved}. + # Absent when `lead` is false, no definition qualifies, the answer does not serve it, + # or the block does not fit what the uses brief and the definitions leave of + # `token_budget`. lead: list[dict[str, Any]] = Field(default_factory=list) # Up to 10 name matches, or the members matched by file clues, fitted to # `token_budget`. Empty when only candidates or presence were found. From dff74b48722ef7f041138446b987757eb14a6ce4 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 05:41:48 +0530 Subject: [PATCH 14/30] The lead's coverage leg counts the tests code.coverage_claim counts The leg asked code.coverage_claim for 3 rows, and the op reads three times its limit per evidence class and counts `tests` over what it read, so a definition with 15 linked test files read 9. It now asks at the op's default limit; a test over 15 mapped files compares the leg with the op through the real handler. The refusal sweep's coverage positive control answers yes, so a refused control read kept as `no` shows. The Python SDK's CodeClient.symbol() and grep() take `lead` and send `lead: false` only when it is false. The descriptions say grep's block falls back to the first qualifying definition, `token_budget` covers the block, the block is absent when no time is left to start a leg, and the docs give the lane's share at the default pool size with its floor below 16 slots. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 14 ++-- docs/features/code-index/operations.md | 10 +-- docs/reference/operations/code.md | 4 +- sdk/go/wire/models.gen.go | 2 +- sdk/python/loom/code.py | 17 ++++- sdk/typescript/src/generated/ops.ts | 2 +- server/code/api/models_grep.py | 3 +- server/code/api/models_symbol.py | 7 +- server/code/app/lead.py | 4 +- server/transport/mcp_descriptions.py | 2 +- tests/unit/snapshots/sdk_public_api.json | 6 +- tests/unit/test_code_lead.py | 88 ++++++++++++++++++++++-- 12 files changed, 132 insertions(+), 27 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 17385a8170e..682e3404d08 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -876,12 +876,14 @@ process). Best-effort work a request adds beside its own reads, such as the code ops' `lead` block, runs in a lane of its own (`best_effort()`). Its statements hold at most their -kind's share of the pool (an eighth of `LOOM_CH_POOL_MAXSIZE` for the `lead` block) and -never wait for a pool slot: a statement past the share, or one that finds no slot free -at once, raises `BusyError` before it is sent and the work reads as not done. Every -claim caps the slots its caller's statements hold at once (`width`, half the share for -one `lead` call); a statement past that waits for one of its caller's slots. What is -left of the lane's deadline caps each statement's bound (the class default or a +kind's share of the pool and never wait for a pool slot: a statement past the share, or +one that finds no slot free at once, raises `BusyError` before it is sent and the work +reads as not done. Every claim caps the slots its caller's statements hold at once +(`width`). For the `lead` block the share is an eighth of `LOOM_CH_POOL_MAXSIZE`, at +least one slot, and one call's width half of it, at least one: at the default pool size +(64) 8 slots and 4, so two calls fit; below 16 slots one call takes the whole share. A +statement past its caller's width waits for one of that caller's slots. What is left of +the lane's deadline caps each statement's bound (the class default or a `statement_timeout()`; an unbounded class gets what is left), on the server and in the client. A task that outlives the block, such as a load other requests join or a deferred write, runs outside the lane and its deadline (`shared_context()`). So do the diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 5c02dd0ee9a..5f953ea076a 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -123,10 +123,12 @@ when they are fast and read `deadline` otherwise. A deployment whose answers nee longer raises the op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example `{"code.symbol": "2x"}`, which scales the `lead` budget too) or `POST /v1/admin/budget.set`. The block is best effort: the three answers' -statements hold at most an eighth of the server's ClickHouse pool -(`ch_pool_maxsize`) between all calls and never wait for a pool slot. One -call's answers hold at most half of that share at once and wait for their own -call's slots past it, so two calls fit. Outside that share, and not counted in +statements hold at most a share of the server's ClickHouse pool between all +calls and never wait for a pool slot. One call's answers hold at most half of +that share at once and wait for their own call's slots past it. At the default +pool size (`ch_pool_maxsize` 64) the share is 8 slots, an eighth, and one call +holds 4, so two calls fit; below 16 slots the share is one slot and one call +takes it whole. Outside that share, and not counted in it, run the history policy gate's statements, a grant load other requests join, the fills of three caches that would keep a refused read as every request's answer (the schema guard's ledger read and the override-edge and diff --git a/docs/reference/operations/code.md b/docs/reference/operations/code.md index 594ef195f7b..50e43c24e4f 100644 --- a/docs/reference/operations/code.md +++ b/docs/reference/operations/code.md @@ -789,7 +789,7 @@ Literal or regex search of indexed source with enclosing symbols and coverage. | `neighbours` | `bool \| None` | `None` | The neighbours graph block in the SAME call, matches mode only: the hits' enclosing functions become anchors (at most 20, first appearance) and each carries up to `neighbour_k` callers, callees and mapped tests at edge confidence >= 0.8… | | `neighbour_k` | `int` | `5` | With `neighbours`: at most this many callers and callees per anchor (1..20). | | `deadline_ms` | `int \| None` | `None` | The request's wall-clock budget in ms, from arrival (values under 200 read as 200). | -| `lead` | `bool` | `True` | Lead with the callers through overrides, test coverage and changing PRs of the enclosing definition the pattern names; default true. | +| `lead` | `bool` | `True` | Lead with the callers through overrides, test coverage and changing PRs of the enclosing definition the pattern names, else the first such one; default true. | | Output field | Type | Meaning | | --- | --- | --- | @@ -1656,7 +1656,7 @@ Find an exact definition by name or path:line. | `example_context_lines` | `int` | `0` | Retained source lines on each side of a usage example. | | `include_lessons` | `bool` | `True` | Attach `lessons` to the first definition: the memories linked to the symbol from `lesson_namespaces` (over MCP the caller's memory home by default) and the repository's team namespace, each with its `code_state` (`fresh`, `moved`, or… | | `lesson_namespaces` | `list[str]` | *(computed)* | The memory namespaces whose linked memories `lessons` reads besides the repository's team rules (over MCP the caller's memory home by default); one the caller cannot read is skipped. | -| `token_budget` | `int` | `0` | Estimated-token cap for definitions and `uses_brief`; 0 (default) is unlimited. | +| `token_budget` | `int` | `0` | Estimated-token cap for definitions, `uses_brief` and the `lead` block; 0 (default) is unlimited. | | `min_fan_in` | `int` | `0` | Definitions carry `fan_in` when the weekly stats are enabled; min_fan_in drops the rest, sort_by='fan_in' puts the most-called definition of an overloaded/ambiguous name first. | | `sort_by` | `Literal['score', 'fan_in']` | `'score'` | `score` keeps the resolver's order; `fan_in` puts the most-called definition first. | | `uses` | `bool \| None` | `None` | `uses=true` returns the definition AND the lines that mention its bare name — what a separate code.grep on the name would return, read beside the definition from the same chunk index — minus the definition's own span(s). | diff --git a/sdk/go/wire/models.gen.go b/sdk/go/wire/models.gen.go index ec7c16566fd..fa09b5feba1 100644 --- a/sdk/go/wire/models.gen.go +++ b/sdk/go/wire/models.gen.go @@ -1,5 +1,5 @@ // Code generated by scripts/codegen/sdk_go_gen.py; DO NOT EDIT. -// Registry model schema SHA-256: 12d91f00e94648ea994dbd8d91bbe330ef88704ece8f168a9ef10d7230675fb2 +// Registry model schema SHA-256: 4566532bbcae788d424fb6c540e79f52aae3dc9a0f15b107730a7dc934de6177 // Package wire contains the Go requests and responses for Loom operations. package wire diff --git a/sdk/python/loom/code.py b/sdk/python/loom/code.py index 9ed87bda1d4..8e00db2e3c1 100644 --- a/sdk/python/loom/code.py +++ b/sdk/python/loom/code.py @@ -157,6 +157,7 @@ async def grep( exclude_globs: list[str] | None = None, langs: list[str] | None = None, namespaces: list[str] | None = None, + lead: bool = True, ) -> dict[str, Any]: """Exact literal (or RE2 regex) match over indexed chunks; every hit carries its enclosing symbol (`scope`) and that unit's span @@ -186,7 +187,11 @@ async def grep( `mode="message"` takes a RENDERED error/log message and returns the statement whose template printed it (`verdict` raised_at | no_template_match, `template`, `error_code`). A regex-shaped literal - that matches nothing is run once as a regex; `note` says so.""" + that matches nothing is run once as a regex; `note` says so. + A first page with bodies starts with a `lead` block: the callers through + overrides, test coverage and changing PRs of the enclosing definition the + pattern names, read within the op's latency budget; `lead=False` leaves it + out (sent only then).""" body: dict[str, Any] = { "pattern": pattern, "regex": regex, @@ -213,6 +218,8 @@ async def grep( body["exclude_globs"] = list(exclude_globs) if langs: body["langs"] = list(langs) + if not lead: + body["lead"] = False return await self._agent.transport.post("/v1/code.grep", body) async def files( @@ -310,6 +317,7 @@ async def symbol( pr_number: int = 0, namespaces: list[str] | None = None, presence: bool = False, + lead: bool = True, ) -> dict[str, Any]: """Exact definition lookup by (qualified) name — or by `path:line` ("src/Foo.cpp:123"), which returns the innermost function containing @@ -318,6 +326,11 @@ async def symbol( Set `example_context_lines` to include retained source around usage examples. + The answer starts with a `lead` block for the first function, method, class + or type definition outside test files and documents: its callers through + overrides, test coverage and the PRs that changed it, read within the op's + latency budget. `lead=False` leaves it out (sent only then). + `uses_brief=True` makes a lookup that resolves to one definition carry a compact `uses` block: `count`, `files`, the top call sites `top: [{path, line, caller, tier, confidence}]`, @@ -369,6 +382,8 @@ async def symbol( if presence or namespaces: body["presence"] = True body["namespaces"] = list(namespaces or []) + if not lead: + body["lead"] = False return await self._agent.transport.post("/v1/code.symbol", body) async def callers( diff --git a/sdk/typescript/src/generated/ops.ts b/sdk/typescript/src/generated/ops.ts index fbda1a8411b..a33e495a984 100644 --- a/sdk/typescript/src/generated/ops.ts +++ b/sdk/typescript/src/generated/ops.ts @@ -1020,7 +1020,7 @@ export interface CodeGrepInput { neighbours?: boolean | null; neighbour_k?: number; deadline_ms?: number | null; - /** Lead with the callers through overrides, test coverage and changing PRs of the enclosing definition the pattern names; default true. */ + /** Lead with the callers through overrides, test coverage and changing PRs of the enclosing definition the pattern names, else the first such one; default true. */ lead?: boolean; } diff --git a/server/code/api/models_grep.py b/server/code/api/models_grep.py index 42d71498c4f..b78e2f98adc 100644 --- a/server/code/api/models_grep.py +++ b/server/code/api/models_grep.py @@ -169,7 +169,8 @@ class CodeGrepInput(_CodeIdentity, _ResultLessons): lead: bool = Field( default=True, description="Lead with the callers through overrides, test coverage and changing " - "PRs of the enclosing definition the pattern names; default true.", + "PRs of the enclosing definition the pattern names, else the first such one; " + "default true.", json_schema_extra=MCP_HIDDEN, ) diff --git a/server/code/api/models_symbol.py b/server/code/api/models_symbol.py index 4e1376475c5..d73d46d1460 100644 --- a/server/code/api/models_symbol.py +++ b/server/code/api/models_symbol.py @@ -116,7 +116,8 @@ class CodeSymbolInput(_CodeIdentity): # team rules (over MCP the caller's memory home by default); one the caller cannot # read is skipped. lesson_namespaces: list[str] = Field(default_factory=list, max_length=4) - # Estimated-token cap for definitions and `uses_brief`; 0 (default) is unlimited. + # Estimated-token cap for definitions, `uses_brief` and the `lead` block; 0 (default) + # is unlimited. token_budget: int = Field(default=0, ge=0) # Definitions carry `fan_in` when the weekly stats are enabled; min_fan_in drops the # rest, sort_by='fan_in' puts the most-called definition of an overloaded/ambiguous @@ -266,8 +267,8 @@ def _drop_empty_presence(self, handler: SerializerFunctionWrapHandler) -> dict[s # touches_symbol, is_fix, is_revert}]} is code.symbol_history. A leg that did not # answer is {unread: deadline | busy | failed | policy | ambiguous | unresolved}. # Absent when `lead` is false, no definition qualifies, the answer does not serve it, - # or the block does not fit what the uses brief and the definitions leave of - # `token_budget`. + # no time is left to start a leg, or the block does not fit what the uses brief and + # the definitions leave of `token_budget`. lead: list[dict[str, Any]] = Field(default_factory=list) # Up to 10 name matches, or the members matched by file clues, fitted to # `token_budget`. Empty when only candidates or presence were found. diff --git a/server/code/app/lead.py b/server/code/app/lead.py index dac0b3e3ec4..c30ad37e6cf 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -283,7 +283,9 @@ def _by_id(d: dict[str, Any]) -> dict[str, Any]: ), "tested": ( "code.coverage_claim", - lambda d: {"symbol": d["symbol"], "limit": LEAD_ROWS}, + # at the op's default `limit`: the op reads three times it per evidence class and + # counts `tests` over what it read, so a smaller one would undercount + lambda d: {"symbol": d["symbol"]}, tested_entry, ), "changed_by": ( diff --git a/server/transport/mcp_descriptions.py b/server/transport/mcp_descriptions.py index 9867f0d7251..92fa6aa3986 100644 --- a/server/transport/mcp_descriptions.py +++ b/server/transport/mcp_descriptions.py @@ -1381,7 +1381,7 @@ def revision_policy(update: str) -> str: "Path filters scope the batch. Bodies are on by default. " "Set `include_body: false` for excerpts, `context_lines: 0` for locations. " "With bodies, a `lead` block first names the callers, tests and changing PRs of " - "the definition the pattern names. " + "the definition the pattern names, else the first such one. " "Omitted match text is in its excerpt at the same path and line. " "Use code.search for behavior. " "Use literal strings or one RE2 string with `regex: true`. " diff --git a/tests/unit/snapshots/sdk_public_api.json b/tests/unit/snapshots/sdk_public_api.json index dbdfea6e89a..a89a02acc25 100644 --- a/tests/unit/snapshots/sdk_public_api.json +++ b/tests/unit/snapshots/sdk_public_api.json @@ -2089,7 +2089,8 @@ "path_globs", "exclude_globs", "langs", - "namespaces" + "namespaces", + "lead" ], "history": [ "name", @@ -2194,7 +2195,8 @@ "near_paths", "pr_number", "namespaces", - "presence" + "presence", + "lead" ], "test_gate": [ "files", diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index f472031f605..fe20cc125e1 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -854,8 +854,9 @@ def _resolved_only(sql: str) -> list[dict[str, Any]]: return [] -def _unread_of_calls(n: int) -> list[str]: - """`n` code.symbol blocks for `_DEF` at once, each one's `unread_of`.""" +def _unread_of_calls(n: int, *, keep: bool = False) -> list[Any]: + """`n` code.symbol blocks for `_DEF` at once, each one's `unread_of` (or, with `keep`, + each block).""" one = functools.partial( lead.definition_leads, "code.symbol", "o", "n", _Identity(), [_DEF], started=0 ) @@ -863,7 +864,8 @@ def _unread_of_calls(n: int) -> list[str]: async def go() -> list[list[dict[str, Any]]]: return list(await asyncio.gather(*(one() for _ in range(n)))) - return [lead.unread_of(block) for block in asyncio.run(go())] + blocks = asyncio.run(go()) + return blocks if keep else [lead.unread_of(block) for block in blocks] def test_one_calls_legs_hold_half_the_lane_so_two_calls_fit(monkeypatch, real_client): @@ -948,14 +950,19 @@ def test_no_refused_lane_statement_is_kept_by_a_cache_every_request_reads(monkey ledger = [{"filename": f} for f in status.repo_migrations()] ctor = {"state_key": "scip_ctor_calls", "state_value": "1", "detail": "", "updated_at": None} + control = {"path": "tests/queries/0_stateless/00001_c.sql", "chunks": 1, "first_line": 1} + def rows(sql: str) -> list[dict[str, Any]]: - # the probes answer yes, so a refusal kept as their answer (no) would show + # the probes and the coverage positive control answer yes, so a refusal kept as + # their answer (no) would show if "loom._migrations" in sql: return ledger if "SELECT 1 AS one" in sql: return [{"one": 1}] if "FROM loom.code_index_state" in sql and "state_key IN" not in sql: return [ctor] + if "count() OVER () AS total" in sql: # a grep_files read: the control's + return [{**control, "total": 1}] return _resolved_only(sql) driver = real_client(rows) @@ -1006,6 +1013,7 @@ def kept_after(at: int) -> tuple[str, dict[str, Any]]: statements = refuse["count"] assert unread == "" and statements > 20 assert {"status", "guard", "overrides"} <= set(clean) + assert clean["control:('o', 'n')"] == (True, _DEF["qualified_name"]) for at in range(1, statements + 1): unread, kept = kept_after(at) # the refused leg reads busy, its op's handler having swallowed the refusal or @@ -1016,6 +1024,46 @@ def kept_after(at: int) -> tuple[str, dict[str, Any]]: reset() +def test_the_tested_leg_counts_the_tests_code_coverage_claim_counts(monkeypatch, real_client): + """15 mapped test files: the leg asks at the op's default limit, so its `tests` is the + op's `tests_total`, not the 9 rows three times a limit of 3 would read.""" + from server.code.api.models_testing import CodeCoverageClaimInput + from server.code.app.coverage import handle_code_coverage_claim + + mapped = [ + { + "src_path": _DEF["path"], + "test_path": f"tests/queries/0_stateless/{i:05}_t.sql", + "method": "include_graph", + "confidence": 0.9, + "evidence": "", + } + for i in range(15) + ] + # only the evidence-class read: the measured-coverage read is not capped by `limit` + driver = real_client( + lambda sql: mapped if "method != 'coverage'" in sql else _resolved_only(sql) + ) + answer = driver.query + + async def limited(sql: str, parameters: Any = None, settings: Any = None, **k: Any) -> Any: + out = await answer(sql, parameters, settings, **k) + out.result_rows = out.result_rows[: (parameters or {}).get("limit", len(out.result_rows))] + return out + + driver.query = limited # the statement's LIMIT, as ClickHouse applies it + monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + (leg,) = _unread_of_calls(1, keep=True) + claim = asyncio.run( + handle_code_coverage_claim( + CodeCoverageClaimInput(org="o", namespace="n", symbol=_DEF["qualified_name"]) + ) + ) + assert claim.tests_total == 15 + assert leg[0]["tested"]["tests"] == claim.tests_total + assert leg[0]["tested"]["strongest_tier"] == claim.strongest_tier + + def _grep(monkeypatch, **fields: Any) -> tuple[Any, list[dict[str, Any]], str]: """code.grep through its handler over the scan fixture, with two enclosing bodies of the match: the first one holds it, the second one is the definition it names.""" @@ -1105,6 +1153,38 @@ def test_code_grep_leads_no_continuation_or_related_answer(monkeypatch): assert seen == [] +def test_the_sdk_sends_lead_false_only_when_asked(): + from sdk.python.loom.code import CodeClient + + sent: list[tuple[str, dict[str, Any]]] = [] + + class _Transport: + async def post(self, path: str, body: dict[str, Any]) -> dict[str, Any]: + sent.append((path, body)) + return {} + + class _Agent: + org = "o" + transport = _Transport() + + api = CodeClient.__new__(CodeClient) + api._agent = _Agent() + + async def go() -> None: + await api.symbol("A::f") + await api.grep("f(") + await api.symbol("A::f", lead=False) + await api.grep("f(", lead=False) + + asyncio.run(go()) + assert [(path, body.get("lead")) for path, body in sent] == [ + ("/v1/code.symbol", None), + ("/v1/code.grep", None), + ("/v1/code.symbol", False), + ("/v1/code.grep", False), + ] + + # ------------------------------------------------------------------ callers inside Loom _INPUTS = {"CodeSymbolInput": "code.symbol", "CodeGrepInput": "code.grep"} From c7c92046ed1de15cdb1b70601eefbfe23581978f Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 06:44:39 +0530 Subject: [PATCH 15/30] The lead's history shows any PR it counts, and its wall follows the call's shape code.symbol_history counted the touching PRs of its 120-PR window but served at most 60 rows, so a definition whose only touching PR was the 61st to 120th newest read `prs: 1` with an empty `top`. The op's `limit` now reaches its window (PR_WINDOW, in the domain) and the history leg asks for all of it. The legs' wall started from the 600 ms `lead` budget even for a lookup priced at `ranked` (3000 ms) or `uses_brief` (1500 ms), so a ranked lookup whose ranking took most of 600 ms got no block. The handler now knows the shape before the legs start, bounds the wall by that shape's budget and prices the request by the same shape. The tracker source registry refresh runs outside the lane, as the tracker-link snapshot does. Trace rows name `lead: false`. The code shunt's denial, the loom-code skill and the overview point to a plain code.symbol call for callers instead of `uses_brief`. The feature page says lead legs write no agent_events row, so a history rule meant to count them names code.symbol or code.grep, and gives the wall by shape instead of an unmeasured latency. The fixed numbers the lead added say why they are not settings, the reviewed hashes of the shunt hook and prompt pack are renewed (each adds only `lead: false`), and the feature page's two new tables are lists so its translated pages' cells stay in place. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 6 +- docs/features/code-index/operations.md | 73 ++++--- docs/features/code-index/overview.md | 4 +- docs/reference/operations/code.md | 2 +- .../claude-code-plugin/lib/code-shunt.mjs | 2 +- .../skills/loom-code/SKILL.md | 2 +- .../tests/code-shunt.test.mjs | 3 +- integrations/codex-plugin/lib/code-shunt.mjs | 2 +- .../codex-plugin/skills/loom-code/SKILL.md | 2 +- sdk/go/wire/models.gen.go | 2 +- server/code/api/models_history.py | 5 +- server/code/app/grep.py | 3 +- server/code/app/lead.py | 45 +++-- server/code/app/symbol/symbol.py | 23 +-- server/code/app/symbol_history.py | 5 +- server/code/domain/index/symbol_history.py | 4 + server/core/ch.py | 1 + server/tracker/app/registry_sources.py | 7 +- .../served_skills/loom-code/SKILL.md | 2 +- server/transport/served_skills/manifest.json | 4 +- skills/loom-code/SKILL.md | 2 +- tests/unit/session_content_senders.json | 8 +- tests/unit/test_code_lead.py | 187 ++++++++++++++++-- tests/unit/tunable_constants.txt | 1 - 24 files changed, 288 insertions(+), 107 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 682e3404d08..7cfa219efb1 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -889,9 +889,9 @@ client. A task that outlives the block, such as a load other requests join or a deferred write, runs outside the lane and its deadline (`shared_context()`). So do the fills awaited inline of three caches that would keep a refused read as every request's answer: the schema guard's ledger read and the code index's override-edge and -constructor-edge probes (`shared_work()`). The tracker-link snapshot refreshes outside -the lane too: a refused refresh keeps nothing, but it would log a warning each time and -leave its call on the previous snapshot. A cache that keeps only reads that answered, +constructor-edge probes (`shared_work()`). The tracker-link snapshot and the tracker +source registry refresh outside the lane too: a refused refresh keeps nothing, but it +would log a warning each time and leave its call on the previous snapshot. A cache that keeps only reads that answered, such as the code index's coverage positive control, fills inside the lane. Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 5f953ea076a..d4004bce27f 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -101,27 +101,43 @@ definition of a first page's bodies whose name the pattern holds as a whole identifier, else the first such one. Its entry carries `symbol`, `path` and `line` and three answers: -| Key | From | Holds | -| ------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `callers` | [`code.callers`](../../reference/operations/code.md#codecallers), one hop | `count`, `files`, `through_overrides` (callers reached through a base or an override), `dispatch` seeds, the first three call sites, `truncated`, `epistemic` | -| `tested` | [`code.coverage_claim`](../../reference/operations/code.md#codecoverage_claim) | `verdict`, `tests`, `strongest_tier`, `measured` (`executed` or `unexecuted` by a verified coverage run) and the first three test files | -| `changed_by` | [`code.symbol_history`](../../reference/operations/code.md#codesymbol_history) | `prs`, `level` (`function` when the tracker read the diffs, `file` otherwise), `fixes`, `reverts` and the first three PRs, those naming the definition first | +- `callers`, from [`code.callers`](../../reference/operations/code.md#codecallers) + one hop: `count`, `files`, `through_overrides` (callers reached through a base + or an override), `dispatch` seeds, the first three call sites, `truncated` and + `epistemic`. +- `tested`, from + [`code.coverage_claim`](../../reference/operations/code.md#codecoverage_claim): + `verdict`, `tests`, `strongest_tier`, `measured` (`executed` or `unexecuted` by + a verified coverage run) and the first three test files. +- `changed_by`, from + [`code.symbol_history`](../../reference/operations/code.md#codesymbol_history): + `prs`, `level` (`function` when the tracker read the diffs, `file` otherwise), + `fixes`, `reverts` and the first three PRs, those naming the definition first. The three answers run at once: in `code.symbol` beside the op's own reads, in -`code.grep` once the page's reads are done. Each passes the history policy gate -its op has. They share what the op's `lead` latency budget leaves after the time -already spent (under `deadline_ms`, at most the caller's deadline), and -ClickHouse stops their statements soon after. The tracker reads of the -`changed_by` answer are the exception: they go through the tracker source's own -client and keep its limits (300 ms for a point read, 900 ms for a text read, -and `LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s, on the tracker's server), so one can -run there after the budget ends. The `lead` budget is the op's own -plus a few hundred milliseconds: 600 ms for `code.symbol` and 1000 ms for -`code.grep`. These values are not measured. They let `code.callers` answer in -the common case, while `code.coverage_claim` and `code.symbol_history` answer -when they are fast and read `deadline` otherwise. A deployment whose answers need -longer raises the op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example -`{"code.symbol": "2x"}`, which scales the `lead` budget too) or +`code.grep` once the page's reads are done. Each passes the +[history policy](../tasks-and-decisions.md#history-policies) gate its op has. +The answers write no `agent_events` row of their own, so a rule leaf that reads +past events (`formerly`, `count_within`, `not_since`) on `code.callers`, +`code.coverage_claim` or `code.symbol_history` does not count them: a rule meant +to count the reads a `lead` block makes names `code.symbol` or `code.grep`. + +The answers share what the latency budget of the call's shape leaves after the +time already spent, less a reserve for the rest of the answer (under +`deadline_ms`, at most the caller's deadline), and ClickHouse stops their +statements soon after. The shape is `lead`, 600 ms for `code.symbol` and +1000 ms for `code.grep`; a `code.symbol` lookup ranked by `near_paths` or +`pr_number` keeps its `ranked` budget (3000 ms) and one that reads the uses +brief its `uses_brief` budget (1500 ms), each covering its answers. The tracker +reads of the `changed_by` answer are the exception: they go through the tracker +source's own client and keep its limits (300 ms for a point read, 900 ms for a +text read, and `LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s, on the tracker's server), +so one can run there after the budget ends. The `lead` budgets are not +measured. They let `code.callers` answer in the common case, while +`code.coverage_claim` and `code.symbol_history` answer when they are fast and +read `deadline` otherwise. A deployment whose answers need longer raises the +op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example +`{"code.symbol": "2x"}`, which scales every shape's budget too) or `POST /v1/admin/budget.set`. The block is best effort: the three answers' statements hold at most a share of the server's ClickHouse pool between all calls and never wait for a pool slot. One call's answers hold at most half of @@ -132,20 +148,19 @@ takes it whole. Outside that share, and not counted in it, run the history policy gate's statements, a grant load other requests join, the fills of three caches that would keep a refused read as every request's answer (the schema guard's ledger read and the override-edge and -constructor-edge probes) and the tracker-link snapshot's refresh, which keeps -no refusal but would log a warning for each. The coverage positive control +constructor-edge probes) and the refreshes of the tracker-link snapshot and +the tracker source registry, which keep no refusal but would log a warning for +each. The coverage positive control keeps only a read that answered, so it fills inside the share. The tracker reads above hold none of its slots. An answer that does not come back reads `{"unread": why}`, and the rest of the response is served: -| `unread` | Why | -| ------------ | ---------------------------------------------------------------- | -| `deadline` | still running when the budget ran out | -| `busy` | other calls held the share, or the pool had no slot free at once | -| `failed` | the op raised | -| `policy` | a history policy rule denies the op | -| `ambiguous` | the op refused an ambiguous name | -| `unresolved` | the op did not resolve the definition | +- `deadline`: still running when the budget ran out. +- `busy`: other calls held the share, or the pool had no slot free at once. +- `failed`: the op raised. +- `policy`: a history policy rule denies the op. +- `ambiguous`: the op refused an ambiguous name. +- `unresolved`: the op did not resolve the definition. The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When no answer can start in time the block is diff --git a/docs/features/code-index/overview.md b/docs/features/code-index/overview.md index 7aa7c1d1918..822e37fed05 100644 --- a/docs/features/code-index/overview.md +++ b/docs/features/code-index/overview.md @@ -186,8 +186,8 @@ flowchart LR 1. **Find.** `code.search` for a question in words, `code.grep` for a string you hold. Each hit names its enclosing unit, so you rarely open the file. -2. **Pin the symbol.** `code.symbol` returns definition, signature, body, recent PRs - and (with `uses_brief: true`) top call sites. +2. **Pin the symbol.** `code.symbol` returns definition, signature, body and recent + PRs, led by the definition's callers, tests and changing PRs (`lead`). 3. **Walk the graph.** `code.callers` with `depth` hops. Read `epistemic` to know whether the list is exact or a lower bound. 4. **Measure the change.** `code.impact` with `files` or a unified `diff` returns the diff --git a/docs/reference/operations/code.md b/docs/reference/operations/code.md index 50e43c24e4f..fd01a7207fc 100644 --- a/docs/reference/operations/code.md +++ b/docs/reference/operations/code.md @@ -1710,7 +1710,7 @@ The regression history of one function: the merged PRs that touched it (with lin | `consumer` | `str` | `''` | trace attribution: which integration is calling (clickgap\|claude-code\|…) | | `name` | `str` | `''` | A qualified symbol name or `path:line`. | | `symbol_id` | `str` | `''` | An index symbol id; wins over `name`. | -| `limit` | `int` | `15` | At most this many PR rows (1–60). | +| `limit` | `int` | `15` | At most this many PR rows, newest first (1–120, the PRs the op reads). | | Output field | Type | Meaning | | --- | --- | --- | diff --git a/integrations/claude-code-plugin/lib/code-shunt.mjs b/integrations/claude-code-plugin/lib/code-shunt.mjs index 0661c34d1e1..e36ddf48704 100644 --- a/integrations/claude-code-plugin/lib/code-shunt.mjs +++ b/integrations/claude-code-plugin/lib/code-shunt.mjs @@ -396,7 +396,7 @@ export function denySymbolGrepWithAnswer(ctx, answer) { const { pattern, symbol } = ctx; return ( `loom-code-shunt: ${JSON.stringify(String(pattern))} names a symbol. ${answer}${answer.includes("\n") ? "\n" : " "}` + - `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))} uses_brief: true.` + + `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))}: its lead lists them.` + scopeSentence(ctx) ); } diff --git a/integrations/claude-code-plugin/skills/loom-code/SKILL.md b/integrations/claude-code-plugin/skills/loom-code/SKILL.md index b7b97d21251..84652006fe7 100644 --- a/integrations/claude-code-plugin/skills/loom-code/SKILL.md +++ b/integrations/claude-code-plugin/skills/loom-code/SKILL.md @@ -36,7 +36,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_callers`, or `loom_code_symbol` with `uses_brief: true` | +| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/integrations/claude-code-plugin/tests/code-shunt.test.mjs b/integrations/claude-code-plugin/tests/code-shunt.test.mjs index bfb8901012a..c136b6d3fee 100644 --- a/integrations/claude-code-plugin/tests/code-shunt.test.mjs +++ b/integrations/claude-code-plugin/tests/code-shunt.test.mjs @@ -930,7 +930,8 @@ test("a symbol-grep denial carries the index's answer, the indexed commit as inf same, ); assert.ok(deny.startsWith('loom-code-shunt: "renameTempPartAndAdd" names a symbol. Index answer')); - assert.match(deny, /uses_brief: true/); + assert.match(deny, /name="renameTempPartAndAdd": its lead lists them\./); + assert.doesNotMatch(deny, /uses_brief/); assert.match(deny, /code-example-private/); }); diff --git a/integrations/codex-plugin/lib/code-shunt.mjs b/integrations/codex-plugin/lib/code-shunt.mjs index 0661c34d1e1..e36ddf48704 100644 --- a/integrations/codex-plugin/lib/code-shunt.mjs +++ b/integrations/codex-plugin/lib/code-shunt.mjs @@ -396,7 +396,7 @@ export function denySymbolGrepWithAnswer(ctx, answer) { const { pattern, symbol } = ctx; return ( `loom-code-shunt: ${JSON.stringify(String(pattern))} names a symbol. ${answer}${answer.includes("\n") ? "\n" : " "}` + - `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))} uses_brief: true.` + + `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))}: its lead lists them.` + scopeSentence(ctx) ); } diff --git a/integrations/codex-plugin/skills/loom-code/SKILL.md b/integrations/codex-plugin/skills/loom-code/SKILL.md index b7b97d21251..84652006fe7 100644 --- a/integrations/codex-plugin/skills/loom-code/SKILL.md +++ b/integrations/codex-plugin/skills/loom-code/SKILL.md @@ -36,7 +36,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_callers`, or `loom_code_symbol` with `uses_brief: true` | +| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/sdk/go/wire/models.gen.go b/sdk/go/wire/models.gen.go index fa09b5feba1..96ba54e87c4 100644 --- a/sdk/go/wire/models.gen.go +++ b/sdk/go/wire/models.gen.go @@ -1,5 +1,5 @@ // Code generated by scripts/codegen/sdk_go_gen.py; DO NOT EDIT. -// Registry model schema SHA-256: 4566532bbcae788d424fb6c540e79f52aae3dc9a0f15b107730a7dc934de6177 +// Registry model schema SHA-256: 0631fafa41c673b49cb5fe1eba680f9741f9f8458053c8d51a4dd64bf4e862d1 // Package wire contains the Go requests and responses for Loom operations. package wire diff --git a/server/code/api/models_history.py b/server/code/api/models_history.py index 964aca2e41f..3e242b09e91 100644 --- a/server/code/api/models_history.py +++ b/server/code/api/models_history.py @@ -17,6 +17,7 @@ from server.code.api.models_common import _CodeIdentity, _git_sha, _trim_namespaces from server.code.domain import pr_reviews +from server.code.domain.index.symbol_history import PR_WINDOW # What may bound a frameless bisect scan _WIDENERS = frozenset({"patterns", "component", "fix_candidate"}) @@ -584,8 +585,8 @@ class CodeSymbolHistoryInput(_CodeIdentity): name: str = Field(default="", max_length=300) # An index symbol id; wins over `name`. symbol_id: str = Field(default="", max_length=200) - # At most this many PR rows (1–60). - limit: int = Field(default=15, ge=1, le=60) + # At most this many PR rows, newest first (1–120, the PRs the op reads). + limit: int = Field(default=15, ge=1, le=PR_WINDOW) # "name or symbol_id is required" is the handler's check, raised after # the namespace gate diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 22c396d369b..6841e04b95b 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -1367,7 +1367,7 @@ def _grep_trace_args( ) -> dict[str, Any]: """The grep arguments that change the answer, for the trace row, so a flip between two same-second calls (0 -> N matches) can be pinned on the argument that differed; with - the lead block's legs that did not answer (`lead_unread`).""" + `lead` when it is false and the lead block's legs that did not answer (`lead_unread`).""" return answer_args( input, "mode", @@ -1388,6 +1388,7 @@ def _grep_trace_args( "prefer_complete_context", context_lines=context_lines, paged=bool(input.cursor) or None, + lead=False if not input.lead else None, lead_unread=_lead_unread(lead or []) or None, ) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index c30ad37e6cf..9651bb52d17 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -22,8 +22,10 @@ most half of them at once (`call_slots`), a statement past that waiting for one of its own call's, so two calls fit: a leg reads `unread: busy` when other calls hold the lane or the pool has no slot free. -- The legs share one wall: what the op's latency budget for its `lead` shape leaves after - the time already spent, less a reserve for the rest of the answer. Each statement is +- The legs share one wall: what the op's latency budget for the call's shape leaves + after the time already spent, less a reserve for the rest of the answer (the `lead` + shape, or for a code.symbol lookup ranked by the change at hand or with the uses brief, + that shape, whose budget covers its legs). Each statement is bounded on the server and in the client by what is left of the wall and a margin, so a leg cancelled at the wall does not keep ClickHouse working; a cancelled leg reads `unread: deadline`, one that raised `unread: failed`. The history leg's tracker reads @@ -36,9 +38,11 @@ would read) runs outside the lane too (`server.core.ch.shared_context`, `shared_work`). - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. -A leg that did not answer is noted on the request's degradations and named in the -`lead_unread` trace argument. The block is small by construction: per leg a few counts -and at most `LEAD_ROWS` rows, each with a path. +A leg that did not answer reads `{"unread": why}` in the entry and is named in the +`lead_unread` trace argument and span attribute. Each kind is also noted on the request's +degradations list, kept out of provider health; no code op's response carries that list. +The block is small by construction: per leg a few counts and at most `LEAD_ROWS` rows, +each with a path. """ from __future__ import annotations @@ -57,6 +61,7 @@ from server.code.api.models_symbol import CodeSymbolInput from server.code.app.spans import code_span, start_stage_wall from server.code.app.symbol.neighbours import is_doc_path +from server.code.domain.index.symbol_history import PR_WINDOW from server.code.domain.index.test_gate import is_test_path from server.code.domain.units import estimate_json_tokens from server.core import ch, request_work @@ -73,18 +78,18 @@ # The budget shape a request whose legs ran is priced by (OP_SHAPE_BUDGETS_P99_MS). LEAD_SHAPE = "lead" # Rows per leg: where to look first; the counts carry the totals. +# not a setting: the block's documented shape (the first three rows of each answer) LEAD_ROWS = 3 # Callers one hop reads before it says `truncated` (code.callers' `max_nodes`). _CALLER_NODES = 50 -# PR rows the history leg reads to pick `LEAD_ROWS` that touch the definition: the op's -# most, since `prs` counts every PR of its window and the newest may not touch it. -_HISTORY_ROWS = 60 _TITLE_CHARS = 80 # Left of the budget for the answer after the wall: the trims, serialization and, for # code.grep, the lessons read that runs after the handler. +# not a setting: part of the wall each `lead` budget is declared for; raise the budget RESERVE_S = 0.1 # A leg's statements run at most this long past the wall on the server; the leg is # cancelled at the wall, so the margin only keeps the server's bound from firing first. +# not a setting: the wall's cancel bounds the leg; this only backs it on the server _MARGIN_S = 0.25 # Kinds a caller, a test or a PR can reach. Variables, fields, macros and document # sections are left out, as are definitions in test files and documents. @@ -161,12 +166,12 @@ def named(r: dict[str, Any]) -> bool: return sorted(rows, key=lambda r: not named(r)) -def wall_s(op_name: str, started: float) -> float: - """Seconds the legs may run: the op's effective budget for the `lead` shape (runtime and - per-consumer overrides and the deployment multiplier applied) less the time the request - has spent and the reserve. `started` is the handler's monotonic start, the clock when no - transport bound the request.""" - declared = OP_SHAPE_BUDGETS_P99_MS[op_name][LEAD_SHAPE] +def wall_s(op_name: str, started: float, shape: str = LEAD_SHAPE) -> float: + """Seconds the legs may run: the op's effective budget for `shape`, the one the call is + priced by (runtime and per-consumer overrides and the deployment multiplier applied), + less the time the request has spent and the reserve. `started` is the handler's + monotonic start, the clock when no transport bound the request.""" + declared = OP_SHAPE_BUDGETS_P99_MS[op_name][shape] budget_s = effective_budget_ms(op_name, declared) / 1000.0 spent = max(request_work.age_s(), time.monotonic() - started) return max(0.0, budget_s - spent - RESERVE_S) @@ -290,7 +295,9 @@ def _by_id(d: dict[str, Any]) -> dict[str, Any]: ), "changed_by": ( "code.symbol_history", - lambda d: {**_by_id(d), "limit": _HISTORY_ROWS}, + # every PR of the op's window: `prs` counts those of them that touch the + # definition, and the newest may not + lambda d: {**_by_id(d), "limit": PR_WINDOW}, changed_entry, ), } @@ -433,13 +440,15 @@ async def definition_leads( *, started: float, cap_s: float = math.inf, + shape: str = LEAD_SHAPE, ) -> list[dict[str, Any]]: """The block for `rows`: one entry, for their `lead_definition`, with each leg's answer; [] when no leg starts. `identity` is the op's input, whose `agent` and - `user_id` the legs carry; `cap_s` is a caller's own deadline. Never raises but on - cancellation, which cancels every leg.""" + `user_id` the legs carry; `cap_s` is a caller's own deadline; `shape` is the budget + shape the call is priced by. Never raises but on cancellation, which cancels every + leg.""" picked = lead_definition(rows) - wall = min(wall_s(op_name, started), cap_s) + wall = min(wall_s(op_name, started, shape), cap_s) if picked is None or wall <= 0: return [] base = { diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index 0e53818e01e..c6ddf521c4a 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -209,14 +209,16 @@ def __init__( if want_brief and not self.brief_declined else None ) + # the budget shape the call is priced by, known before the lead legs start + self.shape = _call_shape(input, brief_started=self.brief is not None) # the lead block (callers through overrides, coverage, the PRs that changed it) - # under the `lead` shape's wall. An edit read builds no block. + # under that shape's wall. An edit read builds no block. self.lead = ( asyncio.ensure_future( _staged( "symbol.lead", code_lead.definition_leads( - "code.symbol", org, ns, input, head, started=started + "code.symbol", org, ns, input, head, started=started, shape=self.shape ), ) ) @@ -1082,7 +1084,7 @@ async def handle_code_symbol( ) if matched_members: route = "edit_context_members" - shape = _served_shape(input, brief, ran) + shape = legs.shape if legs.shape != code_lead.LEAD_SHAPE or ran else "" note_budget_shape(shape) tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 trace_run_id = _symbol_trace( @@ -1108,6 +1110,7 @@ async def handle_code_symbol( near_paths_n=len(input.near_paths) or None, picked_by=picked_by or None, shape=shape or None, + lead=False if not input.lead else None, lead_unread=code_lead.unread_of(ran) or None, ), ) @@ -1145,16 +1148,14 @@ async def handle_code_symbol( ) -def _served_shape(input: CodeSymbolInput, brief: dict[str, Any], ran: list[Any]) -> str: - """The shape this call served: it prices the request's budget and is written on the - trace row, so each shape's p99 is measurable. A ranked lookup and the compact uses - block keep their own budgets, which cover the lead legs they may run; `ran` is the - lead block before a token budget or the served definitions withheld it.""" +def _call_shape(input: CodeSymbolInput, *, brief_started: bool) -> str: + """The shape a lookup is priced by: it bounds the lead legs' wall, prices the request's + budget and is written on the trace row, so each shape's p99 is measurable. A ranked + lookup and one that reads the compact uses block keep their own budgets, which cover + the lead legs they run; any other prices the `lead` shape when its legs ran.""" if input.near_paths or input.pr_number: return "ranked" - if brief: - return "uses_brief" - return code_lead.LEAD_SHAPE if ran else "" + return "uses_brief" if brief_started else code_lead.LEAD_SHAPE def _symbol_trace( diff --git a/server/code/app/symbol_history.py b/server/code/app/symbol_history.py index 898cff068e3..7251b8ff3c7 100644 --- a/server/code/app/symbol_history.py +++ b/server/code/app/symbol_history.py @@ -31,7 +31,6 @@ logger = logging.getLogger(__name__) -_PR_WINDOW = 120 _COMMENT_WINDOW = 120 @@ -128,7 +127,7 @@ async def handle_code_symbol_history(input: Any) -> Any: frames = bi.frame_names([qname]) if qname else [] with code_span("symbol_history.loom", seeds=1): prs, comments = await asyncio.gather( - repo.pr_history_for(org, ns, paths=[path], limit=_PR_WINDOW), + repo.pr_history_for(org, ns, paths=[path], limit=sh.PR_WINDOW), repo.review_comments_for(org, ns, [path], limit=_COMMENT_WINDOW, humans_only=True), ) pr_numbers = [int(r.get("pr_number") or 0) for r in prs] @@ -159,7 +158,7 @@ async def handle_code_symbol_history(input: Any) -> Any: frames=frames, qa_ok=qa_ok, ) - summary = sh.summarize(rows, window_prs=_PR_WINDOW, open_issues=len(open_issues), qa_ok=qa_ok) + summary = sh.summarize(rows, window_prs=sh.PR_WINDOW, open_issues=len(open_issues), qa_ok=qa_ok) verdict, causes = sh.verdict_of(rows, resolved=True) if tracker_ns and not qa_ok: causes = [*causes, "tracker_unavailable"] diff --git a/server/code/domain/index/symbol_history.py b/server/code/domain/index/symbol_history.py index fde5b3fa021..6fc3ac33f3a 100644 --- a/server/code/domain/index/symbol_history.py +++ b/server/code/domain/index/symbol_history.py @@ -19,6 +19,10 @@ HISTORY = "history" NO_HISTORY = "no_history" UNKNOWN = "unknown" +# The merged PRs of the definition's file the op reads, newest first: `prs_total` +# counts those among them that touch the definition, and `limit` serves up to all. +# not a setting: the op's `limit` bound on the wire is derived from it +PR_WINDOW = 120 _FIX_RE = re.compile( r"(?i)\b(fix|fixes|fixed|fixing|bug|crash|regression|logical error|segfault|" diff --git a/server/core/ch.py b/server/core/ch.py index c0b6e4ee641..77f92118686 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -564,6 +564,7 @@ class BusyError(OverloadedError): # The bound of a best-effort statement sent once its block's deadline has passed. +# not a setting: the least bound ClickHouse keeps, since 0 means no limit _PAST_DEADLINE_S = 0.001 diff --git a/server/tracker/app/registry_sources.py b/server/tracker/app/registry_sources.py index 82f95c48dee..c4aedd10cee 100644 --- a/server/tracker/app/registry_sources.py +++ b/server/tracker/app/registry_sources.py @@ -114,13 +114,14 @@ async def refresh_db_sources(*, force: bool = False, ch: Any | None = None) -> l if not force and _LOADED_AT and now - _LOADED_AT < ttl: return sources.registered() try: - from server.core.ch import get_client, sequential_reads + from server.core.ch import get_client, sequential_reads, shared_work client = ch or get_client() # A forced refresh follows a write (add, rotate, retire) # or a miss right after one on another process; on Cloud a plain read - # can land on a replica that has not seen that write yet - with sequential_reads() if force else contextlib.nullcontext(): + # can land on a replica that has not seen that write yet. Every request reads + # the snapshot, so the read runs outside a best-effort lane. + with shared_work(), sequential_reads() if force else contextlib.nullcontext(): rows = await _read_rows(client) sources.set_registered([row_to_source(r) for r in rows if r.get("name") and r.get("host")]) _LOADED_AT = now diff --git a/server/transport/served_skills/loom-code/SKILL.md b/server/transport/served_skills/loom-code/SKILL.md index 9cfe084eb90..97a6b285e4e 100644 --- a/server/transport/served_skills/loom-code/SKILL.md +++ b/server/transport/served_skills/loom-code/SKILL.md @@ -28,7 +28,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_callers`, or `loom_code_symbol` with `uses_brief: true` | +| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/server/transport/served_skills/manifest.json b/server/transport/served_skills/manifest.json index 4c7c1499149..0558a7ca960 100644 --- a/server/transport/served_skills/manifest.json +++ b/server/transport/served_skills/manifest.json @@ -26,8 +26,8 @@ "files": [ { "path": "SKILL.md", - "digest": "sha256:9d43666c8dc77a249946bc5a9a32e457d7d5155ddbc8f2c316b3dca5279a0951", - "size": 3043 + "digest": "sha256:04c8c60a2fbbd5d1458058576d64eb84e26192290e81f78d70ebb9812f84a54e", + "size": 3064 }, { "path": "reference.md", diff --git a/skills/loom-code/SKILL.md b/skills/loom-code/SKILL.md index 4072af88fd4..061430477c7 100644 --- a/skills/loom-code/SKILL.md +++ b/skills/loom-code/SKILL.md @@ -40,7 +40,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_callers`, or `loom_code_symbol` with `uses_brief: true` | +| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/tests/unit/session_content_senders.json b/tests/unit/session_content_senders.json index e40123b41f3..605423978e6 100644 --- a/tests/unit/session_content_senders.json +++ b/tests/unit/session_content_senders.json @@ -383,7 +383,7 @@ } }, "reviewed_source_sha256": { - "integrations/claude-code-plugin/hooks/loom-code-shunt.mjs": "e2efd41b21022501796dead4b0fce9166e3e0d819d7a562b4d8807a7949b134b", + "integrations/claude-code-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/claude-code-plugin/hooks/loom-flush.mjs": "8b48742059e0c7bdc1fe724a78df31f28af646dc9e9325aace7bae3a7d2a86ab", "integrations/claude-code-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "763f90d1291ffc41843cdbca4c2add6331642f21244d273b146dfac7df173904", @@ -393,12 +393,12 @@ "integrations/claude-code-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/claude-code-plugin/lib/loom-client.mjs": "e4bf6fe545e0527bb793f05d92240d462ecf19e7fabb1f88dedeca6c08ab9500", "integrations/claude-code-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/claude-code-plugin/lib/prompt-pack.mjs": "efd318401aebf0a13fb51289b971ae4bab6138b4d175cc8150902f325a5d9101", + "integrations/claude-code-plugin/lib/prompt-pack.mjs": "cb20e08414bc6dec002348584e973544ba71a858ff60cb5561c8fd743b8e4a90", "integrations/claude-code-plugin/lib/repo-scope.mjs": "961eafc828f667daf59e94407bf363c7243890e3f4d1d35c5b9d04e2db72eefe", "integrations/claude-code-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/claude-code-plugin/lib/session-start.mjs": "6b410afc84c63d539f539b9f6e9325a91ab6d8431637541c3b6c8a8e58079ca1", "integrations/claude-code-plugin/lib/task-inbox.mjs": "33fbb1040e9b6db936928a66e4b90555a556220415f4e6394f6d2cd67821dcfc", - "integrations/codex-plugin/hooks/loom-code-shunt.mjs": "e2efd41b21022501796dead4b0fce9166e3e0d819d7a562b4d8807a7949b134b", + "integrations/codex-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/codex-plugin/hooks/loom-flush.mjs": "8b48742059e0c7bdc1fe724a78df31f28af646dc9e9325aace7bae3a7d2a86ab", "integrations/codex-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "763f90d1291ffc41843cdbca4c2add6331642f21244d273b146dfac7df173904", @@ -408,7 +408,7 @@ "integrations/codex-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/codex-plugin/lib/loom-client.mjs": "e4bf6fe545e0527bb793f05d92240d462ecf19e7fabb1f88dedeca6c08ab9500", "integrations/codex-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/codex-plugin/lib/prompt-pack.mjs": "efd318401aebf0a13fb51289b971ae4bab6138b4d175cc8150902f325a5d9101", + "integrations/codex-plugin/lib/prompt-pack.mjs": "cb20e08414bc6dec002348584e973544ba71a858ff60cb5561c8fd743b8e4a90", "integrations/codex-plugin/lib/repo-scope.mjs": "961eafc828f667daf59e94407bf363c7243890e3f4d1d35c5b9d04e2db72eefe", "integrations/codex-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/codex-plugin/lib/session-start.mjs": "6b410afc84c63d539f539b9f6e9325a91ab6d8431637541c3b6c8a8e58079ca1", diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index fe20cc125e1..eef1f3d39c8 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -266,7 +266,7 @@ async def run(query: Any) -> Any: def _run_leads(monkeypatch, ops: _Ops, *, wall: float = 5.0, **kw: Any) -> tuple[Any, list[str]]: monkeypatch.setattr(lead, "_ops", ops) - monkeypatch.setattr(lead, "wall_s", lambda op, started: wall) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: wall) async def go() -> tuple[list[dict[str, Any]], list[str]]: degradations.begin() @@ -318,6 +318,32 @@ def history(query: Any) -> CodeSymbolHistoryOutput: assert [p["pr_number"] for p in changed["top"]] == [88, 87, 86] +def test_the_history_leg_shows_a_pr_from_anywhere_in_the_window_the_op_counts(monkeypatch): + """The only PR touching the definition is the 80th newest of the op's 120, which the op + counts in `prs`: `top` shows it, through the op's real input model.""" + from server.code.domain.index.symbol_history import PR_WINDOW + + window = [ + { + "pr_number": 200 - i, + "title": f"PR {i}", + "merged_at": "2026-11-01", + "touches_symbol": "true" if i == 79 else "false", + } + for i in range(PR_WINDOW) + ] + + def history(query: Any) -> CodeSymbolHistoryOutput: + return CodeSymbolHistoryOutput( + prs=window[: query.limit], summary={"prs_total": 1}, tracker_namespace="t" + ) + + out, _ = _run_leads(monkeypatch, _Ops(**{"code.symbol_history": history})) + changed = out[0]["changed_by"] + assert changed["prs"] == 1 + assert [p["pr_number"] for p in changed["top"]] == [121] + + def test_the_ops_stage_table_holds_each_leg_once_under_its_name(monkeypatch): from server.code.app.spans import code_span, current_stage_ms, start_stage_wall @@ -327,7 +353,7 @@ async def coverage(query: Any) -> CodeCoverageClaimOutput: return CodeCoverageClaimOutput(verdict="unknown") monkeypatch.setattr(lead, "_ops", _Ops(**{"code.coverage_claim": coverage})) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 5.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 5.0) async def go() -> dict[str, int]: start_stage_wall() @@ -429,7 +455,7 @@ async def gate(op, identity, raw_args, *, request_id=""): monkeypatch.setattr(policy_gate, "gate", gate) monkeypatch.setattr(lead, "_ops", _Ops()) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 0.1) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 0.1) async def go() -> list[dict[str, Any]]: out = await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) @@ -475,7 +501,7 @@ def test_a_cancelled_block_retrieves_a_leg_that_raised(monkeypatch): } ) monkeypatch.setattr(lead, "_ops", ops) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) lost: list[dict[str, Any]] = [] async def go() -> None: @@ -510,6 +536,23 @@ def test_the_wall_is_the_lead_budget_less_the_time_spent(monkeypatch): assert lead.wall_s("code.symbol", 99.0) == 0.0 +def test_the_wall_starts_from_the_budget_of_the_shape_of_the_call(monkeypatch): + """Through the real `effective_budget_ms`: a ranked lookup's wall is its 3000 ms budget, + the uses brief's 1500 ms, and `latency_budget_overrides` scales each.""" + from server.observability.budgets import get_overrides + + monkeypatch.setattr(lead.time, "monotonic", lambda: 100.2) + monkeypatch.setattr(lead.request_work, "age_s", lambda: 0.0) + monkeypatch.setattr(settings, "latency_budget_multiplier", 1.0) + monkeypatch.setattr(settings, "latency_budget_overrides", "") + assert get_overrides().get("code.symbol") is None + for shape, budget_s in (("lead", 0.6), ("ranked", 3.0), ("uses_brief", 1.5)): + assert lead.wall_s("code.symbol", 100.0, shape) == pytest.approx(budget_s - 0.3) + monkeypatch.setattr(settings, "latency_budget_overrides", '{"code.symbol": "2x"}') + for shape, budget_s in (("lead", 1.2), ("ranked", 6.0), ("uses_brief", 3.0)): + assert lead.wall_s("code.symbol", 100.0, shape) == pytest.approx(budget_s - 0.3) + + # ------------------------------------------------------------------ the wire @@ -522,6 +565,62 @@ def test_the_block_is_first_on_the_wire_and_off_it_when_empty(): assert "lead" not in CodeGrepOutput(matches=[], chunks_matched=0).model_dump() +def test_the_block_survives_the_mcp_shaping_first_and_whole(): + """An MCP `tools/call` answer goes through `lean_result` and `lean_code`: every key of + every leg, the flags and the rows included, stays, and the block stays first.""" + from server.transport.lean_results import mcp_op_result + + block = [ + { + "symbol": "DB::Foo::bar", + "path": "src/Foo.cpp", + "line": 10, + "callers": { + "count": 2, + "files": 1, + "through_overrides": 1, + "dispatch": ["DB::IFoo::bar"], + "top": [ + {"path": "src/a.cpp", "line": 3, "caller": "DB::a", "via_override": "x"}, + {"path": "src/a.cpp", "line": 9, "caller": "DB::b", "via": "registration"}, + ], + "truncated": True, + "epistemic": "lower_bound", + }, + "tested": { + "verdict": "covered", + "tests": 3, + "strongest_tier": "exact_scoped", + "measured": "executed", + "top": [{"test_path": "tests/queries/0_stateless/00001_a.sql", "tier": "exact"}], + }, + "changed_by": { + "prs": 2, + "level": "function", + "fixes": 1, + "reverts": 1, + "top": [ + { + "pr_number": 7, + "title": "Fix bar", + "merged_at": "2026-11-01", + "touches_symbol": "true", + "is_fix": True, + "is_revert": True, + } + ], + }, + } + ] + payloads = { + "code.symbol": CodeSymbolOutput(definitions=[], lead=block), + "code.grep": CodeGrepOutput(matches=[], chunks_matched=0, lead=block), + } + for op, payload in payloads.items(): + out = mcp_op_result(op, payload.model_dump(mode="json"), {"name": "DB::Foo::bar"}, None) + assert next(iter(out)) == "lead" and out["lead"] == block, op + + # ------------------------------------------------------------------ the handlers @@ -595,8 +694,17 @@ def _intel_on(monkeypatch): def _recorder(seen: list[dict[str, Any]]) -> Any: - async def leads(op_name, org, ns, identity, rows, *, started, cap_s=math.inf): - seen.append({"op": op_name, "rows": [r["qualified_name"] for r in rows], "cap_s": cap_s}) + async def leads( + op_name, org, ns, identity, rows, *, started, cap_s=math.inf, shape=lead.LEAD_SHAPE + ): + seen.append( + { + "op": op_name, + "rows": [r["qualified_name"] for r in rows], + "cap_s": cap_s, + "shape": shape, + } + ) first = rows[0] return [ { @@ -634,7 +742,12 @@ async def symbol_stats(self, org, ns, ids, **_kw): def _symbol( - monkeypatch, *, edit: bool = False, repo: Any = None, **fields: Any + monkeypatch, + *, + edit: bool = False, + repo: Any = None, + traces: list[dict[str, Any]] | None = None, + **fields: Any, ) -> tuple[Any, list[Any], str]: from server.code.api.models_symbol import CodeEditContextInput, CodeSymbolInput from server.code.app.symbol import outline @@ -653,7 +766,11 @@ async def go() -> tuple[Any, str]: patch.object(h, "CodeRepo", return_value=repo or _Repo()), patch.object(h, "symbol_body", new=body), patch.object(outline, "symbol_body", new=body), - patch.object(h, "schedule_code_trace", new=lambda **k: None), + patch.object( + h, + "schedule_code_trace", + new=lambda **k: None if traces is None else traces.append(k), + ), ): if edit: out = await h.handle_code_edit_context( @@ -681,13 +798,29 @@ def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): dump = out.model_dump() assert list(dump)[0] == "lead" assert dump["lead"] == [_LED] - assert shape == lead.LEAD_SHAPE + assert shape == lead.LEAD_SHAPE == seen[0]["shape"] + + +@pytest.mark.usefixtures("_intel_on") +def test_the_legs_run_under_the_shape_of_the_call_its_request_is_priced_by(monkeypatch): + for fields, expected in ( + ({"near_paths": ["src/Foo.cpp"]}, "ranked"), + ({"pr_number": 7}, "ranked"), + ({"uses_brief": True}, "uses_brief"), + ({"uses_brief": True, "token_budget": 1}, "uses_brief"), + ): + _out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", **fields) + assert (seen[0]["shape"], shape) == (expected, expected), fields @pytest.mark.usefixtures("_intel_on") def test_lead_false_and_the_edit_read_run_no_leg(monkeypatch): - out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", lead=False) + traces: list[dict[str, Any]] = [] + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", lead=False, traces=traces) assert seen == [] and "lead" not in out.model_dump() and shape == "" + assert traces[-1]["args"]["lead"] is False + _symbol(monkeypatch, name="DB::Foo::bar", traces=traces) + assert "lead" not in traces[-1]["args"] out, seen, _ = _symbol(monkeypatch, edit=True, name="DB::Foo::bar") assert seen == [] and "lead" not in out.model_dump() @@ -874,7 +1007,7 @@ def test_one_calls_legs_hold_half_the_lane_so_two_calls_fit(monkeypatch, real_cl wait for their own call's slots, and two calls at once both answer: `busy` means other calls hold the lane.""" driver = real_client(_resolved_only) - monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) assert _unread_of_calls(1) == [""] assert driver.peak == lead.call_slots() == 4 driver.peak = 0 @@ -891,18 +1024,20 @@ def test_one_calls_legs_hold_half_the_lane_so_two_calls_fit(monkeypatch, real_cl def test_reads_every_request_keeps_run_outside_a_full_lane(monkeypatch, real_client): """With the lane full, a leg's reads still run the schema guard's ledger refresh, the - namespace probes and the tracker-link snapshot refresh, outside the lane: a refusal is - never kept as every request's answer (an idle guard, a namespace held on the dispatch - heuristics, an empty snapshot).""" + namespace probes, the tracker-link snapshot refresh and the tracker registry refresh, + outside the lane: a refusal is never kept as every request's answer (an idle guard, a + namespace held on the dispatch heuristics, an empty snapshot).""" from server.code.app.symbol import coverage as symbol_coverage from server.code.app.symbol import dispatch from server.code.store.index import CodeRepo from server.core import ch_schema_guard from server.core.schema import status - from server.tracker.app import binding + from server.tracker.app import binding, registry_sources + from server.tracker.domain import sources ledger = [{"filename": f} for f in status.repo_migrations()] ctor = {"state_key": "scip_ctor_calls", "state_value": "1", "detail": "", "updated_at": None} + source = {"org": "o", "name": "qa", "host": "tracker.invalid", "database": "qa"} def rows(sql: str) -> list[dict[str, Any]]: if "loom._migrations" in sql: @@ -911,10 +1046,15 @@ def rows(sql: str) -> list[dict[str, Any]]: return [{"one": 1}] if "FROM loom.code_index_state" in sql and "state_key IN" not in sql: return [ctor] + if "FROM loom.qa_sources" in sql: + return [source] return [] driver = real_client(rows) monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) + monkeypatch.setattr(settings, "tracker_self_service_enabled", True) + monkeypatch.setattr(registry_sources, "_LOADED_AT", 0.0) + monkeypatch.setattr(sources, "_registered", []) full = ch.BestEffortClaim(ch.BestEffortSlots(limit=0), asyncio.Semaphore(1)) async def go() -> tuple[bool, tuple[bool, bool]]: @@ -922,6 +1062,7 @@ async def go() -> tuple[bool, tuple[bool, bool]]: with pytest.raises(ch.BusyError): await CodeRepo().symbols_by_ids("o", "n", ["f1"]) await binding.refresh_overrides() + assert [s.name for s in await registry_sources.refresh_db_sources()] == ["qa"] repo = CodeRepo() return ( await dispatch._namespace_has_override_edges(repo, "o", "n"), @@ -932,8 +1073,8 @@ async def go() -> tuple[bool, tuple[bool, bool]]: assert has_overrides and scip_ctor assert status._cache["value"]["pending"] == [] and "error" not in status._cache["value"] assert ch_schema_guard._schema_guard["at"] is not None - assert binding._OVERRIDES_AT > -math.inf - assert len(driver.seen) == 4 and not any(in_lane for _sql, in_lane in driver.seen) + assert binding._OVERRIDES_AT > -math.inf and registry_sources._LOADED_AT > 0 + assert len(driver.seen) == 5 and not any(in_lane for _sql, in_lane in driver.seen) def test_no_refused_lane_statement_is_kept_by_a_cache_every_request_reads(monkeypatch, real_client): @@ -967,7 +1108,7 @@ def rows(sql: str) -> list[dict[str, Any]]: driver = real_client(rows) driver.delay = 0.0 - monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) monkeypatch.setattr(settings, "code_coverage_control_symbol", _DEF["qualified_name"]) monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) refuse = {"at": 0, "count": 0} @@ -1052,7 +1193,7 @@ async def limited(sql: str, parameters: Any = None, settings: Any = None, **k: A return out driver.query = limited # the statement's LIMIT, as ClickHouse applies it - monkeypatch.setattr(lead, "wall_s", lambda op, started: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) (leg,) = _unread_of_calls(1, keep=True) claim = asyncio.run( handle_code_coverage_claim( @@ -1140,6 +1281,14 @@ def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): assert seen == [] and "lead" not in out.model_dump() and shape == "", kw +def test_the_grep_trace_row_names_lead_only_when_it_is_false(): + from server.code.app.grep import _grep_trace_args + + query = CodeGrepInput(org="o", namespace="n", pattern="bar") + assert "lead" not in _grep_trace_args(query) + assert _grep_trace_args(query.model_copy(update={"lead": False}))["lead"] is False + + def test_code_grep_leads_no_continuation_or_related_answer(monkeypatch): from server.code.app import grep diff --git a/tests/unit/tunable_constants.txt b/tests/unit/tunable_constants.txt index 030db0b73b9..90a8e55867e 100644 --- a/tests/unit/tunable_constants.txt +++ b/tests/unit/tunable_constants.txt @@ -174,7 +174,6 @@ server/code/app/symbol/verify.py::BFS_MAX_VISITED server/code/app/symbol/verify.py::_BFS_READ_LIMIT server/code/app/symbol_context.py::MAX_NEAR_PATHS server/code/app/symbol_history.py::_COMMENT_WINDOW -server/code/app/symbol_history.py::_PR_WINDOW server/code/app/symbol_uses.py::READ_CAP server/code/app/unit_risk.py::COMMIT_CALLEE_PATHS_MAX server/code/app/unit_risk.py::INSERT_BATCH From ddbb2429cbf8d3b8ed528a3f25da1f7d524074f5 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 07:54:22 +0530 Subject: [PATCH 16/30] In-process integration tests import every op first, as the server does at boot A lead leg's policy gate reads the op registry. In a test process that had not imported it, the first code.symbol with the block imported it inside the call, and the definition's lessons read timed out at its 0.5 s bound; the integration conftest now imports the registry once per session. The two wall_s patches in test_code_plane take any arguments, since the wall now takes the call's shape. The plugin text says a plain code.symbol lead counts the callers and lists the first three, with code.callers for all of them or more hops. The feature page keeps the budget per shape, how to raise it and what busy means, and links the ClickHouse page for the share and the work outside the lane, which now also names the policy gate. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 4 +- docs/features/code-index/operations.md | 45 ++++++------------- .../claude-code-plugin/lib/code-shunt.mjs | 2 +- .../skills/loom-code/SKILL.md | 2 +- .../tests/code-shunt.test.mjs | 5 ++- integrations/codex-plugin/lib/code-shunt.mjs | 2 +- .../codex-plugin/skills/loom-code/SKILL.md | 2 +- .../served_skills/loom-code/SKILL.md | 2 +- server/transport/served_skills/manifest.json | 4 +- skills/loom-code/SKILL.md | 2 +- tests/integration/conftest.py | 8 ++++ tests/integration/test_code_plane.py | 4 +- 12 files changed, 39 insertions(+), 43 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 7cfa219efb1..1ae5d68a1ec 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -892,7 +892,9 @@ answer: the schema guard's ledger read and the code index's override-edge and constructor-edge probes (`shared_work()`). The tracker-link snapshot and the tracker source registry refresh outside the lane too: a refused refresh keeps nothing, but it would log a warning each time and leave its call on the previous snapshot. A cache that keeps only reads that answered, -such as the code index's coverage positive control, fills inside the lane. +such as the code index's coverage positive control, fills inside the lane. The history +policy gate a `lead` leg passes runs before the leg enters the lane, so its statements +hold ordinary pool slots and are never refused as best-effort work. Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` (`production`, `interactive`, `bench`, `background`): `priority`, `max_threads`, and for diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index d4004bce27f..e68c03aa623 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -123,37 +123,20 @@ past events (`formerly`, `count_within`, `not_since`) on `code.callers`, to count the reads a `lead` block makes names `code.symbol` or `code.grep`. The answers share what the latency budget of the call's shape leaves after the -time already spent, less a reserve for the rest of the answer (under -`deadline_ms`, at most the caller's deadline), and ClickHouse stops their -statements soon after. The shape is `lead`, 600 ms for `code.symbol` and -1000 ms for `code.grep`; a `code.symbol` lookup ranked by `near_paths` or -`pr_number` keeps its `ranked` budget (3000 ms) and one that reads the uses -brief its `uses_brief` budget (1500 ms), each covering its answers. The tracker -reads of the `changed_by` answer are the exception: they go through the tracker -source's own client and keep its limits (300 ms for a point read, 900 ms for a -text read, and `LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s, on the tracker's server), -so one can run there after the budget ends. The `lead` budgets are not -measured. They let `code.callers` answer in the common case, while -`code.coverage_claim` and `code.symbol_history` answer when they are fast and -read `deadline` otherwise. A deployment whose answers need longer raises the -op's budget with `LOOM_LATENCY_BUDGET_OVERRIDES` (for example -`{"code.symbol": "2x"}`, which scales every shape's budget too) or -`POST /v1/admin/budget.set`. The block is best effort: the three answers' -statements hold at most a share of the server's ClickHouse pool between all -calls and never wait for a pool slot. One call's answers hold at most half of -that share at once and wait for their own call's slots past it. At the default -pool size (`ch_pool_maxsize` 64) the share is 8 slots, an eighth, and one call -holds 4, so two calls fit; below 16 slots the share is one slot and one call -takes it whole. Outside that share, and not counted in -it, run the history policy gate's statements, a grant load other requests -join, the fills of three caches that would keep a refused read as every -request's answer (the schema guard's ledger read and the override-edge and -constructor-edge probes) and the refreshes of the tracker-link snapshot and -the tracker source registry, which keep no refusal but would log a warning for -each. The coverage positive control -keeps only a read that answered, so it fills inside the share. The tracker -reads above hold none of its slots. An answer that does not come back reads -`{"unread": why}`, and the rest of the response is served: +time already spent, less a reserve for the rest of the answer, and at most what +`deadline_ms` leaves. The shape is `lead`, 600 ms for `code.symbol` and 1000 ms +for `code.grep`; a `code.symbol` lookup ranked by `near_paths` or `pr_number` +keeps its `ranked` budget (3000 ms) and one that reads the uses brief its +`uses_brief` budget (1500 ms). These budgets are not measured. Raise them with +`LOOM_LATENCY_BUDGET_OVERRIDES` (`{"code.symbol": "2x"}` scales every shape) or +`POST /v1/admin/budget.set`. The tracker reads of `changed_by` keep the tracker +client's own limits (`LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s), so one can run past +the budget. The answers' ClickHouse statements hold a bounded share of the pool +(`LOOM_CH_POOL_MAXSIZE`) and never wait for a pool slot: +[statement classes](../../architecture/clickhouse.md#statement-classes-deadlines-and-traffic-classes) +gives the share, each call's width and the work that runs outside it. An answer +that does not come back reads `{"unread": why}`, and the rest of the response is +served: - `deadline`: still running when the budget ran out. - `busy`: other calls held the share, or the pool had no slot free at once. diff --git a/integrations/claude-code-plugin/lib/code-shunt.mjs b/integrations/claude-code-plugin/lib/code-shunt.mjs index e36ddf48704..cd8de8ab6e5 100644 --- a/integrations/claude-code-plugin/lib/code-shunt.mjs +++ b/integrations/claude-code-plugin/lib/code-shunt.mjs @@ -396,7 +396,7 @@ export function denySymbolGrepWithAnswer(ctx, answer) { const { pattern, symbol } = ctx; return ( `loom-code-shunt: ${JSON.stringify(String(pattern))} names a symbol. ${answer}${answer.includes("\n") ? "\n" : " "}` + - `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))}: its lead lists them.` + + `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))}: its lead counts the callers and lists the first three; loom_code_callers for all or more hops.` + scopeSentence(ctx) ); } diff --git a/integrations/claude-code-plugin/skills/loom-code/SKILL.md b/integrations/claude-code-plugin/skills/loom-code/SKILL.md index 84652006fe7..ac2708b8e06 100644 --- a/integrations/claude-code-plugin/skills/loom-code/SKILL.md +++ b/integrations/claude-code-plugin/skills/loom-code/SKILL.md @@ -36,7 +36,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | +| who calls X | `loom_code_symbol`: its `lead` counts the callers and lists the first three; `loom_code_callers` for all or more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/integrations/claude-code-plugin/tests/code-shunt.test.mjs b/integrations/claude-code-plugin/tests/code-shunt.test.mjs index c136b6d3fee..f6263ddeb0c 100644 --- a/integrations/claude-code-plugin/tests/code-shunt.test.mjs +++ b/integrations/claude-code-plugin/tests/code-shunt.test.mjs @@ -930,7 +930,10 @@ test("a symbol-grep denial carries the index's answer, the indexed commit as inf same, ); assert.ok(deny.startsWith('loom-code-shunt: "renameTempPartAndAdd" names a symbol. Index answer')); - assert.match(deny, /name="renameTempPartAndAdd": its lead lists them\./); + assert.match( + deny, + /name="renameTempPartAndAdd": its lead counts the callers and lists the first three; loom_code_callers for all or more hops\./, + ); assert.doesNotMatch(deny, /uses_brief/); assert.match(deny, /code-example-private/); }); diff --git a/integrations/codex-plugin/lib/code-shunt.mjs b/integrations/codex-plugin/lib/code-shunt.mjs index e36ddf48704..cd8de8ab6e5 100644 --- a/integrations/codex-plugin/lib/code-shunt.mjs +++ b/integrations/codex-plugin/lib/code-shunt.mjs @@ -396,7 +396,7 @@ export function denySymbolGrepWithAnswer(ctx, answer) { const { pattern, symbol } = ctx; return ( `loom-code-shunt: ${JSON.stringify(String(pattern))} names a symbol. ${answer}${answer.includes("\n") ? "\n" : " "}` + - `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))}: its lead lists them.` + + `For its callers call loom_code_symbol name=${JSON.stringify(String(symbol))}: its lead counts the callers and lists the first three; loom_code_callers for all or more hops.` + scopeSentence(ctx) ); } diff --git a/integrations/codex-plugin/skills/loom-code/SKILL.md b/integrations/codex-plugin/skills/loom-code/SKILL.md index 84652006fe7..ac2708b8e06 100644 --- a/integrations/codex-plugin/skills/loom-code/SKILL.md +++ b/integrations/codex-plugin/skills/loom-code/SKILL.md @@ -36,7 +36,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | +| who calls X | `loom_code_symbol`: its `lead` counts the callers and lists the first three; `loom_code_callers` for all or more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/server/transport/served_skills/loom-code/SKILL.md b/server/transport/served_skills/loom-code/SKILL.md index 97a6b285e4e..341f187da2b 100644 --- a/server/transport/served_skills/loom-code/SKILL.md +++ b/server/transport/served_skills/loom-code/SKILL.md @@ -28,7 +28,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | +| who calls X | `loom_code_symbol`: its `lead` counts the callers and lists the first three; `loom_code_callers` for all or more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/server/transport/served_skills/manifest.json b/server/transport/served_skills/manifest.json index 0558a7ca960..140c6bc1f85 100644 --- a/server/transport/served_skills/manifest.json +++ b/server/transport/served_skills/manifest.json @@ -26,8 +26,8 @@ "files": [ { "path": "SKILL.md", - "digest": "sha256:04c8c60a2fbbd5d1458058576d64eb84e26192290e81f78d70ebb9812f84a54e", - "size": 3064 + "digest": "sha256:2e9f5fcd0ccc7a2507d9e34a65c71a4df43a67ff3348ed70c1e888ad0301b714", + "size": 3094 }, { "path": "reference.md", diff --git a/skills/loom-code/SKILL.md b/skills/loom-code/SKILL.md index 061430477c7..4d59ec1678c 100644 --- a/skills/loom-code/SKILL.md +++ b/skills/loom-code/SKILL.md @@ -40,7 +40,7 @@ make it a literal-search request. |---|---| | where is X defined / its signature and doc | `loom_code_symbol` (`name`) | | what could changing X affect | `loom_code_impact` (`name`, or the current diff) | -| who calls X | `loom_code_symbol` (its `lead` lists the callers), or `loom_code_callers` for more hops | +| who calls X | `loom_code_symbol`: its `lead` counts the callers and lists the first three; `loom_code_callers` for all or more hops | | a concept with no greppable keyword ("where do we retry s3 uploads") | `loom_code_search` | | an exact literal or error string | `loom_code_grep` (each hit with its enclosing symbol) | | what is in a file | `loom_code_outline` (`path`) — then read one span | diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index acf7a1b1994..8db691dfd31 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -273,6 +273,14 @@ def _code_registry_read() -> Iterator[None]: repos._registry_loaded = before +@pytest.fixture(autouse=True, scope="session") +def _operations_imported() -> None: + """The server imports every op at boot (`server.transport.http`); in-process calls + import them first too, or the first `code.symbol` lead leg imports the registry for + its policy gate inside the call, and the definition's bounded reads time out.""" + import server.operations.registry # noqa: F401 + + @pytest.fixture(autouse=True) def _fresh_request_log() -> None: _requests.clear() diff --git a/tests/integration/test_code_plane.py b/tests/integration/test_code_plane.py index 76d75cc5a30..c67e26b4735 100644 --- a/tests/integration/test_code_plane.py +++ b/tests/integration/test_code_plane.py @@ -222,7 +222,7 @@ async def test_grep_returns_distinct_retained_enclosing_bodies_by_default( org, ns = unique_org("grep-bodies"), "source" monkeypatch.setattr(settings, "code_intel_enabled", True) # the block's content, not its wall (tests/unit/test_code_lead.py holds the wall) - monkeypatch.setattr(lead, "wall_s", lambda op_name, started: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda *_args: 30.0) await _ingest(CodeRepo(), org, ns) plain = await handle_code_grep( CodeGrepInput(org=org, namespace=ns, pattern="squashImpl", include_body=False) @@ -474,7 +474,7 @@ async def test_read_ops_and_abstain(code_env, monkeypatch) -> None: include_history=False, include_lessons=False, ) - monkeypatch.setattr(lead, "wall_s", lambda op_name, started: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda *_args: 30.0) plain_response = await handle_code_symbol(query) plain = plain_response.definitions[0].examples # the definition leads with its caller, its coverage and its history From e57a6cad7338c7b9b8dca6c50c36a04d726151d4 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 08:45:48 +0530 Subject: [PATCH 17/30] A grep priced by its lead block reads its lessons inside that budget The lessons read after the code.grep handler was bounded by code_enrich_timeout_s and the caller's deadline_ms only, so a default grep whose legs ran to the wall could end about 0.4 s past its 1000 ms price. A grep priced by its block now reads its lessons in what is left of that budget, the reserve its legs leave; a grep without a block keeps the read's own bound. The block covers a Java record declaration. The grep replay harness replays a trace row's lead and imports the op registry before its run. The caller check's docstring says a dict held in a variable is not read, and a self-check pins the literal forms it reads. The architecture page's code.grep and code.symbol rows name the legs and the lane, and the lane paragraph gives the share for an unbounded pool. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- bench/code_grep_handler.py | 6 +- docs/architecture/clickhouse.md | 3 +- docs/architecture/code-index-architecture.md | 4 +- docs/features/code-index/operations.md | 10 +-- server/code/app/lead.py | 1 + server/code/app/result_lessons.py | 8 ++- tests/unit/test_code_lead.py | 65 +++++++++++++++++++- 7 files changed, 87 insertions(+), 10 deletions(-) diff --git a/bench/code_grep_handler.py b/bench/code_grep_handler.py index 7ffc3e14e01..e56b3273792 100644 --- a/bench/code_grep_handler.py +++ b/bench/code_grep_handler.py @@ -159,7 +159,7 @@ def _input(call: dict[str, Any]) -> Any: "mode": call["m"], "path_prefix": call["path_prefix"] or "", } - for k in ("regex", "case_sensitive", "limit", "neighbours", "include_body"): + for k in ("regex", "case_sensitive", "limit", "neighbours", "include_body", "lead"): if k in args and args[k] is not None: kw[k] = args[k] return CodeGrepInput(**kw) @@ -267,6 +267,10 @@ def main() -> None: if args.cold: cold_reads() + # the server's boot import: a call that imports the registry itself (the `lead` + # legs' policy gate) would time the import + import server.operations.registry # noqa: F401 + async def go() -> list[dict[str, Any]]: from server.code.app.index.repo_registry import read_registry_or_exit from server.core.ch import get_client diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 1ae5d68a1ec..64069cd72c8 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -880,7 +880,8 @@ kind's share of the pool and never wait for a pool slot: a statement past the sh one that finds no slot free at once, raises `BusyError` before it is sent and the work reads as not done. Every claim caps the slots its caller's statements hold at once (`width`). For the `lead` block the share is an eighth of `LOOM_CH_POOL_MAXSIZE`, at -least one slot, and one call's width half of it, at least one: at the default pool size +least one slot, or 8 when the pool is unbounded (`LOOM_CH_POOL_MAXSIZE=0`), and one +call's width half of it, at least one: at the default pool size (64) 8 slots and 4, so two calls fit; below 16 slots one call takes the whole share. A statement past its caller's width waits for one of that caller's slots. What is left of the lane's deadline caps each statement's bound (the class default or a diff --git a/docs/architecture/code-index-architecture.md b/docs/architecture/code-index-architecture.md index 4f683799989..8fa63b02430 100644 --- a/docs/architecture/code-index-architecture.md +++ b/docs/architecture/code-index-architecture.md @@ -611,8 +611,8 @@ 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.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. A default call's first page also runs `code.callers`, `code.coverage_claim` and `code.symbol_history` in-process for its [`lead`](../features/code-index/operations.md#find) block, in the [best-effort lane](clickhouse.md#statement-classes-deadlines-and-traffic-classes). | +| `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. A default call also runs `code.callers`, `code.coverage_claim` and `code.symbol_history` in-process for its [`lead`](../features/code-index/operations.md#find) block, in the [best-effort lane](clickhouse.md#statement-classes-deadlines-and-traffic-classes). | | `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. | diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index e68c03aa623..5437c350eb1 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -124,10 +124,12 @@ to count the reads a `lead` block makes names `code.symbol` or `code.grep`. The answers share what the latency budget of the call's shape leaves after the time already spent, less a reserve for the rest of the answer, and at most what -`deadline_ms` leaves. The shape is `lead`, 600 ms for `code.symbol` and 1000 ms -for `code.grep`; a `code.symbol` lookup ranked by `near_paths` or `pr_number` -keeps its `ranked` budget (3000 ms) and one that reads the uses brief its -`uses_brief` budget (1500 ms). These budgets are not measured. Raise them with +`deadline_ms` leaves. In `code.grep` that reserve holds the lessons read, which +stops where the budget ends. The shape is `lead`, 600 ms for `code.symbol` and +1000 ms for `code.grep`; a `code.symbol` lookup ranked by `near_paths` or +`pr_number` keeps its `ranked` budget (3000 ms) and one that reads the uses +brief its `uses_brief` budget (1500 ms). These budgets are not measured in +production. Raise them with `LOOM_LATENCY_BUDGET_OVERRIDES` (`{"code.symbol": "2x"}` scales every shape) or `POST /v1/admin/budget.set`. The tracker reads of `changed_by` keep the tracker client's own limits (`LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s), so one can run past diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 9651bb52d17..36d40699d88 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -101,6 +101,7 @@ "fixture", "class", "struct", + "record", "interface", "trait", "enum", diff --git a/server/code/app/result_lessons.py b/server/code/app/result_lessons.py index 655679d0854..7dbe9a40fbc 100644 --- a/server/code/app/result_lessons.py +++ b/server/code/app/result_lessons.py @@ -25,6 +25,7 @@ from server.code.api.models_read import CodeReadInput, CodeReadOutput from server.code.api.models_search import CodeSearchInput, CodeSearchOutput from server.code.app import common, enrich, memory_links +from server.code.app.lead import LEAD_SHAPE from server.code.app.search_legs import resolve_deadline_ms from server.code.app.spans import code_span, span_attrs from server.code.domain import deadline as code_deadline @@ -32,6 +33,8 @@ from server.core.ch import caller_shaped from server.identity.app import request_scope from server.memory.app import code_plane_reads, path_lessons +from server.observability.budget_shape import current_budget_shape +from server.observability.budgets import request_time_left_s from server.settings import settings Handler = Callable[[Any], Awaitable[Any]] @@ -79,7 +82,8 @@ def _searched_namespace(input: Any) -> str: def _bound_s(input: Any, started: float) -> float: """Seconds the read may take: `code_enrich_timeout_s`, and no more than what is left - of the operation's own `deadline_ms`.""" + of the operation's own `deadline_ms`; for a `code.grep` priced by its `lead` block, no + more than what is left of that budget, whose reserve its legs left for this read.""" bound = settings.code_enrich_timeout_s if isinstance(input, CodeSearchInput): budget = code_deadline.start(resolve_deadline_ms(input.deadline_ms), started=started) @@ -89,6 +93,8 @@ def _bound_s(input: Any, started: float) -> float: budget = code_deadline.start(input.deadline_ms, started=started) if budget is not None: bound = min(bound, budget.left_ms() / 1000) + if current_budget_shape() == LEAD_SHAPE: + bound = min(bound, request_time_left_s("code.grep")) return bound diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index eef1f3d39c8..53a25d71c54 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -68,6 +68,9 @@ def test_the_block_covers_the_first_reachable_definition_with_its_id(): "symbol_id": "s1", } assert lead.lead_definition(rows[:3]) is None + # a Java record declaration + record = {"qualified_name": "a.Point", "path": "src/a/Point.java", "kind": "record"} + assert lead.lead_definition([rows[0], record])["symbol"] == "a.Point" def test_a_grep_leads_with_the_definition_its_pattern_names_as_a_whole_identifier(): @@ -1275,6 +1278,44 @@ def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkey assert 0 < seen[0]["cap_s"] <= 5.0 - lead.RESERVE_S +def test_a_default_grep_whose_legs_run_to_the_wall_finishes_inside_its_priced_budget( + monkeypatch, +): + """The lessons read after the handler stops where the `lead` price ends, in the reserve + the legs left it, though alone it may take `code_enrich_timeout_s`.""" + import time + + import server.operations.registry # noqa: F401 the server's boot import + from server.code.app import result_lessons + from server.core import request_work + from server.observability.budget_shape import note_budget_shape + + monkeypatch.setattr(settings, "latency_budget_multiplier", 0.4) # priced at 400 ms + monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.5) + monkeypatch.setattr(settings, "code_result_lessons", True) + + async def unanswered(*a: Any, **k: Any) -> list[str]: + await asyncio.sleep(10) + return [] + + monkeypatch.setattr(result_lessons.code_plane_reads, "lesson_namespaces", unanswered) + + async def handler(input: CodeGrepInput) -> CodeGrepOutput: + note_budget_shape(lead.LEAD_SHAPE) + await asyncio.sleep(lead.wall_s("code.grep", time.monotonic())) # legs to the wall + return CodeGrepOutput(matches=[], chunks_matched=0) + + grep = result_lessons.WithLessons(handler, lambda input, out: ["src/a.py"]) + + async def go() -> float: + bag = request_work.begin() + await grep(CodeGrepInput(org="o", namespace="n", pattern="f(")) + return time.perf_counter() - bag.began + + # read to its own bound, the lessons would end the call at about 0.3 + 0.5 s + assert asyncio.run(go()) < 0.4 + 0.2 + + def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): for kw in ({"lead": False}, {"include_body": False}): out, seen, shape = _grep(monkeypatch, **kw) @@ -1362,7 +1403,11 @@ def _built_inputs(tree: ast.AST) -> list[tuple[int, set[Any]]]: """(line, the fields it names) of every input built for either op: a constructor call, `CodeSymbolInput.model_validate({...})`, a by-name call `("code.symbol", {...})`, and a copy of an input parameter sent to another namespace (`model_copy(update={"namespace": - ...})`, a request of its own; a copy that keeps the namespace continues its caller's).""" + ...})`, a request of its own; a copy that keeps the namespace continues its caller's). + The fields of a dict held in a variable (`model_validate(args)`, `("code.symbol", + args)`, `model_copy(update=changes)`) cannot be read without running the code, so + those forms are not seen; a constructor with `**fields` names no `lead` and is + reported.""" out: list[tuple[int, set[Any]]] = [] def visit(node: ast.AST, inputs: frozenset[str]) -> None: @@ -1406,6 +1451,24 @@ def visit(node: ast.AST, inputs: frozenset[str]) -> None: return out +def test_the_caller_check_reads_each_literal_form_of_an_input(): + source = ( + "CodeSymbolInput(name='f', lead=False)\n" + "CodeGrepInput.model_validate({'pattern': 'f(', 'lead': False})\n" + "CodeSymbolInput.model_validate({'name': 'f'})\n" + "plan = [('code.grep', {'pattern': 'f('})]\n" + "CodeSymbolInput(**fields)\n" + "CodeSymbolInput.model_validate(args)\n" + ) + assert _built_inputs(ast.parse(source)) == [ + (1, {"name", "lead"}), + (2, {"pattern", "lead"}), + (3, {"name"}), + (4, {"pattern"}), + (5, {None}), + ] + + def test_every_caller_inside_loom_says_whether_it_wants_the_block(): """A unit test stubs the legs out (tests/unit/conftest.py), so a caller inside Loom that forgot `lead` would pass and run three legs a call in production: every input it From efd43ea38400dd23e997a44fba79d85c0758da27 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 09:42:22 +0530 Subject: [PATCH 18/30] Lead legs need a 100 ms wall and leave code.grep's lessons their bound No leg starts on a wall under MIN_LEG_WALL_S (0.1 s, about the slowest leg's local p50 and a margin). Under it each leg read `deadline` while the call was priced by its `lead` budget; the call now serves no block, keeps its base price and its lessons keep code_enrich_timeout_s. code.grep's wall, and its cap at deadline_ms, reserve the lessons read's own bound (code_enrich_timeout_s) instead of 100 ms, so the read that runs after the handler keeps that bound however long the legs run. code.symbol keeps RESERVE_S. A leg builds its op's input inside its `try`: a name past the op's bound (300 characters for coverage and history) reads `unresolved` with no degradation note, as a direct call would refuse it. Any other validation error still reads `failed`. definition_leads takes `agent` and `user_id` in place of the op's input. The feature page says a tracker statement can keep running on the tracker's server after the wall, and two long lines are rewrapped. Tests: the floor (no block, base price, the lessons' own bound through the real _grep_lead), a 0.3 s lessons read served after legs that run to the wall, a name over 300 characters, and, through code.symbol with auth on, a restricted tracker namespace the caller may not read and a token pinned to one user. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 9 +- docs/features/code-index/operations.md | 25 +- server/code/app/grep.py | 15 +- server/code/app/lead.py | 56 +++-- server/code/app/symbol/symbol.py | 9 +- tests/unit/test_code_lead.py | 328 +++++++++++++++++++++---- 6 files changed, 357 insertions(+), 85 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 64069cd72c8..5fc61bc6ba5 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -892,10 +892,11 @@ fills awaited inline of three caches that would keep a refused read as every req answer: the schema guard's ledger read and the code index's override-edge and constructor-edge probes (`shared_work()`). The tracker-link snapshot and the tracker source registry refresh outside the lane too: a refused refresh keeps nothing, but it -would log a warning each time and leave its call on the previous snapshot. A cache that keeps only reads that answered, -such as the code index's coverage positive control, fills inside the lane. The history -policy gate a `lead` leg passes runs before the leg enters the lane, so its statements -hold ordinary pool slots and are never refused as best-effort work. +would log a warning each time and leave its call on the previous snapshot. A cache that +keeps only reads that answered, such as the code index's coverage positive control, +fills inside the lane. The history policy gate a `lead` leg passes runs before the leg +enters the lane, so its statements hold ordinary pool slots and are never refused as +best-effort work. Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` (`production`, `interactive`, `bench`, `background`): `priority`, `max_threads`, and for diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 5437c350eb1..07b83890443 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -124,16 +124,16 @@ to count the reads a `lead` block makes names `code.symbol` or `code.grep`. The answers share what the latency budget of the call's shape leaves after the time already spent, less a reserve for the rest of the answer, and at most what -`deadline_ms` leaves. In `code.grep` that reserve holds the lessons read, which -stops where the budget ends. The shape is `lead`, 600 ms for `code.symbol` and -1000 ms for `code.grep`; a `code.symbol` lookup ranked by `near_paths` or -`pr_number` keeps its `ranked` budget (3000 ms) and one that reads the uses -brief its `uses_brief` budget (1500 ms). These budgets are not measured in -production. Raise them with +`deadline_ms` leaves. In `code.grep` the reserve is the lessons read's own bound +(`LOOM_CODE_ENRICH_TIMEOUT_S`, 0.5 s), so the lessons keep it however long the +answers run. The shape is `lead`, 600 ms for `code.symbol` and 1000 ms for +`code.grep`; a `code.symbol` lookup ranked by `near_paths` or `pr_number` keeps +its `ranked` budget (3000 ms) and one that reads the uses brief its `uses_brief` +budget (1500 ms). These budgets are not measured in production. Raise them with `LOOM_LATENCY_BUDGET_OVERRIDES` (`{"code.symbol": "2x"}` scales every shape) or -`POST /v1/admin/budget.set`. The tracker reads of `changed_by` keep the tracker -client's own limits (`LOOM_TRACKER_LIVE_TIMEOUT_S`, 1.5 s), so one can run past -the budget. The answers' ClickHouse statements hold a bounded share of the pool +`POST /v1/admin/budget.set`. A tracker statement of `changed_by` can keep +running on the tracker's server after the wall; the answer does not wait for it. +The answers' ClickHouse statements hold a bounded share of the pool (`LOOM_CH_POOL_MAXSIZE`) and never wait for a pool slot: [statement classes](../../architecture/clickhouse.md#statement-classes-deadlines-and-traffic-classes) gives the share, each call's width and the work that runs outside it. An answer @@ -148,9 +148,10 @@ served: - `unresolved`: the op did not resolve the definition. The uses brief and the definitions are fitted to `token_budget` first; a block -that does not fit what they leave is withheld whole. When no answer can start in time the block is -left out. `lead: false` leaves the block out. `code.edit_context` has no `lead` -block; it reads the definition's tests itself. +that does not fit what they leave is withheld whole. When less than 0.1 s is left +for the answers, none starts and the block is left out, so the call keeps its +base budget. `lead: false` leaves the block out. `code.edit_context` has no +`lead` block; it reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For example, `["parse(", "parse_async("]` matches both fragments without escaping diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 6841e04b95b..355c3c20d04 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -734,7 +734,8 @@ async def _grep_lead( ) -> list[dict[str, Any]]: """The `lead` block (`server.code.app.lead`) of a first page's enclosing definitions, read once the page's other reads are done, within what the op's `lead` budget and the - caller's `deadline_ms` leave less the reserve for the lessons read after the handler. + caller's `deadline_ms` leave less the lessons read's bound, which runs after the + handler. A definition the pattern names leads before one that only holds a match. [] on a continuation page (`offset`), a related answer (`related_pattern`), a page without bodies, `lead: false`, or when no leg started.""" @@ -746,10 +747,18 @@ async def _grep_lead( patterns = [input.pattern] if isinstance(input.pattern, str) else input.pattern rows = code_lead.named_first(definitions, patterns) - cap_s = budget.left_ms() / 1000.0 - code_lead.RESERVE_S if budget is not None else math.inf + reserve = code_lead.reserve_s("code.grep") + cap_s = budget.left_ms() / 1000.0 - reserve if budget is not None else math.inf with code_span("grep.lead", results=len(definitions)): lead = await code_lead.definition_leads( - "code.grep", org, ns, input, rows, started=started, cap_s=cap_s + "code.grep", + org, + ns, + rows, + agent=input.agent, + user_id=input.user_id, + started=started, + cap_s=cap_s, ) if lead: note_budget_shape(code_lead.LEAD_SHAPE) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 36d40699d88..95977f1c63c 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -25,11 +25,13 @@ - The legs share one wall: what the op's latency budget for the call's shape leaves after the time already spent, less a reserve for the rest of the answer (the `lead` shape, or for a code.symbol lookup ranked by the change at hand or with the uses brief, - that shape, whose budget covers its legs). Each statement is + that shape, whose budget covers its legs). code.grep reserves its lessons read's own + bound. No leg starts on a wall under `MIN_LEG_WALL_S`. Each statement is bounded on the server and in the client by what is left of the wall and a margin, so a leg cancelled at the wall does not keep ClickHouse working; a cancelled leg reads `unread: deadline`, one that raised `unread: failed`. The history leg's tracker reads - go through the tracker source's own client and keep its limits. + go through the tracker source's own client: one can keep running on the tracker's + server after the wall, and the answer does not wait for it. - The policy gate runs before its leg enters the lane: its statements hold ordinary slots and are not counted in the lane, since an authorization step is never refused for best-effort work. It runs to its end when the wall cancels its leg, since it may flush @@ -57,8 +59,8 @@ from contextlib import contextmanager from typing import Any -from server.code.api.models_grep import CodeGrepInput -from server.code.api.models_symbol import CodeSymbolInput +from pydantic import ValidationError + from server.code.app.spans import code_span, start_stage_wall from server.code.app.symbol.neighbours import is_doc_path from server.code.domain.index.symbol_history import PR_WINDOW @@ -83,10 +85,14 @@ # Callers one hop reads before it says `truncated` (code.callers' `max_nodes`). _CALLER_NODES = 50 _TITLE_CHARS = 80 -# Left of the budget for the answer after the wall: the trims, serialization and, for -# code.grep, the lessons read that runs after the handler. +# Left of the budget for the answer after the wall: the trims and serialization. code.grep +# leaves `code_enrich_timeout_s` instead (`reserve_s`), the bound of its lessons read. # not a setting: part of the wall each `lead` budget is declared for; raise the budget RESERVE_S = 0.1 +# The least wall the legs start on: under it they would read `deadline` and still price +# the call by its `lead` budget. About the slowest leg's local p50 (50 ms) and a margin. +# not a setting: a floor under which a leg cannot answer, not a tuning knob +MIN_LEG_WALL_S = 0.1 # A leg's statements run at most this long past the wall on the server; the leg is # cancelled at the wall, so the margin only keeps the server's bound from firing first. # not a setting: the wall's cancel bounds the leg; this only backs it on the server @@ -113,8 +119,6 @@ # than the index's answer about the name (`ambiguous`, `unresolved`). _DEGRADED = frozenset({"deadline", "failed", "busy", "policy"}) -Identity = CodeSymbolInput | CodeGrepInput - def lead_slots() -> int: """Pool slots the lead's statements hold at once, process-wide: an eighth of the @@ -167,15 +171,22 @@ def named(r: dict[str, Any]) -> bool: return sorted(rows, key=lambda r: not named(r)) +def reserve_s(op_name: str) -> float: + """What the wall leaves of `op_name`'s budget for the answer after it: code.grep's + lessons read runs after its handler, so the legs leave it its whole bound, as on a call + without them.""" + return settings.code_enrich_timeout_s if op_name == "code.grep" else RESERVE_S + + def wall_s(op_name: str, started: float, shape: str = LEAD_SHAPE) -> float: """Seconds the legs may run: the op's effective budget for `shape`, the one the call is priced by (runtime and per-consumer overrides and the deployment multiplier applied), - less the time the request has spent and the reserve. `started` is the handler's + less the time the request has spent and `reserve_s`. `started` is the handler's monotonic start, the clock when no transport bound the request.""" declared = OP_SHAPE_BUDGETS_P99_MS[op_name][shape] budget_s = effective_budget_ms(op_name, declared) / 1000.0 spent = max(request_work.age_s(), time.monotonic() - started) - return max(0.0, budget_s - spent - RESERVE_S) + return max(0.0, budget_s - spent - reserve_s(op_name)) def callers_entry(out: Any) -> dict[str, Any]: @@ -344,7 +355,13 @@ async def _leg( op, fields, compact = LEGS[name] model, handler = _ops()[op] - query = model(**base, **fields(d)) + try: + query = model(**base, **fields(d)) + except ValidationError as e: + if all(err["type"] == "string_too_long" for err in e.errors()): + # a name past the op's own bound, which the op refuses too: a known limit + return {"unread": "unresolved"} + raise claim = ch.BestEffortClaim(_slots(), deadline=deadline, width=width) with code_span(f"lead.{name}"): # the leg's spans report into a wall of its own, so the op's stage table holds the @@ -436,27 +453,28 @@ async def definition_leads( op_name: str, org: str, ns: str, - identity: Identity, rows: list[dict[str, Any]], *, + agent: str, + user_id: str, started: float, cap_s: float = math.inf, shape: str = LEAD_SHAPE, ) -> list[dict[str, Any]]: """The block for `rows`: one entry, for their `lead_definition`, with each leg's - answer; [] when no leg starts. `identity` is the op's input, whose `agent` and - `user_id` the legs carry; `cap_s` is a caller's own deadline; `shape` is the budget - shape the call is priced by. Never raises but on cancellation, which cancels every - leg.""" + answer; [] when no leg starts, as on a wall under `MIN_LEG_WALL_S`, so the call keeps + its base price. The legs carry the op's `agent` and `user_id`; `cap_s` is a caller's + own deadline less `reserve_s`; `shape` is the budget shape the call is priced by. + Never raises but on cancellation, which cancels every leg.""" picked = lead_definition(rows) wall = min(wall_s(op_name, started, shape), cap_s) - if picked is None or wall <= 0: + if picked is None or wall < MIN_LEG_WALL_S: return [] base = { "org": org, "namespace": ns, - "agent": identity.agent, - "user_id": identity.user_id, + "agent": agent, + "user_id": user_id, "consumer": f"{op_name.removeprefix('code.')}_lead", } tasks: dict[str, asyncio.Future[dict[str, Any]]] = {} diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index c6ddf521c4a..d089bcd0219 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -218,7 +218,14 @@ def __init__( _staged( "symbol.lead", code_lead.definition_leads( - "code.symbol", org, ns, input, head, started=started, shape=self.shape + "code.symbol", + org, + ns, + head, + agent=input.agent, + user_id=input.user_id, + started=started, + shape=self.shape, ), ) ) diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 53a25d71c54..81b9112b7a0 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -223,11 +223,7 @@ def test_history_drops_prs_whose_diff_does_not_name_the_definition(): # ------------------------------------------------------------------ the legs -class _Identity: - agent = "a" - user_id = "-" - - +_WHO = {"agent": "a", "user_id": "-"} _ROWS = [ {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "symbol_id": "s1"}, ] @@ -273,9 +269,8 @@ def _run_leads(monkeypatch, ops: _Ops, *, wall: float = 5.0, **kw: Any) -> tuple async def go() -> tuple[list[dict[str, Any]], list[str]]: degradations.begin() - out = await lead.definition_leads( - kw.pop("op_name", "code.symbol"), "o", "n", _Identity(), _ROWS, started=0, **kw - ) + op_name, rows = kw.pop("op_name", "code.symbol"), kw.pop("rows", _ROWS) + out = await lead.definition_leads(op_name, "o", "n", rows, started=0, **_WHO, **kw) return out, degradations.current() return asyncio.run(go()) @@ -360,7 +355,7 @@ async def coverage(query: Any) -> CodeCoverageClaimOutput: async def go() -> dict[str, int]: start_stage_wall() - await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + await lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) return current_stage_ms() stages = asyncio.run(go()) @@ -438,10 +433,23 @@ def record(query: Any) -> Any: assert "read_overflow_mode" not in seen["settings"] -def test_no_time_left_starts_no_leg_and_serves_no_block(monkeypatch): +def test_no_time_left_or_a_wall_under_the_floor_starts_no_leg_and_serves_no_block(monkeypatch): + for wall in (0.0, lead.MIN_LEG_WALL_S - 0.01): + ops = _Ops() + out, notes = _run_leads(monkeypatch, ops, wall=wall, op_name="code.grep") + assert ops.queries == {} and out == [] and notes == [], wall + + +def test_a_name_past_a_legs_bound_reads_unresolved_and_notes_no_degradation(monkeypatch): + """code.coverage_claim and code.symbol_history take names of up to 300 characters, as a + direct call would; code.callers takes any.""" + named = [{"qualified_name": "A::" + "f" * 300, "path": "src/a.cpp", "start_line": 3}] ops = _Ops() - out, notes = _run_leads(monkeypatch, ops, wall=0.0, op_name="code.grep") - assert ops.queries == {} and out == [] and notes == [] + out, notes = _run_leads(monkeypatch, ops, rows=named) + (entry,) = out + assert entry["tested"] == entry["changed_by"] == {"unread": "unresolved"} + assert list(ops.queries) == ["code.callers"] and "unread" not in entry["callers"] + assert notes == [] and lead.unread_of(out) == "tested:unresolved,changed_by:unresolved" def test_the_policy_gate_runs_outside_the_lane_and_to_its_end(monkeypatch): @@ -461,7 +469,7 @@ async def gate(op, identity, raw_args, *, request_id=""): monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 0.1) async def go() -> list[dict[str, Any]]: - out = await lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + out = await lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) await asyncio.sleep(0.4) return out @@ -510,7 +518,7 @@ def test_a_cancelled_block_retrieves_a_leg_that_raised(monkeypatch): async def go() -> None: asyncio.get_running_loop().set_exception_handler(lambda loop, ctx: lost.append(ctx)) task = asyncio.ensure_future( - lead.definition_leads("code.symbol", "o", "n", _Identity(), _ROWS, started=0) + lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) ) await asyncio.sleep(0.05) task.cancel() @@ -530,12 +538,14 @@ def test_a_caller_deadline_caps_the_wall(monkeypatch): assert out[0]["changed_by"] == {"unread": "deadline"} -def test_the_wall_is_the_lead_budget_less_the_time_spent(monkeypatch): +def test_the_wall_is_the_lead_budget_less_the_time_spent_and_the_reserve(monkeypatch): + """code.grep reserves its lessons read's bound, which runs after its handler.""" monkeypatch.setattr(lead.time, "monotonic", lambda: 100.2) monkeypatch.setattr(lead.request_work, "age_s", lambda: 0.0) monkeypatch.setattr(lead, "effective_budget_ms", lambda op, declared: declared) + monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.4) assert lead.wall_s("code.symbol", 100.0) == pytest.approx(0.6 - 0.2 - 0.1) - assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.0 - 0.2 - 0.1) + assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.0 - 0.2 - 0.4) assert lead.wall_s("code.symbol", 99.0) == 0.0 @@ -698,12 +708,22 @@ def _intel_on(monkeypatch): def _recorder(seen: list[dict[str, Any]]) -> Any: async def leads( - op_name, org, ns, identity, rows, *, started, cap_s=math.inf, shape=lead.LEAD_SHAPE + op_name, + org, + ns, + rows, + *, + agent, + user_id, + started, + cap_s=math.inf, + shape=lead.LEAD_SHAPE, ): seen.append( { "op": op_name, "rows": [r["qualified_name"] for r in rows], + "who": (agent, user_id), "cap_s": cap_s, "shape": shape, } @@ -750,6 +770,7 @@ def _symbol( edit: bool = False, repo: Any = None, traces: list[dict[str, Any]] | None = None, + real_leads: bool = False, **fields: Any, ) -> tuple[Any, list[Any], str]: from server.code.api.models_symbol import CodeEditContextInput, CodeSymbolInput @@ -762,7 +783,8 @@ def _symbol( async def body(r, org, ns, sym): return f"" - monkeypatch.setattr(lead, "definition_leads", _recorder(seen)) + if not real_leads: + monkeypatch.setattr(lead, "definition_leads", _recorder(seen)) async def go() -> tuple[Any, str]: with ( @@ -796,8 +818,10 @@ async def go() -> tuple[Any, str]: @pytest.mark.usefixtures("_intel_on") def test_code_symbol_leads_by_default_and_prices_the_lead_shape(monkeypatch): - out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar") - assert [(s["op"], s["rows"]) for s in seen] == [("code.symbol", ["DB::Foo::bar"])] + out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", agent="ag", user_id="u") + assert [(s["op"], s["rows"], s["who"]) for s in seen] == [ + ("code.symbol", ["DB::Foo::bar"], ("ag", "u")) + ] dump = out.model_dump() assert list(dump)[0] == "lead" assert dump["lead"] == [_LED] @@ -994,7 +1018,7 @@ def _unread_of_calls(n: int, *, keep: bool = False) -> list[Any]: """`n` code.symbol blocks for `_DEF` at once, each one's `unread_of` (or, with `keep`, each block).""" one = functools.partial( - lead.definition_leads, "code.symbol", "o", "n", _Identity(), [_DEF], started=0 + lead.definition_leads, "code.symbol", "o", "n", [_DEF], started=0, **_WHO ) async def go() -> list[list[dict[str, Any]]]: @@ -1208,6 +1232,164 @@ async def limited(sql: str, parameters: Any = None, settings: Any = None, **k: A assert leg[0]["tested"]["strongest_tier"] == claim.strongest_tier +# ------------------------------------------------------------------ as the caller + +_PRS = [ + { + "pr_number": n, + "title": f"Change {n}", + "author": "dev", + "merged_at": f"2026-11-{n}T00:00:00", + "files": [_DEF["path"]], + "body_excerpt": "", + "linked_issues": [], + "is_revert": False, + } + for n in (12, 11) +] + + +@pytest.mark.parametrize("reads_tracker", [False, True]) +def test_through_code_symbol_the_history_leg_reads_a_restricted_tracker_only_as_its_reader( + monkeypatch, real_client, reads_tracker +): + """Auth on: the legs run as the caller, so the history leg passes the restricted + tracker's own gate on the tracker namespace. A caller who may not read it gets no + tracker read and nothing of its answer: the PRs at file level, none marked as + naming the definition.""" + import json + + from server.auth import authz + from server.auth.context import set_current_auth + from server.auth.jwt import AuthInfo + from server.operations.base import Role + from server.tracker.app import binding + from server.tracker.app import source as tracker_app_source + from tests.unit._tracker_config import tracker_credentials_json, tracker_sources_json + + real_client(lambda sql: _PRS if "FROM loom.code_pr_history" in sql else _resolved_only(sql)) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) + repo = "ClickHouse/example-private" + monkeypatch.setattr(settings, "tracker_code_namespace_bindings_json", '{"n": "tracker-priv"}') + monkeypatch.setattr( + settings, "code_repos_json", json.dumps([{"org": "o", "namespace": "n", "repo": repo}]) + ) + monkeypatch.setattr(settings, "tracker_org", "o") + monkeypatch.setattr( + settings, + "tracker_sources_json", + tracker_sources_json({repo: "tracker-priv"}, restricted="tracker-priv"), + ) + monkeypatch.setattr(settings, "tracker_credentials_json", tracker_credentials_json()) + asked: list[tuple[str, str]] = [] + + async def check_authorized(auth, required_role=Role.VIEWER, *, org, namespace, **_k): + asked.append((auth.subject, namespace)) + if namespace not in auth.namespaces: + raise PermissionError("not granted") + + monkeypatch.setattr(authz, "check_authorized", check_authorized) + read: list[str] = [] + + class _Tracker: + cfg = None + + async def prs_facts(self, org, ns, numbers, names=()): + read.append(ns) + return {11: {"matched_symbols": [_DEF["qualified_name"]]}} + + async def open_issues_naming(self, org, ns, frames, limit=5): + return [] + + monkeypatch.setattr(tracker_app_source, "tracker_source", lambda org, ns: _Tracker()) + names = ("n", "tracker-priv") if reads_tracker else ("n",) + set_current_auth( + AuthInfo( + subject="alice@x", + org="o", + namespaces=names, + roles=(Role.VIEWER,), + is_service_account=False, + ) + ) + try: + out, _seen, _shape = _symbol(monkeypatch, real_leads=True, name="DB::Foo::bar") + finally: + set_current_auth(None) + changed = out.lead[0]["changed_by"] + assert ("alice@x", "tracker-priv") in asked + if reads_tracker: + assert read == ["tracker-priv"] and changed["level"] == "function" + assert [(p["pr_number"], p.get("touches_symbol")) for p in changed["top"]] == [ + (11, "true"), + (12, None), + ] + else: + assert read == [] and changed["level"] == "file" + assert [(p["pr_number"], p.get("touches_symbol")) for p in changed["top"]] == [ + (12, None), + (11, None), + ] + + +def test_through_code_symbol_a_narrowed_token_gets_from_no_leg_what_its_op_refuses( + monkeypatch, real_client +): + """Auth on, a token pinned to one user: each leg sends a query its op's transport + admits for that token at code.symbol's role, as that user, and no leg reads a memory + (code.callers leaves its lessons out for this token).""" + import contextvars + + from server.auth.context import set_current_auth + from server.auth.jwt import AuthInfo + from server.operations.base import Role + from server.operations.registry import OPERATIONS_BY_NAME + from server.transport import gates + + driver = real_client(_resolved_only) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + handlers = lead._ops() + sent: dict[str, Any] = {} + + def recorded(op: str, handler: Any) -> Any: + async def run(query: Any) -> Any: + sent[op] = query + return await handler(query) + + return run + + monkeypatch.setattr( + lead, "_ops", lambda: {op: (m, recorded(op, h)) for op, (m, h) in handlers.items()} + ) + auth = AuthInfo( + subject="alice@x", + org="o", + namespaces=("n",), + roles=(Role.VIEWER,), + is_service_account=False, + read_scope="own_user", + read_user_id="u1", + ) + set_current_auth(auth) + try: + out, _seen, _shape = _symbol( + monkeypatch, real_leads=True, name="DB::Foo::bar", user_id="u1" + ) + finally: + set_current_auth(None) + assert set(sent) == {op for op, _fields, _compact in lead.LEGS.values()} + role = OPERATIONS_BY_NAME["code.symbol"].required_role + for op, query in sent.items(): + assert OPERATIONS_BY_NAME[op].required_role == role, op + admitted = contextvars.copy_context().run( + gates.read_scope, OPERATIONS_BY_NAME[op], auth, query + ) + assert query.user_id == admitted.user_id == "u1", op + assert all("unread" not in out.lead[0][leg] for leg in lead.LEGS) + assert not any("loom.memor" in sql for sql, _in_lane in driver.seen) + + def _grep(monkeypatch, **fields: Any) -> tuple[Any, list[dict[str, Any]], str]: """code.grep through its handler over the scan fixture, with two enclosing bodies of the match: the first one holds it, the second one is the definition it names.""" @@ -1265,8 +1447,10 @@ async def go() -> tuple[Any, str]: def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): - out, seen, shape = _grep(monkeypatch) - assert [(s["op"], s["rows"]) for s in seen] == [("code.grep", ["B::parseInput", "B::h"])] + out, seen, shape = _grep(monkeypatch, agent="ag", user_id="u") + assert [(s["op"], s["rows"], s["who"]) for s in seen] == [ + ("code.grep", ["B::parseInput", "B::h"], ("ag", "u")) + ] assert seen[0]["cap_s"] == math.inf dump = out.model_dump() assert list(dump)[0] == "lead" and dump["lead"][0]["symbol"] == "B::parseInput" @@ -1275,45 +1459,97 @@ def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkeypatch): out, seen, _ = _grep(monkeypatch, deadline_ms=5000, neighbours=True) - assert 0 < seen[0]["cap_s"] <= 5.0 - lead.RESERVE_S + assert 0 < seen[0]["cap_s"] <= 5.0 - lead.reserve_s("code.grep") < 5.0 - lead.RESERVE_S -def test_a_default_grep_whose_legs_run_to_the_wall_finishes_inside_its_priced_budget( - monkeypatch, -): - """The lessons read after the handler stops where the `lead` price ends, in the reserve - the legs left it, though alone it may take `code_enrich_timeout_s`.""" +_GREP_DEF = { + "symbol": "parseInput", + "qualified_name": "B::parseInput", + "symbol_id": "B::parseInput", + "kind": "function", + "path": "src/B.cpp", + "start_line": 1, +} +_HANG = {op: "hang" for op in ("code.callers", "code.coverage_claim", "code.symbol_history")} + + +def _grep_then_lessons( + monkeypatch, ops: _Ops, *, multiplier: float, lessons_s: float, after_legs_s: float = 0.0 +) -> tuple[Any, str, float]: + """A default code.grep whose handler runs `_grep_lead` over the legs of `ops`, then + `after_legs_s` of other work, and whose lessons read answers one lesson after + `lessons_s`: (the answer, the shape it is priced by, its seconds).""" import time - import server.operations.registry # noqa: F401 the server's boot import - from server.code.app import result_lessons + import server.operations.registry # noqa: F401 the server's boot import, not timed + from server.code.app import grep, result_lessons from server.core import request_work - from server.observability.budget_shape import note_budget_shape + from server.observability.budget_shape import current_budget_shape - monkeypatch.setattr(settings, "latency_budget_multiplier", 0.4) # priced at 400 ms + monkeypatch.setattr(settings, "latency_budget_multiplier", multiplier) + monkeypatch.setattr(settings, "latency_budget_overrides", "") monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.5) monkeypatch.setattr(settings, "code_result_lessons", True) + monkeypatch.setattr(lead, "_ops", ops) - async def unanswered(*a: Any, **k: Any) -> list[str]: - await asyncio.sleep(10) - return [] + async def namespaces(*a: Any, **k: Any) -> list[str]: + await asyncio.sleep(lessons_s) + return ["n"] + + async def lessons(*a: Any, **k: Any) -> Any: + return result_lessons.path_lessons.Lessons([{"memory_id": "m1"}]) - monkeypatch.setattr(result_lessons.code_plane_reads, "lesson_namespaces", unanswered) + monkeypatch.setattr(result_lessons.code_plane_reads, "lesson_namespaces", namespaces) + monkeypatch.setattr(result_lessons.path_lessons, "lessons_for_paths", lessons) async def handler(input: CodeGrepInput) -> CodeGrepOutput: - note_budget_shape(lead.LEAD_SHAPE) - await asyncio.sleep(lead.wall_s("code.grep", time.monotonic())) # legs to the wall - return CodeGrepOutput(matches=[], chunks_matched=0) + block = await grep._grep_lead( + "o", "n", input, {"definitions": [_GREP_DEF]}, time.monotonic(), None, 0, "" + ) + await asyncio.sleep(after_legs_s) + return CodeGrepOutput(matches=[], chunks_matched=0, lead=block) - grep = result_lessons.WithLessons(handler, lambda input, out: ["src/a.py"]) + wrapped = result_lessons.WithLessons(handler, lambda input, out: ["src/a.py"]) - async def go() -> float: + async def go() -> tuple[Any, str, float]: bag = request_work.begin() - await grep(CodeGrepInput(org="o", namespace="n", pattern="f(")) - return time.perf_counter() - bag.began + out = await wrapped(CodeGrepInput(org="o", namespace="n", pattern="parseInput(")) + return out, current_budget_shape(), time.perf_counter() - bag.began + + return asyncio.run(go()) + + +def test_a_grep_wall_under_the_floor_keeps_the_base_price_and_the_lessons_bound(monkeypatch): + """Priced by `lead` (200 ms here), the lessons read would have what is left of 200 ms and + its 0.3 s answer would be cut; at the base price it keeps `code_enrich_timeout_s`.""" + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: lead.MIN_LEG_WALL_S - 0.01) + ops = _Ops() + out, shape, _took = _grep_then_lessons(monkeypatch, ops, multiplier=0.2, lessons_s=0.3) + assert ops.queries == {} and out.lead == [] and shape == "" + assert out.lessons == [{"memory_id": "m1"}] + - # read to its own bound, the lessons would end the call at about 0.3 + 0.5 s - assert asyncio.run(go()) < 0.4 + 0.2 +def test_a_grep_whose_legs_run_to_the_wall_still_serves_a_lessons_read_of_0_3_s(monkeypatch): + """The legs leave code.grep's lessons read its whole bound, as on a call without them: + a 100 ms reserve would leave it about 0.1 s.""" + out, shape, _took = _grep_then_lessons( + monkeypatch, _Ops(**_HANG), multiplier=0.8, lessons_s=0.3 + ) + assert shape == lead.LEAD_SHAPE + assert {out.lead[0][leg]["unread"] for leg in lead.LEGS} == {"deadline"} + assert out.lessons == [{"memory_id": "m1"}] + + +def test_a_default_grep_whose_legs_run_to_the_wall_finishes_inside_its_priced_budget( + monkeypatch, +): + """Work after the legs takes part of the lessons read's reserve: the read stops where + the `lead` price (800 ms here) ends, though alone it may take `code_enrich_timeout_s`.""" + out, _shape, took = _grep_then_lessons( + monkeypatch, _Ops(**_HANG), multiplier=0.8, lessons_s=10.0, after_legs_s=0.3 + ) + # read to its own bound, the lessons would end the call at about 0.3 + 0.3 + 0.5 s + assert out.lessons == [] and took < 0.8 + 0.15 def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): From 60408d509802f985f2a1d91bdbb421d7bd553d70 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 10:23:26 +0530 Subject: [PATCH 19/30] A lookup whose lead legs did not run is priced as without the block code.symbol prices a lookup whose legs did not run (`lead: false`, which the plugins send, a wall under the floor, or a definition `min_fan_in` filters out) as the op does without the block: `ranked` by the change at hand, `uses_brief` only when the brief is served, the base budget otherwise. A `lead: false` lookup whose brief `token_budget` withheld was priced at `uses_brief`. When `min_fan_in` filters out the block's definition, the legs are cancelled once the filter has run, so the call no longer waits for a block `code_lead.fit` would withhold, nor is priced by it. The feature page and the `lead` budgets' catalog comment point only to a multiplier in `latency_budget_overrides`: `admin/budget.set` sets one fixed budget for every shape of an op. code_enrich_timeout_s's comment says code.grep holds it back from its `lead` budget, so a value near that serves no block; the settings reference, schema and example are regenerated. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 22 ++++++------ docs/reference/configuration.md | 2 +- loom.example.yaml | 4 ++- schemas/loom-settings.schema.json | 2 +- server/code/app/symbol/symbol.py | 22 +++++++++++- server/settings/catalog.py | 7 ++-- tests/unit/test_code_lead.py | 46 +++++++++++++++++++++++--- 7 files changed, 83 insertions(+), 22 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 07b83890443..784a1c53ee2 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -125,14 +125,16 @@ to count the reads a `lead` block makes names `code.symbol` or `code.grep`. The answers share what the latency budget of the call's shape leaves after the time already spent, less a reserve for the rest of the answer, and at most what `deadline_ms` leaves. In `code.grep` the reserve is the lessons read's own bound -(`LOOM_CODE_ENRICH_TIMEOUT_S`, 0.5 s), so the lessons keep it however long the -answers run. The shape is `lead`, 600 ms for `code.symbol` and 1000 ms for -`code.grep`; a `code.symbol` lookup ranked by `near_paths` or `pr_number` keeps -its `ranked` budget (3000 ms) and one that reads the uses brief its `uses_brief` -budget (1500 ms). These budgets are not measured in production. Raise them with -`LOOM_LATENCY_BUDGET_OVERRIDES` (`{"code.symbol": "2x"}` scales every shape) or -`POST /v1/admin/budget.set`. A tracker statement of `changed_by` can keep -running on the tracker's server after the wall; the answer does not wait for it. +(`LOOM_CODE_ENRICH_TIMEOUT_S`, 0.5 s): the answers leave it its whole bound; it +still ends where the `lead` budget does. A value near that budget leaves the +answers no time, and `code.grep` serves no block. The shape is `lead`, 600 ms for +`code.symbol` and 1000 ms for `code.grep`; a `code.symbol` lookup ranked by +`near_paths` or `pr_number` keeps its `ranked` budget (3000 ms) and one that +reads the uses brief its `uses_brief` budget (1500 ms). These budgets are not +measured in production. Raise them with a multiplier in +`LOOM_LATENCY_BUDGET_OVERRIDES`: `{"code.symbol": "2x"}` scales every shape. A +tracker statement of `changed_by` can keep running on the tracker's server after +the wall; the answer does not wait for it. The answers' ClickHouse statements hold a bounded share of the pool (`LOOM_CH_POOL_MAXSIZE`) and never wait for a pool slot: [statement classes](../../architecture/clickhouse.md#statement-classes-deadlines-and-traffic-classes) @@ -149,8 +151,8 @@ served: The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When less than 0.1 s is left -for the answers, none starts and the block is left out, so the call keeps its -base budget. `lead: false` leaves the block out. `code.edit_context` has no +for the answers, none starts and the block is left out, so the call keeps the +budget it has without the block. `lead: false` leaves the block out. `code.edit_context` has no `lead` block; it reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 06e23a82f4e..aca665f6926 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -776,7 +776,7 @@ The code index's network git (clone, fetch, ls-remote, submodule update) through | `LOOM_CODE_CITATIONS_GIT_CALL_TIMEOUT_S` | `float` | `3.0` | live | Seconds one git call of code.verify_citations may run, within its request budget. | | `LOOM_CODE_CONVENTIONS_DIFF_TIMEOUT_S` | `float` | `25.0` | live | Seconds the git diff behind code.conventions may run. | | `LOOM_CODE_EGRESS_CONNECT_TIMEOUT_S` | `float` | `15.0` | live | Seconds a repository job's egress tunnel waits to connect to its upstream host. | -| `LOOM_CODE_ENRICH_TIMEOUT_S` | `float` | `0.5` | live | Seconds one enrichment of a code result may take before it is left empty. | +| `LOOM_CODE_ENRICH_TIMEOUT_S` | `float` | `0.5` | live | Seconds one enrichment of a code result may take before it is left empty. code.grep holds it back from its `lead` budget (1 s), so a value near that serves no `lead` block. | | `LOOM_CODE_ENRICH_EXAMPLE_CANDIDATE_LIMIT` | `int` | `50` | | Incoming call sites read before ranking usage examples. The coverage lookup accepts up to 50 paths. | | `LOOM_CODE_ENRICH_INDIRECT_TEST_CALLER_LIMIT` | `int` | `30` | | Indirect test callers ranked as backups. The edge query reads up to twice this many call sites, within its 60-site work limit. | | `LOOM_CODE_ENTRY_LOCK_WAIT_S` | `float` | `14400.0` | live | A full pass waits this long for a delta on its entry (past any delta's harness timeout). | diff --git a/loom.example.yaml b/loom.example.yaml index 5452a075b11..d454ca6adb1 100644 --- a/loom.example.yaml +++ b/loom.example.yaml @@ -2441,7 +2441,9 @@ settings: # [live] # code_egress_connect_timeout_s: 15.0 - # Seconds one enrichment of a code result may take before it is left empty. [live] + # Seconds one enrichment of a code result may take before it is left empty. code.grep + # holds it back from its `lead` budget (1 s), so a value near that serves no `lead` + # block. [live] # code_enrich_timeout_s: 0.5 # Incoming call sites read before ranking usage examples. The coverage lookup accepts diff --git a/schemas/loom-settings.schema.json b/schemas/loom-settings.schema.json index f8536fdc5d3..1108efd47a1 100644 --- a/schemas/loom-settings.schema.json +++ b/schemas/loom-settings.schema.json @@ -1152,7 +1152,7 @@ "default": 0.5, "exclusiveMinimum": 0, "type": "number", - "description": "Seconds one enrichment of a code result may take before it is left empty." + "description": "Seconds one enrichment of a code result may take before it is left empty. code.grep holds it back from its `lead` budget (1 s), so a value near that serves no `lead` block." }, "code_entry_lock_wait_s": { "default": 14400.0, diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index d089bcd0219..8c5787a07f1 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -255,6 +255,15 @@ def __init__( _staged("symbol.hierarchy", _symbol_hierarchy(repo, org, ns, rows)) ) + def drop_lead_unless_served(self, head: list[dict[str, Any]], units: list[CodeUnit]) -> None: + """Cancel the lead legs when `units` (after `min_fan_in`) leave out the definition + they read: `code_lead.fit` would withhold the block, so the call neither waits for + the legs nor is priced by them.""" + picked = code_lead.lead_definition(head) + if self.lead is not None and not (picked and code_lead.served([picked], units)): + self.lead.cancel() + self.lead = None + def cancel(self) -> None: for t in ( self.hashes, @@ -1033,6 +1042,7 @@ async def handle_code_symbol( if legs.brief is not None: brief, brief_stats = await legs.brief units = await _rank_by_fan_in(repo, org, ns, units, input, brief_stats) + legs.drop_lead_unless_served(head, units) _apply_enrichment(units, await legs.enrich) # PRs, examples, lessons # the documents that cite the definition, beside it documented_in = await legs.documented_in @@ -1091,7 +1101,7 @@ async def handle_code_symbol( ) if matched_members: route = "edit_context_members" - shape = legs.shape if legs.shape != code_lead.LEAD_SHAPE or ran else "" + shape = legs.shape if ran else _served_shape(input, brief) note_budget_shape(shape) tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 trace_run_id = _symbol_trace( @@ -1165,6 +1175,16 @@ def _call_shape(input: CodeSymbolInput, *, brief_started: bool) -> str: return "uses_brief" if brief_started else code_lead.LEAD_SHAPE +def _served_shape(input: CodeSymbolInput, brief: dict[str, Any]) -> str: + """The shape of a lookup whose lead legs did not run (`lead: false`, no time left, or + their definition filtered out), priced as without the block: a ranked lookup `ranked`, + one that serves the uses brief `uses_brief`, any other the op's base budget. A brief + withheld by `token_budget` or empty prices nothing.""" + if input.near_paths or input.pr_number: + return "ranked" + return "uses_brief" if brief else "" + + def _symbol_trace( input: Any, org: str, diff --git a/server/settings/catalog.py b/server/settings/catalog.py index d65c77a116d..233cd11451a 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -2001,7 +2001,8 @@ def code_bot_author_names(self) -> frozenset[str]: code_conventions_diff_timeout_s: Annotated[float, LIVE] = Field(default=25.0, gt=0) # Seconds a repository job's egress tunnel waits to connect to its upstream host. code_egress_connect_timeout_s: Annotated[float, LIVE] = Field(default=15.0, gt=0) - # Seconds one enrichment of a code result may take before it is left empty. + # Seconds one enrichment of a code result may take before it is left empty. code.grep + # holds it back from its `lead` budget (1 s), so a value near that serves no `lead` block. code_enrich_timeout_s: Annotated[float, LIVE] = Field(default=0.5, gt=0) # Incoming call sites read before ranking usage examples. The coverage lookup # accepts up to 50 paths. @@ -6928,8 +6929,8 @@ class TrackerSettings(BaseModel): # shape (`server.observability.budget_shape`) is held to that shape's budget. OP_SHAPE_BUDGETS_P99_MS: dict[str, dict[str, int]] = { # "lead": the answer with its `lead` block (docs/features/code-index/operations.md). - # Not measured; a leg past it reads `unread: deadline`. Raise it with - # `latency_budget_overrides` or `admin/budget.set`. + # Not measured; a leg past it reads `unread: deadline`. Raise it with a multiplier in + # `latency_budget_overrides` (`{"code.symbol": "2x"}`), which scales every shape. "code.grep": { "files": 600, "lead": 1000, diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 81b9112b7a0..31e67ef2fad 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -227,6 +227,7 @@ def test_history_drops_prs_whose_diff_does_not_name_the_definition(): _ROWS = [ {"qualified_name": "A::f", "path": "src/a.cpp", "start_line": 3, "symbol_id": "s1"}, ] +_HANG = {op: "hang" for op in ("code.callers", "code.coverage_claim", "code.symbol_history")} class _Ops: @@ -941,10 +942,46 @@ def test_every_budget_serves_the_definitions_lead_false_serves(monkeypatch, sort @pytest.mark.usefixtures("_intel_on") -def test_a_block_whose_definition_is_not_served_is_left_out(monkeypatch): - out, seen, shape = _symbol(monkeypatch, name="DB::Foo::bar", min_fan_in=5) - assert len(seen) == 1 and not out.definitions and "lead" not in out.model_dump() - assert shape == lead.LEAD_SHAPE +def test_a_block_whose_definition_min_fan_in_leaves_out_is_neither_waited_for_nor_priced( + monkeypatch, +): + """The first reachable definition (fan-in 1) is filtered out and the other (fan-in 9) + served: the legs, which hang, are cancelled rather than waited for to the wall, and the + call keeps the base price.""" + import time + + import server.operations.registry # noqa: F401 the server's boot import, not timed + + monkeypatch.setattr(lead, "_ops", _Ops(**_HANG)) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 2.0) + began = time.perf_counter() + out, _seen, shape = _symbol( + monkeypatch, repo=_TwoRepo(), real_leads=True, name="DB::Foo::bar", min_fan_in=5 + ) + took = time.perf_counter() - began + assert [d.path for d in out.definitions] == ["src/Foo2.cpp"] + assert "lead" not in out.model_dump() and shape == "" and took < 1.0 + + +@pytest.mark.usefixtures("_intel_on") +def test_a_lookup_whose_legs_did_not_run_is_priced_as_without_the_block(monkeypatch): + """`lead: false`, which the plugins send, and a wall under the floor price a lookup as + the op does without the block: `ranked` by the change at hand, `uses_brief` only when + the brief is served, the base budget for a brief `token_budget` withholds.""" + monkeypatch.setattr(lead, "_ops", _Ops()) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: lead.MIN_LEG_WALL_S - 0.01) + for fields, expected in ( + ({}, ""), + ({"near_paths": ["src/Foo.cpp"]}, "ranked"), + ({"pr_number": 7}, "ranked"), + ({"uses_brief": True}, "uses_brief"), + ({"uses_brief": True, "token_budget": 1}, ""), + ): + for off in ({"lead": False}, {}): + out, _seen, shape = _symbol( + monkeypatch, real_leads=True, name="DB::Foo::bar", **fields, **off + ) + assert ("lead" in out.model_dump(), shape) == (False, expected), (fields, off) # ------------------------------------------------------------------ the lane @@ -1470,7 +1507,6 @@ def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkey "path": "src/B.cpp", "start_line": 1, } -_HANG = {op: "hang" for op in ("code.callers", "code.coverage_claim", "code.symbol_history")} def _grep_then_lessons( From 07b5ff4be2f61985bffd9ca363821474fd9b6333 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 10:25:16 +0530 Subject: [PATCH 20/30] Wrap the code.grep feature page line the pricing sentence lengthened Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 784a1c53ee2..c98de40ee00 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -152,8 +152,8 @@ served: The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When less than 0.1 s is left for the answers, none starts and the block is left out, so the call keeps the -budget it has without the block. `lead: false` leaves the block out. `code.edit_context` has no -`lead` block; it reads the definition's tests itself. +budget it has without the block. `lead: false` leaves the block out. +`code.edit_context` has no `lead` block; it reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For example, `["parse(", "parse_async("]` matches both fragments without escaping From d521cfa0c077fcc00207bebb9b3c0272d14ff41f Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 11:25:13 +0530 Subject: [PATCH 21/30] A lead leg's policy deny is a value, and the tracker gate reads outside the lane The shielded policy gate can end after the wall cancelled its leg, when nothing awaits it: asyncio.shield drops its inner callback once the outer wait is done, so a raised deny was logged as never retrieved. `_policy` now returns False on a deny and `_leg` reads it as `policy`. The history leg's tracker binding gate read the namespace classification and the caller's grant inside the best-effort lane. A full lane refused them, the gate failed closed with a logged error, and a caller holding the grant got the history without the tracker. `_gated` now reads them in `ch.shared_work()`. The grep lessons tests run on a manual clock and assert exact seconds, and the min_fan_in test asserts the block was cancelled instead of timing the call. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/architecture/clickhouse.md | 3 +- server/code/app/lead.py | 31 ++++-- server/tracker/app/binding.py | 13 ++- tests/unit/test_code_lead.py | 190 +++++++++++++++++++++++++------- 4 files changed, 182 insertions(+), 55 deletions(-) diff --git a/docs/architecture/clickhouse.md b/docs/architecture/clickhouse.md index 5fc61bc6ba5..583bb9c69c6 100644 --- a/docs/architecture/clickhouse.md +++ b/docs/architecture/clickhouse.md @@ -895,7 +895,8 @@ source registry refresh outside the lane too: a refused refresh keeps nothing, b would log a warning each time and leave its call on the previous snapshot. A cache that keeps only reads that answered, such as the code index's coverage positive control, fills inside the lane. The history policy gate a `lead` leg passes runs before the leg -enters the lane, so its statements hold ordinary pool slots and are never refused as +enters the lane, and the tracker binding gate its history leg's op runs reads outside it +(`shared_work()`), so their statements hold ordinary pool slots and are never refused as best-effort work. Reads also carry per-traffic-class settings from `LOOM_CH_SETTINGS_BY_TRAFFIC_CLASS` diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 95977f1c63c..01a8affc94b 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -34,8 +34,11 @@ server after the wall, and the answer does not wait for it. - The policy gate runs before its leg enters the lane: its statements hold ordinary slots and are not counted in the lane, since an authorization step is never refused for - best-effort work. It runs to its end when the wall cancels its leg, since it may flush - the process's queued events, which are every request's. Work a leg does for others (a + best-effort work. The history leg's tracker binding gate runs inside its op, and its + reads leave the lane the same way (`server.tracker.app.binding._gated`). The policy + gate runs to its end when the wall cancels its leg, since it may flush the process's + queued events, which are every request's; a deny is its answer, not an exception, so + one that comes after the cancel is not left unretrieved. Work a leg does for others (a shared load, a deferred write, the fill of a cache whose refused read every request would read) runs outside the lane too (`server.core.ch.shared_context`, `shared_work`). - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. @@ -331,10 +334,13 @@ def _ops() -> dict[str, tuple[Any, Callable[[Any], Awaitable[Any]]]]: } -async def _policy(op: str, query: Any) -> None: +async def _policy(op: str, query: Any) -> bool: """The history policy gate the transports run before `op`'s handler, on the leg's - identity; raises PolicyForbiddenError when an enforcing rule denies.""" - from server.identity.app.policy_gate import gate + identity: False when an enforcing rule denies. The deny is returned, not raised: the + gate is shielded and may end after the wall cancelled its leg, when nothing awaits it + (`asyncio.shield` drops its callback once the outer wait is done), and an exception + there would be left unretrieved.""" + from server.identity.app.policy_gate import PolicyForbiddenError, gate from server.operations.registry import OPERATIONS_BY_NAME identity = { @@ -345,14 +351,18 @@ async def _policy(op: str, query: Any) -> None: "session_id": "-", } raw_args = query.model_dump(exclude_defaults=True) - await gate(OPERATIONS_BY_NAME[op], identity, raw_args, request_id=request_id_var.get() or "") + try: + await gate( + OPERATIONS_BY_NAME[op], identity, raw_args, request_id=request_id_var.get() or "" + ) + except PolicyForbiddenError: + return False + return True async def _leg( name: str, base: dict[str, Any], d: dict[str, Any], deadline: float, width: asyncio.Semaphore ) -> dict[str, Any]: - from server.identity.app.policy_gate import PolicyForbiddenError - op, fields, compact = LEGS[name] model, handler = _ops()[op] try: @@ -370,13 +380,12 @@ async def _leg( try: # outside the lane, and to its end if the wall cancels the leg: the gate # may flush every request's queued events - await shielded(_policy(op, query), name=f"lead-{name}-policy") + if not await shielded(_policy(op, query), name=f"lead-{name}-policy"): + return {"unread": "policy"} with ch.best_effort(claim): out = await handler(query) except ch.BusyError: return {"unread": "busy"} - except PolicyForbiddenError: - return {"unread": "policy"} except NotFoundError: return {"unread": "unresolved"} # An op that swallowed a refused read answers as if the read found nothing (no diff --git a/server/tracker/app/binding.py b/server/tracker/app/binding.py index b85f10a972f..c34fb72bde6 100644 --- a/server/tracker/app/binding.py +++ b/server/tracker/app/binding.py @@ -270,19 +270,22 @@ async def _gated(org: str, code_namespace: str, ns: str, *, hides_answer: bool) """The binding gate for one linked tracker, as the current principal: a STANDARD one by whoever may read the code namespace, a RESTRICTED one (or one the tracker plane does not know) by its own two-factor gate. - Closed on any error.""" + Closed on any error. Its reads hold ordinary pool slots inside a best-effort block + (`ch.shared_work`): an authorization read is never refused as best-effort work.""" try: from server.auth.authz import row_in_scope + from server.core.ch import shared_work from server.operations.base import Role from server.tracker.domain.namespaces import tracker_namespace target = tracker_namespace(org, ns) standard = target is not None and not target.restricted - return bool( - await row_in_scope( - org, code_namespace if standard else ns, Role.VIEWER, hides_answer=hides_answer + with shared_work(): + return bool( + await row_in_scope( + org, code_namespace if standard else ns, Role.VIEWER, hides_answer=hides_answer + ) ) - ) except Exception as e: # noqa: BLE001 — the binding gate fails closed on any error log.debug("qa binding authorization failed (closed): %s", e) return False diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 31e67ef2fad..ece7fdebbe8 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -480,6 +480,47 @@ async def go() -> list[dict[str, Any]]: assert seen.count(unbounded) == 3 and seen.count(("end",)) == 3 +def test_a_deny_is_the_gates_answer_so_one_after_the_wall_is_never_left_unretrieved( + monkeypatch, +): + """The shielded gate may end after the wall cancelled its leg, when nothing awaits it + (`asyncio.shield` drops its callback once the outer wait is done). The callers gate + denies after the 0.1 s wall and the history gate inside it: the loop logs nothing, + the callers leg reads `deadline` and the history leg `policy`.""" + import gc + + from server.identity.app import policy_gate + from server.identity.domain.policy_rules import PolicyDecision + from tests.unit.clock_fake import idle_time + + denied = PolicyDecision("deny", ["r"], [], [], enforcing_rules=["r"]) + + async def gate(op, identity, raw_args, *, request_id=""): + if op.name == "code.callers": + await asyncio.sleep(0.3) + if op.name in ("code.callers", "code.symbol_history"): + raise policy_gate.PolicyForbiddenError("denied", denied) + + monkeypatch.setattr(policy_gate, "gate", gate) + monkeypatch.setattr(lead, "_ops", _Ops()) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 0.1) + logged: list[dict[str, Any]] = [] + + async def go() -> list[dict[str, Any]]: + asyncio.get_running_loop().set_exception_handler(lambda loop, ctx: logged.append(ctx)) + out = await lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) + await asyncio.sleep(0.5) # the callers gate ends, after its leg's wall + gc.collect() + return out + + with asyncio.Runner() as runner, idle_time(runner.get_loop(), ManualClock(t=100.0)): + (entry,) = runner.run(go()) + gc.collect() + assert entry["callers"] == {"unread": "deadline"} + assert entry["changed_by"] == {"unread": "policy"} + assert logged == [] + + def test_a_load_a_leg_starts_for_others_runs_outside_the_lane(monkeypatch): """A shared grant read a leg happens to start runs as every joiner's read would: a refusal or the wall's short bound would fail the requests that join it.""" @@ -946,21 +987,28 @@ def test_a_block_whose_definition_min_fan_in_leaves_out_is_neither_waited_for_no monkeypatch, ): """The first reachable definition (fan-in 1) is filtered out and the other (fan-in 9) - served: the legs, which hang, are cancelled rather than waited for to the wall, and the + served: the block, whose legs hang, is cancelled rather than run to its wall, and the call keeps the base price.""" - import time - - import server.operations.registry # noqa: F401 the server's boot import, not timed - monkeypatch.setattr(lead, "_ops", _Ops(**_HANG)) monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 2.0) - began = time.perf_counter() + leads = lead.definition_leads + ended: list[str] = [] + + async def watched(*a: Any, **k: Any) -> list[dict[str, Any]]: + try: + block = await leads(*a, **k) + except asyncio.CancelledError: + ended.append("cancelled") + raise + ended.append("ran to its wall") + return block + + monkeypatch.setattr(lead, "definition_leads", watched) out, _seen, shape = _symbol( monkeypatch, repo=_TwoRepo(), real_leads=True, name="DB::Foo::bar", min_fan_in=5 ) - took = time.perf_counter() - began assert [d.path for d in out.definitions] == ["src/Foo2.cpp"] - assert "lead" not in out.model_dump() and shape == "" and took < 1.0 + assert "lead" not in out.model_dump() and shape == "" and ended == ["cancelled"] @pytest.mark.usefixtures("_intel_on") @@ -1229,6 +1277,61 @@ def kept_after(at: int) -> tuple[str, dict[str, Any]]: reset() +def test_the_tracker_gate_reads_its_grant_outside_a_full_lane(monkeypatch, real_client, caplog): + """Auth on, a restricted tracker namespace bound: the history leg's binding gate reads + the directory and the caller's grant inside its leg's lane. Like the policy gate, those + authorization reads hold ordinary slots: a full lane refuses neither, nothing is logged, + and the caller who holds the grant reads the tracker.""" + import logging + + import server.identity.app.namespace_classification as nc + from server.auth.context import set_current_auth + from server.auth.jwt import AuthInfo + from server.core.schema import status + from server.operations.base import Role + from server.tracker.app import binding + + ledger = [{"filename": f} for f in status.repo_migrations()] + + def rows(sql: str) -> list[dict[str, Any]]: + if "loom._migrations" in sql: + return ledger + if "FROM loom.namespaces FINAL" in sql and "'restricted'" in sql: + return [{"namespace": "tracker-priv"}] + if "FROM loom.namespace_grants" in sql: + return [{"role": "viewer"}] + return [] + + driver = real_client(rows) + _bind_restricted_tracker(monkeypatch) + monkeypatch.setattr(nc, "_cache", {}) + full = ch.BestEffortClaim(ch.BestEffortSlots(limit=0), asyncio.Semaphore(1)) + + async def go() -> str: + with ch.best_effort(full): + return await binding.authorized_tracker_namespace("o", "n", hides_answer=False) + + set_current_auth( + AuthInfo( + subject="alice@x", + org="o", + namespaces=("n", "tracker-priv"), + roles=(Role.VIEWER,), + is_service_account=False, + ) + ) + try: + with caplog.at_level(logging.WARNING): + got = asyncio.run(go()) + finally: + set_current_auth(None) + statements = [sql for sql, _in_lane in driver.seen] + assert any("FROM loom.namespace_grants" in sql for sql in statements), statements + assert not any(in_lane for _sql, in_lane in driver.seen) + assert [r.getMessage() for r in caplog.records if r.levelno >= logging.WARNING] == [] + assert got == "tracker-priv" + + def test_the_tested_leg_counts_the_tests_code_coverage_claim_counts(monkeypatch, real_client): """15 mapped test files: the leg asks at the op's default limit, so its `tests` is the op's `tests_total`, not the 9 rows three times a limit of 3 would read.""" @@ -1286,26 +1389,14 @@ async def limited(sql: str, parameters: Any = None, settings: Any = None, **k: A ] -@pytest.mark.parametrize("reads_tracker", [False, True]) -def test_through_code_symbol_the_history_leg_reads_a_restricted_tracker_only_as_its_reader( - monkeypatch, real_client, reads_tracker -): - """Auth on: the legs run as the caller, so the history leg passes the restricted - tracker's own gate on the tracker namespace. A caller who may not read it gets no - tracker read and nothing of its answer: the PRs at file level, none marked as - naming the definition.""" +def _bind_restricted_tracker(monkeypatch) -> None: + """Code namespace `n` of org `o` bound to the restricted tracker namespace + `tracker-priv`, with a fresh override snapshot.""" import json - from server.auth import authz - from server.auth.context import set_current_auth - from server.auth.jwt import AuthInfo - from server.operations.base import Role from server.tracker.app import binding - from server.tracker.app import source as tracker_app_source from tests.unit._tracker_config import tracker_credentials_json, tracker_sources_json - real_client(lambda sql: _PRS if "FROM loom.code_pr_history" in sql else _resolved_only(sql)) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) repo = "ClickHouse/example-private" monkeypatch.setattr(settings, "tracker_code_namespace_bindings_json", '{"n": "tracker-priv"}') @@ -1319,6 +1410,25 @@ def test_through_code_symbol_the_history_leg_reads_a_restricted_tracker_only_as_ tracker_sources_json({repo: "tracker-priv"}, restricted="tracker-priv"), ) monkeypatch.setattr(settings, "tracker_credentials_json", tracker_credentials_json()) + + +@pytest.mark.parametrize("reads_tracker", [False, True]) +def test_through_code_symbol_the_history_leg_reads_a_restricted_tracker_only_as_its_reader( + monkeypatch, real_client, reads_tracker +): + """Auth on: the legs run as the caller, so the history leg passes the restricted + tracker's own gate on the tracker namespace. A caller who may not read it gets no + tracker read and nothing of its answer: the PRs at file level, none marked as + naming the definition.""" + from server.auth import authz + from server.auth.context import set_current_auth + from server.auth.jwt import AuthInfo + from server.operations.base import Role + from server.tracker.app import source as tracker_app_source + + real_client(lambda sql: _PRS if "FROM loom.code_pr_history" in sql else _resolved_only(sql)) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + _bind_restricted_tracker(monkeypatch) asked: list[tuple[str, str]] = [] async def check_authorized(auth, required_role=Role.VIEWER, *, org, namespace, **_k): @@ -1514,14 +1624,18 @@ def _grep_then_lessons( ) -> tuple[Any, str, float]: """A default code.grep whose handler runs `_grep_lead` over the legs of `ops`, then `after_legs_s` of other work, and whose lessons read answers one lesson after - `lessons_s`: (the answer, the shape it is priced by, its seconds).""" + `lessons_s`: (the answer, the shape it is priced by, its seconds). It runs on a manual + clock that moves only while every task waits, so the seconds are exact.""" import time - import server.operations.registry # noqa: F401 the server's boot import, not timed from server.code.app import grep, result_lessons from server.core import request_work from server.observability.budget_shape import current_budget_shape + from tests.unit.clock_fake import idle_time + clock = ManualClock(t=1000.0) + monkeypatch.setattr(time, "monotonic", clock.monotonic) + monkeypatch.setattr(time, "perf_counter", clock.monotonic) monkeypatch.setattr(settings, "latency_budget_multiplier", multiplier) monkeypatch.setattr(settings, "latency_budget_overrides", "") monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.5) @@ -1540,7 +1654,7 @@ async def lessons(*a: Any, **k: Any) -> Any: async def handler(input: CodeGrepInput) -> CodeGrepOutput: block = await grep._grep_lead( - "o", "n", input, {"definitions": [_GREP_DEF]}, time.monotonic(), None, 0, "" + "o", "n", input, {"definitions": [_GREP_DEF]}, clock(), None, 0, "" ) await asyncio.sleep(after_legs_s) return CodeGrepOutput(matches=[], chunks_matched=0, lead=block) @@ -1549,10 +1663,12 @@ async def handler(input: CodeGrepInput) -> CodeGrepOutput: async def go() -> tuple[Any, str, float]: bag = request_work.begin() + bag.began = bag.last_mark = clock() # its field defaults read the real clock out = await wrapped(CodeGrepInput(org="o", namespace="n", pattern="parseInput(")) - return out, current_budget_shape(), time.perf_counter() - bag.began + return out, current_budget_shape(), clock() - bag.began - return asyncio.run(go()) + with asyncio.Runner() as runner, idle_time(runner.get_loop(), clock): + return runner.run(go()) def test_a_grep_wall_under_the_floor_keeps_the_base_price_and_the_lessons_bound(monkeypatch): @@ -1560,32 +1676,30 @@ def test_a_grep_wall_under_the_floor_keeps_the_base_price_and_the_lessons_bound( its 0.3 s answer would be cut; at the base price it keeps `code_enrich_timeout_s`.""" monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: lead.MIN_LEG_WALL_S - 0.01) ops = _Ops() - out, shape, _took = _grep_then_lessons(monkeypatch, ops, multiplier=0.2, lessons_s=0.3) + out, shape, took = _grep_then_lessons(monkeypatch, ops, multiplier=0.2, lessons_s=0.3) assert ops.queries == {} and out.lead == [] and shape == "" - assert out.lessons == [{"memory_id": "m1"}] + assert out.lessons == [{"memory_id": "m1"}] and took == pytest.approx(0.3) def test_a_grep_whose_legs_run_to_the_wall_still_serves_a_lessons_read_of_0_3_s(monkeypatch): """The legs leave code.grep's lessons read its whole bound, as on a call without them: - a 100 ms reserve would leave it about 0.1 s.""" - out, shape, _took = _grep_then_lessons( - monkeypatch, _Ops(**_HANG), multiplier=0.8, lessons_s=0.3 - ) + a wall of 0.8 - 0.5 s, then 0.3 s of lessons. A 100 ms reserve would leave it 0.1 s.""" + out, shape, took = _grep_then_lessons(monkeypatch, _Ops(**_HANG), multiplier=0.8, lessons_s=0.3) assert shape == lead.LEAD_SHAPE assert {out.lead[0][leg]["unread"] for leg in lead.LEGS} == {"deadline"} - assert out.lessons == [{"memory_id": "m1"}] + assert out.lessons == [{"memory_id": "m1"}] and took == pytest.approx(0.3 + 0.3) def test_a_default_grep_whose_legs_run_to_the_wall_finishes_inside_its_priced_budget( monkeypatch, ): """Work after the legs takes part of the lessons read's reserve: the read stops where - the `lead` price (800 ms here) ends, though alone it may take `code_enrich_timeout_s`.""" + the `lead` price (800 ms here) ends, though alone it may take `code_enrich_timeout_s` + (it would end the call at 0.3 + 0.3 + 0.5 s).""" out, _shape, took = _grep_then_lessons( monkeypatch, _Ops(**_HANG), multiplier=0.8, lessons_s=10.0, after_legs_s=0.3 ) - # read to its own bound, the lessons would end the call at about 0.3 + 0.3 + 0.5 s - assert out.lessons == [] and took < 0.8 + 0.15 + assert out.lessons == [] and took == pytest.approx(0.8) def test_code_grep_leads_only_a_first_page_of_bodies(monkeypatch): From dfe0fdacb38226bc595c923afe9cc2a265aad144 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 12:30:33 +0530 Subject: [PATCH 22/30] A code.grep that reads no lessons reserves RESERVE_S for its lead legs code.grep held back `code_enrich_timeout_s` from its lead wall on every call, though `lessons_for` skips the lessons read for `include_lessons: false`, with `code_result_lessons` off and for a narrowed token. A default grep with `include_lessons: false` that had spent 0.1 s gave its legs 0.4 s instead of 0.8 s, so a 0.5 s callers leg read `deadline` in a call priced at 1.0 s. `result_lessons.lessons_read` is now the one check for whether the read runs, and `lessons_for` uses it too. `_grep_lead` reserves the read's bound only when it is true, else `RESERVE_S`, and passes the reserve to `definition_leads` and `wall_s`; `lead.reserve_s` is removed. The client-hygiene test drops two asserts the refusal and the driver's calls already prove. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 12 +-- docs/reference/configuration.md | 2 +- loom.example.yaml | 6 +- schemas/loom-settings.schema.json | 2 +- server/code/app/grep.py | 9 ++- server/code/app/lead.py | 32 ++++---- server/code/app/result_lessons.py | 12 ++- server/settings/catalog.py | 5 +- tests/unit/test_ch_client_hygiene.py | 3 - tests/unit/test_code_lead.py | 103 +++++++++++++++++++------ 10 files changed, 124 insertions(+), 62 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index ec622e6af42..e4c6384e8d1 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -124,12 +124,12 @@ to count the reads a `lead` block makes names `code.symbol` or `code.grep`. The answers share what the latency budget of the call's shape leaves after the time already spent, less a reserve for the rest of the answer, and at most what -`deadline_ms` leaves. In `code.grep` the reserve is the lessons read's own bound -(`LOOM_CODE_ENRICH_TIMEOUT_S`, 0.5 s): the answers leave it its whole bound; it -still ends where the `lead` budget does. A value near that budget leaves the -answers no time, and `code.grep` serves no block. The shape is `lead`, 600 ms for -`code.symbol` and 1000 ms for `code.grep`; a `code.symbol` lookup ranked by -`near_paths` or `pr_number` keeps its `ranked` budget (3000 ms) and one that +`deadline_ms` leaves. In a `code.grep` that reads lessons the reserve is the +lessons read's own bound (`LOOM_CODE_ENRICH_TIMEOUT_S`, 0.5 s): the answers leave +it its whole bound; it still ends where the `lead` budget does. A value near that +budget leaves the answers no time, and such a call serves no block. The shape is +`lead`, 600 ms for `code.symbol` and 1000 ms for `code.grep`; a `code.symbol` +lookup ranked by `near_paths` or `pr_number` keeps its `ranked` budget (3000 ms) and one that reads the uses brief its `uses_brief` budget (1500 ms). These budgets are not measured in production. Raise them with a multiplier in `LOOM_LATENCY_BUDGET_OVERRIDES`: `{"code.symbol": "2x"}` scales every shape. A diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index aca665f6926..ca54903d863 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -776,7 +776,7 @@ The code index's network git (clone, fetch, ls-remote, submodule update) through | `LOOM_CODE_CITATIONS_GIT_CALL_TIMEOUT_S` | `float` | `3.0` | live | Seconds one git call of code.verify_citations may run, within its request budget. | | `LOOM_CODE_CONVENTIONS_DIFF_TIMEOUT_S` | `float` | `25.0` | live | Seconds the git diff behind code.conventions may run. | | `LOOM_CODE_EGRESS_CONNECT_TIMEOUT_S` | `float` | `15.0` | live | Seconds a repository job's egress tunnel waits to connect to its upstream host. | -| `LOOM_CODE_ENRICH_TIMEOUT_S` | `float` | `0.5` | live | Seconds one enrichment of a code result may take before it is left empty. code.grep holds it back from its `lead` budget (1 s), so a value near that serves no `lead` block. | +| `LOOM_CODE_ENRICH_TIMEOUT_S` | `float` | `0.5` | live | Seconds one enrichment of a code result may take before it is left empty. A code.grep that reads lessons holds it back from its `lead` budget (1 s), so a value near that serves such a call no `lead` block. | | `LOOM_CODE_ENRICH_EXAMPLE_CANDIDATE_LIMIT` | `int` | `50` | | Incoming call sites read before ranking usage examples. The coverage lookup accepts up to 50 paths. | | `LOOM_CODE_ENRICH_INDIRECT_TEST_CALLER_LIMIT` | `int` | `30` | | Indirect test callers ranked as backups. The edge query reads up to twice this many call sites, within its 60-site work limit. | | `LOOM_CODE_ENTRY_LOCK_WAIT_S` | `float` | `14400.0` | live | A full pass waits this long for a delta on its entry (past any delta's harness timeout). | diff --git a/loom.example.yaml b/loom.example.yaml index d454ca6adb1..30b185f284f 100644 --- a/loom.example.yaml +++ b/loom.example.yaml @@ -2441,9 +2441,9 @@ settings: # [live] # code_egress_connect_timeout_s: 15.0 - # Seconds one enrichment of a code result may take before it is left empty. code.grep - # holds it back from its `lead` budget (1 s), so a value near that serves no `lead` - # block. [live] + # Seconds one enrichment of a code result may take before it is left empty. A + # code.grep that reads lessons holds it back from its `lead` budget (1 s), so a value + # near that serves such a call no `lead` block. [live] # code_enrich_timeout_s: 0.5 # Incoming call sites read before ranking usage examples. The coverage lookup accepts diff --git a/schemas/loom-settings.schema.json b/schemas/loom-settings.schema.json index 1108efd47a1..c9e27028630 100644 --- a/schemas/loom-settings.schema.json +++ b/schemas/loom-settings.schema.json @@ -1152,7 +1152,7 @@ "default": 0.5, "exclusiveMinimum": 0, "type": "number", - "description": "Seconds one enrichment of a code result may take before it is left empty. code.grep holds it back from its `lead` budget (1 s), so a value near that serves no `lead` block." + "description": "Seconds one enrichment of a code result may take before it is left empty. A code.grep that reads lessons holds it back from its `lead` budget (1 s), so a value near that serves such a call no `lead` block." }, "code_entry_lock_wait_s": { "default": 14400.0, diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 355c3c20d04..8db7f42cc61 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -734,8 +734,8 @@ async def _grep_lead( ) -> list[dict[str, Any]]: """The `lead` block (`server.code.app.lead`) of a first page's enclosing definitions, read once the page's other reads are done, within what the op's `lead` budget and the - caller's `deadline_ms` leave less the lessons read's bound, which runs after the - handler. + caller's `deadline_ms` leave less the lessons read's bound when that read runs after + the handler (`result_lessons.lessons_read`), else less `RESERVE_S`. A definition the pattern names leads before one that only holds a match. [] on a continuation page (`offset`), a related answer (`related_pattern`), a page without bodies, `lead: false`, or when no leg started.""" @@ -743,11 +743,13 @@ async def _grep_lead( if not (input.lead and definitions) or offset or related_pattern: return [] from server.code.app import lead as code_lead + from server.code.app import result_lessons from server.observability.budget_shape import note_budget_shape patterns = [input.pattern] if isinstance(input.pattern, str) else input.pattern rows = code_lead.named_first(definitions, patterns) - reserve = code_lead.reserve_s("code.grep") + lessons = result_lessons.lessons_read(input) + reserve = settings.code_enrich_timeout_s if lessons else code_lead.RESERVE_S cap_s = budget.left_ms() / 1000.0 - reserve if budget is not None else math.inf with code_span("grep.lead", results=len(definitions)): lead = await code_lead.definition_leads( @@ -759,6 +761,7 @@ async def _grep_lead( user_id=input.user_id, started=started, cap_s=cap_s, + reserve=reserve, ) if lead: note_budget_shape(code_lead.LEAD_SHAPE) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 01a8affc94b..0eceb53454e 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -26,7 +26,7 @@ after the time already spent, less a reserve for the rest of the answer (the `lead` shape, or for a code.symbol lookup ranked by the change at hand or with the uses brief, that shape, whose budget covers its legs). code.grep reserves its lessons read's own - bound. No leg starts on a wall under `MIN_LEG_WALL_S`. Each statement is + bound when that read runs. No leg starts on a wall under `MIN_LEG_WALL_S`. Each statement is bounded on the server and in the client by what is left of the wall and a margin, so a leg cancelled at the wall does not keep ClickHouse working; a cancelled leg reads `unread: deadline`, one that raised `unread: failed`. The history leg's tracker reads @@ -89,7 +89,7 @@ _CALLER_NODES = 50 _TITLE_CHARS = 80 # Left of the budget for the answer after the wall: the trims and serialization. code.grep -# leaves `code_enrich_timeout_s` instead (`reserve_s`), the bound of its lessons read. +# leaves `code_enrich_timeout_s` instead when its lessons read runs, that read's bound. # not a setting: part of the wall each `lead` budget is declared for; raise the budget RESERVE_S = 0.1 # The least wall the legs start on: under it they would read `deadline` and still price @@ -174,22 +174,18 @@ def named(r: dict[str, Any]) -> bool: return sorted(rows, key=lambda r: not named(r)) -def reserve_s(op_name: str) -> float: - """What the wall leaves of `op_name`'s budget for the answer after it: code.grep's - lessons read runs after its handler, so the legs leave it its whole bound, as on a call - without them.""" - return settings.code_enrich_timeout_s if op_name == "code.grep" else RESERVE_S - - -def wall_s(op_name: str, started: float, shape: str = LEAD_SHAPE) -> float: +def wall_s( + op_name: str, started: float, shape: str = LEAD_SHAPE, reserve: float = RESERVE_S +) -> float: """Seconds the legs may run: the op's effective budget for `shape`, the one the call is priced by (runtime and per-consumer overrides and the deployment multiplier applied), - less the time the request has spent and `reserve_s`. `started` is the handler's - monotonic start, the clock when no transport bound the request.""" + less the time the request has spent and `reserve`, what the answer after the legs needs. + `started` is the handler's monotonic start, the clock when no transport bound the + request.""" declared = OP_SHAPE_BUDGETS_P99_MS[op_name][shape] budget_s = effective_budget_ms(op_name, declared) / 1000.0 spent = max(request_work.age_s(), time.monotonic() - started) - return max(0.0, budget_s - spent - reserve_s(op_name)) + return max(0.0, budget_s - spent - reserve) def callers_entry(out: Any) -> dict[str, Any]: @@ -469,14 +465,16 @@ async def definition_leads( started: float, cap_s: float = math.inf, shape: str = LEAD_SHAPE, + reserve: float = RESERVE_S, ) -> list[dict[str, Any]]: """The block for `rows`: one entry, for their `lead_definition`, with each leg's answer; [] when no leg starts, as on a wall under `MIN_LEG_WALL_S`, so the call keeps - its base price. The legs carry the op's `agent` and `user_id`; `cap_s` is a caller's - own deadline less `reserve_s`; `shape` is the budget shape the call is priced by. - Never raises but on cancellation, which cancels every leg.""" + its base price. The legs carry the op's `agent` and `user_id`; `shape` is the budget + shape the call is priced by; `reserve` is what the answer after the legs needs, and + `cap_s` a caller's own deadline less it. Never raises but on cancellation, which + cancels every leg.""" picked = lead_definition(rows) - wall = min(wall_s(op_name, started, shape), cap_s) + wall = min(wall_s(op_name, started, shape, reserve), cap_s) if picked is None or wall < MIN_LEG_WALL_S: return [] base = { diff --git a/server/code/app/result_lessons.py b/server/code/app/result_lessons.py index 7dbe9a40fbc..d51a2079d20 100644 --- a/server/code/app/result_lessons.py +++ b/server/code/app/result_lessons.py @@ -98,6 +98,14 @@ def _bound_s(input: Any, started: float) -> float: return bound +def lessons_read(input: Any) -> bool: + """Whether a call's lessons read runs when its answer names a file: asked for, on, + and for a token that may read every user's memories (the memory rows are not filtered + by user).""" + asked = bool(input.include_lessons and settings.code_result_lessons) + return asked and not request_scope.request_narrowed() + + async def lessons_for( input: Any, paths: Iterable[str], @@ -111,10 +119,8 @@ async def lessons_for( past the call's deadline, or unable to read the scope. `started` is the call's monotonic start.""" offered_paths = _result_paths(paths) - if not (input.include_lessons and settings.code_result_lessons and offered_paths): + if not (offered_paths and lessons_read(input)): return path_lessons.Lessons([]) - if request_scope.request_narrowed(): - return path_lessons.Lessons([]) # a token that may not read every user's memories async def scope() -> tuple[str, list[str], str, bool]: org, ns = common.resolve_code_identity(input.org, _searched_namespace(input)) diff --git a/server/settings/catalog.py b/server/settings/catalog.py index 233cd11451a..9f7cf936eae 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -2001,8 +2001,9 @@ def code_bot_author_names(self) -> frozenset[str]: code_conventions_diff_timeout_s: Annotated[float, LIVE] = Field(default=25.0, gt=0) # Seconds a repository job's egress tunnel waits to connect to its upstream host. code_egress_connect_timeout_s: Annotated[float, LIVE] = Field(default=15.0, gt=0) - # Seconds one enrichment of a code result may take before it is left empty. code.grep - # holds it back from its `lead` budget (1 s), so a value near that serves no `lead` block. + # Seconds one enrichment of a code result may take before it is left empty. A code.grep + # that reads lessons holds it back from its `lead` budget (1 s), so a value near that + # serves such a call no `lead` block. code_enrich_timeout_s: Annotated[float, LIVE] = Field(default=0.5, gt=0) # Incoming call sites read before ranking usage examples. The coverage lookup # accepts up to 50 paths. diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index 1b6a446cdd7..235d0b7a4f4 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -441,11 +441,8 @@ async def test_best_effort_work_is_refused_at_once_when_the_pool_is_full( holder = asyncio.create_task(c.query_all("SELECT slow")) await asyncio.sleep(0.02) claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=8), asyncio.Semaphore(4)) - t0 = time.perf_counter() with ch_mod.best_effort(claim), pytest.raises(ch_mod.BusyError): await c.query_all("SELECT refused") - assert time.perf_counter() - t0 < 0.25 - assert ch_mod.pool_reading()["waiters"] == 0 await holder with ch_mod.best_effort(claim): await c.query_all("SELECT later") diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index ece7fdebbe8..a54fc3fc25e 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -266,7 +266,7 @@ async def run(query: Any) -> Any: def _run_leads(monkeypatch, ops: _Ops, *, wall: float = 5.0, **kw: Any) -> tuple[Any, list[str]]: monkeypatch.setattr(lead, "_ops", ops) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: wall) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: wall) async def go() -> tuple[list[dict[str, Any]], list[str]]: degradations.begin() @@ -352,7 +352,7 @@ async def coverage(query: Any) -> CodeCoverageClaimOutput: return CodeCoverageClaimOutput(verdict="unknown") monkeypatch.setattr(lead, "_ops", _Ops(**{"code.coverage_claim": coverage})) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 5.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 5.0) async def go() -> dict[str, int]: start_stage_wall() @@ -467,7 +467,7 @@ async def gate(op, identity, raw_args, *, request_id=""): monkeypatch.setattr(policy_gate, "gate", gate) monkeypatch.setattr(lead, "_ops", _Ops()) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 0.1) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 0.1) async def go() -> list[dict[str, Any]]: out = await lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) @@ -503,7 +503,7 @@ async def gate(op, identity, raw_args, *, request_id=""): monkeypatch.setattr(policy_gate, "gate", gate) monkeypatch.setattr(lead, "_ops", _Ops()) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 0.1) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 0.1) logged: list[dict[str, Any]] = [] async def go() -> list[dict[str, Any]]: @@ -554,7 +554,7 @@ def test_a_cancelled_block_retrieves_a_leg_that_raised(monkeypatch): } ) monkeypatch.setattr(lead, "_ops", ops) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 30.0) lost: list[dict[str, Any]] = [] async def go() -> None: @@ -581,13 +581,13 @@ def test_a_caller_deadline_caps_the_wall(monkeypatch): def test_the_wall_is_the_lead_budget_less_the_time_spent_and_the_reserve(monkeypatch): - """code.grep reserves its lessons read's bound, which runs after its handler.""" + """`RESERVE_S` unless the caller names its own, as code.grep does for its lessons read.""" monkeypatch.setattr(lead.time, "monotonic", lambda: 100.2) monkeypatch.setattr(lead.request_work, "age_s", lambda: 0.0) monkeypatch.setattr(lead, "effective_budget_ms", lambda op, declared: declared) - monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.4) assert lead.wall_s("code.symbol", 100.0) == pytest.approx(0.6 - 0.2 - 0.1) - assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.0 - 0.2 - 0.4) + assert lead.wall_s("code.grep", 100.0) == pytest.approx(1.0 - 0.2 - 0.1) + assert lead.wall_s("code.grep", 100.0, reserve=0.4) == pytest.approx(1.0 - 0.2 - 0.4) assert lead.wall_s("code.symbol", 99.0) == 0.0 @@ -760,6 +760,7 @@ async def leads( started, cap_s=math.inf, shape=lead.LEAD_SHAPE, + reserve=lead.RESERVE_S, ): seen.append( { @@ -768,6 +769,7 @@ async def leads( "who": (agent, user_id), "cap_s": cap_s, "shape": shape, + "reserve": reserve, } ) first = rows[0] @@ -990,7 +992,7 @@ def test_a_block_whose_definition_min_fan_in_leaves_out_is_neither_waited_for_no served: the block, whose legs hang, is cancelled rather than run to its wall, and the call keeps the base price.""" monkeypatch.setattr(lead, "_ops", _Ops(**_HANG)) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 2.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 2.0) leads = lead.definition_leads ended: list[str] = [] @@ -1017,7 +1019,9 @@ def test_a_lookup_whose_legs_did_not_run_is_priced_as_without_the_block(monkeypa the op does without the block: `ranked` by the change at hand, `uses_brief` only when the brief is served, the base budget for a brief `token_budget` withholds.""" monkeypatch.setattr(lead, "_ops", _Ops()) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: lead.MIN_LEG_WALL_S - 0.01) + monkeypatch.setattr( + lead, "wall_s", lambda op, started, shape, reserve: lead.MIN_LEG_WALL_S - 0.01 + ) for fields, expected in ( ({}, ""), ({"near_paths": ["src/Foo.cpp"]}, "ranked"), @@ -1119,7 +1123,7 @@ def test_one_calls_legs_hold_half_the_lane_so_two_calls_fit(monkeypatch, real_cl wait for their own call's slots, and two calls at once both answer: `busy` means other calls hold the lane.""" driver = real_client(_resolved_only) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 30.0) assert _unread_of_calls(1) == [""] assert driver.peak == lead.call_slots() == 4 driver.peak = 0 @@ -1220,7 +1224,7 @@ def rows(sql: str) -> list[dict[str, Any]]: driver = real_client(rows) driver.delay = 0.0 - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 30.0) monkeypatch.setattr(settings, "code_coverage_control_symbol", _DEF["qualified_name"]) monkeypatch.setattr(binding, "_OVERRIDES_AT", -math.inf) refuse = {"at": 0, "count": 0} @@ -1360,7 +1364,7 @@ async def limited(sql: str, parameters: Any = None, settings: Any = None, **k: A return out driver.query = limited # the statement's LIMIT, as ClickHouse applies it - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 30.0) (leg,) = _unread_of_calls(1, keep=True) claim = asyncio.run( handle_code_coverage_claim( @@ -1427,7 +1431,7 @@ def test_through_code_symbol_the_history_leg_reads_a_restricted_tracker_only_as_ from server.tracker.app import source as tracker_app_source real_client(lambda sql: _PRS if "FROM loom.code_pr_history" in sql else _resolved_only(sql)) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 30.0) _bind_restricted_tracker(monkeypatch) asked: list[tuple[str, str]] = [] @@ -1495,7 +1499,7 @@ def test_through_code_symbol_a_narrowed_token_gets_from_no_leg_what_its_op_refus from server.transport import gates driver = real_client(_resolved_only) - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: 30.0) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 30.0) handlers = lead._ops() sent: dict[str, Any] = {} @@ -1606,7 +1610,9 @@ def test_code_grep_leads_with_the_definition_its_pattern_names(monkeypatch): def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkeypatch): out, seen, _ = _grep(monkeypatch, deadline_ms=5000, neighbours=True) - assert 0 < seen[0]["cap_s"] <= 5.0 - lead.reserve_s("code.grep") < 5.0 - lead.RESERVE_S + reserve = settings.code_enrich_timeout_s + assert seen[0]["reserve"] == reserve > lead.RESERVE_S + assert 0 < seen[0]["cap_s"] <= 5.0 - reserve _GREP_DEF = { @@ -1620,14 +1626,24 @@ def test_code_grep_caps_the_lead_at_the_callers_deadline_less_the_reserve(monkey def _grep_then_lessons( - monkeypatch, ops: _Ops, *, multiplier: float, lessons_s: float, after_legs_s: float = 0.0 + monkeypatch, + ops: _Ops, + *, + multiplier: float, + lessons_s: float, + before_legs_s: float = 0.0, + after_legs_s: float = 0.0, + auth: Any = None, + **fields: Any, ) -> tuple[Any, str, float]: - """A default code.grep whose handler runs `_grep_lead` over the legs of `ops`, then - `after_legs_s` of other work, and whose lessons read answers one lesson after - `lessons_s`: (the answer, the shape it is priced by, its seconds). It runs on a manual - clock that moves only while every task waits, so the seconds are exact.""" + """A code.grep with `fields`, as `auth`, whose handler runs `before_legs_s` of other + reads, `_grep_lead` over the legs of `ops`, then `after_legs_s` of other work, and whose + lessons read answers one lesson after `lessons_s`: (the answer, the shape it is priced + by, its seconds). It runs on a manual clock that moves only while every task waits, so + the seconds are exact.""" import time + from server.auth.context import set_current_auth from server.code.app import grep, result_lessons from server.core import request_work from server.observability.budget_shape import current_budget_shape @@ -1653,6 +1669,7 @@ async def lessons(*a: Any, **k: Any) -> Any: monkeypatch.setattr(result_lessons.path_lessons, "lessons_for_paths", lessons) async def handler(input: CodeGrepInput) -> CodeGrepOutput: + await asyncio.sleep(before_legs_s) block = await grep._grep_lead( "o", "n", input, {"definitions": [_GREP_DEF]}, clock(), None, 0, "" ) @@ -1662,9 +1679,11 @@ async def handler(input: CodeGrepInput) -> CodeGrepOutput: wrapped = result_lessons.WithLessons(handler, lambda input, out: ["src/a.py"]) async def go() -> tuple[Any, str, float]: + set_current_auth(auth) # in the runner's context, so it ends with the run bag = request_work.begin() bag.began = bag.last_mark = clock() # its field defaults read the real clock - out = await wrapped(CodeGrepInput(org="o", namespace="n", pattern="parseInput(")) + query = CodeGrepInput(org="o", namespace="n", pattern="parseInput(", **fields) + out = await wrapped(query) return out, current_budget_shape(), clock() - bag.began with asyncio.Runner() as runner, idle_time(runner.get_loop(), clock): @@ -1674,7 +1693,9 @@ async def go() -> tuple[Any, str, float]: def test_a_grep_wall_under_the_floor_keeps_the_base_price_and_the_lessons_bound(monkeypatch): """Priced by `lead` (200 ms here), the lessons read would have what is left of 200 ms and its 0.3 s answer would be cut; at the base price it keeps `code_enrich_timeout_s`.""" - monkeypatch.setattr(lead, "wall_s", lambda op, started, shape: lead.MIN_LEG_WALL_S - 0.01) + monkeypatch.setattr( + lead, "wall_s", lambda op, started, shape, reserve: lead.MIN_LEG_WALL_S - 0.01 + ) ops = _Ops() out, shape, took = _grep_then_lessons(monkeypatch, ops, multiplier=0.2, lessons_s=0.3) assert ops.queries == {} and out.lead == [] and shape == "" @@ -1690,6 +1711,42 @@ def test_a_grep_whose_legs_run_to_the_wall_still_serves_a_lessons_read_of_0_3_s( assert out.lessons == [{"memory_id": "m1"}] and took == pytest.approx(0.3 + 0.3) +@pytest.mark.parametrize("caller", ["include_lessons: false", "a narrowed token"]) +def test_a_grep_that_reads_no_lessons_gives_its_legs_the_whole_wall(monkeypatch, caller): + """A grep whose lessons read will not run holds back `RESERVE_S`, not that read's + bound: after 0.1 s of other reads, a 0.5 s callers leg answers inside the 0.8 s wall of + the 1.0 s `lead` budget. A 0.5 s reserve would leave it 0.4 s.""" + from server.auth.jwt import AuthInfo + from server.identity.domain.read_scope import request_read_narrowed + + async def callers(query: Any) -> Any: + await asyncio.sleep(0.5) + return CodeCallersOutput(edges=[], seed_symbols=[]) + + fields: dict[str, Any] = {} + if caller == "include_lessons: false": + fields["include_lessons"] = False + else: + pinned = AuthInfo( + subject="alice@x", + org="o", + namespaces=("n",), + roles=("viewer",), + is_service_account=False, + read_scope="own_user", + read_user_id="u1", + ) + assert request_read_narrowed(pinned) + fields["auth"] = pinned + ops = _Ops(**{**_HANG, "code.callers": callers}) + out, shape, took = _grep_then_lessons( + monkeypatch, ops, multiplier=1.0, lessons_s=0.0, before_legs_s=0.1, **fields + ) + assert shape == lead.LEAD_SHAPE and "unread" not in out.lead[0]["callers"] + assert {out.lead[0][leg]["unread"] for leg in ("tested", "changed_by")} == {"deadline"} + assert out.lessons == [] and took == pytest.approx(0.1 + 0.8) + + def test_a_default_grep_whose_legs_run_to_the_wall_finishes_inside_its_priced_budget( monkeypatch, ): From 01af491797980d3e6293156e305615c843370a02 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 13:26:08 +0530 Subject: [PATCH 23/30] A lead block whose legs all refused at once keeps the call's base price `definition_leads` returned an entry whenever a leg started, so a call whose legs all read `busy`, `policy` or `unresolved` straight away was priced by its `lead` budget (600 or 1000 ms). A 400 ms code.symbol in a full lane was priced at 600 ms; the same call with `lead: false` is flagged past its 250 ms base budget. A best-effort claim now records that one of its statements held a lane slot (`BestEffortClaim.held`). `definition_leads` returns a `Block` of its entries and whether a leg ran: one held a slot or ran until the wall. code.symbol and code.grep price the `lead` shape only when it did, and still serve the block. code.symbol and code.grep no longer stamp an empty `lead_unread` span attribute when every leg answered. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 4 +- server/code/app/grep.py | 11 +- server/code/app/lead.py | 47 +++++--- server/code/app/symbol/symbol.py | 21 ++-- server/core/ch.py | 6 +- tests/unit/conftest.py | 4 +- tests/unit/test_ch_client_hygiene.py | 3 +- tests/unit/test_code_lead.py | 159 ++++++++++++++++++++++--- 8 files changed, 201 insertions(+), 54 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index e4c6384e8d1..e6b61a51288 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -152,7 +152,9 @@ served: The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When less than 0.1 s is left for the answers, none starts and the block is left out, so the call keeps the -budget it has without the block. `lead: false` leaves the block out. +budget it has without the block. A block whose answers all came back as `busy`, +`policy` or `unresolved` before any of them read in the share is served, and its +call keeps that budget too. `lead: false` leaves the block out. `code.edit_context` has no `lead` block; it reads the definition's tests itself. Pass `pattern` as a list of exact strings to find any of them in one scan. For diff --git a/server/code/app/grep.py b/server/code/app/grep.py index 8db7f42cc61..650b078cba2 100644 --- a/server/code/app/grep.py +++ b/server/code/app/grep.py @@ -685,7 +685,7 @@ async def _grep_lines( abstain=not returned, retrieval_risk=risk, consumer=input.consumer, - lead_unread=_lead_unread(lead), + lead_unread=_lead_unread(lead) or None, ) if ( not matches @@ -738,7 +738,8 @@ async def _grep_lead( the handler (`result_lessons.lessons_read`), else less `RESERVE_S`. A definition the pattern names leads before one that only holds a match. [] on a continuation page (`offset`), a related answer (`related_pattern`), a page without - bodies, `lead: false`, or when no leg started.""" + bodies, `lead: false`, or when no leg started. The call is priced by the `lead` shape + only when a leg ran (`Block.ran`).""" definitions = bodies.get("definitions") or [] if not (input.lead and definitions) or offset or related_pattern: return [] @@ -752,7 +753,7 @@ async def _grep_lead( reserve = settings.code_enrich_timeout_s if lessons else code_lead.RESERVE_S cap_s = budget.left_ms() / 1000.0 - reserve if budget is not None else math.inf with code_span("grep.lead", results=len(definitions)): - lead = await code_lead.definition_leads( + block = await code_lead.definition_leads( "code.grep", org, ns, @@ -763,9 +764,9 @@ async def _grep_lead( cap_s=cap_s, reserve=reserve, ) - if lead: + if block.ran: note_budget_shape(code_lead.LEAD_SHAPE) - return lead + return block.entries def _lead_unread(lead: list[dict[str, Any]]) -> str: diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 0eceb53454e..7ac1730bf28 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -26,12 +26,15 @@ after the time already spent, less a reserve for the rest of the answer (the `lead` shape, or for a code.symbol lookup ranked by the change at hand or with the uses brief, that shape, whose budget covers its legs). code.grep reserves its lessons read's own - bound when that read runs. No leg starts on a wall under `MIN_LEG_WALL_S`. Each statement is - bounded on the server and in the client by what is left of the wall and a margin, so a - leg cancelled at the wall does not keep ClickHouse working; a cancelled leg reads - `unread: deadline`, one that raised `unread: failed`. The history leg's tracker reads - go through the tracker source's own client: one can keep running on the tracker's - server after the wall, and the answer does not wait for it. + bound when that read runs. No leg starts on a wall under `MIN_LEG_WALL_S`. Each + statement is bounded on the server and in the client by what is left of the wall and a + margin, so a leg cancelled at the wall does not keep ClickHouse working; a cancelled leg + reads `unread: deadline`, one that raised `unread: failed`. The history leg's tracker + reads go through the tracker source's own client: one can keep running on the + tracker's server after the wall, and the answer does not wait for it. +- A call is priced by its block's shape only when a leg ran (`Block.ran`): held a lane + slot or ran until the wall. A block whose legs were all refused, denied or unresolved at + once added no time, and its call keeps the price it has without the block. - The policy gate runs before its leg enters the lane: its statements hold ordinary slots and are not counted in the lane, since an authorization step is never refused for best-effort work. The history leg's tracker binding gate runs inside its op, and its @@ -60,7 +63,7 @@ import time from collections.abc import Awaitable, Callable, Iterator from contextlib import contextmanager -from typing import Any +from typing import Any, NamedTuple from pydantic import ValidationError @@ -357,7 +360,7 @@ async def _policy(op: str, query: Any) -> bool: async def _leg( - name: str, base: dict[str, Any], d: dict[str, Any], deadline: float, width: asyncio.Semaphore + name: str, base: dict[str, Any], d: dict[str, Any], claim: ch.BestEffortClaim ) -> dict[str, Any]: op, fields, compact = LEGS[name] model, handler = _ops()[op] @@ -368,7 +371,6 @@ async def _leg( # a name past the op's own bound, which the op refuses too: a known limit return {"unread": "unresolved"} raise - claim = ch.BestEffortClaim(_slots(), deadline=deadline, width=width) with code_span(f"lead.{name}"): # the leg's spans report into a wall of its own, so the op's stage table holds the # leg once, as its name @@ -454,6 +456,14 @@ def unread_of(lead: list[dict[str, Any]]) -> str: return ",".join(out) +class Block(NamedTuple): + """The `lead` block's entries, and whether a leg ran: one held a lane slot or ran until + the wall. Only a block that ran prices its call by the block's shape.""" + + entries: list[dict[str, Any]] + ran: bool + + async def definition_leads( op_name: str, org: str, @@ -466,17 +476,16 @@ async def definition_leads( cap_s: float = math.inf, shape: str = LEAD_SHAPE, reserve: float = RESERVE_S, -) -> list[dict[str, Any]]: +) -> Block: """The block for `rows`: one entry, for their `lead_definition`, with each leg's - answer; [] when no leg starts, as on a wall under `MIN_LEG_WALL_S`, so the call keeps - its base price. The legs carry the op's `agent` and `user_id`; `shape` is the budget - shape the call is priced by; `reserve` is what the answer after the legs needs, and - `cap_s` a caller's own deadline less it. Never raises but on cancellation, which - cancels every leg.""" + answer; no entry when no leg starts, as on a wall under `MIN_LEG_WALL_S`. The legs + carry the op's `agent` and `user_id`; `shape` is the budget shape the call is priced + by; `reserve` is what the answer after the legs needs, and `cap_s` a caller's own + deadline less it. Never raises but on cancellation, which cancels every leg.""" picked = lead_definition(rows) wall = min(wall_s(op_name, started, shape, reserve), cap_s) if picked is None or wall < MIN_LEG_WALL_S: - return [] + return Block([], ran=False) base = { "org": org, "namespace": ns, @@ -487,9 +496,10 @@ async def definition_leads( tasks: dict[str, asyncio.Future[dict[str, Any]]] = {} deadline = time.monotonic() + wall + _MARGIN_S width = asyncio.Semaphore(call_slots()) + claims = {name: ch.BestEffortClaim(_slots(), deadline=deadline, width=width) for name in LEGS} with _unshaped(): for name in LEGS: - tasks[name] = asyncio.ensure_future(_leg(name, base, picked, deadline, width)) + tasks[name] = asyncio.ensure_future(_leg(name, base, picked, claims[name])) tasks[name].add_done_callback(_retrieved) try: await asyncio.wait(tasks.values(), timeout=wall) @@ -502,4 +512,5 @@ async def definition_leads( entry[name], why = _answer(task) if why: degradations.note(op_name, f"lead_{name}_unread", why, health=False) - return [entry] + ran = any(c.held for c in claims.values()) or any(t.cancelled() for t in tasks.values()) + return Block([entry], ran) diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index 8c5787a07f1..a754bf37b0e 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -1049,7 +1049,7 @@ async def handle_code_symbol( hierarchy = await legs.hierarchy # the neighbours block on the definitions themselves block, block_tokens = await legs.block - ran = await legs.lead if legs.lead is not None else [] + lead_read = await legs.lead if legs.lead is not None else code_lead.Block([], False) uses_leg = legs.uses uses_read = await uses_leg if uses_leg is not None else (None, False, "") except BaseException: @@ -1071,7 +1071,9 @@ async def handle_code_symbol( budgeted, tokens, lessons_left_out = _budget_definitions( units, remaining_token_budget(input.token_budget, uses_tokens) ) - lead, lead_tokens = code_lead.fit(ran, budgeted, input.token_budget, uses_tokens + tokens) + lead, lead_tokens = code_lead.fit( + lead_read.entries, budgeted, input.token_budget, uses_tokens + tokens + ) tokens += uses_tokens + lead_tokens if documented_in: tokens += estimate_json_tokens(documented_in) @@ -1101,7 +1103,7 @@ async def handle_code_symbol( ) if matched_members: route = "edit_context_members" - shape = legs.shape if ran else _served_shape(input, brief) + shape = legs.shape if lead_read.ran else _served_shape(input, brief) note_budget_shape(shape) tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 trace_run_id = _symbol_trace( @@ -1128,7 +1130,7 @@ async def handle_code_symbol( picked_by=picked_by or None, shape=shape or None, lead=False if not input.lead else None, - lead_unread=code_lead.unread_of(ran) or None, + lead_unread=code_lead.unread_of(lead_read.entries) or None, ), ) set_code_span_attributes( @@ -1140,7 +1142,7 @@ async def handle_code_symbol( abstain=not budgeted, retrieval_risk="low" if budgeted else "abstain", consumer=input.consumer, - lead_unread=code_lead.unread_of(ran), + lead_unread=code_lead.unread_of(lead_read.entries) or None, ) return CodeSymbolOutput( lead=lead, @@ -1176,10 +1178,11 @@ def _call_shape(input: CodeSymbolInput, *, brief_started: bool) -> str: def _served_shape(input: CodeSymbolInput, brief: dict[str, Any]) -> str: - """The shape of a lookup whose lead legs did not run (`lead: false`, no time left, or - their definition filtered out), priced as without the block: a ranked lookup `ranked`, - one that serves the uses brief `uses_brief`, any other the op's base budget. A brief - withheld by `token_budget` or empty prices nothing.""" + """The shape of a lookup whose lead legs did not run (`lead: false`, no time left, + their definition filtered out, or every leg refused, denied or unresolved at once), + priced as without the block: a ranked lookup `ranked`, one that serves the uses brief + `uses_brief`, any other the op's base budget. A brief withheld by `token_budget` or + empty prices nothing.""" if input.near_paths or input.pr_number: return "ranked" return "uses_brief" if brief else "" diff --git a/server/core/ch.py b/server/core/ch.py index 77f92118686..3e2ee63ce14 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -586,12 +586,15 @@ class BestEffortClaim: - `width`: shared by the claims of one caller, the slots they hold at once; a statement past it waits for one of them, never for the pool's. - `refused` is set once one of its statements found no slot, so a caller whose op - swallowed the BusyError still knows the answer is short.""" + swallowed the BusyError still knows the answer is short. + - `held` is set once one of its statements took a slot: the work spent time in the + lane.""" slots: BestEffortSlots width: asyncio.Semaphore deadline: float = 0.0 refused: bool = False + held: bool = False _best_effort_var: ContextVar[BestEffortClaim | None] = ContextVar("ch_best_effort", default=None) @@ -1361,6 +1364,7 @@ async def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: claim.refused = True raise BusyError(f"no ClickHouse slot free for best-effort work ({op_name})") claim.slots.in_use += 1 + claim.held = True return claim async def _retry_ladder(self, op_name: str, fn, *, cls: str): # type: ignore[no-untyped-def] diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 58622da1a76..124df97c60e 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -500,8 +500,8 @@ def _no_code_lead(request: pytest.FixtureRequest) -> Iterator[None]: return from server.code.app import lead - async def _none(*_a: object, **_k: object) -> list[dict[str, Any]]: - return [] + async def _none(*_a: object, **_k: object) -> Any: + return lead.Block([], ran=False) original = lead.definition_leads lead.definition_leads = _none # type: ignore[assignment] diff --git a/tests/unit/test_ch_client_hygiene.py b/tests/unit/test_ch_client_hygiene.py index 235d0b7a4f4..dcada40cbca 100644 --- a/tests/unit/test_ch_client_hygiene.py +++ b/tests/unit/test_ch_client_hygiene.py @@ -443,10 +443,11 @@ async def test_best_effort_work_is_refused_at_once_when_the_pool_is_full( claim = ch_mod.BestEffortClaim(ch_mod.BestEffortSlots(limit=8), asyncio.Semaphore(4)) with ch_mod.best_effort(claim), pytest.raises(ch_mod.BusyError): await c.query_all("SELECT refused") + assert claim.refused and not claim.held await holder with ch_mod.best_effort(claim): await c.query_all("SELECT later") - assert claim.slots.in_use == 0 + assert claim.held and claim.slots.in_use == 0 assert [key for k, key, _s in fake.calls if k == "query"] == ["SELECT slow", "SELECT later"] diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index a54fc3fc25e..6ccaea6c623 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -28,6 +28,7 @@ from server.code.app import lead from server.code.domain.units import CodeUnit, estimate_json_tokens from server.core import ch +from server.core.errors import NotFoundError from server.observability import degradations from server.settings import settings from tests.unit.clock_fake import ManualClock @@ -272,7 +273,7 @@ async def go() -> tuple[list[dict[str, Any]], list[str]]: degradations.begin() op_name, rows = kw.pop("op_name", "code.symbol"), kw.pop("rows", _ROWS) out = await lead.definition_leads(op_name, "o", "n", rows, started=0, **_WHO, **kw) - return out, degradations.current() + return out.entries, degradations.current() return asyncio.run(go()) @@ -472,7 +473,7 @@ async def gate(op, identity, raw_args, *, request_id=""): async def go() -> list[dict[str, Any]]: out = await lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) await asyncio.sleep(0.4) - return out + return out.entries (entry,) = asyncio.run(go()) assert entry["callers"] == entry["tested"] == entry["changed_by"] == {"unread": "deadline"} @@ -511,7 +512,7 @@ async def go() -> list[dict[str, Any]]: out = await lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) await asyncio.sleep(0.5) # the callers gate ends, after its leg's wall gc.collect() - return out + return out.entries with asyncio.Runner() as runner, idle_time(runner.get_loop(), ManualClock(t=100.0)): (entry,) = runner.run(go()) @@ -773,14 +774,13 @@ async def leads( } ) first = rows[0] - return [ - { - "symbol": first["qualified_name"], - "path": first["path"], - "line": first["start_line"], - **_LEGS, - } - ] + entry = { + "symbol": first["qualified_name"], + "path": first["path"], + "line": first["start_line"], + **_LEGS, + } + return lead.Block([entry], ran=True) return leads @@ -815,8 +815,12 @@ def _symbol( repo: Any = None, traces: list[dict[str, Any]] | None = None, real_leads: bool = False, + clock: ManualClock | None = None, **fields: Any, ) -> tuple[Any, list[Any], str]: + """code.symbol (or, with `edit`, code.edit_context) through its handler: (the answer, + the blocks `_recorder` saw unless `real_leads`, the shape it is priced by). With + `clock`, the loop runs on it (`idle_time`).""" from server.code.api.models_symbol import CodeEditContextInput, CodeSymbolInput from server.code.app.symbol import outline from server.code.app.symbol import symbol as h @@ -856,7 +860,13 @@ async def go() -> tuple[Any, str]: ) return out, current_budget_shape() - out, shape = asyncio.run(go()) + if clock is None: + out, shape = asyncio.run(go()) + else: + from tests.unit.clock_fake import idle_time + + with asyncio.Runner() as runner, idle_time(runner.get_loop(), clock): + out, shape = runner.run(go()) return out, seen, shape @@ -913,14 +923,14 @@ def test_a_handler_that_fails_before_its_joins_cancels_the_lead_task(monkeypatch seen: list[str] = [] - async def leads(*_a: Any, **_k: Any) -> list[dict[str, Any]]: + async def leads(*_a: Any, **_k: Any) -> Any: seen.append("started") try: await asyncio.sleep(30) except asyncio.CancelledError: seen.append("cancelled") raise - return [] + return lead.Block([], ran=False) async def rank(*_a: Any, **_k: Any) -> Any: raise RuntimeError("fan-in read failed") @@ -996,7 +1006,7 @@ def test_a_block_whose_definition_min_fan_in_leaves_out_is_neither_waited_for_no leads = lead.definition_leads ended: list[str] = [] - async def watched(*a: Any, **k: Any) -> list[dict[str, Any]]: + async def watched(*a: Any, **k: Any) -> Any: try: block = await leads(*a, **k) except asyncio.CancelledError: @@ -1110,10 +1120,10 @@ def _unread_of_calls(n: int, *, keep: bool = False) -> list[Any]: lead.definition_leads, "code.symbol", "o", "n", [_DEF], started=0, **_WHO ) - async def go() -> list[list[dict[str, Any]]]: + async def go() -> list[Any]: return list(await asyncio.gather(*(one() for _ in range(n)))) - blocks = asyncio.run(go()) + blocks = [block.entries for block in asyncio.run(go())] return blocks if keep else [lead.unread_of(block) for block in blocks] @@ -1747,6 +1757,121 @@ async def callers(query: Any) -> Any: assert out.lessons == [] and took == pytest.approx(0.1 + 0.8) +# How each leg refuses at once, and the block's `unread_of`; the control's callers leg +# runs to the wall instead. +_REFUSALS = { + "busy": "callers:busy,tested:busy,changed_by:busy", + "policy": "callers:policy,tested:policy,changed_by:policy", + "unresolved": "callers:unresolved,tested:unresolved,changed_by:unresolved", + "a mix": "callers:busy,tested:unresolved,changed_by:policy", + "control": "callers:deadline,tested:busy,changed_by:busy", +} + + +def _refusing_legs(monkeypatch, how: str) -> _Ops: + """Legs that hold no lane slot: refused (`busy`), denied by the policy gate or + unresolved, as `how` names (`a mix`: one of each); in the `control` the callers leg + hangs to the wall and the others are refused.""" + from server.identity.app import policy_gate + from server.identity.domain.policy_rules import PolicyDecision + + busy, unresolved = ch.BusyError("no slot free"), NotFoundError("no such definition") + denied = {"policy": set(_HANG), "a mix": {"code.symbol_history"}}.get(how, set()) + decision = PolicyDecision("deny", ["r"], [], [], enforcing_rules=["r"]) + + async def gate(op, identity, raw_args, *, request_id=""): + if op.name in denied: + raise policy_gate.PolicyForbiddenError("denied", decision) + + monkeypatch.setattr(policy_gate, "gate", gate) + behaviour: dict[str, Any] = { + "busy": {op: busy for op in _HANG}, + "policy": {}, + "unresolved": {op: unresolved for op in _HANG}, + "a mix": {"code.callers": busy, "code.coverage_claim": unresolved}, + "control": {**{op: busy for op in _HANG}, "code.callers": "hang"}, + }[how] + return _Ops(**behaviour) + + +def test_a_block_ran_only_when_a_leg_held_a_lane_slot_or_reached_the_wall(monkeypatch, real_client): + """`Block.ran` over a real `CHClient`: false when every leg is refused at once, true + when one leg's statement held a lane slot, and true when one ran until the wall.""" + from server.core.schema import status + from tests.unit.clock_fake import idle_time + + ledger = [{"filename": f} for f in status.repo_migrations()] + real_client(lambda sql: ledger if "loom._migrations" in sql else []) + + async def reads(query: Any) -> Any: + await ch.get_client().query_all("SELECT 1") + return CodeCallersOutput(edges=[], seed_symbols=[]) + + def block(**behaviour: Any) -> Any: + monkeypatch.setattr( + lead, "_ops", _Ops(**{**{op: ch.BusyError("x") for op in _HANG}, **behaviour}) + ) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 0.3) + call = lead.definition_leads("code.symbol", "o", "n", _ROWS, started=0, **_WHO) + with asyncio.Runner() as runner, idle_time(runner.get_loop(), ManualClock(t=100.0)): + return runner.run(call) + + refused = block() + assert not refused.ran and lead.unread_of(refused.entries) == _REFUSALS["busy"] + held = block(**{"code.callers": reads}) + assert held.ran and lead.unread_of(held.entries) == "tested:busy,changed_by:busy" + assert block(**{"code.callers": "hang"}).ran + + +@pytest.mark.parametrize("how", list(_REFUSALS)) +def test_a_grep_whose_legs_all_refused_at_once_keeps_the_base_price(monkeypatch, how): + """The block is served with each leg's reason, and the call keeps the price it has + without it; in the control a leg runs to the 0.5 s wall (1.0 s less the lessons read's + 0.5 s) and the call is priced by `lead`.""" + ops = _refusing_legs(monkeypatch, how) + out, shape, took = _grep_then_lessons(monkeypatch, ops, multiplier=1.0, lessons_s=0.0) + ran = how == "control" + assert lead.unread_of(out.lead) == _REFUSALS[how] + assert shape == (lead.LEAD_SHAPE if ran else "") + assert took == pytest.approx(0.5 if ran else 0.0) + + +@pytest.mark.usefixtures("_intel_on") +@pytest.mark.parametrize("how", list(_REFUSALS)) +def test_a_symbol_lookup_whose_legs_all_refused_at_once_keeps_the_base_price(monkeypatch, how): + """As for code.grep: with every leg refused, denied or unresolved at once the lookup is + priced as with `lead: false`; in the control it is priced by `lead`.""" + ops = _refusing_legs(monkeypatch, how) + monkeypatch.setattr(lead, "_ops", ops) + monkeypatch.setattr(lead, "wall_s", lambda op, started, shape, reserve: 0.3) + out, _seen, shape = _symbol( + monkeypatch, real_leads=True, clock=ManualClock(t=100.0), name="DB::Foo::bar" + ) + _no, _seen, unled = _symbol(monkeypatch, name="DB::Foo::bar", lead=False) + assert lead.unread_of(out.lead) == _REFUSALS[how] + assert shape == (lead.LEAD_SHAPE if how == "control" else unled) and unled == "" + + +@pytest.mark.usefixtures("_intel_on") +def test_a_block_whose_legs_all_answered_stamps_no_lead_unread_on_the_span(monkeypatch): + """`lead_unread` is left off the span when every leg answered, as it is off the trace + row, for code.symbol and code.grep.""" + from server.code.app import grep + from server.code.app.symbol import symbol as h + + stamped: list[Any] = [] + + def record(**facts: Any) -> None: + if "lead_unread" in facts: + stamped.append(facts["lead_unread"]) + + monkeypatch.setattr(h, "set_code_span_attributes", record) + monkeypatch.setattr(grep, "set_code_span_attributes", record) + _symbol(monkeypatch, name="DB::Foo::bar") + _grep(monkeypatch) + assert stamped == [None, None] + + def test_a_default_grep_whose_legs_run_to_the_wall_finishes_inside_its_priced_budget( monkeypatch, ): From d41f6a49def564a05bdc192a0086b95780a3ac76 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 13:35:09 +0530 Subject: [PATCH 24/30] Keep handle_code_symbol within the function-length gate Unpacking the lead `Block` where the handler awaits it keeps the `fit` call on one line, so the handler stays at 200 lines. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/code/app/symbol/symbol.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/code/app/symbol/symbol.py b/server/code/app/symbol/symbol.py index a754bf37b0e..a693608f796 100644 --- a/server/code/app/symbol/symbol.py +++ b/server/code/app/symbol/symbol.py @@ -1049,7 +1049,7 @@ async def handle_code_symbol( hierarchy = await legs.hierarchy # the neighbours block on the definitions themselves block, block_tokens = await legs.block - lead_read = await legs.lead if legs.lead is not None else code_lead.Block([], False) + lead_rows, lead_ran = await legs.lead if legs.lead is not None else ([], False) uses_leg = legs.uses uses_read = await uses_leg if uses_leg is not None else (None, False, "") except BaseException: @@ -1071,9 +1071,7 @@ async def handle_code_symbol( budgeted, tokens, lessons_left_out = _budget_definitions( units, remaining_token_budget(input.token_budget, uses_tokens) ) - lead, lead_tokens = code_lead.fit( - lead_read.entries, budgeted, input.token_budget, uses_tokens + tokens - ) + lead, lead_tokens = code_lead.fit(lead_rows, budgeted, input.token_budget, uses_tokens + tokens) tokens += uses_tokens + lead_tokens if documented_in: tokens += estimate_json_tokens(documented_in) @@ -1103,7 +1101,7 @@ async def handle_code_symbol( ) if matched_members: route = "edit_context_members" - shape = legs.shape if lead_read.ran else _served_shape(input, brief) + shape = legs.shape if lead_ran else _served_shape(input, brief) note_budget_shape(shape) tokens += estimate_json_tokens(hierarchy) if hierarchy else 0 trace_run_id = _symbol_trace( @@ -1130,7 +1128,7 @@ async def handle_code_symbol( picked_by=picked_by or None, shape=shape or None, lead=False if not input.lead else None, - lead_unread=code_lead.unread_of(lead_read.entries) or None, + lead_unread=code_lead.unread_of(lead_rows) or None, ), ) set_code_span_attributes( @@ -1142,7 +1140,7 @@ async def handle_code_symbol( abstain=not budgeted, retrieval_risk="low" if budgeted else "abstain", consumer=input.consumer, - lead_unread=code_lead.unread_of(lead_read.entries) or None, + lead_unread=code_lead.unread_of(lead_rows) or None, ) return CodeSymbolOutput( lead=lead, From 774a47daeed5048e0c86dbf57de006d912efd318 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Thu, 3 Dec 2026 14:20:54 +0530 Subject: [PATCH 25/30] Name the best-effort claim a statement holds `claim` The local in `_with_retry` was `held`, the same name as the `BestEffortClaim.held` flag it carries. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/core/ch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/core/ch.py b/server/core/ch.py index 3e2ee63ce14..6f1216a22b6 100644 --- a/server/core/ch.py +++ b/server/core/ch.py @@ -1322,7 +1322,7 @@ async def _with_retry( # type: ignore[no-untyped-def] retried batch lands once); a replica-bound server error gets up to two more connections; a class deadline and every other error raise at once.""" self._ensure_state() - held = await self._hold_best_effort(op_name) + claim = await self._hold_best_effort(op_name) session = _coordination_session.get() took = False if session is not None: @@ -1346,9 +1346,9 @@ async def _with_retry( # type: ignore[no-untyped-def] session.inflight -= 1 if took: self._release_slot() - if held is not None: - held.slots.in_use -= 1 - held.width.release() + if claim is not None: + claim.slots.in_use -= 1 + claim.width.release() async def _hold_best_effort(self, op_name: str) -> BestEffortClaim | None: """Count a statement of a `best_effort()` block against its kind's slots, once one From 83778661cdfb4800fb92bdbb0f9c60410e97f387 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Fri, 4 Dec 2026 13:49:27 +0530 Subject: [PATCH 26/30] A lead leg that did not answer is noted with degradations.partial The note is the handler's own step, so it goes through partial, and a failed leg passes its error, which degraded shows as for any other note: a Loom error's code and message, another error's kind. The transports now put the request's notes on every response, so the docstring and the feature page say the response's degraded names the leg. A scan fails on any note(..., health=False) left in server/. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 5 +++ server/code/app/lead.py | 18 ++++++---- tests/unit/test_code_lead.py | 15 ++++++++ tests/unit/test_degraded_unnoted.py | 49 ++++++++++++++++++++------ 4 files changed, 70 insertions(+), 17 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 9539fb9cd84..055e177f956 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -155,6 +155,11 @@ served: - `ambiguous`: the op refused an ambiguous name. - `unresolved`: the op did not resolve the definition. +The response's [`degraded`](../../reference/http-api.md#degraded-answers) names +each answer that read `deadline`, `busy`, `failed` or `policy`, as +`code.symbol: lead_tested_unread (deadline)`; a `failed` one names the error the +op raised. + The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When less than 0.1 s is left for the answers, none starts and the block is left out, so the call keeps the diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 7ac1730bf28..2e6321a58a4 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -47,8 +47,10 @@ - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. A leg that did not answer reads `{"unread": why}` in the entry and is named in the -`lead_unread` trace argument and span attribute. Each kind is also noted on the request's -degradations list, kept out of provider health; no code op's response carries that list. +`lead_unread` trace argument and span attribute. One that did not answer for the +request's own shortfall (`deadline`, `busy`, `failed`, `policy`) is also named in the +response's `degraded` (`code.symbol: lead_tested_unread (deadline)`) by +`degradations.partial`: it is the handler's own step, which provider health does not count. The block is small by construction: per leg a few counts and at most `LEAD_ROWS` rows, each with a path. """ @@ -403,14 +405,16 @@ def _unshaped() -> Iterator[None]: ch.caller_shaped_var.reset(shaped) -def _answer(task: asyncio.Future[dict[str, Any]]) -> tuple[dict[str, Any], str]: - """(the leg's entry, why it did not answer when that is a degradation, else '').""" +def _answer(task: asyncio.Future[dict[str, Any]]) -> tuple[dict[str, Any], str | BaseException]: + """(the leg's entry, why it did not answer when that is a degradation: the error a + failed leg raised, which the note shows as a caller may see it, or the `unread` kind; + else '').""" if task.cancelled(): return {"unread": "deadline"}, "deadline" error = task.exception() if error is not None: logger.info("code lead leg failed", exc_info=error) - return {"unread": "failed"}, type(error).__name__ + return {"unread": "failed"}, error entry = task.result() unread = str(entry.get("unread") or "") return entry, unread if unread in _DEGRADED else "" @@ -510,7 +514,7 @@ async def definition_leads( entry = {k: picked[k] for k in ("symbol", "path", "line")} for name, task in tasks.items(): entry[name], why = _answer(task) - if why: - degradations.note(op_name, f"lead_{name}_unread", why, health=False) + if why != "": + degradations.partial(op_name, f"lead_{name}_unread", why) ran = any(c.held for c in claims.values()) or any(t.cancelled() for t in tasks.values()) return Block([entry], ran) diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index 6ccaea6c623..de0901c1eba 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -377,6 +377,21 @@ def test_a_leg_past_the_wall_or_failed_says_so_and_notes_a_degradation(monkeypat assert lead.unread_of(out) == "tested:failed,changed_by:deadline" +def test_a_failed_leg_is_noted_as_degraded_names_an_error(monkeypatch): + """A Loom error by its code and message, which are written for callers, and kept out + of provider health: the leg is a handler's step (`degradations.partial`).""" + from server.core.errors import BackendUnavailableError + from server.observability import provider_health + + recorded: list[str] = [] + monkeypatch.setattr(provider_health, "record_failure", lambda p, *a, **k: recorded.append(p)) + ops = _Ops(**{"code.coverage_claim": BackendUnavailableError("ClickHouse is down")}) + out, notes = _run_leads(monkeypatch, ops) + assert out[0]["tested"] == {"unread": "failed"} + assert notes == ["code.symbol: lead_tested_unread (BACKEND_UNAVAILABLE: ClickHouse is down)"] + assert recorded == [] + + def test_a_leg_with_no_slot_free_reads_busy_even_when_its_op_swallowed_it(monkeypatch): def swallowed(query: Any) -> Any: # an op that caught the BusyError and answered without the read diff --git a/tests/unit/test_degraded_unnoted.py b/tests/unit/test_degraded_unnoted.py index a0820515b79..dccc8df1850 100644 --- a/tests/unit/test_degraded_unnoted.py +++ b/tests/unit/test_degraded_unnoted.py @@ -324,17 +324,34 @@ def test_every_broad_handler_notes_its_fallback_or_says_why_it_need_not() -> Non ) -def _health_notes(tree: ast.AST) -> list[tuple[int, str | None]]: - """(line, provider literal or None) of each `degradations.note` that feeds provider - health (no `health=False`).""" - out: list[tuple[int, str | None]] = [] +@functools.cache +def _server_trees() -> dict[str, ast.Module]: + return { + str(p.relative_to(REPO_ROOT)): ast.parse(p.read_text()) + for p in (REPO_ROOT / "server").rglob("*.py") + } + + +def _note_calls(tree: ast.AST) -> list[tuple[ast.Call, bool]]: + """Each `degradations.note` call, and whether it feeds provider health (no + `health=False`).""" + out: list[tuple[ast.Call, bool]] = [] for n in ast.walk(tree): if not (isinstance(n, ast.Call) and isinstance(n.func, ast.Attribute)): continue if n.func.attr != "note" or not _is_degradations(n.func.value): continue health = next((k.value for k in n.keywords if k.arg == "health"), None) - if isinstance(health, ast.Constant) and health.value is False: + out.append((n, not (isinstance(health, ast.Constant) and health.value is False))) + return out + + +def _health_notes(tree: ast.AST) -> list[tuple[int, str | None]]: + """(line, provider literal or None) of each `degradations.note` that feeds provider + health.""" + out: list[tuple[int, str | None]] = [] + for n, health in _note_calls(tree): + if not health: continue first = n.args[0] if n.args else None literal = first.value if isinstance(first, ast.Constant) else None @@ -342,7 +359,7 @@ def _health_notes(tree: ast.AST) -> list[tuple[int, str | None]]: return out -def _cleared_by_success(trees: dict[str, ast.AST]) -> set[str]: +def _cleared_by_success(trees: dict[str, ast.Module]) -> set[str]: """The provider names a `record_success("")` call clears.""" names: set[str] = set() for tree in trees.values(): @@ -358,10 +375,7 @@ def test_a_fallback_counted_in_provider_health_names_a_provider_a_success_clears later success clears it. A note that feeds that state names a provider that also records its successes; a store read or a handler's step uses `partial`, or it would read failing for the whole window after one fallback.""" - trees = { - str(p.relative_to(REPO_ROOT)): ast.parse(p.read_text()) - for p in (REPO_ROOT / "server").rglob("*.py") - } + trees = _server_trees() cleared = _cleared_by_success(trees) bad = [ f"{rel}:{line} {provider!r}" @@ -372,3 +386,18 @@ def test_a_fallback_counted_in_provider_health_names_a_provider_a_success_clears assert not bad, "health-counted notes no success clears (use degradations.partial):\n" + ( "\n".join(bad) ) + + +def test_a_fallback_kept_out_of_provider_health_is_noted_with_partial() -> None: + """`partial` is the one spelling of a note provider health does not count (a store + read, a handler's step, a provider whose client counted the failure), so a reader and + the scan above find every such note by one name.""" + bad = [ + f"{rel}:{n.lineno}" + for rel, tree in _server_trees().items() + for n, health in _note_calls(tree) + if not health + ] + assert not bad, "notes spelled note(..., health=False) (use degradations.partial):\n" + ( + "\n".join(bad) + ) From 9f0f2d983bd4f3aa99089d6f53e9ce0ef566897c Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Fri, 4 Dec 2026 14:21:15 +0530 Subject: [PATCH 27/30] A lead leg cut by the call's budget or denied by policy is not listed in degraded A leg cut by the lead wall or by the call's deadline_ms is the call's own budget working, and a policy deny is the operator's rule working, so neither is a fallback. Each still reads `unread: deadline` or `unread: policy` in the entry, lead_unread and the span. A failed leg, and a busy one that the lead's fixed share of the pool left unread, are still listed. Two cases pin the code.grep lessons bound under the lead shape. The tracker binding gate holds only its row_reach read in shared_work. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 7 ++-- server/code/app/lead.py | 18 +++++----- server/tracker/app/binding.py | 8 ++--- tests/unit/test_code_lead.py | 47 +++++++++++++++++++------- tests/unit/test_code_result_lessons.py | 26 +++++++++++--- 5 files changed, 74 insertions(+), 32 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index 055e177f956..bb46503a4dc 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -156,9 +156,10 @@ served: - `unresolved`: the op did not resolve the definition. The response's [`degraded`](../../reference/http-api.md#degraded-answers) names -each answer that read `deadline`, `busy`, `failed` or `policy`, as -`code.symbol: lead_tested_unread (deadline)`; a `failed` one names the error the -op raised. +each answer that read `busy` or `failed`, as +`code.symbol: lead_tested_unread (busy)`; a `failed` one names the error the op +raised. The other kinds are not listed: each is a limit of the call working (its +budget or `deadline_ms`, a policy rule, the index's answer), not a fallback. The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When less than 0.1 s is left diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 2e6321a58a4..ef72efc3baf 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -47,10 +47,11 @@ - The legs run their ops' own reads, never under code.grep's caller-shaped ceilings. A leg that did not answer reads `{"unread": why}` in the entry and is named in the -`lead_unread` trace argument and span attribute. One that did not answer for the -request's own shortfall (`deadline`, `busy`, `failed`, `policy`) is also named in the -response's `degraded` (`code.symbol: lead_tested_unread (deadline)`) by -`degradations.partial`: it is the handler's own step, which provider health does not count. +`lead_unread` trace argument and span attribute. The response's `degraded` names it too +(`code.symbol: lead_tested_unread (busy)`) only when a failure or a fixed server-side +bound left it unread: a cut by the call's own budget or a rule's deny is that limit +working, not a fallback. The note is `degradations.partial`, since it is the handler's +own step, which provider health does not count. The block is small by construction: per leg a few counts and at most `LEAD_ROWS` rows, each with a path. """ @@ -123,9 +124,10 @@ "type", } ) -# Why a leg did not answer, when that is the request's shortfall (a degradation) rather -# than the index's answer about the name (`ambiguous`, `unresolved`). -_DEGRADED = frozenset({"deadline", "failed", "busy", "policy"}) +# The `unread` kinds `degraded` lists: a fallback, where a failure or a fixed server-side +# bound (the lead's share of the pool) left the leg unread. Any other is a limit of the +# call working: its own budget, the operator's rule, the index's answer about the name. +_DEGRADED = frozenset({"failed", "busy"}) def lead_slots() -> int: @@ -410,7 +412,7 @@ def _answer(task: asyncio.Future[dict[str, Any]]) -> tuple[dict[str, Any], str | failed leg raised, which the note shows as a caller may see it, or the `unread` kind; else '').""" if task.cancelled(): - return {"unread": "deadline"}, "deadline" + return {"unread": "deadline"}, "" error = task.exception() if error is not None: logger.info("code lead leg failed", exc_info=error) diff --git a/server/tracker/app/binding.py b/server/tracker/app/binding.py index 994db8b439a..08002cec00a 100644 --- a/server/tracker/app/binding.py +++ b/server/tracker/app/binding.py @@ -290,10 +290,10 @@ async def _gated(org: str, code_namespace: str, ns: str, *, hides_answer: bool) standard = target is not None and not target.restricted with shared_work(): verdict = await row_reach(org, code_namespace if standard else ns, Role.VIEWER) - if verdict is None and hides_answer: - note_answered_unverified() - elif verdict is None: - degradations.partial("identity", "tracker_unverified") + if verdict is None and hides_answer: + note_answered_unverified() + elif verdict is None: + degradations.partial("identity", "tracker_unverified") return bool(verdict) except Exception as e: # noqa: BLE001 — the binding gate fails closed on any error degradations.partial("identity", "tracker_gate_unchecked", e) diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index de0901c1eba..ffe56e4c6e7 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -2,7 +2,8 @@ definition, callers through overrides, test coverage and the PRs that changed it, compacted from code.callers, code.coverage_claim and code.symbol_history. The legs run at once under the op's `lead` budget as best-effort ClickHouse work; a leg that did not -answer says why and notes a degradation.""" +answer says why, and `degraded` lists one that the lead's share of the pool or a failure +left unread.""" from __future__ import annotations @@ -364,16 +365,15 @@ async def go() -> dict[str, int]: assert "resolve" not in stages and stages["tested"] >= 45 -def test_a_leg_past_the_wall_or_failed_says_so_and_notes_a_degradation(monkeypatch): +def test_a_leg_past_the_wall_reads_deadline_and_only_a_failed_one_is_listed(monkeypatch): + """The wall is the call's own budget, so a leg it cut is its budget working: named in + the entry and the trace, not in `degraded`. A leg that raised is listed.""" ops = _Ops(**{"code.coverage_claim": RuntimeError("down"), "code.symbol_history": "hang"}) out, notes = _run_leads(monkeypatch, ops, wall=0.2) (entry,) = out assert entry["tested"] == {"unread": "failed"} assert entry["changed_by"] == {"unread": "deadline"} - assert notes == [ - "code.symbol: lead_tested_unread (RuntimeError)", - "code.symbol: lead_changed_by_unread (deadline)", - ] + assert notes == ["code.symbol: lead_tested_unread (RuntimeError)"] assert lead.unread_of(out) == "tested:failed,changed_by:deadline" @@ -409,7 +409,9 @@ def swallowed(query: Any) -> Any: ] -def test_a_leg_the_history_policy_denies_reads_policy(monkeypatch): +def test_a_leg_the_history_policy_denies_reads_policy_and_is_not_listed(monkeypatch): + """A deny is the operator's rule working, not a fallback: the entry and the trace name + it, `degraded` does not.""" from server.identity.app import policy_gate from server.identity.domain.policy_rules import PolicyDecision @@ -431,7 +433,7 @@ async def gate(op, identity, raw_args, *, request_id=""): assert all(i["org"] == "o" and i["namespace"] == "n" and i["agent"] == "a" for _, i in gated) assert out[0]["changed_by"] == {"unread": "policy"} assert "callers" in out[0] and "unread" not in out[0]["callers"] - assert notes == ["code.symbol: lead_changed_by_unread (policy)"] + assert lead.unread_of(out) == "changed_by:policy" and notes == [] def test_the_legs_statements_stop_near_the_wall_outside_caller_shaped_ceilings(monkeypatch): @@ -1659,17 +1661,20 @@ def _grep_then_lessons( before_legs_s: float = 0.0, after_legs_s: float = 0.0, auth: Any = None, + notes: list[str] | None = None, **fields: Any, ) -> tuple[Any, str, float]: """A code.grep with `fields`, as `auth`, whose handler runs `before_legs_s` of other - reads, `_grep_lead` over the legs of `ops`, then `after_legs_s` of other work, and whose - lessons read answers one lesson after `lessons_s`: (the answer, the shape it is priced - by, its seconds). It runs on a manual clock that moves only while every task waits, so - the seconds are exact.""" + reads, `_grep_lead` over the legs of `ops` within its `deadline_ms`, then `after_legs_s` + of other work, and whose lessons read answers one lesson after `lessons_s`: (the answer, + the shape it is priced by, its seconds), and the request's `degraded` notes in `notes`. + It runs on a manual clock that moves only while every task waits, so the seconds are + exact.""" import time from server.auth.context import set_current_auth from server.code.app import grep, result_lessons + from server.code.domain import deadline as code_deadline from server.core import request_work from server.observability.budget_shape import current_budget_shape from tests.unit.clock_fake import idle_time @@ -1694,9 +1699,10 @@ async def lessons(*a: Any, **k: Any) -> Any: monkeypatch.setattr(result_lessons.path_lessons, "lessons_for_paths", lessons) async def handler(input: CodeGrepInput) -> CodeGrepOutput: + budget = code_deadline.start(input.deadline_ms, started=clock()) await asyncio.sleep(before_legs_s) block = await grep._grep_lead( - "o", "n", input, {"definitions": [_GREP_DEF]}, clock(), None, 0, "" + "o", "n", input, {"definitions": [_GREP_DEF]}, clock(), budget, 0, "" ) await asyncio.sleep(after_legs_s) return CodeGrepOutput(matches=[], chunks_matched=0, lead=block) @@ -1705,10 +1711,13 @@ async def handler(input: CodeGrepInput) -> CodeGrepOutput: async def go() -> tuple[Any, str, float]: set_current_auth(auth) # in the runner's context, so it ends with the run + degradations.begin() bag = request_work.begin() bag.began = bag.last_mark = clock() # its field defaults read the real clock query = CodeGrepInput(org="o", namespace="n", pattern="parseInput(", **fields) out = await wrapped(query) + if notes is not None: + notes.extend(degradations.current()) return out, current_budget_shape(), clock() - bag.began with asyncio.Runner() as runner, idle_time(runner.get_loop(), clock): @@ -1736,6 +1745,18 @@ def test_a_grep_whose_legs_run_to_the_wall_still_serves_a_lessons_read_of_0_3_s( assert out.lessons == [{"memory_id": "m1"}] and took == pytest.approx(0.3 + 0.3) +def test_a_grep_leg_cut_by_the_callers_deadline_reads_deadline_and_is_not_listed(monkeypatch): + """`deadline_ms: 700` less the lessons read's 0.5 s bound caps the legs at 0.2 s, under + the 0.5 s the `lead` budget leaves them: the cut is the call's own deadline working.""" + notes: list[str] = [] + out, shape, took = _grep_then_lessons( + monkeypatch, _Ops(**_HANG), multiplier=1.0, lessons_s=0.0, deadline_ms=700, notes=notes + ) + assert shape == lead.LEAD_SHAPE and took == pytest.approx(0.2) + assert {out.lead[0][leg]["unread"] for leg in lead.LEGS} == {"deadline"} + assert out.lessons == [{"memory_id": "m1"}] and notes == [] + + @pytest.mark.parametrize("caller", ["include_lessons: false", "a narrowed token"]) def test_a_grep_that_reads_no_lessons_gives_its_legs_the_whole_wall(monkeypatch, caller): """A grep whose lessons read will not run holds back `RESERVE_S`, not that read's diff --git a/tests/unit/test_code_result_lessons.py b/tests/unit/test_code_result_lessons.py index 3fb2c7c7366..8ca9dc7ae9b 100644 --- a/tests/unit/test_code_result_lessons.py +++ b/tests/unit/test_code_result_lessons.py @@ -1095,13 +1095,17 @@ async def test_unlimited_lessons_keep_all_selected_rows(monkeypatch: pytest.Monk @pytest.mark.asyncio @pytest.mark.parametrize("other_file", ["slow", "failing"]) -@pytest.mark.parametrize("bound", ["fixed", "deadline"]) +@pytest.mark.parametrize("bound", ["fixed", "deadline", "lead budget", "lead, fixed bound"]) async def test_a_file_whose_lessons_are_missing_is_noted_unless_the_deadline_cut_it( monkeypatch: pytest.MonkeyPatch, other_file: str, bound: str ) -> None: """A failed file read is noted; a slow one is noted when the fixed bound cut it (the - store answered slowly), not when what was left of the call's deadline did.""" + store answered slowly), not when what was left of the call's deadline did, or of the + `lead` budget of a code.grep priced by its block, which counts as the call's own.""" + from server.code.app.lead import LEAD_SHAPE + from server.core import request_work from server.observability import degradations + from server.observability.budget_shape import note_budget_shape async def _nss(org: str, code_ns: str, extra: list[str]) -> list[str]: return ["code-repo"] @@ -1122,17 +1126,31 @@ async def _rows(inp: Any) -> tuple[list[dict[str, Any]], bool]: if bound == "fixed": monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.05) inp = _input(deadline_ms=0) - else: + elif bound == "deadline": monkeypatch.setattr(settings, "code_enrich_timeout_s", 5.0) inp, started = _input(deadline_ms=1000), started - 0.9 # about 0.1 s left + else: + # a code.grep priced by its `lead` block, 1000 ms here; the test's context ends both + monkeypatch.setattr(settings, "latency_budget_multiplier", 1.0) + monkeypatch.setattr(settings, "latency_budget_overrides", "") + note_budget_shape(LEAD_SHAPE) + bag = request_work.begin() + inp = CodeGrepInput(org="acme", namespace="code-repo", pattern="parse") + if bound == "lead budget": + monkeypatch.setattr(settings, "code_enrich_timeout_s", 5.0) + bag.began -= 0.9 # about 0.1 s left of it + else: + # the whole budget left, more than the fixed bound + monkeypatch.setattr(settings, "code_enrich_timeout_s", 0.05) degradations.begin() found = await result_lessons.lessons_for(inp, ["a.py", "b.py"], started) assert [row["memory_key"] for row in found.rows] == ["notes/known"] + fixed = bound in ("fixed", "lead, fixed bound") noted = { "failing": ["code_lessons: file_lessons_dropped (RuntimeError)"], - "slow": ["code_lessons: file_lessons_dropped (TimeoutError)"] if bound == "fixed" else [], + "slow": ["code_lessons: file_lessons_dropped (TimeoutError)"] if fixed else [], }[other_file] assert degradations.current() == noted From 21ed0f2d0d977ddace44c97be561f035a3aea21d Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Fri, 4 Dec 2026 14:45:53 +0530 Subject: [PATCH 28/30] lead: degraded lists a busy leg; a failed one is noted with its error Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/code/app/lead.py | 9 +++++---- tests/unit/test_code_lead.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index ef72efc3baf..6be768eb105 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -124,10 +124,11 @@ "type", } ) -# The `unread` kinds `degraded` lists: a fallback, where a failure or a fixed server-side -# bound (the lead's share of the pool) left the leg unread. Any other is a limit of the -# call working: its own budget, the operator's rule, the index's answer about the name. -_DEGRADED = frozenset({"failed", "busy"}) +# The `unread` kind `degraded` lists: a fixed server-side bound (the lead's share of the +# pool, or a full pool) left the leg unread. `_answer` notes a failed leg with its error. +# Any other kind is a limit of the call working: its own budget, the operator's rule, the +# index's answer about the name. +_DEGRADED = frozenset({"busy"}) def lead_slots() -> int: diff --git a/tests/unit/test_code_lead.py b/tests/unit/test_code_lead.py index ffe56e4c6e7..d0cfad54490 100644 --- a/tests/unit/test_code_lead.py +++ b/tests/unit/test_code_lead.py @@ -2,8 +2,8 @@ definition, callers through overrides, test coverage and the PRs that changed it, compacted from code.callers, code.coverage_claim and code.symbol_history. The legs run at once under the op's `lead` budget as best-effort ClickHouse work; a leg that did not -answer says why, and `degraded` lists one that the lead's share of the pool or a failure -left unread.""" +answer says why, and `degraded` lists one that a failure, the lead's share of the pool +or a full pool left unread.""" from __future__ import annotations From 6447f5221b7a39dad75a94d49d7ec3fbed13bebf Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Fri, 4 Dec 2026 14:52:14 +0530 Subject: [PATCH 29/30] lead: say each unlisted kind is a limit working, without a list Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- docs/features/code-index/operations.md | 3 +-- server/code/app/lead.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/features/code-index/operations.md b/docs/features/code-index/operations.md index bb46503a4dc..08064f281ba 100644 --- a/docs/features/code-index/operations.md +++ b/docs/features/code-index/operations.md @@ -158,8 +158,7 @@ served: The response's [`degraded`](../../reference/http-api.md#degraded-answers) names each answer that read `busy` or `failed`, as `code.symbol: lead_tested_unread (busy)`; a `failed` one names the error the op -raised. The other kinds are not listed: each is a limit of the call working (its -budget or `deadline_ms`, a policy rule, the index's answer), not a fallback. +raised. The other kinds are not listed: each is a limit working, not a fallback. The uses brief and the definitions are fitted to `token_budget` first; a block that does not fit what they leave is withheld whole. When less than 0.1 s is left diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 6be768eb105..0c30962c3c7 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -125,9 +125,8 @@ } ) # The `unread` kind `degraded` lists: a fixed server-side bound (the lead's share of the -# pool, or a full pool) left the leg unread. `_answer` notes a failed leg with its error. -# Any other kind is a limit of the call working: its own budget, the operator's rule, the -# index's answer about the name. +# pool, or a full pool) left the leg unread. A failed leg is noted with the error `_answer` +# returns; every other kind is a limit working, not a fallback. _DEGRADED = frozenset({"busy"}) From aae84489d2ece3aa149da3bfa319c5d020a582c1 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Fri, 4 Dec 2026 14:57:27 +0530 Subject: [PATCH 30/30] lead: the docstring states the degraded rule without a partial list Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lareb Zafar --- server/code/app/lead.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/code/app/lead.py b/server/code/app/lead.py index 0c30962c3c7..2b1b6c9f466 100644 --- a/server/code/app/lead.py +++ b/server/code/app/lead.py @@ -49,9 +49,9 @@ A leg that did not answer reads `{"unread": why}` in the entry and is named in the `lead_unread` trace argument and span attribute. The response's `degraded` names it too (`code.symbol: lead_tested_unread (busy)`) only when a failure or a fixed server-side -bound left it unread: a cut by the call's own budget or a rule's deny is that limit -working, not a fallback. The note is `degradations.partial`, since it is the handler's -own step, which provider health does not count. +bound left it unread; every other kind is a limit working, not a fallback. The note is +`degradations.partial`, since it is the handler's own step, which provider health does +not count. The block is small by construction: per leg a few counts and at most `LEAD_ROWS` rows, each with a path. """