Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e364b7a
fix(importers): resolve unstated threshold and clip as the Python pat…
sromoam Oct 15, 2026
adbda67
fix(importers): credit a zero threshold to the comparator only when i…
sromoam Oct 16, 2026
3637981
Merge origin/dev into fix/334-348-importer-defaults
sromoam Oct 28, 2026
530e77f
test: pin the free-form clip default from #334 in the extension refer…
sromoam Oct 28, 2026
ede3216
Merge remote-tracking branch 'origin/dev' into m408
sromoam Oct 29, 2026
60703e0
fix(334): name an adopted comparator threshold in the explain() trail
sromoam Oct 29, 2026
626f6dd
fix(348): resolve comparator keys on a nested model as the Python pat…
sromoam Oct 29, 2026
7dfab62
docs(348): document the nested-model comparator warning and the new d…
sromoam Oct 29, 2026
83f1556
docs(348): say the nested-object default threshold is fixed, not the …
sromoam Oct 30, 2026
6e51532
fix(348): plural warning verbs, keep ValueError for a list comparator…
sromoam Oct 30, 2026
fe8b830
Merge origin/dev into fix/334-348-importer-defaults
sromoam Nov 17, 2026
c6878eb
fix(importers): check an adopted comparator threshold and resolve nes…
sromoam Nov 17, 2026
2934248
docs(importers): state the threshold and clip defaults the importers …
sromoam Nov 17, 2026
dad0ca9
fix(importers): load a comparator that requires threshold on an array…
sromoam Nov 17, 2026
f7a4640
test(importers): pin the union, nested-warning and explain() behaviou…
sromoam Nov 17, 2026
1caa1cb
docs(importers): correct the free-form clip, nested comparator and wa…
sromoam Nov 17, 2026
ff19b01
docs(importers): scope the free-form clip claim to each object, and n…
sromoam Nov 17, 2026
a7ab802
docs(thresholds): state that an invalid field threshold raises, on ev…
sromoam Nov 17, 2026
09dcedd
fix(thresholds): raise on a field threshold that is not a number from…
sromoam Nov 17, 2026
a17802c
test(thresholds): pin the raise for an invalid field threshold on eve…
sromoam Nov 17, 2026
4f0fb4a
docs(thresholds): one message per path, int or float only, match_thre…
sromoam Nov 17, 2026
f5ad746
fix(thresholds): check Annotated fields, quote values as written, no …
sromoam Nov 17, 2026
3991537
test(thresholds): pin the per-path messages, Annotated, postponed ann…
sromoam Nov 17, 2026
be9b0b0
fix(thresholds): load an in-range Decimal, Fraction or numpy threshol…
sromoam Nov 17, 2026
d78cb3c
fix(thresholds): give every threshold message a fix, and the list ref…
sromoam Nov 17, 2026
526061b
fix(thresholds): check a forward-referenced field when the class is d…
sromoam Nov 17, 2026
7aa8375
docs(thresholds): a number from 0.0 to 1.0, on the class, config and …
sromoam Nov 17, 2026
55e4023
fix(thresholds): keep the runtime match_threshold check of evaluate()…
sromoam Nov 17, 2026
1654b58
fix(thresholds): check forward-referenced lists, keep numpy verdicts,…
sromoam Nov 17, 2026
32febb2
fix(importers): name a titled schema's model in its warnings, and say…
sromoam Nov 17, 2026
89b7e07
docs(thresholds): scope the runtime check, forward-referenced lists, …
sromoam Nov 17, 2026
9794614
docs(thresholds): a bare alias name for a list is ignored once resolv…
sromoam Nov 17, 2026
9d4a8a5
chore: merge origin/dev into fix/334-348-importer-defaults
sromoam Nov 17, 2026
0cad533
fix(thresholds): check an Annotated field whose type is defined furth…
sromoam Nov 17, 2026
4e59553
docs(thresholds): numpy float16 and float32 compare as Python floats,…
sromoam Nov 17, 2026
f7c7782
fix(auto): a runtime match_threshold=False does not warn that the thr…
sromoam Nov 17, 2026
60cc3a2
fix(thresholds): correct the threshold messages whose advice was wron…
sromoam Nov 17, 2026
d77fb56
docs(thresholds): scope the numpy, runtime, class match_threshold and…
sromoam Nov 17, 2026
e9228d7
fix(thresholds): evaluate Annotated metadata as pydantic does, once p…
sromoam Nov 17, 2026
44d21f9
fix(thresholds): a list-of-models message no longer tells an element …
sromoam Nov 17, 2026
96f5567
fix(thresholds): an unresolved dict or tuple gets the usual fix, and …
sromoam Nov 17, 2026
c4612ba
docs(thresholds): scope the Python list warning, name match_threshold…
sromoam Nov 17, 2026
9b2b5a9
docs(changelog): rewrap the threshold-rule paragraph
sromoam Nov 17, 2026
3a18858
test(thresholds): pin that a numpy float16 or float32 match_threshold…
sromoam Nov 17, 2026
cb26400
test(thresholds): drop the postponed Annotated case from the dict-or-…
sromoam Nov 17, 2026
8ce3b28
Revert "fix(thresholds): evaluate Annotated metadata as pydantic does…
sromoam Nov 17, 2026
5d85b9b
Revert "fix(thresholds): check an Annotated field whose type is defin…
sromoam Nov 17, 2026
605ea32
docs(thresholds): an Annotated field written as a string that names s…
sromoam Nov 17, 2026
a5230d5
fix(thresholds): a class loads when the working directory no longer e…
sromoam Nov 18, 2026
d86e94e
docs(importers): a threshold a custom comparator's constructor sets i…
sromoam Nov 18, 2026
43579b1
docs(thresholds): scope the Annotated, numpy float64 and array-sentin…
sromoam Nov 18, 2026
2b8d1b0
fix(evaluate): a runtime match_threshold of any real type in range is…
sromoam Nov 18, 2026
f7149a4
docs(thresholds): scope the Set at, None and unread-key claims
sromoam Nov 18, 2026
a93086a
docs(changelog): give the TP-to-FD example for a comparator's constru…
sromoam Nov 18, 2026
726726f
ci(thresholds): mark the test's exec calls reviewed, and skip the mad…
sromoam Nov 18, 2026
f0800a4
Merge origin/dev into fix/334-348-importer-defaults
sromoam Nov 23, 2026
b78859f
test(thresholds): patch in the NaN threshold the report test needs
sromoam Nov 23, 2026
e7ccbdc
test(thresholds): name the bool match_threshold test for the refusal …
sromoam Nov 23, 2026
619b714
fix(importers): name the model in the nested-model warnings as the er…
sromoam Nov 23, 2026
006f558
Merge dev into fix/334-348-importer-defaults
sromoam Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs(thresholds): scope the Set at, None and unread-key claims
- CHANGELOG and Thresholds and Metrics: a base class that overrides
  __init_subclass__ makes a class match_threshold's "Set at", and the
  list comparator warning, point at the line of that override. Field
  thresholds are unaffected.
