nthlayer-core 2.0.0__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/PKG-INFO +2 -2
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/pyproject.toml +7 -4
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/_openapi/paths_other.py +277 -38
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/catalogue.py +16 -24
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core.egg-info/PKG-INFO +2 -2
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core.egg-info/SOURCES.txt +2 -1
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core.egg-info/requires.txt +1 -1
- nthlayer_core-3.0.0/tests/test_api_manifests.py +637 -0
- nthlayer_core-3.0.0/tests/test_threshold_schema_parity.py +110 -0
- nthlayer_core-2.0.0/tests/test_api_manifests.py +0 -334
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/README.md +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/setup.cfg +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/__init__.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/_openapi/__init__.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/_openapi/paths_assessments_cases.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/_openapi/paths_health.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/_openapi/paths_verdicts.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/cli.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/openapi_spec.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/server.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core/store.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core.egg-info/dependency_links.txt +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core.egg-info/entry_points.txt +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/src/nthlayer_core.egg-info/top_level.txt +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_api.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_api_cases.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_api_component_state.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_api_heartbeats.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_api_overrides.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_api_suppressions.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_dependency_declarations.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_deploying_doc_parity.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_health.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_openapi.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_retention.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_store.py +0 -0
- {nthlayer_core-2.0.0 → nthlayer_core-3.0.0}/tests/test_store_verdictstore.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nthlayer-core
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: NthLayer core — reliability-critical verdict store, case management, and HTTP API
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: nthlayer-common<
|
|
7
|
+
Requires-Dist: nthlayer-common<6.0.0,>=5.0.0
|
|
8
8
|
Requires-Dist: starlette>=0.40
|
|
9
9
|
Requires-Dist: uvicorn>=0.30
|
|
10
10
|
Requires-Dist: httpx>=0.27
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nthlayer-core"
|
|
7
|
-
version = "
|
|
7
|
+
version = "3.0.0"
|
|
8
8
|
description = "NthLayer core — reliability-critical verdict store, case management, and HTTP API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -15,9 +15,12 @@ dependencies = [
|
|
|
15
15
|
# tests/smoke/test_resolved_dependencies.py; see CLAUDE.md
|
|
16
16
|
# hard rule 10 for why both are needed [opensrm-p3bm].
|
|
17
17
|
# 4.0.0 moved segments/stability/calibration/audit_backlog/feedback_latency
|
|
18
|
-
# out of manifest.slos into manifest.judgment_thresholds [opensrm-l33e]
|
|
19
|
-
#
|
|
20
|
-
|
|
18
|
+
# out of manifest.slos into manifest.judgment_thresholds [opensrm-l33e].
|
|
19
|
+
# 5.0.0 gives segments a required `metric` (+ its parameter) and closes
|
|
20
|
+
# every threshold entry [opensrm-7zpz]; catalogue.manifest_to_dict
|
|
21
|
+
# serialises each threshold via threshold_to_v2_entry, common's validated
|
|
22
|
+
# emitter of the v2 spec.judgment_threshold entry, never a hand-copy.
|
|
23
|
+
"nthlayer-common>=5.0.0,<6.0.0",
|
|
21
24
|
"starlette>=0.40",
|
|
22
25
|
"uvicorn>=0.30",
|
|
23
26
|
"httpx>=0.27",
|
|
@@ -775,6 +775,247 @@ PATHS: dict[str, dict] = {
|
|
|
775
775
|
},
|
|
776
776
|
}
|
|
777
777
|
|
|
778
|
+
# ---------------------------------------------------------------------------
|
|
779
|
+
# Judgment threshold items (opensrm-7zpz). Each /manifests judgment_thresholds
|
|
780
|
+
# item is the v2 spec.judgment_threshold entry nthlayer-common's
|
|
781
|
+
# threshold_to_v2_entry emits. The shapes mirror opensrm spec/v2/schema.json
|
|
782
|
+
# JudgmentThresholdSpec per type -- closed objects, closed bounds, the segments
|
|
783
|
+
# metric enum and its per-metric parameters -- narrowed only where the served
|
|
784
|
+
# entry is always more complete than a declared one: a segments item always
|
|
785
|
+
# carries measurement.window (the 30d default stated, OPENSRM-CORE-v2 §5.5.1)
|
|
786
|
+
# -- a server-side narrowing of the spec, which leaves window optional.
|
|
787
|
+
# Duration and Ratio copy the spec's definitions of the same names.
|
|
788
|
+
# ---------------------------------------------------------------------------
|
|
789
|
+
|
|
790
|
+
_DURATION: dict = {
|
|
791
|
+
"type": "string",
|
|
792
|
+
"pattern": "^[0-9]+(ms|s|m|h|d|w)$",
|
|
793
|
+
"description": "Duration: an integer followed by ms, s, m, h, d, or w.",
|
|
794
|
+
}
|
|
795
|
+
_RATIO: dict = {
|
|
796
|
+
"type": "number",
|
|
797
|
+
"minimum": 0,
|
|
798
|
+
"maximum": 1,
|
|
799
|
+
"description": "Ratio value (0.0 - 1.0), not a percentage.",
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
def _threshold_item(type_name: str, description: str, required: list[str],
|
|
804
|
+
properties: dict, **extra: object) -> dict:
|
|
805
|
+
"""A closed threshold item whose ``type`` is *type_name*."""
|
|
806
|
+
return {
|
|
807
|
+
"type": "object",
|
|
808
|
+
"description": description,
|
|
809
|
+
"required": ["type", *required, "bounds"],
|
|
810
|
+
"properties": {"type": {"const": type_name}, **properties},
|
|
811
|
+
"additionalProperties": False,
|
|
812
|
+
**extra,
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
# Matches no value: a key so marked must be absent. The spec's spelling.
|
|
817
|
+
_ABSENT: dict = {"not": {}}
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
def _requires_parameter_iff(metric: str, then: dict, otherwise: dict) -> dict:
|
|
821
|
+
"""*then* applies when ``metric`` is *metric*, *otherwise* for every other."""
|
|
822
|
+
return {
|
|
823
|
+
"if": {"properties": {"metric": {"const": metric}}, "required": ["metric"]},
|
|
824
|
+
"then": then,
|
|
825
|
+
"else": otherwise,
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
_SEGMENTS_THRESHOLD = _threshold_item(
|
|
830
|
+
"segments",
|
|
831
|
+
(
|
|
832
|
+
"The rate ``metric`` names must not vary across ``segment_values`` "
|
|
833
|
+
"of ``segment_dimension`` by more than the bound (OPENSRM-CORE-v2 "
|
|
834
|
+
"§5.5.1). ``measurement.window`` is the population window and is "
|
|
835
|
+
"always present (``30d`` when the manifest omits it). Parameters "
|
|
836
|
+
"per metric: reversal_rate ``measurement.source``; "
|
|
837
|
+
"high_confidence_failure ``measurement.confidence_threshold``; "
|
|
838
|
+
"outcomes ``outcome_signal``; escalation none."
|
|
839
|
+
),
|
|
840
|
+
["metric", "measurement", "segment_dimension", "segment_values"],
|
|
841
|
+
{
|
|
842
|
+
"metric": {
|
|
843
|
+
"enum": [
|
|
844
|
+
"reversal_rate",
|
|
845
|
+
"high_confidence_failure",
|
|
846
|
+
"outcomes",
|
|
847
|
+
"escalation",
|
|
848
|
+
],
|
|
849
|
+
"description": (
|
|
850
|
+
"The judgment rate compared across segments. escalation is "
|
|
851
|
+
"the escalation rate, not the human agreement rate."
|
|
852
|
+
),
|
|
853
|
+
},
|
|
854
|
+
"measurement": {
|
|
855
|
+
"type": "object",
|
|
856
|
+
"required": ["window"],
|
|
857
|
+
"properties": {
|
|
858
|
+
"window": {
|
|
859
|
+
"description": (
|
|
860
|
+
"Population window. Always present when served: the "
|
|
861
|
+
"manifest's value or the 30d default "
|
|
862
|
+
"(OPENSRM-CORE-v2 §5.5.1)."
|
|
863
|
+
),
|
|
864
|
+
"allOf": [
|
|
865
|
+
_DURATION,
|
|
866
|
+
{
|
|
867
|
+
"not": {"pattern": "^0+(ms|s|m|h|d|w)$"},
|
|
868
|
+
"description": "Never zero.",
|
|
869
|
+
},
|
|
870
|
+
],
|
|
871
|
+
},
|
|
872
|
+
"source": {
|
|
873
|
+
"enum": ["lineage", "calibration_sample", "downstream_signal"],
|
|
874
|
+
},
|
|
875
|
+
"confidence_threshold": _RATIO,
|
|
876
|
+
},
|
|
877
|
+
"additionalProperties": False,
|
|
878
|
+
},
|
|
879
|
+
"outcome_signal": {
|
|
880
|
+
"type": "object",
|
|
881
|
+
"description": (
|
|
882
|
+
"outcomes only. ``window`` is how long after a decision to "
|
|
883
|
+
"wait for its outcome, not the population window."
|
|
884
|
+
),
|
|
885
|
+
"required": ["source", "window"],
|
|
886
|
+
"properties": {"source": {"type": "string"}, "window": _DURATION},
|
|
887
|
+
"additionalProperties": False,
|
|
888
|
+
},
|
|
889
|
+
"segment_dimension": {"type": "string", "minLength": 1},
|
|
890
|
+
"segment_values": {
|
|
891
|
+
"type": "array",
|
|
892
|
+
"items": {"type": "string", "minLength": 1},
|
|
893
|
+
"minItems": 1,
|
|
894
|
+
},
|
|
895
|
+
"bounds": {
|
|
896
|
+
"type": "object",
|
|
897
|
+
"required": ["maximum_variance_from_overall"],
|
|
898
|
+
"properties": {"maximum_variance_from_overall": _RATIO},
|
|
899
|
+
"additionalProperties": False,
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
allOf=[
|
|
903
|
+
_requires_parameter_iff(
|
|
904
|
+
"reversal_rate",
|
|
905
|
+
{"properties": {"measurement": {"required": ["source"]}}},
|
|
906
|
+
{"properties": {"measurement": {"properties": {"source": _ABSENT}}}},
|
|
907
|
+
),
|
|
908
|
+
_requires_parameter_iff(
|
|
909
|
+
"high_confidence_failure",
|
|
910
|
+
{"properties": {"measurement": {"required": ["confidence_threshold"]}}},
|
|
911
|
+
{"properties": {"measurement": {"properties": {"confidence_threshold": _ABSENT}}}},
|
|
912
|
+
),
|
|
913
|
+
_requires_parameter_iff(
|
|
914
|
+
"outcomes",
|
|
915
|
+
{"required": ["outcome_signal"]},
|
|
916
|
+
{"properties": {"outcome_signal": _ABSENT}},
|
|
917
|
+
),
|
|
918
|
+
],
|
|
919
|
+
)
|
|
920
|
+
|
|
921
|
+
_STABILITY_THRESHOLD = _threshold_item(
|
|
922
|
+
"stability",
|
|
923
|
+
"Drift on a frozen probe input set must stay within ``maximum_drift``.",
|
|
924
|
+
["probe"],
|
|
925
|
+
{
|
|
926
|
+
"probe": {
|
|
927
|
+
"type": "object",
|
|
928
|
+
"required": ["frozen_input_set", "frequency"],
|
|
929
|
+
"properties": {
|
|
930
|
+
"frozen_input_set": {"type": "string"},
|
|
931
|
+
"frequency": {"enum": ["hourly", "daily", "weekly"]},
|
|
932
|
+
},
|
|
933
|
+
"additionalProperties": False,
|
|
934
|
+
},
|
|
935
|
+
"bounds": {
|
|
936
|
+
"type": "object",
|
|
937
|
+
"required": ["maximum_drift"],
|
|
938
|
+
"properties": {"maximum_drift": _RATIO},
|
|
939
|
+
"additionalProperties": False,
|
|
940
|
+
},
|
|
941
|
+
},
|
|
942
|
+
)
|
|
943
|
+
|
|
944
|
+
_CALIBRATION_THRESHOLD = _threshold_item(
|
|
945
|
+
"calibration",
|
|
946
|
+
(
|
|
947
|
+
"Calibration error over ``measurement.bins`` confidence bins in "
|
|
948
|
+
"``measurement.window``. An srm/v1 calibration SLO is served lifted "
|
|
949
|
+
"to this shape (bound ``maximum_expected_calibration_error``)."
|
|
950
|
+
),
|
|
951
|
+
["measurement"],
|
|
952
|
+
{
|
|
953
|
+
"measurement": {
|
|
954
|
+
"type": "object",
|
|
955
|
+
"required": ["bins", "window"],
|
|
956
|
+
"properties": {
|
|
957
|
+
"bins": {"type": "integer", "minimum": 2},
|
|
958
|
+
"window": _DURATION,
|
|
959
|
+
},
|
|
960
|
+
"additionalProperties": False,
|
|
961
|
+
},
|
|
962
|
+
"bounds": {
|
|
963
|
+
"type": "object",
|
|
964
|
+
"anyOf": [
|
|
965
|
+
{"required": ["maximum_brier_score"]},
|
|
966
|
+
{"required": ["maximum_expected_calibration_error"]},
|
|
967
|
+
],
|
|
968
|
+
"properties": {
|
|
969
|
+
"maximum_brier_score": {"type": "number", "minimum": 0, "maximum": 1},
|
|
970
|
+
"maximum_expected_calibration_error": _RATIO,
|
|
971
|
+
},
|
|
972
|
+
"additionalProperties": False,
|
|
973
|
+
},
|
|
974
|
+
},
|
|
975
|
+
)
|
|
976
|
+
|
|
977
|
+
_AUDIT_BACKLOG_THRESHOLD = _threshold_item(
|
|
978
|
+
"audit_backlog",
|
|
979
|
+
"The oldest unaudited decision must be younger than ``maximum_age``.",
|
|
980
|
+
[],
|
|
981
|
+
{
|
|
982
|
+
"bounds": {
|
|
983
|
+
"type": "object",
|
|
984
|
+
"required": ["maximum_age"],
|
|
985
|
+
"properties": {"maximum_age": _DURATION},
|
|
986
|
+
"additionalProperties": False,
|
|
987
|
+
},
|
|
988
|
+
},
|
|
989
|
+
)
|
|
990
|
+
|
|
991
|
+
_FEEDBACK_LATENCY_THRESHOLD = _threshold_item(
|
|
992
|
+
"feedback_latency",
|
|
993
|
+
(
|
|
994
|
+
"Time from decision to outcome must stay within the percentile "
|
|
995
|
+
"bounds. An srm/v1 feedback_latency SLO is served lifted to this "
|
|
996
|
+
"shape (target in its unit becomes ``maximum_p50``)."
|
|
997
|
+
),
|
|
998
|
+
[],
|
|
999
|
+
{
|
|
1000
|
+
"bounds": {
|
|
1001
|
+
"type": "object",
|
|
1002
|
+
"anyOf": [{"required": ["maximum_p50"]}, {"required": ["maximum_p90"]}],
|
|
1003
|
+
"properties": {"maximum_p50": _DURATION, "maximum_p90": _DURATION},
|
|
1004
|
+
"additionalProperties": False,
|
|
1005
|
+
},
|
|
1006
|
+
},
|
|
1007
|
+
)
|
|
1008
|
+
|
|
1009
|
+
# Component name per threshold type, shared by the oneOf and its discriminator.
|
|
1010
|
+
_THRESHOLD_COMPONENTS = {
|
|
1011
|
+
"segments": "JudgmentThresholdSegments",
|
|
1012
|
+
"stability": "JudgmentThresholdStability",
|
|
1013
|
+
"calibration": "JudgmentThresholdCalibration",
|
|
1014
|
+
"audit_backlog": "JudgmentThresholdAuditBacklog",
|
|
1015
|
+
"feedback_latency": "JudgmentThresholdFeedbackLatency",
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
|
|
778
1019
|
SCHEMAS: dict[str, dict] = {
|
|
779
1020
|
"ChangeFreeze": {
|
|
780
1021
|
"type": "object",
|
|
@@ -900,48 +1141,46 @@ SCHEMAS: dict[str, dict] = {
|
|
|
900
1141
|
},
|
|
901
1142
|
"judgment_thresholds": {
|
|
902
1143
|
"type": "array",
|
|
903
|
-
"
|
|
904
|
-
"
|
|
905
|
-
"
|
|
906
|
-
"
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
},
|
|
917
|
-
"bounds": {
|
|
918
|
-
"type": "object",
|
|
919
|
-
"description": (
|
|
920
|
-
"Bound name to value, as declared: a number "
|
|
921
|
-
"for Ratio bounds, a duration string such as "
|
|
922
|
-
"``24h`` for Duration bounds."
|
|
923
|
-
),
|
|
924
|
-
"additionalProperties": {
|
|
925
|
-
"oneOf": [{"type": "number"}, {"type": "string"}]
|
|
926
|
-
},
|
|
927
|
-
},
|
|
928
|
-
"measurement": {
|
|
929
|
-
"type": "object",
|
|
930
|
-
"description": (
|
|
931
|
-
"Only the fields set for the threshold's type: "
|
|
932
|
-
"calibration bins/window; stability probe "
|
|
933
|
-
"{frozen_input_set, frequency}; segments "
|
|
934
|
-
"segment_dimension/segment_values; empty for "
|
|
935
|
-
"audit_backlog and feedback_latency."
|
|
936
|
-
),
|
|
937
|
-
"additionalProperties": True,
|
|
938
|
-
},
|
|
939
|
-
},
|
|
940
|
-
},
|
|
1144
|
+
"description": (
|
|
1145
|
+
"Each item is the OpenSRM v2 ``spec.judgment_threshold`` "
|
|
1146
|
+
"entry (OPENSRM-CORE-v2 §5.5), emitted by nthlayer-common's "
|
|
1147
|
+
"``threshold_to_v2_entry``. Items are closed: only the "
|
|
1148
|
+
"keys their ``type`` defines appear. Changed in 3.0 (was "
|
|
1149
|
+
"{type, bounds, measurement}): segment_dimension, "
|
|
1150
|
+
"segment_values and probe are now entry-level, not under "
|
|
1151
|
+
"measurement; segments gain required ``metric`` and "
|
|
1152
|
+
"optional ``outcome_signal``; audit_backlog and "
|
|
1153
|
+
"feedback_latency have no ``measurement`` key (2.x sent "
|
|
1154
|
+
"{}). Branch on ``type``."
|
|
1155
|
+
),
|
|
1156
|
+
"items": {"$ref": "#/components/schemas/JudgmentThreshold"},
|
|
941
1157
|
},
|
|
942
1158
|
},
|
|
943
1159
|
"additionalProperties": True,
|
|
944
1160
|
},
|
|
1161
|
+
"JudgmentThreshold": {
|
|
1162
|
+
"description": (
|
|
1163
|
+
"A bound on a judgment error magnitude (OpenSRM decision 3c): "
|
|
1164
|
+
"breached when the measured value exceeds a bound. Not an SLO -- "
|
|
1165
|
+
"no error budget, no complement. One shape per ``type``."
|
|
1166
|
+
),
|
|
1167
|
+
"oneOf": [
|
|
1168
|
+
{"$ref": f"#/components/schemas/{name}"}
|
|
1169
|
+
for name in _THRESHOLD_COMPONENTS.values()
|
|
1170
|
+
],
|
|
1171
|
+
"discriminator": {
|
|
1172
|
+
"propertyName": "type",
|
|
1173
|
+
"mapping": {
|
|
1174
|
+
type_name: f"#/components/schemas/{name}"
|
|
1175
|
+
for type_name, name in _THRESHOLD_COMPONENTS.items()
|
|
1176
|
+
},
|
|
1177
|
+
},
|
|
1178
|
+
},
|
|
1179
|
+
"JudgmentThresholdSegments": _SEGMENTS_THRESHOLD,
|
|
1180
|
+
"JudgmentThresholdStability": _STABILITY_THRESHOLD,
|
|
1181
|
+
"JudgmentThresholdCalibration": _CALIBRATION_THRESHOLD,
|
|
1182
|
+
"JudgmentThresholdAuditBacklog": _AUDIT_BACKLOG_THRESHOLD,
|
|
1183
|
+
"JudgmentThresholdFeedbackLatency": _FEEDBACK_LATENCY_THRESHOLD,
|
|
945
1184
|
"Suppression": {
|
|
946
1185
|
"type": "object",
|
|
947
1186
|
"description": (
|
|
@@ -21,6 +21,7 @@ from typing import Any
|
|
|
21
21
|
from nthlayer_common.manifest import (
|
|
22
22
|
ManifestLoadError,
|
|
23
23
|
load_manifest,
|
|
24
|
+
threshold_to_v2_entry,
|
|
24
25
|
)
|
|
25
26
|
from nthlayer_common.manifest.models import ReliabilityManifest
|
|
26
27
|
|
|
@@ -115,6 +116,10 @@ class ManifestCatalogue:
|
|
|
115
116
|
try:
|
|
116
117
|
mtime = yaml_file.stat().st_mtime # capture before parse to avoid TOCTOU
|
|
117
118
|
manifest = load_manifest(yaml_file, suppress_deprecation_warning=True)
|
|
119
|
+
# Serialise once before caching: a manifest the emitter refuses
|
|
120
|
+
# (ValueError) is skipped here like any rejected manifest, rather
|
|
121
|
+
# than making every GET /manifests a 500.
|
|
122
|
+
manifest_to_dict(manifest)
|
|
118
123
|
self._manifests[manifest.name] = manifest
|
|
119
124
|
self._mtimes[str(yaml_file)] = mtime
|
|
120
125
|
return manifest.name
|
|
@@ -156,30 +161,17 @@ def manifest_to_dict(m: ReliabilityManifest) -> dict[str, Any]:
|
|
|
156
161
|
slo_dict["description"] = slo.description
|
|
157
162
|
result["slos"].append(slo_dict)
|
|
158
163
|
|
|
159
|
-
# Judgment thresholds
|
|
160
|
-
#
|
|
161
|
-
#
|
|
162
|
-
#
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
measurement["window"] = tm.window
|
|
171
|
-
if tm.probe:
|
|
172
|
-
measurement["probe"] = {
|
|
173
|
-
"frozen_input_set": tm.probe.frozen_input_set,
|
|
174
|
-
"frequency": tm.probe.frequency,
|
|
175
|
-
}
|
|
176
|
-
if tm.segment_dimension:
|
|
177
|
-
measurement["segment_dimension"] = tm.segment_dimension
|
|
178
|
-
if tm.segment_values:
|
|
179
|
-
measurement["segment_values"] = list(tm.segment_values)
|
|
180
|
-
result["judgment_thresholds"].append(
|
|
181
|
-
{"type": t.type, "bounds": dict(t.bounds), "measurement": measurement}
|
|
182
|
-
)
|
|
164
|
+
# Judgment thresholds: error-magnitude bounds live beside slos, not in them
|
|
165
|
+
# (opensrm-l33e). Each item is exactly the v2 spec.judgment_threshold entry,
|
|
166
|
+
# built by nthlayer-common's validated emitter rather than copied field by
|
|
167
|
+
# field here, so serialisation needs no change in core when common adds a
|
|
168
|
+
# field (opensrm-7zpz); the closed OpenAPI item schemas (paths_other.py)
|
|
169
|
+
# and docs/api/openapi.json DO need updating, and
|
|
170
|
+
# test_every_served_manifest_validates_against_openapi_manifest fails
|
|
171
|
+
# until they are. srm/v1 thresholds arrive already lifted to v2.
|
|
172
|
+
result["judgment_thresholds"] = [
|
|
173
|
+
threshold_to_v2_entry(t) for t in m.judgment_thresholds
|
|
174
|
+
]
|
|
183
175
|
|
|
184
176
|
# Dependencies
|
|
185
177
|
result["dependencies"] = [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nthlayer-core
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: NthLayer core — reliability-critical verdict store, case management, and HTTP API
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: nthlayer-common<
|
|
7
|
+
Requires-Dist: nthlayer-common<6.0.0,>=5.0.0
|
|
8
8
|
Requires-Dist: starlette>=0.40
|
|
9
9
|
Requires-Dist: uvicorn>=0.30
|
|
10
10
|
Requires-Dist: httpx>=0.27
|