diff --git a/changelog.d/run-leaderboard.added.md b/changelog.d/run-leaderboard.added.md index 652d6f42..a4390285 100644 --- a/changelog.d/run-leaderboard.added.md +++ b/changelog.d/run-leaderboard.added.md @@ -1 +1 @@ -- **`experiment_run.get_run_leaderboard`: run leaderboard declared on an experiment-run reference, paginated; the analytics-path GET deprecated (additive, contract only).** `GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard` (operation id `experiment_run.get_run_leaderboard`) takes the server-issued reference `^experiment_run_[0-9a-f]{32}$` and the explicit project. Query: `limit` (default 20, maximum 100; this replaces the backend's historical default 50 and maximum 200 of the query), `cursor` (opaque sealed string, at most 512 base64url characters, bound to caller, project, run and query) and the backend's own `objective` (`weighted` default, `quality`, `cost`, `latency`), `weights` and `constraints` (JSON-object strings, at most 50 keys, bounded here to 8192 characters) and `request_count` (1 to 1000000, default 1); every other parameter, including retired `page` and `offset`, is the closed 400. The 200 is the new `analytics/experiment_run_leaderboard_response_schema.json`: `data` carries `run_id` (the experiment_run_ref), `ranking_basis` (`objective`, `weights`, `constraints`), `items`, `warnings` and `pagination` (`limit`, `next_cursor` nullable, `has_more` true if and only if `next_cursor` is non-null, required integer `total`), mirroring the backend leaderboard computation. Each item has `rank`, `trial_ref`, `composite_score`, `measures`, `confidence`, `risk_flags` and `recommendation`. The ranking is computed over the full eligible population and only then paginated: non-disqualified first, descending composite score, ranks assigned after that order, so `rank` is unique across pages. The cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503). The cursor also seals the `analysis_revision` (a per-run monotonic counter bumped in the same transaction as any ranking-relevant configuration or metric write, read from the same snapshot as the ranked rows); a stale or foreign cursor is the closed 400 `invalid_cursor`, echoing nothing. Measure values and scores are any finite JSON number; `warnings` are the builder's four forms and `risk_flags` its four tags. The 1 MiB limit is enforced on the serialized envelope (closed 503); the schema gives no static byte bound. Canonical projection omits config_id: internal configuration-run id (replaced by the shared persisted `trial_ref`, `^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$` (both issued formats), via `experiment_run_trial_ref_schema.json`; a run with any unissued reference is the closed 503). Canonical projection omits label: the builder falls back to `Trial `, which embeds the internal id. `data.run_id` is the experiment_run_ref. Errors are the closed problems of `analytics/leaderboard_problem_schema.json`. `GET /api/v1/analytics/runs/{run_id}/leaderboard` stays declared, marked `deprecated` and naming the successor; its project beta mount `/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/leaderboard` retires with it. `run_leaderboard_schema.json` and `run_leaderboard_response_schema.json` are unchanged. Removal follows the backend retirement PR after the client receipt. One name policy `^[^\x00-\x1f\x7f]{1,128}$` for every measure name wherever echoed (a query key outside it is the closed 400, a stored metric name outside it the closed 503 for the run); each weight is a number in [0, 1000] (a negative or larger weight is the closed 400, replacing the builder's silent exclusion of negative weights) and the composite is computed over weights normalized to sum to 1, so it is finite. At least one weight must be greater than 0 when weights is given (all-zero, e.g. `{"accuracy": 0}`, is the closed 400 with no echo; omitting weights keeps the default objective path). Each measure's min-max normalization is computed without overflow (values scaled by the largest absolute finite value before subtracting, or an equivalent exact method), so equal values score equal; the composite is a convex combination of normalized terms in [0, 1]. The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic). The positive-weight rule applies only to a weights map supplied in the request; the response's effective `ranking_basis.weights` may be empty. The response description names both issued `trial_ref` formats. +- **`experiment_run.get_run_leaderboard`: run leaderboard declared on an experiment-run reference, paginated; the analytics-path GET deprecated (additive, contract only).** `GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard` (operation id `experiment_run.get_run_leaderboard`) takes the server-issued reference `^experiment_run_[0-9a-f]{32}$` and the explicit project. Query: `limit` (default 20, maximum 100; this replaces the backend's historical default 50 and maximum 200 of the query), `cursor` (opaque sealed string, at most 512 base64url characters, bound to caller, project, run and query) and the backend's own `objective` (`weighted` default, `quality`, `cost`, `latency`), `weights` and `constraints` (JSON-object strings, at most 50 keys, bounded here to 8192 characters) and `request_count` (1 to 1000000, default 1); every other parameter, including retired `page` and `offset`, is the closed 400. The 200 is the new `analytics/experiment_run_leaderboard_response_schema.json`: `data` carries `run_id` (the experiment_run_ref), `ranking_basis` (`objective`, `weights`, `constraints`), `items`, `warnings` and `pagination` (`limit`, `next_cursor` nullable, `has_more` true if and only if `next_cursor` is non-null, required integer `total`), mirroring the backend leaderboard computation. Each item has `rank`, `trial_ref`, `composite_score`, `measures`, `confidence`, `risk_flags` and `recommendation`. The ranking is computed over the full eligible population and only then paginated: non-disqualified first, descending composite score, ranks assigned after that order, so `rank` is unique across pages. The cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503). The cursor also seals the `analysis_revision` (a per-run monotonic counter the backend increments in the same transaction as any insert or delete of the run's configuration rows, and any update that changes a configuration row's analysis content (its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it, read from the same snapshot as the ranked rows); a stale or foreign cursor is the closed 400 `invalid_cursor`, echoing nothing. Measure values and scores are any finite JSON number; `warnings` are the builder's four forms and `risk_flags` its four tags. The 1 MiB limit is enforced on the serialized envelope (closed 503); the schema gives no static byte bound. Canonical projection omits config_id: internal configuration-run id (replaced by the shared persisted `trial_ref`, `^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$` (both issued formats), via `experiment_run_trial_ref_schema.json`; a run with any unissued reference is the closed 503). Canonical projection omits label: the builder falls back to `Trial `, which embeds the internal id. `data.run_id` is the experiment_run_ref. Errors are the closed problems of `analytics/leaderboard_problem_schema.json`. `GET /api/v1/analytics/runs/{run_id}/leaderboard` stays declared, marked `deprecated` and naming the successor; its project beta mount `/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/leaderboard` retires with it. `run_leaderboard_schema.json` and `run_leaderboard_response_schema.json` are unchanged. Removal follows the backend retirement PR after the client receipt. One name policy `^[^\x00-\x1f\x7f]{1,128}$` for every measure name wherever echoed (a query key outside it is the closed 400, a stored metric name outside it the closed 503 for the run); each weight is a number in [0, 1000] (a negative or larger weight is the closed 400, replacing the builder's silent exclusion of negative weights) and the composite is computed over weights normalized to sum to 1, so it is finite. At least one weight must be greater than 0 when weights is given (all-zero, e.g. `{"accuracy": 0}`, is the closed 400 with no echo; omitting weights keeps the default objective path). Each measure's min-max normalization is computed without overflow (values scaled by the largest absolute finite value before subtracting, or an equivalent exact method), so equal values score equal; the composite is a convex combination of normalized terms in [0, 1]. The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic). The positive-weight rule applies only to a weights map supplied in the request; the response's effective `ranking_basis.weights` may be empty. The response description names both issued `trial_ref` formats. diff --git a/changelog.d/run-pareto.added.md b/changelog.d/run-pareto.added.md index 7ce9013a..881c8067 100644 --- a/changelog.d/run-pareto.added.md +++ b/changelog.d/run-pareto.added.md @@ -1 +1 @@ -- **`experiment_run.get_run_pareto`: run Pareto analysis declared on an experiment-run reference, paginated; the analytics-path GET deprecated (additive, contract only).** `metrics` keys use the shared measure-name class `^[^\x00-\x1f\x7f]{1,100}$` (the same as `x_measure` and `y_measure`, so names such as `review score` are valid); a stored metric name outside it makes the run's response the closed 503, never truncated or sanitized. The shared `trial_ref` accepts both issued formats, `trial_` plus 16 hex and `configuration_run_` plus 32 hex; every pattern in the report and Pareto schemas and in their query and path parameters ends in `$` (not the absolute end `(?![\s\S])`, because Pydantic v2's rust-regex engine refuses lookahead; trailing-newline hardening is applied by the Python-side validators). The cursor seals caller, project, run, query and `analysis_revision` (a per-run monotonic counter the backend increments in the same transaction as any insert, update or delete of the run's configuration rows or their metrics); a stale or foreign cursor is the closed 400 `invalid_cursor` (declared in the problem schema). Frontier ties break by ascending `trial_ref` (lexicographic) before ranks are assigned; dominated entries are ordered by ascending `trial_ref` (lexicographic). The 10000 cap counts ALL scoped configuration rows before any metric processing (above it the closed 503). Metric values are any finite JSON number (the earlier 1e15 bound is removed). `has_more` is true if and only if `next_cursor` is non-null. `warnings` are constrained to the builder's three tag forms. The deprecation names the full beta route `/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/pareto`. `GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto` (operation id `experiment_run.get_run_pareto`) takes the server-issued reference `^experiment_run_[0-9a-f]{32}$` and the explicit project. Query: `limit` (default 20, maximum 100), `cursor` (opaque sealed string, at most 512 base64url characters, bound to caller, project, run and query), and the backend's own `x_measure`, `y_measure` (1-100 characters, defaults `cost` and `quality`) and `request_count` (1 to 1000000, default 1) from the backend's query; every other parameter, including retired `page` and `offset`, is the closed 400. The 200 is the new `analytics/experiment_run_pareto_response_schema.json`: `data` carries `run_id` (the experiment_run_ref), `measures`, `shape`, `knee_ref`, `frontier_total`, `dominated_total`, `warnings`, `items` and `pagination` (`limit`, `next_cursor` nullable, `has_more` and a required integer `total`), mirroring the backend Pareto computation. The ranking, frontier, knee and shape are computed over the full eligible population (at most 10000 configurations; more is the closed 503) and only then paginated, ordered frontier first by ascending rank then dominated, with ascending `trial_ref` (lexicographic) as the stable tie-breaker; the historical 500/1000 truncation is replaced by pagination. At most 100 items per page, metrics at most 5 names. The 1 MiB limit (`x-max-response-bytes` 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 over the limit; the schema gives no static byte bound. Canonical projection omits config_id: internal configuration-run id (replaced by the run-scoped `trial_ref` of `analytics/experiment_run_trial_ref_schema.json`, `^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$`: `trial_ref` is the configuration run's issued public reference (sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in)). Canonical projection omits project_id: the explicit URL project. Canonical projection omits run_id as a historical id: `data.run_id` is the experiment_run_ref. `dominated_by` is a `trial_ref`, never an internal id. The closed schema rejects these properties. Errors are the closed problems of `analytics/pareto_problem_schema.json` (400 malformed reference, limit or query echoing no value, and the closed `invalid_cursor` 400 for any invalid or stale cursor, 401, 403, one identical 404, 429, 500, 503). `GET /api/v1/analytics/runs/{run_id}/pareto` stays declared, marked `deprecated` and naming the successor; its project beta mount retires with it. `run_pareto_schema.json` and `run_pareto_response_schema.json` are unchanged. Removal follows the backend retirement PR after the client receipt. +- **`experiment_run.get_run_pareto`: run Pareto analysis declared on an experiment-run reference, paginated; the analytics-path GET deprecated (additive, contract only).** `metrics` keys use the shared measure-name class `^[^\x00-\x1f\x7f]{1,100}$` (the same as `x_measure` and `y_measure`, so names such as `review score` are valid); a stored metric name outside it makes the run's response the closed 503, never truncated or sanitized. The shared `trial_ref` accepts both issued formats, `trial_` plus 16 hex and `configuration_run_` plus 32 hex; every pattern in the report and Pareto schemas and in their query and path parameters ends in `$` (not the absolute end `(?![\s\S])`, because Pydantic v2's rust-regex engine refuses lookahead; trailing-newline hardening is applied by the Python-side validators). The cursor seals caller, project, run, query and `analysis_revision` (a per-run monotonic counter the backend increments in the same transaction as any insert or delete of the run's configuration rows and any update that changes a configuration row's analysis content); a stale or foreign cursor is the closed 400 `invalid_cursor` (declared in the problem schema). Frontier ties break by ascending `trial_ref` (lexicographic) before ranks are assigned; dominated entries are ordered by ascending `trial_ref` (lexicographic). The 10000 cap counts ALL scoped configuration rows before any metric processing (above it the closed 503). Metric values are any finite JSON number (the earlier 1e15 bound is removed). `has_more` is true if and only if `next_cursor` is non-null. `warnings` are constrained to the builder's three tag forms. The deprecation names the full beta route `/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/pareto`. `GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto` (operation id `experiment_run.get_run_pareto`) takes the server-issued reference `^experiment_run_[0-9a-f]{32}$` and the explicit project. Query: `limit` (default 20, maximum 100), `cursor` (opaque sealed string, at most 512 base64url characters, bound to caller, project, run and query), and the backend's own `x_measure`, `y_measure` (1-100 characters, defaults `cost` and `quality`) and `request_count` (1 to 1000000, default 1) from the backend's query; every other parameter, including retired `page` and `offset`, is the closed 400. The 200 is the new `analytics/experiment_run_pareto_response_schema.json`: `data` carries `run_id` (the experiment_run_ref), `measures`, `shape`, `knee_ref`, `frontier_total`, `dominated_total`, `warnings`, `items` and `pagination` (`limit`, `next_cursor` nullable, `has_more` and a required integer `total`), mirroring the backend Pareto computation. The ranking, frontier, knee and shape are computed over the full eligible population (at most 10000 configurations; more is the closed 503) and only then paginated, ordered frontier first by ascending rank then dominated, with ascending `trial_ref` (lexicographic) as the stable tie-breaker; the historical 500/1000 truncation is replaced by pagination. At most 100 items per page, metrics at most 5 names. The 1 MiB limit (`x-max-response-bytes` 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 over the limit; the schema gives no static byte bound. Canonical projection omits config_id: internal configuration-run id (replaced by the run-scoped `trial_ref` of `analytics/experiment_run_trial_ref_schema.json`, `^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$`: `trial_ref` is the configuration run's issued public reference (sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in)). Canonical projection omits project_id: the explicit URL project. Canonical projection omits run_id as a historical id: `data.run_id` is the experiment_run_ref. `dominated_by` is a `trial_ref`, never an internal id. The closed schema rejects these properties. Errors are the closed problems of `analytics/pareto_problem_schema.json` (400 malformed reference, limit or query echoing no value, and the closed `invalid_cursor` 400 for any invalid or stale cursor, 401, 403, one identical 404, 429, 500, 503). `GET /api/v1/analytics/runs/{run_id}/pareto` stays declared, marked `deprecated` and naming the successor; its project beta mount retires with it. `run_pareto_schema.json` and `run_pareto_response_schema.json` are unchanged. Removal follows the backend retirement PR after the client receipt. diff --git a/changelog.d/run-report.added.md b/changelog.d/run-report.added.md index 9724babf..185c189c 100644 --- a/changelog.d/run-report.added.md +++ b/changelog.d/run-report.added.md @@ -1 +1 @@ -- **`experiment_run.get_run_report`: run report declared on an experiment-run reference; the analytics-path GET deprecated (additive, contract only).** `GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report` (operation id `experiment_run.get_run_report`) takes the server-issued reference `^experiment_run_[0-9a-f]{32}$` and the explicit project, with no query parameters. The 200 is the new `analytics/experiment_run_report_response_schema.json`, a closed definition that declares every field the report builder always emits (`generated_at`, `experiment_context`, `methodology`, `example_index_map`, `provenance` with `source_counts`, `max_source_timestamp`, `generator_versions`, rows, insights, warnings). The serialized response is the authority for the 8 MiB limit (`x-max-response-bytes` 8388608); the schema gives no static byte bound. The handler measures the final serialized envelope, sends those same bytes, and returns the closed 503 over the limit. Collection caps are realistic limits: 1000 aggregated rows, 5000 raw example rows (`example_index_map` indexes the displayed rows only), 50 insights computed over the full population, 1000 warnings of at most 512 characters, labels 512 characters. Rows beyond a cap are truncated server-side; `meta.aggregated_results_total` and `meta.raw_example_results_total` (both required integers) carry the untruncated counts. `config_params` follows the sanitizer shapes: depth 3, lists of at most 12 items, strings of at most 128 characters, at most 64 keys per object. `data.provenance.run_id` is required and is the experiment_run_ref (the projection populates it from the resolved reference). Row identity is the opaque run-scoped `trial_ref` (`^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$`, defined once in the new `analytics/experiment_run_trial_ref_schema.json` shared with the Pareto view; `trial_ref` is the configuration run's issued public reference (sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in); shared by aggregate and example rows). `trial_ref` is the persisted configuration_run_ref, not a positional index; `trial_id` (the internal configuration-run id) is rejected. The projection must also scrub internal ids embedded in warnings, insight evidence and fallback labels (backend obligation). Canonical projection omits experiment_context.experiment_id: internal id. Canonical projection omits experiment_context.run_id: internal id. Canonical projection omits provenance.source_endpoints: URLs embed the internal run id. Canonical projection omits report_id: it embeds the internal run id. Canonical projection omits trial_id: internal configuration-run id (replaced by trial_ref). The closed schema rejects these properties. Errors are the closed problems of `analytics/report_problem_schema.json` (400 malformed reference, 401, 403, one identical 404, 429, 500, and 503 when the serialized report is over the limit or cannot be produced, never a partial success). `GET /api/v1/analytics/runs/{run_id}/report` stays declared, marked `deprecated` and naming the successor; its two beta mounts are not declared here and retire with it. The optimization report payload (`report.get_optimization_report_payload`) is a separate contract and unchanged. Removal follows the backend retirement PR after the client receipt. +- **`experiment_run.get_run_report`: run report declared on an experiment-run reference; the analytics-path GET deprecated (additive, contract only).** `GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report` (operation id `experiment_run.get_run_report`) takes the server-issued reference `^experiment_run_[0-9a-f]{32}$` and the explicit project, with no query parameters. The 200 is the new `analytics/experiment_run_report_response_schema.json`, a closed definition that declares every field the report builder always emits (`generated_at`, `experiment_context`, `methodology`, `example_index_map`, `provenance` with `source_counts`, `max_source_timestamp`, `generator_versions`, rows, insights, warnings). The serialized response is the authority for the 8 MiB limit (`x-max-response-bytes` 8388608); the schema gives no static byte bound. The handler measures the final serialized envelope, sends those same bytes, and returns the closed 503 over the limit. Collection caps are realistic limits: 1000 aggregated rows, 5000 raw example rows (`example_index_map` indexes the displayed rows only), 50 insights computed over the full population, 1000 warnings of at most 512 characters, labels 512 characters. Rows beyond a cap are truncated server-side; `meta.aggregated_results_total` and `meta.raw_example_results_total` (both required integers) carry the untruncated counts. `config_params` follows the sanitizer shapes: depth 3, lists of at most 12 items, strings of at most 128 characters, at most 64 keys per object. `data.provenance.run_id` is required and is the experiment_run_ref (the projection populates it from the resolved reference). Row identity is the opaque run-scoped `trial_ref` (`^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$`, defined once in the new `analytics/experiment_run_trial_ref_schema.json` shared with the Pareto view; `trial_ref` is the configuration run's issued public reference (sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in); shared by aggregate and example rows). `trial_ref` is the persisted configuration_run_ref, not a positional index; `trial_id` (the internal configuration-run id) is rejected. The projection must also scrub internal ids embedded in warnings, insight evidence and fallback labels (backend obligation). Canonical projection omits experiment_context.experiment_id: internal id. Canonical projection omits experiment_context.run_id: internal id. Canonical projection omits provenance.source_endpoints: URLs embed the internal run id. Canonical projection omits report_id: it embeds the internal run id. Canonical projection omits trial_id: internal configuration-run id (replaced by trial_ref). The closed schema rejects these properties. Errors are the closed problems of `analytics/report_problem_schema.json` (400 malformed reference, 401, 403, one identical 404, 429, 500, and 503 when the serialized report is over the limit or cannot be produced, never a partial success). `GET /api/v1/analytics/runs/{run_id}/report` stays declared, marked `deprecated` and naming the successor; its two beta mounts are not declared here and retire with it. The optimization report payload (`GET /api/v1/experiment-runs/runs/{run_id}/report-payload`) is a separate contract and unchanged. Removal follows the backend retirement PR after the client receipt. diff --git a/changelog.d/run-view-wording.changed.md b/changelog.d/run-view-wording.changed.md new file mode 100644 index 00000000..15400403 --- /dev/null +++ b/changelog.d/run-view-wording.changed.md @@ -0,0 +1 @@ +- **Experiment-run views: exact wording (descriptions only, no schema change).** The `analysis_revision` rule is stated exactly: the backend increments it in the same transaction as any insert or delete of the run's configuration rows and any update that changes a configuration row's analysis content. The run report states that insights beyond 50 and warnings beyond 1000 are truncated server-side in a deterministic order, that a warning longer than 512 characters is omitted and never cut, and that the server reports the untruncated counts under the optional `meta.insights_total` and `meta.warnings_total` keys (extra keys of the existing open `meta` map, which the schema neither requires nor types as integers). Descriptions no longer cite backend implementation files. diff --git a/parity/python-js-sdk.json b/parity/python-js-sdk.json index 6474b185..e6100078 100644 --- a/parity/python-js-sdk.json +++ b/parity/python-js-sdk.json @@ -399,7 +399,7 @@ "sdk032Surface": "Manifest Python pin advanced from d56e4353 to 6e8e4a54 (origin/develop, the SDK 0.32.0 release candidate) to cover two root exports the js-public-parity gate flagged unclassified on Traigent/Traigent#2861. requirement (traigent.runtime.decorator) is the runtime latency requirement decorator; traigent-js origin/main and origin/develop both export requirement from src/runtime/index.ts and list it in tests/integration/fixtures/api-surface.snapshot.json, so it is classified matched and added to requiredRootExports next to require. SnapshotBindingError (traigent.utils.exceptions) is the typed error of the Python opt-in snapshot store (S0 before dispatch, S1 from the terminal result, online G1); traigent-js has no snapshot store and no export of it (zero occurrences in src or its api-surface snapshot), so it is classified deferred-backlog, Python-only for now with no open JS design and no ticket. Owner may re-bucket." }, "schemaRefresh": { - "lastSchemaFileSha": "5d3e6046e87944acf6a7f3663b9f97e43472ee9db56a7acb380cb25126f000b9", + "lastSchemaFileSha": "b67ecd143e25de91c4347af09316c5c178e0fb24f0f3943ffe16033fb9601d9c", "schemaFileCount": 692, "note": "Auto-stamped by scripts/refresh_parity.py. Do not hand-edit this block." } diff --git a/tests/test_experiment_run_correlations_contract.py b/tests/test_experiment_run_correlations_contract.py index fb11a29d..e90e1f3f 100644 --- a/tests/test_experiment_run_correlations_contract.py +++ b/tests/test_experiment_run_correlations_contract.py @@ -6,6 +6,7 @@ import hashlib import json +import re import pytest from jsonschema import Draft7Validator, FormatChecker @@ -93,7 +94,7 @@ def test_path_parameters_and_ref_pattern(): def test_query_parameters_follow_the_backend_query_model(): - # backend RunCorrelationsQuery: src/shared_infrastructure/schemas/run_analytics.py:79-84 + # the backend correlations query model: # (method enum default pearson, min_sample int ge=2 le=10_000 default 3, extra="forbid"). query = {p["name"]: p for p in OP["parameters"] if p["in"] == "query"} assert set(query) == {"method", "min_sample"} @@ -150,10 +151,9 @@ def test_bad_query_problem_names_and_echoes_nothing(): assert list(v.iter_errors({**_problem("400"), "detail": "min_sample must be >= 2"})) -# builder field set: RunAnalyticsService.correlations (backend -# src/services/analytics/run_analytics_service.py:803-832) returns run_id, method, sample_size, -# measure_correlations, parameter_correlations, warnings. Measure rows x/y/r/p_value/strength are -# built at :874-882, parameter rows parameter/measure/effect/confidence at :919-930. +# builder field set: the backend correlations builder returns run_id, method, sample_size, +# measure_correlations, parameter_correlations, warnings. Measure rows carry x/y/r/p_value/strength, +# parameter rows parameter/measure/effect/confidence. DATA_FIELDS = {"method", "sample_size", "measure_correlations", "parameter_correlations", "warnings"} BUILDER_FIELDS = DATA_FIELDS | {"run_id"} @@ -306,9 +306,9 @@ def test_dimension_cap_and_required_totals(): assert "never truncated or partially analyzed" in OP["description"] assert "before either analysis loop" in OP["description"].lower() assert "work cap of 10000 scoped configuration rows" in OP["description"] - assert "src/schemas/traigent.py:54-63" in OP["description"] + assert "the backend accepts up to 100 search-space parameters" in OP["description"] assert "parses the query strictly" in OP["description"] - assert "query_params.py:64-97" in OP["description"] + assert "unlike the legacy adapter, which drops unknown keys" in OP["description"] and not re.search(r"\.py\b|s[r]c/|\.p" + r"y:\d|:\d+-\d+", OP["description"]) assert "tenant-selector" in OP["responses"]["400"]["description"] @@ -332,7 +332,7 @@ def test_deprecated_path_points_at_the_successor(): assert old["operationId"] == "analytics_runs.get_run_correlations" assert OP_ID in old["description"] assert "{experiment_run_ref}/correlations" in old["description"] - assert "beta" in old["description"] and "api_v1beta.py:111" in old["description"] + assert "beta" in old["description"] and ".py" not in old["description"] assert not OP.get("deprecated") @@ -382,6 +382,6 @@ def test_parameter_scan_exclusion_and_key_cap_are_stated(): assert "capped at 256" in text assert "closed 503 above it (never truncated)" in text assert "before any analysis loop" in text - assert "run_analytics_service.py:909-919, :3506-3529" in text + assert "importance loop scans every stored parameter key for each measure" in text and ".py" not in text assert "256 distinct stored parameter keys" in OP["responses"]["503"]["description"] assert "256 distinct stored parameter keys" in _load(PROBLEM_FILE)["description"] diff --git a/tests/test_experiment_run_leaderboard_contract.py b/tests/test_experiment_run_leaderboard_contract.py index 7f2f8260..7e91437f 100644 --- a/tests/test_experiment_run_leaderboard_contract.py +++ b/tests/test_experiment_run_leaderboard_contract.py @@ -6,6 +6,7 @@ import hashlib import json +import re import pytest from jsonschema import Draft7Validator, FormatChecker @@ -13,6 +14,9 @@ from traigent_schema import SchemaValidator from traigent_schema.utils import get_schemas_dir +# Generic path-shape guards (file ref, file:line ref, source-tree prefix, line range); split so the repository's own leak scan stays clean. +_PRIVATE = re.compile(r"\.py\b|s[r]c/|\.p" + r"y:\d|:\d+-\d+") + S = get_schemas_dir() PATH = "/api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard" OLD_PATH = "/api/v1/analytics/runs/{run_id}/leaderboard" @@ -121,7 +125,7 @@ def test_path_parameters_and_ref_pattern(): def test_query_vocabulary_matches_the_backend_query_model(): - # backend RunLeaderboardQuery (src/shared_infrastructure/schemas/run_analytics.py:86-91): objective, + # the backend leaderboard query model: objective, # weights, constraints, request_count, limit; page/offset are replaced by the cursor assert set(QUERY) == {"limit", "cursor", "objective", "weights", "constraints", "request_count"} assert all(not p["required"] for p in QUERY.values()) @@ -138,7 +142,7 @@ def test_query_vocabulary_matches_the_backend_query_model(): for text in (OP["description"], OP["responses"]["400"]["description"]): assert "page" in text and "offset" in text assert "any other query parameter" in OP["description"] - assert "run_analytics.py:86-91" in OP["description"] + assert "of the legacy leaderboard query" in OP["description"] and ".py" not in OP["description"] def test_limit_bounds_and_default_replace_the_backend_50_200(): @@ -234,10 +238,8 @@ def test_has_more_is_true_if_and_only_if_next_cursor_is_non_null(): def test_field_set_matches_the_backend_builder(): - # backend src/services/analytics/run_analytics_service.py:1465-1472 (payload keys: run_id, - # ranking_basis, configs, warnings) and :1449-1462 (config entry keys: rank, config_id, label, - # composite_score, measures, confidence, risk_flags, recommendation); route - # src/routes/analytics_runs_routes.py:119-142; query model run_analytics.py:86-91 + # backend payload keys: run_id, ranking_basis, configs, warnings; config entry keys: rank, + # config_id, label, composite_score, measures, confidence, risk_flags, recommendation page = RESP["definitions"]["LeaderboardPage"] assert set(page["properties"]) == {"run_id", "ranking_basis", "items", "warnings", "pagination"} basis = page["properties"]["ranking_basis"] @@ -249,8 +251,8 @@ def test_field_set_matches_the_backend_builder(): assert set(RESP["definitions"]["LeaderboardItem"]["required"]) == set( RESP["definitions"]["LeaderboardItem"]["properties"] ) - for cite in ("run_analytics_service.py:1400-1473", ":1449-1462", ":1466-1470"): - assert cite in RESP["description"] or cite in json.dumps(RESP) + assert "The fields mirror the backend's leaderboard analysis" in RESP["description"] + assert not re.search(r"\.py\b|\.p" + r"y:\d|s[r]c/|:\d{3,}-\d{3,}", json.dumps(RESP)) old = _load("analytics/run_leaderboard_schema.json") assert set(old["required"]) == {"run_id", "ranking_basis", "configs", "warnings"} # untouched @@ -412,7 +414,7 @@ def test_deprecated_path_points_at_the_successor_and_the_full_beta_route(): assert OP_ID in old["description"] assert "{experiment_run_ref}/leaderboard" in old["description"] assert "/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/leaderboard" in old["description"] - assert "api_v1beta.py:111" in old["description"] + assert not _PRIVATE.search(old["description"]) assert not OP.get("deprecated") assert old["responses"]["200"]["content"]["application/json"]["schema"]["$ref"] == "./run_leaderboard_response_schema.json" @@ -467,12 +469,21 @@ def test_weights_are_bounded_normalized_and_the_score_sorts_unrounded(): assert "UNROUNDED" in RESP["definitions"]["LeaderboardItem"]["properties"]["composite_score"]["description"] +REVISION_RULE = ( + "a per-run monotonic counter the backend increments in the same transaction as any insert or delete " + "of the run's configuration rows, and any update that changes a configuration row's analysis content " + "(its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of " + "these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it" +) + + def test_analysis_revision_is_a_monotonic_counter_from_the_same_snapshot(): for text in (RESP["description"], OP["description"]): assert "per-run monotonic counter" in text assert "same transaction" in text assert "SAME snapshot as the ranked rows" in text assert "maximum configuration updated_at" not in text + assert REVISION_RULE in text def _patterns(node, out=None): @@ -529,7 +540,7 @@ def test_every_leaderboard_ref_rejects_empty_and_malformed_ids_and_accepts_valid def test_description_names_both_issued_trial_ref_formats(): for text in (RESP["description"],): assert "trial_ plus 16 lowercase hex or configuration_run_ plus 32 lowercase hex" in text - assert "mint_configuration_run_ref" in text + assert "minted by the backend" in text and not _PRIVATE.search(text) shared = _load("analytics/experiment_run_trial_ref_schema.json") assert "Two issued formats exist" in shared["description"] @@ -553,7 +564,7 @@ def test_normalization_is_overflow_safe_and_a_convex_combination(): assert "distinct finite values keep their order" not in text assert "equal values score equal" in text assert "convex combination" in text - assert "run_analytics_service.py:1555-1575" in RESP["description"] + assert "replacing the builder's range arithmetic" in RESP["description"] and ".py" not in RESP["description"] cs = RESP["definitions"]["LeaderboardItem"]["properties"]["composite_score"]["description"] assert "overflow-safe" in cs and "unrounded binary64 composite" in cs assert "distinct finite" not in cs @@ -600,3 +611,14 @@ def test_one_tie_rule_identical_in_all_four_places_and_no_other_tie_wording(): rest = text.replace(TIE_RULE, "") assert not re.search(r"\btie[- ]?break|\bties\b|\btie\b", rest, re.IGNORECASE), rest[:0] or re.findall(r".{40}\btie.{40}", rest) assert "as the tie-break" not in rest + + +def test_cursor_failures_are_invalid_cursor_never_bad_request_in_the_wording(): + desc = _load(PROBLEM_FILE)["description"] + bad, _, rest = desc.partition("BadRequestProblem is") + bad_sentence = rest.split("ServiceUnavailableProblem is", 1)[0] + assert "cursor" not in bad_sentence + assert "any invalid or stale cursor" in desc.split("InvalidCursorProblem", 1)[1] + text400 = OP["responses"]["400"]["description"] + head, _, tail = text400.partition("Any invalid or stale cursor") + assert "cursor" not in head and "is the closed invalid_cursor 400" in tail diff --git a/tests/test_experiment_run_pareto_contract.py b/tests/test_experiment_run_pareto_contract.py index a83b2b17..0ab5e82d 100644 --- a/tests/test_experiment_run_pareto_contract.py +++ b/tests/test_experiment_run_pareto_contract.py @@ -6,6 +6,7 @@ import hashlib import json +import re import pytest from jsonschema import Draft7Validator, FormatChecker @@ -13,6 +14,9 @@ from traigent_schema import SchemaValidator from traigent_schema.utils import get_schemas_dir +# Generic path-shape guards (file ref, file:line ref, source-tree prefix, line range); split so the repository's own leak scan stays clean. +_PRIVATE = re.compile(r"\.py\b|s[r]c/|\.p" + r"y:\d|:\d+-\d+") + S = get_schemas_dir() PATH = "/api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto" OLD_PATH = "/api/v1/analytics/runs/{run_id}/pareto" @@ -88,7 +92,7 @@ def test_path_parameters_and_ref_pattern(): def test_query_vocabulary_is_closed_and_matches_the_backend_query_model(): - # backend RunParetoQuery (src/shared_infrastructure/schemas/run_analytics.py:71-76) + # the backend Pareto query model # plus the collection pair limit/cursor; extra="forbid" in the backend, so any other name is the 400 assert set(QUERY) == {"limit", "cursor", "x_measure", "y_measure", "request_count"} assert all(not p["required"] for p in QUERY.values()) @@ -247,8 +251,7 @@ def test_knee_and_frontier_semantics_are_preserved_across_pages(): def test_field_set_matches_the_backend_builder(): - # backend src/services/analytics/run_analytics_service.py:1115-1133 (_pareto_payload keys), - # frontier entry keys :1087-1097, dominated entry keys :1330-1364 + # the backend Pareto payload, frontier entry and dominated entry key sets page = RESP["definitions"]["ParetoPage"]["properties"] assert {"measures", "shape", "warnings"} <= set(page) assert set(RESP["definitions"]["FrontierItem"]["properties"]) == { @@ -258,9 +261,9 @@ def test_field_set_matches_the_backend_builder(): "kind", "trial_ref", "dominated_by", "reason", } # config_id -> trial_ref assert RESP["definitions"]["ParetoPage"]["properties"]["measures"]["required"] == ["quality", "cost", "latency"] - assert RESP["definitions"]["Metrics"]["maxProperties"] == 5 # x, y and three axes (:1196-1208) - assert "run_analytics_service.py:1004-1113" in RESP["description"] - assert "payload keys :1115-1133" in RESP["description"] + assert RESP["definitions"]["Metrics"]["maxProperties"] == 5 # x, y and three axes + assert "The analysis mirrors the backend's Pareto analysis" in RESP["description"] + assert not re.search(r"\.py\b|\.p" + r"y:\d|s[r]c/|:\d{3,}-\d{3,}", RESP["description"]) # the historical DTO is unchanged and still serves the deprecated path old = _load("analytics/run_pareto_schema.json") assert set(old["required"]) == {"run_id", "project_id", "measures", "frontier", "dominated", "shape", "warnings"} @@ -364,8 +367,8 @@ def test_trial_ref_is_the_shared_run_scoped_definition(): assert Draft7Validator(shared).is_valid("configuration_run_" + "0f" * 16) assert not Draft7Validator(shared).is_valid("trial_10000") assert "run-scoped" in OP["description"] - # persisted reference: backend migration 20261122_0001_configuration_run_ref_role_v1.py:1-24 - assert "20261122_0001_configuration_run_ref_role_v1.py:1-24" in RESP["description"] + # persisted reference: no private migration file is cited + assert not _PRIVATE.search(RESP["description"]) assert "1-based" not in RESP["description"] and "1-based" not in OP["description"] assert "not yet issued is the closed 503" in RESP["description"] assert "not yet issued is the closed 503" in OP["description"] @@ -375,11 +378,19 @@ def test_trial_ref_is_the_shared_run_scoped_definition(): assert RESP["definitions"]["ParetoPage"]["properties"]["knee_ref"]["anyOf"][0] == {"$ref": "#/definitions/TrialRef"} +REVISION_RULE = ( + "a per-run monotonic counter the backend increments in the same transaction as any insert or delete " + "of the run's configuration rows, and any update that changes a configuration row's analysis content " + "(its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of " + "these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it" +) + + def test_cursor_seals_the_analysis_revision_and_a_stale_cursor_is_invalid_cursor(): for text in (RESP["description"], OP["description"]): assert "analysis_revision" in text assert "per-run monotonic counter" in text - assert "same transaction as any insert, update or delete of the run's configuration rows" in text + assert REVISION_RULE in text assert "maximum configuration updated_at" not in text and "digest" not in text assert "invalid_cursor" in text assert "analysis_revision" in QUERY["cursor"]["description"] @@ -390,7 +401,7 @@ def test_cursor_seals_the_analysis_revision_and_a_stale_cursor_is_invalid_cursor ] bad = _load(PROBLEM_FILE)["definitions"]["InvalidCursorProblem"] one = Draft7Validator(bad) - urn = "urn:traigent:problem:invalid_cursor" # backend src/api_kit/problems.py:33 + urn = "urn:traigent:problem:invalid_cursor" doc = { "type": urn, "title": "Bad Request", @@ -529,8 +540,8 @@ def test_both_issued_reference_formats_are_accepted_on_every_ref_field(): items = [{**_frontier(0, 1), "trial_ref": ref}, {**_dominated(3, 1), "trial_ref": ref, "dominated_by": ref}] assert not list(v.iter_errors(_env({**d, "knee_ref": ref, "items": items}))), ref desc = _load("analytics/experiment_run_trial_ref_schema.json")["description"] - assert "configuration_run_dal.py:50" in desc and "configuration_run_dal.py:60, :345" in desc - assert "configuration_run_service.py:238" in desc + assert not re.search(r"\.py\b|s[r]c/|\.p" + r"y:\d|:\d+-\d+", desc) + assert "(issued by sessions)" in desc and "(minted by the backend)" in desc def test_metric_keys_use_the_shared_name_class_and_a_stored_bad_name_is_the_503(): @@ -551,3 +562,11 @@ def test_metric_keys_use_the_shared_name_class_and_a_stored_bad_name_is_the_503( assert "never truncated or sanitized" in text assert needle in RESP["definitions"]["Metrics"]["description"] assert "stored metric name" in _load(PROBLEM_FILE)["description"] + + +def test_pareto_cursor_wording_drift_guard(): + """Drift guard: passes on the previous wording by design; the Pareto text was already correct. It fails if a future edit lists a cursor case under BadRequestProblem or drops "any invalid or stale cursor" from InvalidCursorProblem.""" + desc = _load(PROBLEM_FILE)["description"] + bad_sentence = desc.partition("BadRequestProblem is")[2].split("ServiceUnavailableProblem is", 1)[0] + assert "cursor" not in bad_sentence + assert "any invalid or stale cursor" in desc.split("InvalidCursorProblem", 1)[1] diff --git a/tests/test_experiment_run_report_contract.py b/tests/test_experiment_run_report_contract.py index b15e74aa..9274ec23 100644 --- a/tests/test_experiment_run_report_contract.py +++ b/tests/test_experiment_run_report_contract.py @@ -6,6 +6,7 @@ import hashlib import json +import re import pytest from jsonschema import Draft7Validator, FormatChecker @@ -13,6 +14,9 @@ from traigent_schema import SchemaValidator from traigent_schema.utils import get_schemas_dir +# Generic path-shape guards (file ref, file:line ref, source-tree prefix, line range); split so the repository's own leak scan stays clean. +_PRIVATE = re.compile(r"\.py\b|s[r]c/|\.p" + r"y:\d|:\d+-\d+") + S = get_schemas_dir() PATH = "/api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report" OLD_PATH = "/api/v1/analytics/runs/{run_id}/report" @@ -321,6 +325,39 @@ def test_truncation_is_declared_through_the_required_meta_totals(): assert "aggregated_results_total" in text +def test_insight_and_warning_totals_are_integer_keys_of_the_open_meta_map(): + v = _validator("experiment_run_report_response_schema") + d = _report() + ok = _envelope(d) + # absent: still valid; present as integer keys of the open meta map: valid (no new typed property) + assert not list(v.iter_errors(ok)) + assert not list(v.iter_errors({**ok, "meta": {**_meta(), "insights_total": 80, "warnings_total": 2500}})) + assert not list(v.iter_errors({**ok, "meta": {**_meta(), "insights_total": 0, "warnings_total": 0}})) + # the open meta map is unchanged: extra scalar keys allowed, nested values and over-count rejected + assert not list(v.iter_errors({**ok, "meta": {**_meta(), "note": "x"}})) + assert list(v.iter_errors({**ok, "meta": {**_meta(), "note": {"nested": 1}}})) + assert list(v.iter_errors({**ok, "meta": {**_meta(), **{f"k{i}": 1 for i in range(7)}}})) + # no typed property was added (that would tighten the open map) + props = _load("analytics/experiment_run_report_response_schema.json")["definitions"]["MetaMap"]["properties"] + assert "insights_total" not in props and "warnings_total" not in props + + +def test_truncation_order_and_over_length_warning_omission_are_stated(): + text = _load("analytics/experiment_run_report_response_schema.json")["description"] + for phrase in ( + "insights beyond 50 and warnings beyond 1000 are truncated server-side in a deterministic order", + "omitted (never cut, so no partial identifier is emitted)", + "the server reports the untruncated counts under the optional meta keys insights_total and warnings_total", + ): + assert phrase in text, phrase + assert "insights beyond 50 and warnings beyond 1000 are truncated server-side" in OP["description"] + assert "omitted (never cut" in OP["description"] + for t in (text, OP["description"]): + assert "a warning longer than 512 characters is omitted" in t + assert "counting omitted over-length warnings" in t + assert "warnings 1000 of at most 512 characters" in text + + def test_config_params_follow_the_sanitizer_shapes(): v = _validator("experiment_run_report_response_schema") d = _report() @@ -333,7 +370,7 @@ def with_params(params: dict) -> dict: assert not list(v.iter_errors(with_params({"a": {"b": {"c": {"d": 1}}}}))) assert not list(v.iter_errors(with_params({"a": {"b": {"c": ["x", 2, None, True]}}}))) assert not list(v.iter_errors(with_params({"safe_nested": {"temperature": 0.2}}))) - # the sanitizer emits {} and [] at its depth limit (config_redaction.py:157,172) + # the sanitizer emits {} and [] at its depth limit assert not list(v.iter_errors(with_params({"a": {"b": {"c": []}}}))) assert not list(v.iter_errors(with_params({"a": {"b": {"c": {}}}}))) assert not list(v.iter_errors(with_params({"a": {"b": {"c": {"d": []}}}}))) @@ -415,8 +452,7 @@ def test_trial_ref_is_the_shared_run_scoped_definition(): assert "report-scoped" not in new["description"] assert "1-based" not in new["description"] and "1-based" not in shared["description"] desc = shared["description"] - assert "configuration_runs.configuration_run_ref" in desc - assert "20261122_0001_configuration_run_ref_role_v1.py:1-24" in desc + assert "the stored configuration-run reference" in desc and not _PRIVATE.search(desc) assert "Issued once, never re-minted" in desc assert "never a positional or synthetic stand-in" in desc assert "the closed 503" in desc @@ -465,3 +501,24 @@ def walk(n): *walk(_load("analytics/experiment_run_trial_ref_schema.json"))] assert pats assert not [p for p in pats if "(?!" in p] + + +def test_trial_ref_description_lists_only_views_that_reference_it(): + shared = _load("analytics/experiment_run_trial_ref_schema.json")["description"] + assert "Shared by the report, Pareto and leaderboard views" in shared + assert "correlations" not in shared + corr = json.dumps(_load("analytics/experiment_run_correlations_response_schema.json")) + assert "trial_ref" not in corr + + +def test_meta_totals_wording_matches_what_the_schema_guarantees(): + resp = _load("analytics/experiment_run_report_response_schema.json") + meta = resp["definitions"]["MetaMap"] + assert "insights_total" not in meta["required"] and "warnings_total" not in meta["required"] + texts = [resp["description"], resp["definitions"]["BoundedReport"]["properties"]["insights"]["description"] if "BoundedReport" in resp["definitions"] else "", OP["description"], json.dumps(resp)] + blob = " ".join(texts) + for stale in ("as the integers meta.insights_total", "as the integer meta.insights_total", "as the integer meta.warnings_total"): + assert stale not in blob, stale + assert "optional meta keys insights_total and warnings_total" in resp["description"] + assert "optional meta keys insights_total and warnings_total" in OP["description"] + assert "optional meta key insights_total" in blob and "optional meta key warnings_total" in blob diff --git a/traigent_schema/schemas/analytics/analytics_endpoints.json b/traigent_schema/schemas/analytics/analytics_endpoints.json index 5877f09a..66bfb932 100644 --- a/traigent_schema/schemas/analytics/analytics_endpoints.json +++ b/traigent_schema/schemas/analytics/analytics_endpoints.json @@ -144,7 +144,7 @@ "get": { "operationId": "experiment_run.get_run_leaderboard", "summary": "Get the ranked configuration leaderboard of one experiment run, paginated", - "description": "Pure read: returns one cursor page (items plus pagination) of the ranked configuration leaderboard of one experiment run addressed by its server-issued reference and an explicit project. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/leaderboard. Query: limit (default 20, maximum 100; this replaces the backend's historical default 50 and maximum 200 of RunLeaderboardQuery, src/shared_infrastructure/schemas/run_analytics.py:86-91), cursor (opaque sealed string of at most 512 base64url characters), and the backend's own objective, weights, constraints and request_count (run_analytics.py:86-91); any other query parameter, including the retired page and offset, is rejected with the closed 400. Name policy: every measure name (weights and constraints keys, and stored metric names, wherever echoed in measures, ranking_basis, risk_flags and warnings) matches ^[^\\x00-\\x1f\\x7f]{1,128}$; a query key outside it is the closed 400 (no echo) and a stored metric name outside it is the closed 503 for the run, never truncated. Weights: each weight is a number in [0, 1000]; a negative or larger weight is the closed 400, which replaces the builder's silent exclusion of negative weights; the composite score is computed over the weights normalized to sum to 1, so it is finite. When weights is given at least one weight must be greater than 0: all-zero weights (for example {\"accuracy\": 0}) are the closed 400 with no echo, and omitting weights keeps the default objective path. Each measure's min-max normalization is computed without overflow (values scaled by the largest absolute finite value before subtracting, or an equivalent exact method), so equal values score equal; the composite is a convex combination of normalized terms in [0, 1]. The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic). Authorization order: authenticate, authorize the URL project, validate experiment_run_ref, limit, cursor and the other query syntax (400 before any lookup, echoing no value), then resolve the reference under that project and enforce grants on every page. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. The ranking is computed over the full eligible population and then paginated, ordered by non-disqualified first, descending UNROUNDED composite_score (the displayed composite_score may be rounded), with ranks assigned after that order, so rank is a unique position across all pages; the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503); the cursor seals caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any ranking-relevant configuration or metric write, read from the SAME snapshot as the ranked rows), and a stale or foreign cursor is the closed 400 invalid_cursor; pagination.total is a required integer. The encoded response is at most 1 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. The canonical projection omits config_id and label (internal id and its fallback), uses the shared persisted trial_ref (experiment_run_trial_ref_schema.json) instead, and data.run_id is the experiment_run_ref. The builder never writes, creates jobs or calls providers. A run with any configuration whose trial_ref (configuration_run_ref) is not yet issued is the closed 503 until the backfill completes.", + "description": "Pure read: returns one cursor page (items plus pagination) of the ranked configuration leaderboard of one experiment run addressed by its server-issued reference and an explicit project. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/leaderboard. Parameters: limit (default 20, maximum 100; this replaces the backend's historical default 50 and maximum 200 of the legacy leaderboard query), cursor (opaque sealed string of at most 512 base64url characters), and the backend's own objective, weights, constraints and request_count; any other query parameter, including the retired page and offset, is rejected with the closed 400. Name policy: every measure name (weights and constraints keys, and stored metric names, wherever echoed in measures, ranking_basis, risk_flags and warnings) matches ^[^\\x00-\\x1f\\x7f]{1,128}$; a query key outside it is the closed 400 (no echo) and a stored metric name outside it is the closed 503 for the run, never truncated. Weights: each weight is a number in [0, 1000]; a negative or larger weight is the closed 400, which replaces the builder's silent exclusion of negative weights; the composite score is computed over the weights normalized to sum to 1, so it is finite. When weights is given at least one weight must be greater than 0: all-zero weights (for example {\"accuracy\": 0}) are the closed 400 with no echo, and omitting weights keeps the default objective path. Each measure's min-max normalization is computed without overflow (values scaled by the largest absolute finite value before subtracting, or an equivalent exact method), so equal values score equal; the composite is a convex combination of normalized terms in [0, 1]. The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic). Authorization order: authenticate, authorize the URL project, validate experiment_run_ref, limit, cursor and the other query syntax (400 before any lookup, echoing no value), then resolve the reference under that project and enforce grants on every page. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. The ranking is computed over the full eligible population and then paginated, ordered by non-disqualified first, descending UNROUNDED composite_score (the displayed composite_score may be rounded), with ranks assigned after that order, so rank is a unique position across all pages; the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503); the cursor seals caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any insert or delete of the run's configuration rows, and any update that changes a configuration row's analysis content (its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it, read from the SAME snapshot as the ranked rows), and a stale or foreign cursor is the closed 400 invalid_cursor; pagination.total is a required integer. The encoded response is at most 1 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. The canonical projection omits config_id and label (internal id and its fallback), uses the shared persisted trial_ref (experiment_run_trial_ref_schema.json) instead, and data.run_id is the experiment_run_ref. The builder never writes, creates jobs or calls providers. A run with any configuration whose trial_ref (configuration_run_ref) is not yet issued is the closed 503 until the backfill completes.", "x-max-response-bytes": 1048576, "x-asserted-against-backend": false, "parameters": [ @@ -199,7 +199,7 @@ "name": "objective", "in": "query", "required": false, - "description": "Ranking objective (backend LeaderboardObjective, run_analytics.py:64-68): weighted (default) uses weights, the others rank by the resolved quality, cost or latency axis. An unknown value is the closed 400.", + "description": "Ranking objective (the backend's leaderboard objective): weighted (default) uses weights, the others rank by the resolved quality, cost or latency axis. An unknown value is the closed 400.", "schema": { "type": "string", "enum": [ @@ -215,7 +215,7 @@ "name": "weights", "in": "query", "required": false, - "description": "JSON-object string of measure name to weight (at most 50 keys; keys match ^[^\\x00-\\x1f\\x7f]{1,128}$, otherwise the closed 400 with no echo; backend _parse_numeric_map, run_analytics.py:24-56). Each weight is a number in [0, 1000]; a negative or larger weight is the closed 400 (replacing the builder's silent exclusion of negative weights); zero weights are dropped, but at least one weight must be greater than 0 (all-zero, e.g. {\"accuracy\": 0}, is the closed 400 with no echo; omit weights for the default objective path); the composite is computed over weights normalized to sum to 1. At most 8192 characters on the wire.", + "description": "JSON-object string of measure name to weight (at most 50 keys; keys match ^[^\\x00-\\x1f\\x7f]{1,128}$, otherwise the closed 400 with no echo; the backend's numeric-map parsing). Each weight is a number in [0, 1000]; a negative or larger weight is the closed 400 (replacing the builder's silent exclusion of negative weights); zero weights are dropped, but at least one weight must be greater than 0 (all-zero, e.g. {\"accuracy\": 0}, is the closed 400 with no echo; omit weights for the default objective path); the composite is computed over weights normalized to sum to 1. At most 8192 characters on the wire.", "schema": { "type": "string", "minLength": 1, @@ -237,7 +237,7 @@ "name": "request_count", "in": "query", "required": false, - "description": "Backend RunLeaderboardQuery.request_count (1 to 1000000, default 1); display-only, the composite score does not use it (run_analytics_service.py:1727, 'no request_count in composite').", + "description": "The backend's request_count (1 to 1000000, default 1); display-only, the composite score does not use it.", "schema": { "type": "integer", "minimum": 1, @@ -258,7 +258,7 @@ } }, "400": { - "description": "Malformed experiment_run_ref, limit, cursor, objective, weights (including a weight outside [0, 1000] or all weights zero), constraints or request_count, a measure name outside the name policy, a cursor that does not belong to this caller, run and query, or an unknown or retired query parameter (page, offset and others); syntax is checked before any lookup and no value is echoed. A cursor whose analysis_revision no longer matches is the closed invalid_cursor 400.", + "description": "Malformed experiment_run_ref, limit, objective, weights (including a weight outside [0, 1000] or all weights zero), constraints or request_count, a measure name outside the name policy, or an unknown or retired query parameter (page, offset and others); syntax is checked before any lookup and no value is echoed. Any invalid or stale cursor (malformed, over-long, not this caller's, project's, run's or query's, or whose analysis_revision no longer matches) is the closed invalid_cursor 400.", "content": { "application/problem+json": { "schema": { @@ -359,7 +359,7 @@ "get": { "operationId": "experiment_run.get_run_pareto", "summary": "Get the Pareto analysis of one experiment run, paginated", - "description": "Pure read: returns one cursor page (items plus pagination) of the Pareto frontier analysis of one experiment run addressed by its server-issued reference and an explicit project. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/pareto. Query: limit (default 20, maximum 100), cursor (opaque sealed string of at most 512 base64url characters), x_measure, y_measure, request_count; any other query parameter, including the retired page and offset, is rejected with the closed 400. Authorization order: authenticate, authorize the URL project, validate experiment_run_ref, limit, cursor and the other query syntax (400 before any lookup, echoing no value), then resolve the reference under that project and enforce grants on every page. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. The frontier, knee and shape are computed over the full population and then paginated; the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503); frontier ties are broken by ascending trial_ref (lexicographic) before ranks are assigned and dominated entries are ordered by ascending trial_ref (lexicographic); the cursor seals caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any insert, update or delete of the run's configuration rows or their metrics), and a stale or foreign cursor is the closed 400 invalid_cursor; pagination.total is a required integer. The encoded response is at most 1 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. The canonical projection omits config_id and project_id (internal ids), uses the opaque run-scoped trial_ref (experiment_run_trial_ref_schema.json) instead, and data.run_id is the experiment_run_ref. The builder never writes, creates jobs or calls providers. A run with any configuration whose trial_ref (configuration_run_ref) is not yet issued is the closed 503 until the backfill completes. A stored metric name outside the shared name class ^[^\\x00-\\x1f\\x7f]{1,100}$ (control characters, empty or over 100 characters) makes the run's response the closed 503, never truncated or sanitized.", + "description": "Pure read: returns one cursor page (items plus pagination) of the Pareto frontier analysis of one experiment run addressed by its server-issued reference and an explicit project. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/pareto. Parameters: limit (default 20, maximum 100), cursor (opaque sealed string of at most 512 base64url characters), x_measure, y_measure, request_count; any other query parameter, including the retired page and offset, is rejected with the closed 400. Authorization order: authenticate, authorize the URL project, validate experiment_run_ref, limit, cursor and the other query syntax (400 before any lookup, echoing no value), then resolve the reference under that project and enforce grants on every page. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. The frontier, knee and shape are computed over the full population and then paginated; the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503); frontier ties are broken by ascending trial_ref (lexicographic) before ranks are assigned and dominated entries are ordered by ascending trial_ref (lexicographic); the cursor seals caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any insert or delete of the run's configuration rows, and any update that changes a configuration row's analysis content (its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it), and a stale or foreign cursor is the closed 400 invalid_cursor; pagination.total is a required integer. The encoded response is at most 1 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. The canonical projection omits config_id and project_id (internal ids), uses the opaque run-scoped trial_ref (experiment_run_trial_ref_schema.json) instead, and data.run_id is the experiment_run_ref. The builder never writes, creates jobs or calls providers. A run with any configuration whose trial_ref (configuration_run_ref) is not yet issued is the closed 503 until the backfill completes. A stored metric name outside the shared name class ^[^\\x00-\\x1f\\x7f]{1,100}$ (control characters, empty or over 100 characters) makes the run's response the closed 503, never truncated or sanitized.", "x-max-response-bytes": 1048576, "x-asserted-against-backend": false, "parameters": [ @@ -414,7 +414,7 @@ "name": "x_measure", "in": "query", "required": false, - "description": "Measure or axis alias (quality, cost, latency) on the x axis (backend RunParetoQuery, src/shared_infrastructure/schemas/run_analytics.py:71-76). Control characters (U+0000-U+001F, U+007F) are rejected with the closed 400.", + "description": "Measure or axis alias (quality, cost, latency) on the x axis (the backend's Pareto query). Control characters (U+0000-U+001F, U+007F) are rejected with the closed 400.", "schema": { "type": "string", "minLength": 1, @@ -562,7 +562,7 @@ "get": { "operationId": "experiment_run.get_run_correlations", "summary": "Get the correlation analysis for one experiment run", - "description": "Pure read: returns the client-safe enveloped correlation analysis of one experiment run addressed by its server-issued reference and an explicit project: measure-to-measure correlations (r, p_value, coarse strength) and parameter-to-measure effects (effect, coarse confidence) over the run's own measured aggregates. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/correlations. Authorization order: authenticate, authorize the URL project, validate experiment_run_ref syntax and the query (400 before any lookup), then resolve the reference under that project and enforce grants. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. Query (backend RunCorrelationsQuery, src/shared_infrastructure/schemas/run_analytics.py:79-84, extra=forbid): method (pearson or spearman, default pearson) and min_sample (integer 2 to 10000, default 3, the minimum paired samples for a measure pair; pairs below it are dropped with an insufficient_samples warning). A malformed reference, an out-of-range or non-enumerated value or an unknown query parameter is the closed 400, which names no parameter and echoes no value. DIMENSIONS AND INPUT ARE BOUNDED: the analysis enumerates numeric measure dimensions (measure pairs, run_analytics_service.py:839-884) and numeric parameter dimensions times measures (:898-933), so a run is analyzed only with at most 128 numeric measure dimensions (the run-wide union of numeric measure keys) and at most 128 numeric parameter dimensions (the backend accepts up to 100 search-space parameters, src/schemas/traigent.py:54-63; booleans count as numeric parameters; the existing exclusion of string-valued parameters across completed configurations applies), giving at most 8128 measure pairs (128 choose 2) and 16384 parameter-measure rows. The dimensions are counted on the exact normalized inputs, after authorization and BEFORE either analysis loop; the counts are in the required meta.measure_dimensions_total and meta.parameter_dimensions_total. Input budget (the same as the Pareto contract): a work cap of 10000 scoped configuration rows, counted during the scoped read before materialization; sample_size is the exact count of measured configurations (at most 10000). Parameter scan: non-numeric (categorical, string-valued) parameters are excluded BEFORE the importance loop, because the backend's importance loop scans every stored parameter key for each measure before it omits categorical ones (run_analytics_service.py:909-919, :3506-3529); and the number of DISTINCT stored parameter keys scanned across the run's configurations is capped at 256, with the closed 503 above it (never truncated), counted with the other caps before any analysis loop. A run over the dimension limits or the input budget is refused with the closed 503, never truncated or partially analyzed (the backend does not enforce these limits today; backend obligation). Measure and parameter names are at most 256 characters of printable text (no control characters); Any STORED measure or parameter name that fails the name pattern (a control character such as a tab, or a length over 256) makes the response the closed 503, never truncated and never sanitized. Truncation or sanitizing could merge two names. The canonical handler parses the query strictly: unknown keys and tenant-selector keys are the closed 400, unlike the legacy adapter, which drops unknown keys and always drops tenant-selector keys (backend src/routes/query_params.py:64-97). The encoded response is at most 1 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. The canonical projection omits data.run_id (internal run id, emitted by the builder at run_analytics_service.py:823); the run is already identified by the experiment_run_ref in the URL. The builder never writes, creates jobs or calls providers.", + "description": "Pure read: returns the client-safe enveloped correlation analysis of one experiment run addressed by its server-issued reference and an explicit project: measure-to-measure correlations (r, p_value, coarse strength) and parameter-to-measure effects (effect, coarse confidence) over the run's own measured aggregates. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/correlations. Authorization order: authenticate, authorize the URL project, validate experiment_run_ref syntax and the query (400 before any lookup), then resolve the reference under that project and enforce grants. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. Parameters (the backend's correlations query, which forbids extra parameters): method (pearson or spearman, default pearson) and min_sample (integer 2 to 10000, default 3, the minimum paired samples for a measure pair; pairs below it are dropped with an insufficient_samples warning). A malformed reference, an out-of-range or non-enumerated value or an unknown query parameter is the closed 400, which names no parameter and echoes no value. DIMENSIONS AND INPUT ARE BOUNDED: the analysis enumerates numeric measure dimensions (measure pairs) and numeric parameter dimensions times measures, so a run is analyzed only with at most 128 numeric measure dimensions (the run-wide union of numeric measure keys) and at most 128 numeric parameter dimensions (the backend accepts up to 100 search-space parameters; booleans count as numeric parameters; the existing exclusion of string-valued parameters across completed configurations applies), giving at most 8128 measure pairs (128 choose 2) and 16384 parameter-measure rows. The dimensions are counted on the exact normalized inputs, after authorization and BEFORE either analysis loop; the counts are in the required meta.measure_dimensions_total and meta.parameter_dimensions_total. Input budget (the same as the Pareto contract): a work cap of 10000 scoped configuration rows, counted during the scoped read before materialization; sample_size is the exact count of measured configurations (at most 10000). Parameter scan: non-numeric (categorical, string-valued) parameters are excluded BEFORE the importance loop, because the backend's importance loop scans every stored parameter key for each measure before it omits categorical ones; and the number of DISTINCT stored parameter keys scanned across the run's configurations is capped at 256, with the closed 503 above it (never truncated), counted with the other caps before any analysis loop. A run over the dimension limits or the input budget is refused with the closed 503, never truncated or partially analyzed (the backend does not enforce these limits today; backend obligation). Measure and parameter names are at most 256 characters of printable text (no control characters); Any STORED measure or parameter name that fails the name pattern (a control character such as a tab, or a length over 256) makes the response the closed 503, never truncated and never sanitized. Truncation or sanitizing could merge two names. The canonical handler parses the query strictly: unknown keys and tenant-selector keys are the closed 400, unlike the legacy adapter, which drops unknown keys and always drops tenant-selector keys. The encoded response is at most 1 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. The canonical projection omits data.run_id (internal run id, emitted by the builder); the run is already identified by the experiment_run_ref in the URL. The builder never writes, creates jobs or calls providers.", "x-max-response-bytes": 1048576, "x-asserted-against-backend": false, "parameters": [ @@ -3750,7 +3750,7 @@ } }, "deprecated": true, - "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report (operationId experiment_run.get_run_report), addressed by an explicit project and a server-issued run reference; the same handler is also mounted on the two beta analytics mounts (/api/v1beta/analytics and /api/v1beta/projects/{project_id}/analytics, backend src/routes/api_v1beta.py:109-110), which are not declared in this contract and retire with it; removal follows the backend retirement PR after the client receipt." + "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report (operationId experiment_run.get_run_report), addressed by an explicit project and a server-issued run reference; the same handler is also mounted on the two beta analytics mounts (/api/v1beta/analytics and /api/v1beta/projects/{project_id}/analytics), which are not declared in this contract and retire with it; removal follows the backend retirement PR after the client receipt." } }, "/api/v1/analytics/runs/{run_id}/pareto": { @@ -3830,7 +3830,7 @@ } }, "deprecated": true, - "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto (operationId experiment_run.get_run_pareto), addressed by an explicit project and a server-issued run reference and paginated (limit, cursor, items, pagination); the same handler is also mounted on /api/v1beta/projects/{project_id}/analytics/runs/{run_id}/pareto (backend src/routes/api_v1beta.py:111), which is not declared in this contract and retires with it; removal follows the backend retirement PR after the client receipt." + "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto (operationId experiment_run.get_run_pareto), addressed by an explicit project and a server-issued run reference and paginated (limit, cursor, items, pagination); the same handler is also mounted on /api/v1beta/projects/{project_id}/analytics/runs/{run_id}/pareto, which is not declared in this contract and retires with it; removal follows the backend retirement PR after the client receipt." } }, "/api/v1/analytics/runs/{run_id}/correlations": { @@ -3910,7 +3910,7 @@ } }, "deprecated": true, - "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/correlations (operationId experiment_run.get_run_correlations), addressed by an explicit project and a server-issued run reference, with bounded dimensions and a closed problem vocabulary; the same handler is also mounted on the project-scoped beta analytics mount (/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/correlations, backend src/routes/api_v1beta.py:111), which is not declared in this contract and retires with it; removal follows the backend retirement PR after the client receipt." + "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/correlations (operationId experiment_run.get_run_correlations), addressed by an explicit project and a server-issued run reference, with bounded dimensions and a closed problem vocabulary; the same handler is also mounted on the project-scoped beta analytics mount (/api/v1beta/projects/{project_id}/analytics/runs/{run_id}/correlations), which is not declared in this contract and retires with it; removal follows the backend retirement PR after the client receipt." } }, "/api/v1/analytics/runs/{run_id}/leaderboard": { @@ -3990,7 +3990,7 @@ } }, "deprecated": true, - "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard (operationId experiment_run.get_run_leaderboard), addressed by an explicit project and a server-issued run reference and paginated (limit default 20, maximum 100, cursor, items, pagination); the same handler is also mounted on /api/v1beta/projects/{project_id}/analytics/runs/{run_id}/leaderboard (backend src/routes/api_v1beta.py:111), which is not declared in this contract and retires with it; removal follows the backend retirement PR after the client receipt." + "description": "DEPRECATED: replaced by GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard (operationId experiment_run.get_run_leaderboard), addressed by an explicit project and a server-issued run reference and paginated (limit default 20, maximum 100, cursor, items, pagination); the same handler is also mounted on /api/v1beta/projects/{project_id}/analytics/runs/{run_id}/leaderboard, which is not declared in this contract and retires with it; removal follows the backend retirement PR after the client receipt." } }, "/api/v1/analytics/runs/{run_id}/parameter-insights": { @@ -4637,7 +4637,7 @@ "get": { "operationId": "experiment_run.get_run_report", "summary": "Get the report for one experiment run", - "description": "Pure read: returns the client-safe enveloped report of one experiment run addressed by its server-issued reference and an explicit project. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/report. Distinct from report.get_optimization_report_payload (bare response, feature gate, export audit), which is not changed here. Authorization order: authenticate, authorize the URL project, validate experiment_run_ref syntax (400 before any lookup), then resolve the reference under that project and enforce grants. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. The encoded response is at most 8 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. Rows beyond the collection caps are truncated server-side (meta.aggregated_results_total and meta.raw_example_results_total carry the untruncated counts), the canonical projection omits experiment_context.experiment_id, experiment_context.run_id, provenance.source_endpoints and report_id (internal ids), and uses the opaque run-scoped trial_ref instead of trial_id, and a report that cannot be produced within its budget is the closed 503 and never a partial success. No query parameters; the builder never writes, creates jobs or calls providers. A report of a run with any configuration whose trial_ref (configuration_run_ref) is not yet issued is the closed 503 until the backfill completes.", + "description": "Pure read: returns the client-safe enveloped report of one experiment run addressed by its server-issued reference and an explicit project. Replaces the deprecated GET /api/v1/analytics/runs/{run_id}/report. Distinct from GET /api/v1/experiment-runs/runs/{run_id}/report-payload (bare response, feature gate, export audit), which is not changed here. Authorization order: authenticate, authorize the URL project, validate experiment_run_ref syntax (400 before any lookup), then resolve the reference under that project and enforce grants. A missing, foreign, ungranted, revoked or retired run is one closed 404 with identical bytes. The encoded response is at most 8 MiB, enforced on the serialized envelope (the handler measures the final serialized bytes, sends those same bytes, and over-limit = the closed 503); the schema gives no static byte bound. Rows beyond the collection caps are truncated server-side (meta.aggregated_results_total and meta.raw_example_results_total carry the untruncated counts); insights beyond 50 and warnings beyond 1000 are truncated server-side in a deterministic order, a warning longer than 512 characters is omitted (never cut, so no partial identifier is emitted), and the server reports the untruncated counts under the optional meta keys insights_total and warnings_total (extra keys of the open meta map, counting omitted over-length warnings; the schema does not require them or type them beyond the open meta value rule); the canonical projection omits experiment_context.experiment_id, experiment_context.run_id, provenance.source_endpoints and report_id (internal ids), and uses the opaque run-scoped trial_ref instead of trial_id, and a report that cannot be produced within its budget is the closed 503 and never a partial success. No query parameters; the builder never writes, creates jobs or calls providers. A report of a run with any configuration whose trial_ref (configuration_run_ref) is not yet issued is the closed 503 until the backfill completes.", "x-max-response-bytes": 8388608, "x-asserted-against-backend": false, "parameters": [ diff --git a/traigent_schema/schemas/analytics/correlations_problem_schema.json b/traigent_schema/schemas/analytics/correlations_problem_schema.json index 60597323..0f039a57 100644 --- a/traigent_schema/schemas/analytics/correlations_problem_schema.json +++ b/traigent_schema/schemas/analytics/correlations_problem_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/correlations_problem_schema.json", "title": "Run Correlations Problem", - "description": "Closed RFC 9457 problem documents of experiment_run.get_run_correlations (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue (src/api_kit/problems.py PROBLEMS) with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref or a rejected query value (method outside pearson/spearman, min_sample outside 2..10000, an unknown or tenant-selector query parameter; validated before any lookup); the problem names no parameter and echoes no value. ServiceUnavailableProblem is the declared outcome when the correlations cannot be produced within their budget (serialized response over 1 MiB, more than 128 numeric measure dimensions or 128 numeric parameter dimensions in the run, more than 10000 scoped configuration rows, more than 256 distinct stored parameter keys across the run's configurations, a stored measure or parameter name that fails the name pattern (a control character such as a tab, or over 256 characters), deadline exhausted, or a required dependency down): the response is refused, never a partial result presented as complete. 429 and 503 may carry a Retry-After header.", + "description": "Closed RFC 9457 problem documents of experiment_run.get_run_correlations (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref or a rejected query value (method outside pearson/spearman, min_sample outside 2..10000, an unknown or tenant-selector query parameter; validated before any lookup); the problem names no parameter and echoes no value. ServiceUnavailableProblem is the declared outcome when the correlations cannot be produced within their budget (serialized response over 1 MiB, more than 128 numeric measure dimensions or 128 numeric parameter dimensions in the run, more than 10000 scoped configuration rows, more than 256 distinct stored parameter keys across the run's configurations, a stored measure or parameter name that fails the name pattern (a control character such as a tab, or over 256 characters), deadline exhausted, or a required dependency down): the response is refused, never a partial result presented as complete. 429 and 503 may carry a Retry-After header.", "definitions": { "UnauthenticatedProblem": { "type": "object", diff --git a/traigent_schema/schemas/analytics/decision_payload_problem_schema.json b/traigent_schema/schemas/analytics/decision_payload_problem_schema.json index fdebd92b..a3578d43 100644 --- a/traigent_schema/schemas/analytics/decision_payload_problem_schema.json +++ b/traigent_schema/schemas/analytics/decision_payload_problem_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/decision_payload_problem_schema.json", "title": "Run Decision Payload Problem", - "description": "Closed RFC 9457 problem documents of experiment_run.get_run_decision_payload (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue (src/api_kit/problems.py PROBLEMS) with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the payload cannot be produced within its budget (response over 1 MiB, more eligible rows than the computation limit, deadline exhausted, or a required dependency down): the response is refused, never a partial payload presented as complete. 429 and 503 may carry a Retry-After header.", + "description": "Closed RFC 9457 problem documents of experiment_run.get_run_decision_payload (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the payload cannot be produced within its budget (response over 1 MiB, more eligible rows than the computation limit, deadline exhausted, or a required dependency down): the response is refused, never a partial payload presented as complete. 429 and 503 may carry a Retry-After header.", "definitions": { "UnauthenticatedProblem": { "type": "object", diff --git a/traigent_schema/schemas/analytics/decision_payload_response_schema.json b/traigent_schema/schemas/analytics/decision_payload_response_schema.json index 0964b6f2..366d7549 100644 --- a/traigent_schema/schemas/analytics/decision_payload_response_schema.json +++ b/traigent_schema/schemas/analytics/decision_payload_response_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/decision_payload_response_schema.json", "title": "Decision Payload Success Response", - "description": "Platform success envelope for GET /api/v1/analytics/runs/{run_id}/decision-payload. The backend route uses response_handler.success_response, so the decision_payload DTO is nested under data.", + "description": "Platform success envelope for GET /api/v1/analytics/runs/{run_id}/decision-payload. The route returns the platform success envelope, so the decision_payload DTO is nested under data.", "type": "object", "additionalProperties": false, "properties": { diff --git a/traigent_schema/schemas/analytics/experiment_run_correlations_response_schema.json b/traigent_schema/schemas/analytics/experiment_run_correlations_response_schema.json index 3903b763..594955a0 100644 --- a/traigent_schema/schemas/analytics/experiment_run_correlations_response_schema.json +++ b/traigent_schema/schemas/analytics/experiment_run_correlations_response_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/experiment_run_correlations_response_schema.json", "title": "Run Correlations Canonical Success Response", - "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/correlations. data declares every field RunAnalyticsService.correlations emits (backend src/services/analytics/run_analytics_service.py:803-832: method, sample_size, measure_correlations, parameter_correlations, warnings) as a closed, bounded definition. CANONICAL PROJECTION OMITS INTERNAL IDS: the canonical projection omits data.run_id: internal id (the builder emits run.id at run_analytics_service.py:823); the run is identified by the experiment_run_ref in the URL, and the closed schema rejects the property. DIMENSIONS AND INPUT ARE BOUNDED: the analysis runs over at most 128 numeric measure dimensions (measure pairs, :839-884, at most 8128 rows) and at most 128 numeric parameter dimensions (:898-933, at most 128 x 128 = 16384 rows; booleans count as numeric, string-valued parameters are excluded across completed configurations), counted on the exact normalized inputs after authorization and before either analysis loop; the backend accepts up to 100 search-space parameters (src/schemas/traigent.py:54-63). meta.measure_dimensions_total and meta.parameter_dimensions_total (required integers, 0 to 128) carry the analyzed counts. The input budget is a work cap of 10000 scoped configuration rows counted during the scoped read before materialization (as the Pareto contract); sample_size is the exact count of measured configurations (at most 10000). Parameter scan: non-numeric (categorical, string-valued) parameters are excluded BEFORE the importance loop, because the backend's importance loop scans every stored parameter key for each measure before it omits categorical ones (run_analytics_service.py:909-919, :3506-3529); and the number of DISTINCT stored parameter keys scanned across the run's configurations is capped at 256, with the closed 503 above it (never truncated), counted with the other caps before any analysis loop. A run over either dimension limit or the input budget is refused with the closed 503, never truncated. Names are at most 256 characters with no control characters (class [^\\x00-\\x1f\\x7f]); Any STORED measure or parameter name that fails the name pattern (a control character such as a tab, or a length over 256) makes the response the closed 503, never truncated and never sanitized. Truncation or sanitizing could merge two names. The name and warning patterns end with $, not a lookahead (Pydantic v2 rust-regex refuses it); trailing-newline hardening is applied by the Python-side validators. warnings are constrained to the builder's three formats (:855-867, :909-925): insufficient_samples:~ (<=534 characters), zero_variance: (<=270) and the fixed categorical_parameters_omitted notice; at most one per measure pair plus one categorical notice, so at most 8129. r and effect are clamped to [-1, 1] (:873, :979) and p_value is in [0, 1]; strength is weak, moderate or strong (:3300); confidence is low, medium or high (:982). Names are run-defined identifiers shown only to the authorized reader. SIZE: this schema gives NO static byte bound. The 1 MiB limit (x-max-response-bytes 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. meta and metadata are bounded scalar maps. The historical envelope run_correlations_response_schema.json (and run_correlations_schema.json) are unchanged and still serve the deprecated analytics path.", + "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/correlations. data declares every field the backend's correlations analysis emits (method, sample_size, measure_correlations, parameter_correlations, warnings) as a closed, bounded definition. CANONICAL PROJECTION OMITS INTERNAL IDS: the canonical projection omits data.run_id: internal id (the builder emits the internal run id); the run is identified by the experiment_run_ref in the URL, and the closed schema rejects the property. DIMENSIONS AND INPUT ARE BOUNDED: the analysis runs over at most 128 numeric measure dimensions (measure pairs, at most 8128 rows) and at most 128 numeric parameter dimensions (at most 128 x 128 = 16384 rows; booleans count as numeric, string-valued parameters are excluded across completed configurations), counted on the exact normalized inputs after authorization and before either analysis loop; the backend accepts up to 100 search-space parameters. meta.measure_dimensions_total and meta.parameter_dimensions_total (required integers, 0 to 128) carry the analyzed counts. The input budget is a work cap of 10000 scoped configuration rows counted during the scoped read before materialization (as the Pareto contract); sample_size is the exact count of measured configurations (at most 10000). Parameter scan: non-numeric (categorical, string-valued) parameters are excluded BEFORE the importance loop, because the backend's importance loop scans every stored parameter key for each measure before it omits categorical ones; and the number of DISTINCT stored parameter keys scanned across the run's configurations is capped at 256, with the closed 503 above it (never truncated), counted with the other caps before any analysis loop. A run over either dimension limit or the input budget is refused with the closed 503, never truncated. Names are at most 256 characters with no control characters (class [^\\x00-\\x1f\\x7f]); Any STORED measure or parameter name that fails the name pattern (a control character such as a tab, or a length over 256) makes the response the closed 503, never truncated and never sanitized. Truncation or sanitizing could merge two names. The name and warning patterns end with $, not a lookahead (Pydantic v2 rust-regex refuses it); trailing-newline hardening is applied by the Python-side validators. warnings are constrained to the builder's three formats: insufficient_samples:~ (<=534 characters), zero_variance: (<=270) and the fixed categorical_parameters_omitted notice; at most one per measure pair plus one categorical notice, so at most 8129. r and effect are clamped to [-1, 1] and p_value is in [0, 1]; strength is weak, moderate or strong; confidence is low, medium or high. Names are run-defined identifiers shown only to the authorized reader. SIZE: this schema gives NO static byte bound. The 1 MiB limit (x-max-response-bytes 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. meta and metadata are bounded scalar maps. The historical envelope run_correlations_response_schema.json (and run_correlations_schema.json) are unchanged and still serve the deprecated analytics path.", "type": "object", "additionalProperties": false, "x-max-response-bytes": 1048576, diff --git a/traigent_schema/schemas/analytics/experiment_run_leaderboard_response_schema.json b/traigent_schema/schemas/analytics/experiment_run_leaderboard_response_schema.json index fd243266..6e2954a7 100644 --- a/traigent_schema/schemas/analytics/experiment_run_leaderboard_response_schema.json +++ b/traigent_schema/schemas/analytics/experiment_run_leaderboard_response_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/experiment_run_leaderboard_response_schema.json", "title": "Run Leaderboard Canonical Success Response", - "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard: one cursor page (items plus pagination) of the ranked configuration leaderboard of one experiment run. The fields mirror RunAnalyticsService.leaderboard (backend src/services/analytics/run_analytics_service.py:1400-1473): run_id, ranking_basis (objective, weights, constraints), the ranked configurations (rank, composite_score, measures, confidence, risk_flags, recommendation; :1449-1462) and warnings. The population is every configuration with a numeric measure whose status is not FAILED or CANCELLED (:1414-1425, _LEADERBOARD_INELIGIBLE_STATUSES :205-207); the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503, never truncated and presented as complete). The ranking, recommendation and every composite_score are computed over the FULL eligible population and only then paginated, so rank 1 and the winner do not depend on the page. Order: configurations that pass every constraint first, then the disqualified ones (:1443-1447); within each group by descending composite_score; ranks are assigned after the order below, so rank is a unique 1-based position across all pages and page boundaries are stable. The historical top-N truncation by limit (50 by default, at most 200, backend src/shared_infrastructure/schemas/run_analytics.py:91) is replaced by cursor pagination with limit default 20, maximum 100. CANONICAL PROJECTION OMITS INTERNAL IDS: omits config_id (internal configuration-run id; replaced by trial_ref, the shared persisted configuration_run_ref of experiment_run_trial_ref_schema.json: trial_ plus 16 lowercase hex or configuration_run_ plus 32 lowercase hex (the two issued formats, as in the shared definition: trial_ plus 16 hex issued by sessions, configuration_run_ plus 32 hex minted by mint_configuration_run_ref), issued once and never re-minted, so stable across pages and deletion of other configurations; a run with any configuration whose trial_ref is not yet issued is the closed 503 until the backfill completes) and omits label (the builder falls back to 'Trial ', which embeds the internal id, :1455; a free label is customer-chosen content), and data.run_id is the experiment_run_ref (^experiment_run_[0-9a-f]{32}$) populated from the resolved reference, never the historical run id (:1465). The closed schema rejects config_id, label and every other undeclared property. pagination carries limit, next_cursor (null on the last page), has_more and a required integer total (the number of ranked configurations across all pages, at most 10000). The cursor is a sealed opaque string bound to the caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any ranking-relevant configuration or metric write, read from the SAME snapshot as the ranked rows), never a raw historical primary key; a cursor whose revision no longer matches is the closed 400 invalid_cursor, so a page walk never mixes two rankings. SIZE: this schema gives NO static byte bound. The 1 MiB limit (x-max-response-bytes 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. warnings are constrained to the builder's four forms (:1429, :1497-1499, :1522, :1527-1529), at most 8, identical on every page. Measure values are any finite JSON number (the builder drops non-finite values, :1738-1746). The historical envelope run_leaderboard_response_schema.json is unchanged and still serves the deprecated analytics path. NAME POLICY: every measure name, wherever echoed (measures, ranking_basis weights and constraints, risk_flags, warnings), matches ^[^\\x00-\\x1f\\x7f]{1,128}$; a query key outside it is the closed 400 (no echo) and a stored metric name outside it is the closed 503 for the run, never truncated. WEIGHTS: each weight is a number in [0, 1000] (negative or larger is the closed 400, replacing the builder's silent exclusion of negative weights) and the composite is computed over the weights normalized to sum to 1, so it is finite; sorting uses the unrounded score. NORMALIZATION: each measure's min-max normalization is computed without overflow (the values are scaled by the largest absolute finite value before subtracting, or an equivalent exact method), so equal values score equal; the composite is a convex combination of normalized terms in [0, 1] (a backend obligation, replacing the builder's range arithmetic at run_analytics_service.py:1555-1575 and :1585-1597). The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic). EFFECTIVE WEIGHTS: ranking_basis.weights are the effective weights actually applied and may be empty (for example an empty leaderboard with no fallback measure, run_analytics_service.py:1518-1523); the positive-weight rule applies only to a weights map supplied in the request (see the weights query parameter).", + "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/leaderboard: one cursor page (items plus pagination) of the ranked configuration leaderboard of one experiment run. The fields mirror the backend's leaderboard analysis: run_id, ranking_basis (objective, weights, constraints), the ranked configurations (rank, composite_score, measures, confidence, risk_flags, recommendation) and warnings. The population is every configuration with a numeric measure whose status is not FAILED or CANCELLED; the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing (above it the closed 503, never truncated and presented as complete). The ranking, recommendation and every composite_score are computed over the FULL eligible population and only then paginated, so rank 1 and the winner do not depend on the page. Order: configurations that pass every constraint first, then the disqualified ones; within each group by descending composite_score; ranks are assigned after the order below, so rank is a unique 1-based position across all pages and page boundaries are stable. The historical top-N truncation by limit (50 by default, at most 200) is replaced by cursor pagination with limit default 20, maximum 100. CANONICAL PROJECTION OMITS INTERNAL IDS: omits config_id (internal configuration-run id; replaced by trial_ref, the shared persisted configuration_run_ref of experiment_run_trial_ref_schema.json: trial_ plus 16 lowercase hex or configuration_run_ plus 32 lowercase hex (the two issued formats, as in the shared definition: trial_ plus 16 hex issued by sessions, configuration_run_ plus 32 hex minted by the backend), issued once and never re-minted, so stable across pages and deletion of other configurations; a run with any configuration whose trial_ref is not yet issued is the closed 503 until the backfill completes) and omits label (the builder falls back to 'Trial ', which embeds the internal id; a free label is customer-chosen content), and data.run_id is the experiment_run_ref (^experiment_run_[0-9a-f]{32}$) populated from the resolved reference, never the historical run id. The closed schema rejects config_id, label and every other undeclared property. pagination carries limit, next_cursor (null on the last page), has_more and a required integer total (the number of ranked configurations across all pages, at most 10000). The cursor is a sealed opaque string bound to the caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any insert or delete of the run's configuration rows, and any update that changes a configuration row's analysis content (its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it, read from the SAME snapshot as the ranked rows), never a raw historical primary key; a cursor whose revision no longer matches is the closed 400 invalid_cursor, so a page walk never mixes two rankings. SIZE: this schema gives NO static byte bound. The 1 MiB limit (x-max-response-bytes 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. warnings are constrained to the builder's four forms, at most 8, identical on every page. Measure values are any finite JSON number (the builder drops non-finite values). The historical envelope run_leaderboard_response_schema.json is unchanged and still serves the deprecated analytics path. NAME POLICY: every measure name, wherever echoed (measures, ranking_basis weights and constraints, risk_flags, warnings), matches ^[^\\x00-\\x1f\\x7f]{1,128}$; a query key outside it is the closed 400 (no echo) and a stored metric name outside it is the closed 503 for the run, never truncated. WEIGHTS: each weight is a number in [0, 1000] (negative or larger is the closed 400, replacing the builder's silent exclusion of negative weights) and the composite is computed over the weights normalized to sum to 1, so it is finite; sorting uses the unrounded score. NORMALIZATION: each measure's min-max normalization is computed without overflow (the values are scaled by the largest absolute finite value before subtracting, or an equivalent exact method), so equal values score equal; the composite is a convex combination of normalized terms in [0, 1] (a backend obligation, replacing the builder's range arithmetic). The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic). EFFECTIVE WEIGHTS: ranking_basis.weights are the effective weights actually applied and may be empty (for example an empty leaderboard with no fallback measure); the positive-weight rule applies only to a weights map supplied in the request (see the weights query parameter).", "type": "object", "additionalProperties": false, "x-max-response-bytes": 1048576, @@ -66,7 +66,7 @@ "weights", "constraints" ], - "description": "How the ranking was produced (run_analytics_service.py:1466-1470); identical on every page. weights are the effective weights actually applied (zero weights dropped; the fallback single-measure weight when the objective had no measure, :1475-1531); constraints are upper bounds per measure.", + "description": "How the ranking was produced; identical on every page. weights are the effective weights actually applied (zero weights dropped; the fallback single-measure weight when the objective had no measure); constraints are upper bounds per measure.", "properties": { "objective": { "type": "string", @@ -89,7 +89,7 @@ "minimum": 0, "maximum": 1000 }, - "description": "Effective weights as requested: each a number in [0, 1000] (a negative or larger weight is the closed 400; the builder's historical silent exclusion of negative weights, run_analytics_service.py:1489-1494 and :1615, no longer applies). Zero weights are dropped. The composite score is computed over the weights normalized to sum to 1, so it is finite. The map may be empty (no fallback measure, :1518-1523); the at-least-one-positive rule applies only to the request's supplied weights." + "description": "Effective weights as requested: each a number in [0, 1000] (a negative or larger weight is the closed 400; the builder's historical silent exclusion of negative weights, no longer applies). Zero weights are dropped. The composite score is computed over the weights normalized to sum to 1, so it is finite. The map may be empty (no fallback measure); the at-least-one-positive rule applies only to the request's supplied weights." }, "constraints": { "type": "object", @@ -134,7 +134,7 @@ } ] }, - "description": "Closed builder warnings, identical on every page: the no-eligible-configuration sentence (:1429), the weighted-without-weights sentence (:1497-1499), objective_unavailable:; no numeric measure to rank by (:1522), objective_unavailable:; ranked by fallback measure (:1527-1529)." + "description": "Closed builder warnings, identical on every page: the no-eligible-configuration sentence, the weighted-without-weights sentence, objective_unavailable:; no numeric measure to rank by, objective_unavailable:; ranked by fallback measure ." }, "pagination": { "$ref": "#/definitions/Pagination" @@ -158,14 +158,14 @@ "type": "integer", "minimum": 1, "maximum": 10000, - "description": "1-based unique position over the full ranked population, across all pages (:1449)." + "description": "1-based unique position over the full ranked population, across all pages." }, "trial_ref": { "$ref": "#/definitions/TrialRef" }, "composite_score": { "type": "number", - "description": "Composite objective score, computed over the weights normalized to sum to 1 (so finite), rounded to 9 decimals for display (run_analytics_service.py:1452); the sort and the rank use the UNROUNDED score, so distinct scores may serialize to the same value; any finite JSON number. Normalization is overflow-safe (scaled before subtracting), so equal values score equal; the composite is a convex combination of terms in [0, 1]. The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic)." + "description": "Composite objective score, computed over the weights normalized to sum to 1 (so finite), rounded to 9 decimals for display; the sort and the rank use the UNROUNDED score, so distinct scores may serialize to the same value; any finite JSON number. Normalization is overflow-safe (scaled before subtracting), so equal values score equal; the composite is a convex combination of terms in [0, 1]. The ranking sorts by the unrounded binary64 composite; equal composites are ordered by the raw values of the weighted measures in descending weight order, ties between equal weights broken by measure name ascending (lexicographic), each compared in that measure's better direction, with a missing raw value ordered after any present value at that step; any remaining tie is broken by ascending trial_ref (lexicographic)." }, "measures": { "allOf": [ @@ -174,7 +174,7 @@ } ], "minProperties": 1, - "description": "Raw measured aggregate per measure name (the weighted measures plus the resolved quality, cost and latency axes), finite values only (:1738-1746); at least one. Names follow the one name policy ^[^\\x00-\\x1f\\x7f]{1,128}$; a stored metric name outside it is the closed 503 for the run, never truncated." + "description": "Raw measured aggregate per measure name (the weighted measures plus the resolved quality, cost and latency axes), finite values only; at least one. Names follow the one name policy ^[^\\x00-\\x1f\\x7f]{1,128}$; a stored metric name outside it is the closed 503 for the run, never truncated." }, "confidence": { "type": "string", @@ -183,7 +183,7 @@ "medium", "high" ], - "description": "Coarse confidence bucket (:1715-1725)." + "description": "Coarse confidence bucket." }, "risk_flags": { "type": "array", @@ -207,7 +207,7 @@ } ] }, - "description": "Closed risk tags (:1651, :1653, :1690, :1694): disqualified_by_constraint:, missing_constrained_measure:, missing_weighted_measure:, low_sample." + "description": "Closed risk tags: disqualified_by_constraint:, missing_constrained_measure:, missing_weighted_measure:, low_sample." }, "recommendation": { "type": "string", @@ -216,7 +216,7 @@ "candidate", "reject" ], - "description": "winner only for rank 1 with no risk flags; reject for every disqualified configuration; otherwise candidate (:1666-1676)." + "description": "winner only for rank 1 with no risk flags; reject for every disqualified configuration; otherwise candidate." } } }, diff --git a/traigent_schema/schemas/analytics/experiment_run_pareto_response_schema.json b/traigent_schema/schemas/analytics/experiment_run_pareto_response_schema.json index c184abf6..b7043f32 100644 --- a/traigent_schema/schemas/analytics/experiment_run_pareto_response_schema.json +++ b/traigent_schema/schemas/analytics/experiment_run_pareto_response_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/experiment_run_pareto_response_schema.json", "title": "Run Pareto Canonical Success Response", - "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto: one cursor page (items plus pagination) of the Pareto analysis of one experiment run. The analysis mirrors RunAnalyticsService.pareto (backend src/services/analytics/run_analytics_service.py:1004-1113, payload keys :1115-1133): measures, frontier entries (rank_on_frontier, metrics, is_knee, tradeoff_summary) and dominated entries (dominated_by, reason), shape (clear_knee, flat, linear, scattered) and warnings. The ranking, frontier, knee and shape are computed over the FULL eligible population (the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing; above it the closed 503, never truncated and presented as complete) and only then paginated, so the frontier and the knee do not depend on the page. items are ordered frontier first by ascending rank_on_frontier (the frontier is sorted by the x measure, run_analytics_service.py:1294), then the dominated entries in population order; ties on the frontier are broken by ascending trial_ref (lexicographic) BEFORE ranks are assigned, and the dominated entries are ordered by ascending trial_ref (lexicographic), so page boundaries are stable. The 500 frontier and 1000 dominated truncation of the historical contract (run_analytics_service.py:82-83, :1153-1173) does not apply to this operation, pagination replaces it, so no frontier_truncated, dominated_truncated or dominated_by_truncated warning is emitted. knee_ref names the knee whatever page it is on (null when the frontier has fewer than 3 points, :1298-1303). CANONICAL PROJECTION OMITS INTERNAL IDS: omits config_id (internal configuration-run id; replaced by the run-scoped trial_ref of experiment_run_trial_ref_schema.json, the same value as the report's trial_ref for the same configuration: the configuration run's issued public reference (configuration_runs.configuration_run_ref; backend infrastructure/migrations/versions/20261122_0001_configuration_run_ref_role_v1.py:1-24: sessions issue trial_ plus 16 hex, an issued reference is never re-minted, UNIQUE (tenant_id, configuration_run_ref), NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions; backend src/dal/configuration_run_dal.py:50) and configuration_run_ plus 32 hex (minted by mint_configuration_run_ref, configuration_run_dal.py:60, :345, called from src/services/configuration_run_service.py:238). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in).), omits dominated_by as an internal id (it is a trial_ref of a frontier item), omits project_id (the explicit project is the URL project), and data.run_id is the experiment_run_ref (^experiment_run_[0-9a-f]{32}$) populated from the resolved reference, never the historical run id. The closed schema rejects config_id, project_id and every other undeclared property. pagination carries limit, next_cursor (null on the last page), has_more and a required integer total (the number of items across all pages, at most 10000); frontier_total and dominated_total are the two untruncated counts. The cursor is a sealed opaque string bound to the caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any insert, update or delete of the run's configuration rows or their metrics), never a raw historical primary key; a cursor whose revision no longer matches is the closed 400 invalid_cursor, so a page walk never mixes two analyses. SIZE: this schema gives NO static byte bound. The 1 MiB limit (x-max-response-bytes 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. warnings are constrained to the builder's three tag forms (measure_unavailable:, non_finite_filtered:, single_configuration; run_analytics_service.py:1135-1151, :1051-1080), at most 50 strings of at most 500 characters. Metric values are any finite JSON number. The historical envelope run_pareto_response_schema.json is unchanged and still serves the deprecated analytics path. A canonical view of a run with any configuration whose trial_ref is not yet issued is the closed 503 until the backfill completes. A stored metric name outside the shared name class ^[^\\x00-\\x1f\\x7f]{1,100}$ (control characters, empty or over 100 characters) makes the run's response the closed 503, never truncated or sanitized.", + "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/pareto: one cursor page (items plus pagination) of the Pareto analysis of one experiment run. The analysis mirrors the backend's Pareto analysis: measures, frontier entries (rank_on_frontier, metrics, is_knee, tradeoff_summary) and dominated entries (dominated_by, reason), shape (clear_knee, flat, linear, scattered) and warnings. The ranking, frontier, knee and shape are computed over the FULL eligible population (the cap of 10000 counts ALL the run's scoped configuration rows before any metric processing; above it the closed 503, never truncated and presented as complete) and only then paginated, so the frontier and the knee do not depend on the page. items are ordered frontier first by ascending rank_on_frontier (the frontier is sorted by the x measure), then the dominated entries in population order; ties on the frontier are broken by ascending trial_ref (lexicographic) BEFORE ranks are assigned, and the dominated entries are ordered by ascending trial_ref (lexicographic), so page boundaries are stable. The 500 frontier and 1000 dominated truncation of the historical contract does not apply to this operation, pagination replaces it, so no frontier_truncated, dominated_truncated or dominated_by_truncated warning is emitted. knee_ref names the knee whatever page it is on (null when the frontier has fewer than 3 points). CANONICAL PROJECTION OMITS INTERNAL IDS: omits config_id (internal configuration-run id; replaced by the run-scoped trial_ref of experiment_run_trial_ref_schema.json, the same value as the report's trial_ref for the same configuration: the configuration run's issued public reference (the stored configuration-run reference: sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, absent until the backend's reference backfill has run). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in).), omits dominated_by as an internal id (it is a trial_ref of a frontier item), omits project_id (the explicit project is the URL project), and data.run_id is the experiment_run_ref (^experiment_run_[0-9a-f]{32}$) populated from the resolved reference, never the historical run id. The closed schema rejects config_id, project_id and every other undeclared property. pagination carries limit, next_cursor (null on the last page), has_more and a required integer total (the number of items across all pages, at most 10000); frontier_total and dominated_total are the two untruncated counts. The cursor is a sealed opaque string bound to the caller, project, run, query and analysis_revision (a per-run monotonic counter the backend increments in the same transaction as any insert or delete of the run's configuration rows, and any update that changes a configuration row's analysis content (its status, measures, summary_stats, experiment_parameters or metadata); writes that change none of these (timestamps, workflow metadata, public-reference backfill, identical rewrites) do not change it), never a raw historical primary key; a cursor whose revision no longer matches is the closed 400 invalid_cursor, so a page walk never mixes two analyses. SIZE: this schema gives NO static byte bound. The 1 MiB limit (x-max-response-bytes 1048576) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. warnings are constrained to the builder's three warning formats (measure_unavailable:, non_finite_filtered:, single_configuration), at most 50 strings of at most 500 characters. Metric values are any finite JSON number. The historical envelope run_pareto_response_schema.json is unchanged and still serves the deprecated analytics path. A canonical view of a run with any configuration whose trial_ref is not yet issued is the closed 503 until the backfill completes. A stored metric name outside the shared name class ^[^\\x00-\\x1f\\x7f]{1,100}$ (control characters, empty or over 100 characters) makes the run's response the closed 503, never truncated or sanitized.", "type": "object", "additionalProperties": false, "x-max-response-bytes": 1048576, @@ -64,7 +64,7 @@ "cost", "latency" ], - "description": "Measure name used for each of the three trade-off axes; the literal unavailable when an axis did not resolve (run_analytics_service.py:79, :1017-1021).", + "description": "Measure name used for each of the three trade-off axes; the literal unavailable when an axis did not resolve.", "properties": { "quality": { "$ref": "#/definitions/MeasureName" @@ -85,7 +85,7 @@ "linear", "scattered" ], - "description": "Coarse frontier shape over the full population (run_analytics_service.py:1366-1395)." + "description": "Coarse frontier shape over the full population." }, "knee_ref": { "anyOf": [ @@ -129,7 +129,7 @@ } ] }, - "description": "Closed builder warning tags, identical on every page: measure_unavailable:, non_finite_filtered:, single_configuration (run_analytics_service.py:1051-1080, :1135-1151)." + "description": "Closed builder warning tags, identical on every page: measure_unavailable:, non_finite_filtered:, single_configuration." }, "items": { "type": "array", @@ -163,7 +163,7 @@ "additionalProperties": { "type": "number" }, - "description": "Raw measured aggregate per measure name for this configuration (no request_count scaling): the requested x and y measures plus the resolved quality, cost and latency axes, at most 5 distinct names (run_analytics_service.py:1196-1208). Any finite JSON number is accepted (non-finite values are filtered by the builder and counted in the non_finite_filtered warning); the 1 MiB serialized-envelope guard is the size bound. A stored metric name outside the shared name class ^[^\\x00-\\x1f\\x7f]{1,100}$ (control characters, empty or over 100 characters) makes the run's response the closed 503, never truncated or sanitized." + "description": "Raw measured aggregate per measure name for this configuration (no request_count scaling): the requested x and y measures plus the resolved quality, cost and latency axes, at most 5 distinct names. Any finite JSON number is accepted (non-finite values are filtered by the builder and counted in the non_finite_filtered warning); the 1 MiB serialized-envelope guard is the size bound. A stored metric name outside the shared name class ^[^\\x00-\\x1f\\x7f]{1,100}$ (control characters, empty or over 100 characters) makes the run's response the closed 503, never truncated or sanitized." }, "FrontierItem": { "type": "object", @@ -199,7 +199,7 @@ "type": "string", "minLength": 1, "maxLength": 500, - "description": "Templated trade-off summary (run_analytics_service.py:1322-1327); echoes the requested x and y measure names." + "description": "Templated trade-off summary; echoes the requested x and y measure names." } } }, diff --git a/traigent_schema/schemas/analytics/experiment_run_report_response_schema.json b/traigent_schema/schemas/analytics/experiment_run_report_response_schema.json index 2c9a8a25..c0cb895f 100644 --- a/traigent_schema/schemas/analytics/experiment_run_report_response_schema.json +++ b/traigent_schema/schemas/analytics/experiment_run_report_response_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/experiment_run_report_response_schema.json", "title": "Run Report Canonical Success Response", - "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report. The report DTO (results/report_payload_response_schema.json) is mirrored under data by a closed definition (not re-used through allOf, because the shared DTO requires the internal trial_id on every row) that declares every field ExperimentReportService.generate_report_payload always emits (src/services/analytics/experiment_report_service.py:279-315: generated_at, experiment_context, methodology, example_index_map, provenance, aggregated_results, raw_example_results, insights, warnings), each bounded in shape. CANONICAL PROJECTION OMITS INTERNAL IDS (internal ids never appear in payloads): the canonical projection omits experiment_context.experiment_id: internal id; omits experiment_context.run_id: internal id; omits provenance.source_endpoints: its URLs embed the internal run id; omits report_id: it embeds the internal run id (report__, experiment_report_service.py:264). The closed branch rejects these properties. data.provenance.run_id is REQUIRED and is the experiment_run_ref (^experiment_run_[0-9a-f]{32}$); the canonical projection populates it from the resolved reference (backend obligation), never from the historical run id. trial_ref (an opaque persisted reference) and example_id are the row identity; trial_id is omitted (internal configuration-run id). config_params follows the sanitizer shapes (src/services/analytics/config_redaction.py:79-82, :111-172): nesting to depth 3, lists of at most 12 items, strings of at most 128 characters, at most 64 keys per object; empty objects and arrays are accepted at the depth limit, as the sanitizer emits them. Row identity is the opaque run-scoped trial_ref (^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$, defined once in experiment_run_trial_ref_schema.json: The configuration run's issued public reference (configuration_runs.configuration_run_ref; backend infrastructure/migrations/versions/20261122_0001_configuration_run_ref_role_v1.py:1-24: sessions issue trial_ plus 16 hex, an issued reference is never re-minted, UNIQUE (tenant_id, configuration_run_ref), NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions; backend src/dal/configuration_run_dal.py:50) and configuration_run_ plus 32 hex (minted by mint_configuration_run_ref, configuration_run_dal.py:60, :345, called from src/services/configuration_run_service.py:238). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in). Shared by aggregate and example rows); trial_id (the internal configuration-run id, builder :1621-1629, :1707) is rejected. The projection must also scrub internal ids embedded in warnings, insight evidence and fallback config labels (backend obligation; builder :1621-1629, :1707, :1777, :1887-1891, :1933, :2288). SIZE: this schema gives NO static byte bound. The 8 MiB limit (x-max-response-bytes 8388608) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. Collection caps are realistic limits (aggregated_results 1000, raw_example_results 5000 with example_index_map the same displayed rows, insights 50 computed over the full population, warnings 1000 of at most 512 characters). Rows beyond a cap are truncated server-side, deterministically; meta.aggregated_results_total and meta.raw_example_results_total (required integers) carry the untruncated counts. meta and metadata are bounded maps of strings, booleans, null and safe-range integers. The historical envelope run_report_response_schema.json is unchanged and still serves the deprecated analytics path. The optimization report payload (report.get_optimization_report_payload, W8) is a different contract and is not merged here.", + "description": "Platform success envelope for GET /api/v1/projects/{project_id}/experiment-runs/{experiment_run_ref}/report. The report DTO (results/report_payload_response_schema.json) is mirrored under data by a closed definition (not re-used through allOf, because the shared DTO requires the internal trial_id on every row) that declares every field the backend's report builder always emits (generated_at, experiment_context, methodology, example_index_map, provenance, aggregated_results, raw_example_results, insights, warnings), each bounded in shape. CANONICAL PROJECTION OMITS INTERNAL IDS (internal ids never appear in payloads): the canonical projection omits experiment_context.experiment_id: internal id; omits experiment_context.run_id: internal id; omits provenance.source_endpoints: its URLs embed the internal run id; omits report_id: it embeds the internal run id (report__). The closed branch rejects these properties. data.provenance.run_id is REQUIRED and is the experiment_run_ref (^experiment_run_[0-9a-f]{32}$); the canonical projection populates it from the resolved reference (backend obligation), never from the historical run id. trial_ref (an opaque persisted reference) and example_id are the row identity; trial_id is omitted (internal configuration-run id). config_params follows the sanitizer shapes: nesting to depth 3, lists of at most 12 items, strings of at most 128 characters, at most 64 keys per object; empty objects and arrays are accepted at the depth limit, as the sanitizer emits them. Row identity is the opaque run-scoped trial_ref (^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$, defined once in experiment_run_trial_ref_schema.json: The configuration run's issued public reference (the stored configuration-run reference: sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, absent until the backend's reference backfill has run). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in). Shared by aggregate and example rows); trial_id (the internal configuration-run id) is rejected. The projection must also scrub internal ids embedded in warnings, insight evidence and fallback config labels (backend obligation). SIZE: this schema gives NO static byte bound. The 8 MiB limit (x-max-response-bytes 8388608) is enforced on the serialized envelope: the handler measures the final serialized bytes, sends those same bytes, and returns the closed 503 when over the limit. Collection caps are realistic limits (aggregated_results 1000, raw_example_results 5000 with example_index_map the same displayed rows, insights 50 computed over the full population, warnings 1000 of at most 512 characters). Rows beyond a cap are truncated server-side, deterministically; meta.aggregated_results_total and meta.raw_example_results_total (required integers) carry the untruncated counts. Likewise insights beyond 50 and warnings beyond 1000 are truncated server-side in a deterministic order, and a warning longer than 512 characters is omitted (never cut, so no partial identifier is emitted); the server reports the untruncated counts under the optional meta keys insights_total and warnings_total (extra keys of the open meta map, counting omitted over-length warnings); the schema does not require these keys and does not type them beyond the open meta value rule (string, boolean, null or safe-range integer). meta and metadata are bounded maps of strings, booleans, null and safe-range integers. The historical envelope run_report_response_schema.json is unchanged and still serves the deprecated analytics path. The optimization report payload (GET /api/v1/experiment-runs/runs/{run_id}/report-payload) is a different contract and is not merged here.", "type": "object", "additionalProperties": false, "x-max-response-bytes": 8388608, @@ -81,7 +81,7 @@ "type": "string", "maxLength": 64 }, - "description": "Sanitized configuration (config_redaction.py:79-82,111-172): nesting to depth 3 (objects and lists), lists of at most 12 items, strings of at most 128 characters, at most 64 keys per object.", + "description": "Sanitized configuration : nesting to depth 3 (objects and lists), lists of at most 12 items, strings of at most 128 characters, at most 64 keys per object.", "additionalProperties": { "anyOf": [ { @@ -355,7 +355,7 @@ "items": { "$ref": "#/definitions/ReportInsight" }, - "description": "Computed over the full report population, before any display truncation." + "description": "Computed over the full report population, before any display truncation. Insights beyond 50 are truncated server-side in a deterministic order; the server reports the untruncated count under the optional meta key insights_total (not required or integer-typed by this schema)." }, "warnings": { "type": "array", @@ -363,7 +363,8 @@ "items": { "type": "string", "maxLength": 512 - } + }, + "description": "Warnings beyond 1000 are truncated server-side in a deterministic order. A warning longer than 512 characters is omitted, never cut, so no partial identifier is emitted; the server reports the untruncated count under the optional meta key warnings_total, counting omitted over-length warnings (not required or integer-typed by this schema)." } } }, @@ -584,7 +585,7 @@ } ] }, - "description": "Deepest container the sanitizer keeps content in. Its children sit at the sanitizer depth limit: scalars, or an EMPTY object or array, which the sanitizer emits as {} and [] (config_redaction.py:157, :172); a non-empty container at that depth is dropped (:112-114, :157, :172), so it is rejected here." + "description": "Deepest container the sanitizer keeps content in. Its children sit at the sanitizer depth limit: scalars, or an EMPTY object or array, which the sanitizer emits as {} and []; a non-empty container at that depth is dropped, so it is rejected here." }, "ConfigDepth2List": { "type": "array", @@ -614,7 +615,7 @@ } ] }, - "description": "Deepest container the sanitizer keeps content in. Its children sit at the sanitizer depth limit: scalars, or an EMPTY object or array, which the sanitizer emits as {} and [] (config_redaction.py:157, :172); a non-empty container at that depth is dropped (:112-114, :157, :172), so it is rejected here." + "description": "Deepest container the sanitizer keeps content in. Its children sit at the sanitizer depth limit: scalars, or an EMPTY object or array, which the sanitizer emits as {} and []; a non-empty container at that depth is dropped, so it is rejected here." }, "ConfigDepth1Object": { "type": "object", diff --git a/traigent_schema/schemas/analytics/experiment_run_trial_ref_schema.json b/traigent_schema/schemas/analytics/experiment_run_trial_ref_schema.json index 6afc0960..335a0215 100644 --- a/traigent_schema/schemas/analytics/experiment_run_trial_ref_schema.json +++ b/traigent_schema/schemas/analytics/experiment_run_trial_ref_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/experiment_run_trial_ref_schema.json", "title": "Experiment Run Trial Reference", - "description": "The configuration run's issued public reference (configuration_runs.configuration_run_ref; backend infrastructure/migrations/versions/20261122_0001_configuration_run_ref_role_v1.py:1-24: sessions issue trial_ plus 16 hex, an issued reference is never re-minted, UNIQUE (tenant_id, configuration_run_ref), NULL until the reference backfill). Two issued formats exist: trial_ plus 16 hex (issued by sessions; backend src/dal/configuration_run_dal.py:50) and configuration_run_ plus 32 hex (minted by mint_configuration_run_ref, configuration_run_dal.py:60, :345, called from src/services/configuration_run_service.py:238). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in). Shared by the report, Pareto, correlations and leaderboard views of one experiment run.", + "description": "The configuration run's issued public reference (the stored configuration-run reference: sessions issue trial_ plus 16 hex, an issued reference is never re-minted, unique per tenant, absent until the backend's reference backfill has run). Two issued formats exist: trial_ plus 16 hex (issued by sessions) and configuration_run_ plus 32 hex (minted by the backend). Issued once, never re-minted, so it is stable across views, pages and deletion of other configurations. The internal id is never emitted. A canonical view of a run with any configuration whose reference is not yet issued is the closed 503 until the backfill completes (never a positional or synthetic stand-in). Shared by the report, Pareto and leaderboard views of one experiment run.", "type": "string", "pattern": "^(trial_[0-9a-f]{16}|configuration_run_[0-9a-f]{32})$", "minLength": 22, diff --git a/traigent_schema/schemas/analytics/leaderboard_problem_schema.json b/traigent_schema/schemas/analytics/leaderboard_problem_schema.json index 43d532c0..c92c7eba 100644 --- a/traigent_schema/schemas/analytics/leaderboard_problem_schema.json +++ b/traigent_schema/schemas/analytics/leaderboard_problem_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/leaderboard_problem_schema.json", "title": "Run Leaderboard Problem", - "description": "Closed RFC 9457 problem documents of experiment_run.get_run_leaderboard (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue (src/api_kit/problems.py PROBLEMS) with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref, an out-of-range limit or request_count, an unknown objective, or a malformed weights or constraints value, a malformed or over-long cursor, a cursor that does not belong to this caller, run and query, or an unknown or retired query parameter (page, offset and every undeclared name); it never echoes the offending value (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the leaderboard cannot be produced within its budget (serialized response over 1 MiB, more than 10000 scoped configuration rows (counted before any metric processing), deadline exhausted, or a required dependency down, a run with any configuration whose trial_ref is not yet issued, or a stored metric name outside the name policy): the response is refused, never a partial leaderboard presented as complete. 429 and 503 may carry a Retry-After header. InvalidCursorProblem (backend src/api_kit/problems.py:33, code invalid_cursor, 400) is a cursor that is malformed or does not belong to this caller, project, run and query, or whose analysis_revision (the per-run monotonic counter) no longer matches the run; it echoes nothing.", + "description": "Closed RFC 9457 problem documents of experiment_run.get_run_leaderboard (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref, an out-of-range limit or request_count, an unknown objective, or a malformed weights or constraints value, or an unknown or retired query parameter (page, offset and every undeclared name); it never echoes the offending value (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the leaderboard cannot be produced within its budget (serialized response over 1 MiB, more than 10000 scoped configuration rows (counted before any metric processing), deadline exhausted, or a required dependency down, a run with any configuration whose trial_ref is not yet issued, or a stored metric name outside the name policy): the response is refused, never a partial leaderboard presented as complete. 429 and 503 may carry a Retry-After header. InvalidCursorProblem (the backend's existing invalid-cursor problem, code invalid_cursor, 400) is any invalid or stale cursor: malformed or over-long, not belonging to this caller, project, run and query, or whose analysis_revision (the per-run monotonic counter) no longer matches the run; it echoes nothing.", "definitions": { "UnauthenticatedProblem": { "type": "object", diff --git a/traigent_schema/schemas/analytics/pareto_problem_schema.json b/traigent_schema/schemas/analytics/pareto_problem_schema.json index 6dc120a7..3887e34e 100644 --- a/traigent_schema/schemas/analytics/pareto_problem_schema.json +++ b/traigent_schema/schemas/analytics/pareto_problem_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/pareto_problem_schema.json", "title": "Run Pareto Problem", - "description": "Closed RFC 9457 problem documents of experiment_run.get_run_pareto (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue (src/api_kit/problems.py PROBLEMS) with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref, an out-of-range limit or request_count, an x_measure or y_measure containing control characters, or an unknown or retired query parameter (page, offset and every undeclared name); it never echoes the offending value (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the Pareto analysis cannot be produced within its budget (serialized response over 1 MiB, more than 10000 scoped configuration rows, counted before any metric processing, deadline exhausted, a configuration whose trial_ref is not yet issued, or a required dependency down): the response is refused, never a partial analysis presented as complete. 429 and 503 may carry a Retry-After header. InvalidCursorProblem (backend src/api_kit/problems.py:33, code invalid_cursor, 400) is any invalid or stale cursor: malformed or over-long, not belonging to this caller, project, run and query, or whose analysis_revision no longer matches the run; it echoes nothing. ServiceUnavailableProblem is also the outcome when a stored metric name is outside the shared name class (control characters, empty or over 100 characters): never truncated or sanitized.", + "description": "Closed RFC 9457 problem documents of experiment_run.get_run_pareto (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref, an out-of-range limit or request_count, an x_measure or y_measure containing control characters, or an unknown or retired query parameter (page, offset and every undeclared name); it never echoes the offending value (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the Pareto analysis cannot be produced within its budget (serialized response over 1 MiB, more than 10000 scoped configuration rows, counted before any metric processing, deadline exhausted, a configuration whose trial_ref is not yet issued, or a required dependency down): the response is refused, never a partial analysis presented as complete. 429 and 503 may carry a Retry-After header. InvalidCursorProblem (the backend's existing invalid-cursor problem, code invalid_cursor, 400) is any invalid or stale cursor: malformed or over-long, not belonging to this caller, project, run and query, or whose analysis_revision no longer matches the run; it echoes nothing. ServiceUnavailableProblem is also the outcome when a stored metric name is outside the shared name class (control characters, empty or over 100 characters): never truncated or sanitized.", "definitions": { "UnauthenticatedProblem": { "type": "object", diff --git a/traigent_schema/schemas/analytics/report_problem_schema.json b/traigent_schema/schemas/analytics/report_problem_schema.json index f7a00aa6..5663575c 100644 --- a/traigent_schema/schemas/analytics/report_problem_schema.json +++ b/traigent_schema/schemas/analytics/report_problem_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.traigent.ai/analytics/report_problem_schema.json", "title": "Run Report Problem", - "description": "Closed RFC 9457 problem documents of experiment_run.get_run_report (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue (src/api_kit/problems.py PROBLEMS) with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the report cannot be produced within its budget (response over 8 MiB, more eligible rows than the computation limit, deadline exhausted, or a required dependency down): the response is refused, never a partial report presented as complete. 429 and 503 may carry a Retry-After header.", + "description": "Closed RFC 9457 problem documents of experiment_run.get_run_report (application/problem+json). Each definition is one status/code/type combination of the backend problem catalogue with its fixed title, detail and server-minted problem_id (first 32 hex of sha256 of the type URN); nothing the client sent is echoed. NotFoundProblem is the one closed 404 for a missing, foreign, ungranted, revoked or retired run: identical bytes in every case. BadRequestProblem is a malformed experiment_run_ref (syntax is validated before any lookup). ServiceUnavailableProblem is the declared outcome when the report cannot be produced within its budget (response over 8 MiB, more eligible rows than the computation limit, deadline exhausted, or a required dependency down): the response is refused, never a partial report presented as complete. 429 and 503 may carry a Retry-After header.", "definitions": { "UnauthenticatedProblem": { "type": "object",