- structured_model.py comment and Thresholds and Metrics: None reads as
  unset only as a field threshold. A class match_threshold = None is let
  through, as before, and raises TypeError where it is read.
- CHANGELOG: an unread comparator key warns when it is written on a field
  or property; on a $defs definition it is still ignored silently.
  • Loading branch information
sromoam committed Nov 18, 2026
commit f7149a459ae8bfa1411593c1de49a5247b9fa99f
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ Each release links to full notes on the
`True` and `False` still count as 1.0 and 0.0. Every path gives one
message. It quotes the value as written, names the model and the field,
says why the value fails and gives the fix in full; on the Python path it
ends with where the value was set.
The refusal of `ComparableField(threshold=...)`
ends with where the value was set, though a base class that overrides
`__init_subclass__` can make a `match_threshold` point at the line of
that override. The refusal of `ComparableField(threshold=...)`
on a `List[StructuredModel]` field uses the same template, says to remove
it and names the element class, and is headed `Unused threshold` whatever
its value. The warning for a comparator threshold there names the model
and the element class, and points at the class rather than at
`<frozen abc>`. On the config path it is no longer prefixed
`<frozen abc>`, or at a base class's `__init_subclass__` if it overrides
one. On the config path it is no longer prefixed
`Invalid field configuration:` or
`Error converting field configurations:`, and a field inside a
`list_structured_model` is named `items[].sku` there and in warnings, as
Expand Down Expand Up @@ -134,9 +136,12 @@ Each release links to full notes on the
`-comparator-config` on an object with `properties` were dropped, and on an
array of objects the config's `threshold` was reported by `explain()` as the
field's explicit threshold though nothing read it. Every such key that is
not read now emits a `UserWarning` naming it, the model, and where the
effective setting goes (`threshold` / `x-aws-stickler-threshold` on an object,
`match_threshold` / `x-aws-stickler-match-threshold` on a list). A threshold
written on a field or a property and not read now emits a `UserWarning`
naming it, the model, and where the effective setting goes (`threshold` /
`x-aws-stickler-threshold` on an object, `match_threshold` /
`x-aws-stickler-match-threshold` on a list). On a `$defs` definition that
a property references, they are still ignored without a warning; beside
the `$ref`, they are treated as on any property. A threshold
the comparator names on a single nested model, in its config or its own
constructor, is read (see Changed), and the warning gives its value. A named
comparator stays on the field, as on the Python path, so `explain()` reports
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/Getting-Started/thresholds-and-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LineItem(StructuredModel):

**Default:** `0.7`

**Valid values:** a number from 0.0 to 1.0, checked when the class is defined. See [Valid Threshold Values](#valid-threshold-values).
**Valid values:** a number from 0.0 to 1.0, checked when the class is defined. `None` is not checked and does not read as unset: the class keeps it, and a comparison that reads it, such as of a list of the class, a bare-annotated field or `evaluate()`, raises `TypeError`. Leave `match_threshold` out instead. See [Valid Threshold Values](#valid-threshold-values).

### 4. Runtime Match Threshold

Expand Down Expand Up @@ -161,7 +161,7 @@ A threshold is a number from 0.0 to 1.0, inclusive: the minimum similarity score
| Stickler config | `"threshold"` | `"comparator_config": {"threshold": ...}` | `"match_threshold"` |
| JSON Schema | `"x-aws-stickler-threshold"` | `"x-aws-stickler-comparator-config": {"threshold": ...}` | `"x-aws-stickler-match-threshold"` |

Anything else, such as `85`, `1.5`, `-1`, `"0.9"`, `true`, NaN or infinity, raises `ValueError` when the class is defined or the config or schema is loaded. Each path gives the same message, quoting the value as you wrote it. It names the model, the field, why the value fails, and the fix, and on the Python path where it was set:
Anything else, such as `85`, `1.5`, `-1`, `"0.9"`, `true`, NaN or infinity, raises `ValueError` when the class is defined or the config or schema is loaded. On the Python path `None` is not checked: `ComparableField(threshold=None)` reads as unset, and a class `match_threshold = None` loads, then raises `TypeError` where it is read (see [Model Match Threshold](#3-model-match-threshold)). Each path gives the same message, quoting the value as you wrote it. It names the model, the field, why the value fails, and the fix, and on the Python path where it was set (for a class `match_threshold` under a base class that overrides `__init_subclass__`, the line of that override):

```text
ValueError: Invalid threshold for field 'vendor' of model 'Invoice': ComparableField sets no threshold, so the field adopts its comparator's: LevenshteinComparator(threshold=85). A threshold is the minimum similarity score for a match, from 0.0 to 1.0. 85 is above 1.0, so even identical values would not match. If 85 is a percentage, write LevenshteinComparator(threshold=0.85), or ComparableField(threshold=0.85), which wins over the comparator's. (Set at invoice_models.py:6.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,11 @@ def __init_subclass__(cls, **kwargs):
)

# `match_threshold` is a plain class attribute rather than a field, so
# it is not covered by the loop above. `None` reads as unset, and a
# property or method is not a value to check.
# it is not covered by the loop above. `None` is not checked, as it was
# not before, but it does not read as unset as a field's
# `threshold=None` does: the class keeps `None`, and a comparison that
# reads it (a list of the class, a bare-annotated field, `evaluate()`)
# raises `TypeError`. A property or method is not a value to check.
if "match_threshold" in cls.__dict__:
value = cls.__dict__["match_threshold"]
if not (
Expand Down