Skip to content

release(v1.0.1): escape document values and field names, mitigate CVE-2024-4367 - #452

Closed
digalaviz wants to merge 9 commits into
awslabs:mainfrom
digalaviz:release/1.0.1
Closed

digalaviz wants to merge 9 commits into
awslabs:mainfrom
digalaviz:release/1.0.1

Conversation

@digalaviz

Copy link
Copy Markdown
Contributor

Summary

Version

1.0.0 → 1.0.1 (patch — fixes and one lockfile bump, no new public API, and no score, metric
or verdict behaviour change; not breaking)

This follows RELEASING.md's hotfix note, with one deliberate deviation on tagging

RELEASING.md has a troubleshooting note, "Hotfix without releasing dev", whose shape is exactly this: branch from main, bump the
patch version on the hotfix branch, PR back to main, release, then merge main into dev. That is
exactly this cut. The document's main flow — squash dev → main — would drag ~424 commits and four
**Breaking:** [Unreleased] entries into a patch. Two merged changes on dev move a
strands-agents-evals consumer's test_pass verdict; that is #443 and it belongs in a major.
strands-agents-evals 1.6.0 pins stickler-eval>=1.0.0,<2.0.0, so a 1.0.1 reaches any consumer
of the [stickler] extra who re-resolves the range, with no opt-in — which is what you want for a
security fix and exactly what you do not want for the breaking set.

Four of the nine commits are cherry-picks of #429's and #444's work, already merged on dev (#444 at
215ac16) — three fix( and one test(. The other five are new here
(#444 at 215ac16). Each applied with a conflict in CHANGELOG.md only; the [1.0.1] section was
hand-written instead.

What a consumer will notice

A report that embeds document or threshold data changes byte-for-byte. Measured on the same
evaluation, with and without individual_results_jsonl_path:

report v1.0.0 1.0.1
with the JSONL embedded 53534 bytes 53569, one line differing, 7 substitutions
a fixture with a plain-ASCII field name and short values 14552 bytes byte-identical (comparison holds the generation timestamp fixed — the footer embeds strftime, so a report is not byte-stable against itself across a second)

The first changes even for pure-ASCII document data, because stickler's own generated reason
strings contain comparison operators ("above threshold (0.714 >= 0.7)").

Do not read the second row as "no JSONL path means no change." Two of the fixes here are in
sections that render regardless of that argument — include_field_analysis and
include_non_matches both default to True — so a report without embedded data still changes
whenever a performance-table field name contains <, >, &, " or ' — html.escape escapes
quotes by default — or when a non-match value's escaped length exceeds 100 characters — which an all-quotes value
crosses at 17 raw characters —
or when doc_id/field_path is non-str. Fixtures were built for all three routes and all three
trigger; a plain-ASCII field name with short, plain values stays byte-identical.

So: a consumer snapshot-testing a report must check whether theirs is affected, and re-baseline if
so.
The evaluation results do not change either way.

The embedded data itself round-trips: for JSON-standard values, both strict JSON.parse and
JavaScript evaluation recover exactly what the reporter was fed, and the page's own JavaScript reads
the escaped characters as the same characters. One pre-existing caveat, unchanged by this release:
Python emits NaN and Infinity, which are valid JavaScript expressions but not strict JSON, so
a strict parser rejects a blob containing them.

Why this does not reach the evaluation path

Outside the version bump, the CHANGELOG and the lockfile, the diff touches
src/stickler/reporting/html/ and its tests and nothing else. The Strands Evals evaluator reads
EvalResult.raw; stickler/__init__.py does not import reporting, nothing under src/ imports
back into it, and after a real evaluate() call sys.modules contains no reporting module at all.
The public surface — __all__, dir(stickler), the full module list — is identical between the
1.0.0 and 1.0.1 wheels except for the version string.

As a no-leak control, a 45-case Strands corpus — dev's 42 cases plus the three NaN shapes from the still-open #447 — gives 0 cases differing from v1.0.0 and
0 verdicts moving. Read it as exactly that and no more: an auditor replaced all three changed HTML
modules with raise RuntimeError and the number did not move, because the oracle never imports the
reporter. The evidence that the fixes work is the 114 reporting tests and the differential probes
against the built wheel, below.

Evidence the fixes work

Differential, from two clean venvs outside any source tree, 1.0.0 wheel vs 1.0.1 wheel:

probe 1.0.0 1.0.1
document value </script><script>...</script> payload present, runs as its own script absent
JSON Schema property name carrying the same payload alert(1) runs no such script body
markup field name in the performance table raw <img src=x escaped
non-str field name in the chart AttributeError no exception
integer doc_id from a DataFrame generate_report() → success=False, no page written report written
truncation splitting &amp; entity split intact

An AST sweep of every f-string placeholder in reporting/html that is neither escaped nor
numerically formatted: 56 at v1.0.0, 50 here — zero new, six removed. The six are exactly
this release's escapes (field_name, tp, fd, fa, fn, value). The residue is not 50 HTML
sinks: it includes log messages, dict keys and _json_for_script's own output.

The dependency bump, and why only one of #346's two

Merging this release triggers docs.yml (push to main, filtered to src/**, which this release
touches), which rebuilds and redeploys the public docs site. docs/mkdocs.yml enables the search
plugin, and GHSA-xvg9-69gf-fjrf is a DOM-based XSS in mkdocs-material's search suggestions affecting
>=7.2.0,<9.7.7. Shipping without the bump would knowingly redeploy that, as the last act of a
release whose headline is an XSS fix.

Only the three mkdocs-material records are changed — version, sdist, wheel — copied verbatim from
#346. That PR's transformers 5.5.0 → 5.10.1 is deliberately left out of a hotfix. The lockfile
diff against v1.0.0 is 8 lines total, exclude-newer and the CUDA/nvidia platform markers intact,
uv lock --check passing. mkdocs build succeeds on 9.7.7.

The second injection route, now closed

An earlier draft of this release left tp/fd/fa/fn unescaped in the field performance table as
an accepted follow-up. They are in now. The route is not reachable from document data — on the
ProcessEvaluation path those are library-computed ints, and a 21-payload document-data sweep found
no path — but generate_report() publicly accepts a plain dict, so a caller assembling their own
metrics could put markup in those cells and have a browser parse it. Shipping a release that closes
one script-execution route while knowingly keeping a demonstrated one in the same table was not
defensible. The confusion-matrix cell is escaped alongside them.

Its regression asserts on what a parser sees — no on* attribute, no script body — rather than
on substring absence, because escaping leaves the characters present as inert text. #449
covers an audit of the remaining f-string placeholders; an AST sweep already puts the
count at 56 unescaped at v1.0.0 and 50 here.

Test plan

  • Full suite, local (macOS / CPython 3.12): 2757 passed, 12 skipped, 1 xfailed — the CI
    figure supersedes this
  • tests/reporting/html: 114 passed, and the collected count is pinned as a gate
  • The two new doc_id tests fail with the fix reverted and pass with it — load-bearing
  • 45-case Strands corpus (dev's 42 + test(381): snapshot the NaN shapes #447's three, which is on no merged branch) identical to v1.0.0 — a no-leak control, see above
  • uv lock --check passes; 8-line lockfile diff; exclude-newer and platform markers intact
  • All three version files agree, checked by path rather than by string
  • uv build produces a 1.0.1 wheel and sdist; the wheel installs into a clean venv outside the
    source tree and the fixes are live in it
  • mkdocs build succeeds with mkdocs-material 9.7.7
  • CHANGELOG: new [1.0.1], empty [Unreleased], both link definitions — verified by hand,
    because the docs-drift guards do not check structure (they stay green if a link definition is
    dropped)
  • CI green on all five Python versions — required before the Release is created; nothing
    downstream checks it
  • Verify the PyPI publish after tagging v1.0.1
  • Anonymous fetch of the public docs site after the deploy

After merge

  1. Check the release date first. CHANGELOG.md reads ## [1.0.1] - 2026-10-26. It is
    permanent on PyPI. If the tag lands on another day, change the heading before merging.

  2. Create the tag explicitly on the merge commit, then create the Release against that tag — if
    you let GitHub create the tag at publish time it lands on main's tip at that moment, and nothing
    in the workflow asserts that the built version matches the tag.

  3. Publish the GitHub Security Advisory at the same moment 1.0.1 appears on PyPI, not after —
    between a diffable fix being public and an advisory existing, a scanning consumer has no signal.
    Draft it before the merge; GHSA drafts are private. Range >=0.1.3,<1.0.1, fixed in 1.0.1
    (exactly ten published versions, none yanked). It supplies the
    machine-readable affected and fixed ranges that Dependabot, pip-audit and the advisory
    databases consume; a consumer who re-resolves for any other reason already gets 1.0.1. Do
    not yank the affected releases —
    exploitation needs someone to open a generated report, and yanking breaks every pinned consumer.

  4. Back-merge main into dev, by hand. Three conflicts: CHANGELOG.md (keep dev's four
    **Breaking:** [Unreleased] entries, move the released [BUG]: HTML report lets document data break out of its <script> tag, and truncates values mid-entity #431/[BUG]: Field performance table in the HTML report renders field names unescaped #422 entries under [1.0.1]) and a
    comment-only one in html_reporter.py, and one in visualization_engine.py — the escaping fix
    itself, where dev differs in exactly these five lines. Take the release side in both. Never
    -X ours or -X theirs:
    one deletes the pending-major release notes, the other deletes the [1.0.1] heading.

  5. [Unreleased] on dev keeps its breaking entries. 1.0.1 changes a Strands Evals verdict: decide the version number and the scope #443 remains the open decision for the next
    major — note for whoever cuts next that dev will read 1.0.1, and the next cut from it is
    2.0.0, not 1.0.2.

harrycav and others added 9 commits October 25, 2026 19:39
The table wrote each field name into the page raw, while the chart beside
it escaped the same name. The function's local html string shadowed the
html module, so the escape could not simply be copied across; rename it,
and the same shadowing local in generate_confusion_matrix_heatmap and
SectionGenerator.generate_confusion_matrix.

Fixes awslabs#422

(cherry picked from commit f59b247)
…efore escaping

Review follow-ups: a non-str key in a hand-built results dict no longer
raises in the chart or table; the chart gets the same escaping test as the
table; the non-matches table truncates before escaping, so the cut cannot
split an entity such as &amp;.

(cherry picked from commit 86372b5)
The report embeds each document's values as JSON inside <script>, and
json.dumps leaves < as is, so a value carrying </script><script>... ran as
its own script when the report was opened. Write <, >, &, U+2028 and
U+2029 as \uXXXX in both embedded blobs; the page's JavaScript reads the
same data.

Fixes awslabs#431

(cherry picked from commit 19f8618)
… name

Review found that reverting only thresholds_json left every test green,
though that path runs injected script in Chrome via a JSON Schema
property name. Add that case, and name the route in the CHANGELOG.

(cherry picked from commit f72dc4b)
The non-matches table escaped doc_id and field_path without converting
them first, while the three columns beside them converted.
evaluate_dataframe reads doc_id straight off a DataFrame column, so an
integer id — ordinary for one read from CSV, parquet or a database —
raised and generate_report() returned success=False having written no
page at all. Optional[str] on update() is an annotation, not a runtime
check, and evaluate_dataframe declares nothing.

No issue covers this one; found while reviewing awslabs#444.

Adds a unit test on the table and an end-to-end regression from a
DataFrame carrying an integer doc_id.
tp/fd/fa/fn were written into the table with no escaping and no format
spec, unlike the precision/recall/f1 cells beside them, whose :.3f
rejects a string by accident. generate_report() publicly accepts a plain
dict, so a caller assembling their own metrics — rather than passing a
ProcessEvaluation, where these are library-computed ints — could put
markup there and have it parsed. The confusion-matrix cell gets the same
treatment, though sum() rejects a non-numeric before it is reached.

Not reachable from document data, and identical on v1.0.0. Closing it
here because awslabs#422 fixed the same class one function above in this file,
and because a release headlined on stopping a document value running as
script should not leave a demonstrated route in the same table. No issue
covers these four cells.

The regression asserts on what a parser sees — no on* attribute, no
script body — rather than on substring absence, since escaping leaves
the characters present as inert text.
json.dumps escapes both under its default ensure_ascii=True, so the two
translate entries never fire on today's output. They are defensive
depth, not the active guard, and the comment claimed otherwise.
Fixes a DOM-based XSS in the search suggestions, affecting >=7.2.0,<9.7.7.
The docs site enables the search plugin, and merging this release triggers
docs.yml (push to main, filtered to src/**, docs/** and the workflow
itself), which would otherwise rebuild and redeploy the public site on the
vulnerable version.

Scope: the lockfile governs this repo's CI and the docs deploy, since the
docs group is a dependency-group rather than an extra. The wheel does
carry mkdocs-material, under the `dev` extra and unpinned, so anyone
installing stickler-eval[dev] already resolves whatever PyPI serves and is
unaffected either way. Taken from awslabs#346; that PR's transformers bump is
deliberately left out of this hotfix.
Adds the [1.0.1] CHANGELOG section with both link definitions, and bumps
pyproject.toml, src/stickler/__init__.py and uv.lock together.
@digalaviz
digalaviz requested a review from vawsgit October 26, 2026 15:51
@digalaviz
digalaviz requested a review from sromoam as a code owner October 26, 2026 15:51
@github-actions

Copy link
Copy Markdown

Security Scan Results

ASH Security Scan Report

  • Report generated: 2026-10-26T15:54:44+00:00
  • Time since scan: 3 minutes

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-10-26T15:51:30+00:00
  • ASH version: 3.1.2

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

  • Severity levels:
    • Suppressed (S): Findings that have been explicitly suppressed and don't affect scanner status
    • Critical (C): Highest severity findings that require immediate attention
    • High (H): Serious findings that should be addressed soon
    • Medium (M): Moderate risk findings
    • Low (L): Lower risk findings
    • Info (I): Informational findings with minimal risk
  • Duration (Time): Time taken by the scanner to complete its execution
  • Actionable: Number of findings at or above the threshold severity level that require attention
  • Result:
    • PASSED = No findings at or above threshold
    • FAILED = Findings at or above threshold
    • MISSING = Required dependencies not available
    • SKIPPED = Scanner explicitly disabled
    • ERROR = Scanner execution error
  • Threshold: The minimum severity level that will cause a scanner to fail
    • Thresholds: ALL, LOW, MEDIUM, HIGH, CRITICAL
    • Source: Values in parentheses indicate where the threshold is set:
      • global (global_settings section in the ASH_CONFIG used)
      • config (scanner config section in the ASH_CONFIG used)
      • scanner (default configuration in the plugin, if explicitly set)
  • Statistics calculation:
    • All statistics are calculated from the final aggregated SARIF report
    • Suppressed findings are counted separately and do not contribute to actionable findings
    • Scanner status is determined by comparing actionable findings to the threshold
Scanner Suppressed Critical High Medium Low Info Actionable Result Threshold
bandit 0 3 0 0 5745 0 3 FAILED MEDIUM (global)
cdk-nag 0 0 0 0 0 0 0 PASSED MEDIUM (global)
cfn-nag 0 0 0 0 0 0 0 MISSING MEDIUM (global)
checkov 0 0 0 0 0 0 0 PASSED MEDIUM (global)
detect-secrets 0 1 0 0 0 0 1 SKIPPED MEDIUM (global)
grype 0 0 0 0 0 0 0 MISSING MEDIUM (global)
npm-audit 0 0 0 0 0 0 0 PASSED MEDIUM (global)
opengrep 0 0 0 0 0 0 0 MISSING MEDIUM (global)
semgrep 3 0 0 0 0 0 0 PASSED MEDIUM (global)
syft 0 0 0 0 0 0 0 MISSING MEDIUM (global)

Top 2 Hotspots

Files with the highest number of security findings:

Finding Count File Location
2 tests/comparators/test_anls_leaf_semantics.py
2 tests/structured_object_evaluator/test_rollup_node_semantics.py

Detailed Findings

Show 4 actionable findings

Finding 1: SECRET-HEX-HIGH-ENTROPY-STRING

  • Severity: HIGH
  • Scanner: detect-secrets
  • Rule ID: SECRET-HEX-HIGH-ENTROPY-STRING
  • Location: tests/comparators/test_anls_leaf_semantics.py:89

Description:
Secret of type 'Hex High Entropy String' detected in file 'tests/comparators/test_anls_leaf_semantics.py' at line 89

Code Snippet:

Secret of type Hex High Entropy String detected

Finding 2: B108

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B108
  • Location: tests/comparators/test_anls_leaf_semantics.py:210-212

Description:
Probable insecure usage of temp file/directory.

Code Snippet:

uuid.UUID(int=1),
            pathlib.Path("/tmp/x"),
            b"bytes",

Finding 3: B307

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B307
  • Location: tests/structured_object_evaluator/test_rollup_node_semantics.py:1362-1368

Description:
Use of possibly insecure function - consider using safer ast.literal_eval.

Code Snippet:

def published_label(node: dict, section: str, object_lists: set) -> str:
            counts_objects = eval(  # noqa: S307
                cond.group(1),
                {},
                {"data": node, "section": section, "OBJECT_LISTS": object_lists},
            )
            return eval(unit.group(1), {}, {"counts_objects": counts_objects})  # noqa: S307

Finding 4: B307

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B307
  • Location: tests/structured_object_evaluator/test_rollup_node_semantics.py:1367-1369

Description:
Use of possibly insecure function - consider using safer ast.literal_eval.

Code Snippet:

)
            return eval(unit.group(1), {}, {"counts_objects": counts_objects})  # noqa: S307

Report generated by Automated Security Helper (ASH) at 2026-10-26T15:54:46+00:00

@digalaviz

Copy link
Copy Markdown
Contributor Author

@vawsgit @sromoam — five things here that no tool in this PR covers, and they are what I am
actually asking for a read on.

1. The ### Security wording. It is permanent on PyPI and nothing validates it. It describes
two injection routes and gives three workarounds for anyone who cannot leave the 0.x line.

2. The scope call. 6a259d8 and 9a6f13d — the two merged changes on dev that move a
strands-agents-evals consumer's test_pass verdict — are deliberately out of this cut, for a
major. That is #443, where the measurement lives. This branch is cut from main per
RELEASING.md's hotfix note rather than squashing dev, precisely so those two do not ride a
patch that reaches every [stickler] consumer on their next resolve.

3. That the tag must land on the merge commit. workflow.yml checks out whatever the tag
resolves to and asserts nothing about the built version. If the tag is created at publish time it
lands on main's tip at that moment.

4. The re-baseline guidance in the body. Consumers will act on it, and the character list
includes " and ' as well as <, > and &, because html.escape escapes quotes by default.

5. What this branch's CI does not cover — please read this before reading the green checks.

Seven checks ran, not the usual nine. The strands-evals job does not exist at v1.0.0, and
this branch is cut from main, so it carries v1.0.0's workflow files; tests/integrations/ is
not in the tree either. Nothing was skipped — that job had not been written when 1.0.0 was cut.

Importing those tests was considered and rejected: dev's golden snapshot is baselined against
dev's library, so it asserts tagged/leading_none → test_pass: true where a 1.0.x library gives
false. That discrepancy is the break #443 documents. Importing it would turn CI red, and making
it green would mean a second, divergent baseline that collides on the back-merge — i.e. deciding the
major inside the patch.

So the evidence that this cut changes nothing for a strands-agents-evals consumer is local, not
CI: that package imports only eval_for, aggregate_from_comparisons and ProcessEvaluation with
zero references to stickler.reporting (the only package this diff touches); a 45-case corpus is
identical to v1.0.0 with no verdict moving; and the two built wheels' __all__, dir(), module
list and Requires-Dist are identical but for the version string. I will re-run the integration
suite against the published wheel after release, which is better evidence than a CI job on a
branch.

Also: lint and security run with continue-on-error, so their green does not mean "no
findings". Worth opening those logs, the security one especially.

On the 62 deterministic gates the body mentions: treat them as a floor, not an authorisation.
Three rounds of adversarial attack found real holes in that suite, including one that let an
exfiltration call added to the shipped main.js through, and an end-to-end gate that tested nothing
because it passed a JSONL path it never created. Each was fixed, and the suite is not portable off
the machine that wrote it. The controls that matter here are your read and the CI you can see.

@digalaviz

Copy link
Copy Markdown
Contributor Author

@vawsgit — follow-up on the two continue-on-error checks, because their green does not mean
"no findings". Please pull the artifact and confirm this yourself rather than taking my summary;
I am deliberately not putting locations in a public comment.

security (3.12) renders green while ASH reports FAILED. Its summary table fails two scanners
against the MEDIUM threshold. I downloaded security-reports from the run and went through the
aggregated report:

  • 7 HIGH findings in total, across two scanners plus one secrets detector.
  • None of them is in any of the 10 files this release changes. The one changed src/ file
    outside reporting/html/ is __init__.py, and this release's only edit there is the single
    __version__ line; the finding in that file is elsewhere in it and untouched.
  • Three of the seven are flagged suppressed by the scanner itself — a long-accepted pattern in
    the lazy-import machinery, present identically at v1.0.0.
  • The remaining four are in test files that ship in neither distribution: the wheel contains no
    test files at all, and the five in the sdist are not among them.
  • The 5745 LOW are almost entirely the one rule that flags assert in tests.
  • For contrast, bandit run directly over src/ reports no issues identified, 19704 lines
    scanned. The difference is scope: ASH scans the whole repository.

lint (3.12) renders green while Ruff exits 1, with eleven errors — all in examples/
notebooks and one demo script, all pre-existing, none in src/ and none in a changed file.

So: nothing here blocks this PR, and everything is pre-existing. What I would ask you to weigh
separately from the release is the process point: a security release whose security scanner reports
FAILED while the check renders green is worth a decision of its own. security.yaml's ASH step
and the Ruff step both carry continue-on-error, and there are no required_status_checks on the
ruleset, so a red scanner is invisible at the only place a reviewer looks.

To reproduce: gh run download <security run id> -R awslabs/stickler, then read
.ash/ash_output/reports/ash.summary.txt for the table and ash.flat.json for the per-finding
detail. If you reach a different count than 7 HIGH, or find one inside the changed files, say so and
I will stop the release.

@vawsgit vawsgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs changes

Two blockers, each with an inline comment:

  1. A third-party PDF still runs script in a 1.0.1 report (CHANGELOG.md:16, interactive/main.js:538). The report loads pdf.js 3.11.174, which is affected by CVE-2024-4367, and calls getDocument with the default isEvalSupported: true. This applies when the report is served over HTTP(S), which the reporter README recommends for PDF reports. Pass isEvalSupported: false to pdfjsLib.getDocument. Alternatively, narrow the [1.0.1] Security text, the advice at CHANGELOG.md:40-44 and the GHSA text so they do not claim to cover PDFs.
  2. Integer doc_id: the per-document view shows aggregate numbers (section_generator.py:126, interactive/main.js:232). The report now renders, but selecting a document in the Report View dropdown leaves every section on aggregate numbers. Convert the id to str in _load_individual_results (html_reporter.py:183), and pass a JSONL in the DataFrame test.

Before merging, not blocking: RELEASING.md:117 sets the release PR title to release(vX.Y.Z): <short summary>. The repository squash-merges with COMMIT_OR_PR_TITLE, so this title would put Release/1.0.1 (#452) on main. Retitle the PR, or edit the subject in the squash dialog.

The three inline comments marked optional are not required for merge.

Verified as correct:

  • The two <script> blobs, the field-name cells and the confusion-count cells. In headless Chrome, payloads routed through each of them run on base and none run on head, including after the per-document re-render.
  • The new tests. Each one fails when the fix it covers is reverted, including the thresholds-blob case.
  • Release metadata. uv lock --check passes, and exclude-newer and the platform markers are unchanged. The version reads 1.0.1 in all three files. The advisory range 0.1.3 to 1.0.0 matches the tags and the ten PyPI releases.

Measured on the PR-head worktree at 09b6afe (inspect.getfile(stickler) printed the worktree path; __version__ is 1.0.1) and on git archive e028427 for base, with CPython 3.12.13.

Comment thread CHANGELOG.md

### Security

- **A document value can no longer run as script in the HTML report.** With

@vawsgit vawsgit Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker. A third-party PDF can still run script in a 1.0.1 report, so this headline does not hold for every document input.

The report loads pdf.js 3.11.174 from cdnjs (html_reporter.py:244 and :247), and loadPDF calls pdfjsLib.getDocument(url) with default options (interactive/main.js:538). That version is affected by CVE-2024-4367 (GHSA-wgrm-67xf-hhpq). With the default isEvalSupported: true, a crafted font in a PDF runs JavaScript in the page's origin. Every release from 0.1.3 through this branch loads the same pdf.js version with the same call.

Reproduced at this PR's head (09b6afe): generate_report(..., document_files={"invoice-001": "<crafted>.pdf"}, individual_results_jsonl_path=...) with the default ReportConfig.

  • Opening the report runs nothing.
  • Selecting invoice-001 in the Report View dropdown makes updateDocumentFiles choose the PDF renderer from the file extension (main.js:401), and the payload runs in headless Chrome.
  • The PDF fetch has to succeed. It does when the report is served over HTTP(S), which I modelled with --allow-file-access-from-files. Opened from file:// in Chrome with default settings, the fetch fails with MissingPDFException, so neither the viewer nor the payload runs.
  • Serving over HTTP is the documented way to view PDFs: src/stickler/reporting/html/README.md:123-138 tells users to run python -m http.server 8080 (line 130), because "PDF features work only when served via HTTP" (line 138).

Lines 40-44 give "do not open a report built from untrusted document data" as a precaution for users who cannot upgrade. That reads as: the precaution is unnecessary on 1.0.1. For PDFs it is still necessary.

Change requested, one of:

  1. In interactive/main.js:538, call pdfjsLib.getDocument({ url, isEvalSupported: false }). With only that change, the same PDF still renders ("Page 1 of 1") and the payload does not run. The complete fix is pdf.js 4.2.67 or later, vendored or pinned with an integrity= hash.
  2. Or leave the code and narrow this entry, the advice at lines 40-44, and the GHSA text: state that PDFs passed in document_files are not covered, and add "do not pass untrusted PDFs in document_files" to the advice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line is applied verbatim: pdfjsLib.getDocument({ url, isEvalSupported: false }), inside
const loadPDF = (url, canvasId, loadingId, errorId), so the property shorthand resolves as you
wrote it.

The finding, the reproduction and the headless-Chrome measurement are yours.

Verification boundary. What was measured here is that the option reaches the generated page, and
that reverting the call to getDocument(url) turns exactly one test red. The browser-level result —
that the same PDF renders while the payload does not run — is yours; it was not reproduced here,
because this side has no browser harness. If you want that half re-confirmed against the branch
rather than against your original run, it needs your setup.

Residual: this release applies the upstream-documented option-level mitigation only. It does not
upgrade the pdf.js dependency, and dependency loading and pinning are unchanged. Both are tracked
for the next release and are out of scope for this patch.

One narrowing worth having in the text: main.js is embedded only when individual results are
loaded, so this route required both document_files and individual_results_jsonl_path. Not
passing the JSONL path therefore closed this route and the <script> blob route together. Easiest
way to see it: generate a report with document_files and no JSONL path, and look for
getDocument in the output. That narrowing is in the changelog on this branch, in the
"Affected versions" paragraph.

Advisory: the severity and vector are being settled on the advisory draft rather than here,
including how to characterise the dependency route this release mitigates but does not upgrade. No
action is needed on this comment.

Request: confirm the line was applied as you measured it.

for nm in displayed:
doc_id = html.escape(nm.get('doc_id', 'N/A'))
field_path = html.escape(nm.get('field_path', 'N/A'))
doc_id = html.escape(str(nm.get('doc_id', 'N/A')))

@vawsgit vawsgit Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker. With an integer doc_id, this line now lets the report render, but the per-document view does nothing for that document. The page keeps showing aggregate numbers while the dropdown names one document.

interactive/main.js:232 finds the selected document with documentData.find(d => d.doc_id === docId). docId is the <select> value, which is always a string. The JSONL writer keeps the id as a JSON number (json.dumps(record, default=str) at bulk_structured_model_evaluator.py:241 leaves a Python int as is), and _json_for_script embeds it as a number. 1001 === "1001" is false, so filterReportToDocument updates nothing and raises no error.

Reproduced with BulkStructuredModelEvaluator(Invoice, individual_results_jsonl=p).evaluate_dataframe(df) for doc_id 1001 and 1002, where only 1001 has a non-match, followed by generate_report(..., individual_results_jsonl_path=p):

  • Base e028427: success=False with 'int' object has no attribute 'replace', and no page is written.
  • Head 09b6afe: success=True. In headless Chrome, selecting 1002 leaves the header at "Evaluation Report - 2 Documents", the gauge at the aggregate 85%, and 1001's non-match row in the table.

For this input, the PR turns a visible failure into a page that shows the wrong numbers for the selected document. The [1.0.1] entry at CHANGELOG.md:59-67 says integer ids now work, and names only the gallery as an exception.

Change requested:

  • Convert the id to str where the reporter reads the JSONL (_load_individual_results, html_reporter.py:183), matching the str() on this line. A JavaScript-only String(d.doc_id) === docId also fixes the filter. The Python-side conversion additionally keeps two other ids identical in the dropdown and the table: a float id (1001.0, from an id column with a missing value) and an id above 2^53.
  • Pass a JSONL in test_a_dataframe_with_an_integer_doc_id_still_produces_a_report (tests/reporting/html/test_section_generator.py:397). It passes none today, so it does not reach this view.

Related, not blocking: str() on the document_files keys in generate_document_gallery (lines 163-181) would remove the gallery exception the CHANGELOG documents. A user with integer ids is likely to key document_files by the same ids, and document_files={1001: "a.png"} still returns success=False.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in Python, in _load_individual_results, rather than in JavaScript, for the reason you gave:
it also normalises a float identifier and one above 2^53, so the dropdown and the table agree.

Coverage was added for the document filter, and your anchor case —
tests/reporting/html/test_section_generator.py:397 at 09b6afe,
test_a_dataframe_with_an_integer_doc_id_still_produces_a_report — was extended to pass a JSONL
and assert the embedded identifier rather than only that a report was produced. Measured here:
removing the two conversion lines turns seven tests red across tests/reporting/html. The diff
follows on this PR, so that is reproducible once it lands.

Three limits. Two are in the release text; the NaN case is not yet, and will be added before the
branch is updated.

  • None and a missing key are left unconverted, so the filter still cannot find them.
  • A NaN identifier becomes the string "nan". This is the ordinary missing-value case for a
    float identifier column — a pandas identifier column with a blank cell reads back as NaN, not
    as None. Measured here: two such records embed two entries, both carrying "nan". What
    happens on selecting them is the part this side cannot measure; if the strict-equality lookup
    resolves both to the first of them, the second document is unreachable and shows the first
    one's numbers. Worth one run in your setup to confirm or rule out.
  • str is not injective. 1001 and "1001" collide. Measured here: the survivor is whichever
    the JSONL lists first, not the numeric one by type — reversing the two records reverses which
    one the lookup reaches.

Not claimed as closed, and not the element you named. The Evaluation Report - 2 Documents header
is repaired, because updateReportTitle rewrites it from the selection. What remains stale is the
Executive Summary's Documents card: extractDocumentMetrics returns only precision, recall, F1
and accuracy, and updateExecutiveSummary writes only cards whose label it has data for, so no
documents value is ever written. Both of those are byte-identical at v1.0.0 — the same metrics
map and the same !== undefined guard — so this is pre-existing rather than a regression from this
change. Closing it requires a main.js change. Confirmation requested on whether it leaves the
blocker open.

The browser-level behaviour here is also yours. What was measured on this side is the Python layer:
the loader, the embedded payload, and the mutation results above.


def _json_for_script(value: Any) -> str:
"""Serialize ``value`` as JSON that is safe to place inside ``<script>``."""
return json.dumps(value).translate(_SCRIPT_SAFE)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, not blocking. str.translate with multi-character replacements leaves CPython's ASCII fast path at the first <, > or &. Stickler's own reason strings contain >= and < (for example above threshold (0.893 >= 0.8)), so every realistic blob takes the slow path.

Measured at the PR head on CPython 3.12.13, with a 1,000-document JSONL (13.3 MB blob):

call time
json.dumps(value) 42 ms
_json_for_script(value) 467 ms
json.dumps(value).replace("<", "\\u003c").replace(">", "\\u003e").replace("&", "\\u0026") 51 ms

The .replace chain produces byte-identical output. The U+2028/U+2029 entries can stay as two more .replace calls; on json.dumps's ASCII output they return the string unchanged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision requested: take the change now, or defer it and note the slowdown in the release notes.
Recommendation: defer and note.

The measured values are yours — json.dumps 42 ms, _json_for_script 467 ms, the .replace chain
51 ms, byte-identical output, on a 13.3 MB blob. They were not re-measured here. The regression is
introduced by this release: at v1.0.0, html_reporter.py:298 is a plain
json.dumps(individual_docs).

Reason for deferring: the change edits the escape helper whose correctness is the subject of the
release. Against deferring: your measurement reports byte-identical output, and this branch will be
updated before merge in any case. The release notes do not currently mention the slowdown.

ground_truth_value = html.escape(str(nm.get('ground_truth_value', 'None')))[:100] # Truncate long values
prediction_value = html.escape(str(nm.get('prediction_value', 'None')))[:100]
ground_truth_value = html.escape(str(nm.get('ground_truth_value', 'None'))[:100]) # Truncate long values
prediction_value = html.escape(str(nm.get('prediction_value', 'None'))[:100])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, not blocking. No test covers the truncate-before-escape change on this line. Reverting only this line to html.escape(str(...))[:100] leaves all 114 tests in tests/reporting/html passing; I checked this on a copy of the PR head. test_generate_non_matches_truncation_never_splits_an_entity (tests/reporting/html/test_section_generator.py:251) puts the "x" * 97 + "&" value only in ground_truth_value. Using the same value for prediction_value would cover this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete. test_generate_non_matches_truncation_never_splits_an_entity now places
"y" * 97 + "&" in prediction_value and asserts both columns. Measured here: reverting :130 to
escape-then-truncate turns it red, with &am visible in the failure output. No source change.

One caveat. The test discriminates because of the literal [:100]: 98 raw characters that escape
to 102. Raise that limit without raising the fixture and escape-then-truncate also fits, so the
test would stop discriminating without failing. That is not recorded anywhere yet and will go in
the test docstring.

<tr>
<td>{field_name}</td>
<td>{html.escape(str(field_name))}</td>
<td>{precision:.3f}</td>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, low. By the reasoning in test_the_confusion_matrix_cell_is_inert (tests/reporting/html/test_visualization_engine.py:375), these three cells are reachable in the same way. A float subclass whose __format__ returns markup passes through :.3f unescaped.

With class HF(float) overriding __format__ to return <img src=x onerror=...>, the metrics {"vendor": {"cm_precision": HF(1.0), "cm_f1": HF(1.0), "tp": 1, ...}} emit the raw <img> from this table and from the chart's {f1_score:.3f} at line 69. This happens on base and on head. Like the Hostile(int) case, it needs a caller-built metrics dict. html.escape(f"{precision:.3f}") closes it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be deferred to a tracking issue targeted at 2.0.0, drafted and not yet opened: five call sites,
each requiring its own test.

Two statements written on this side were incorrect and have been corrected. The first described the
confusion-matrix heatmap as inert and excluded it from the sites to escape, reasoning that
float.__truediv__ on a subclass returns a plain float. That is true of the inherited method and
does not hold when the class is caller-supplied, because the caller also supplies its arithmetic.
The corrected count is five live sites rather than four. The per-site breakdown goes in the tracking
issue.

Reachability: the route needs a caller-built metrics dict. It is not reachable from document data or
model output as far as anyone has shown, which is an argument rather than a measurement — if you see
a path from either, that changes the priority.

Escaping these sites would make them inert rather than robust: a non-numeric or non-finite value
still terminates report generation instead of degrading. Hardening the formatting path is therefore
a separate decision from escaping it, and the tracking issue will record both.

@digalaviz

Copy link
Copy Markdown
Contributor Author

@vawsgit — status before I re-cut, and two questions that decide what goes in the cut.

Nothing is pushed. The head of this PR is still 09b6afe, which is the tree you reviewed. I am
deliberately not re-requesting review yet, because re-requesting now would hand you the same tree
with none of the fixes in it. The re-request comes after the push, on the new SHA, and I will say
what changed when I do.

What is already answered. Each of your five inline comments has a reply on its own thread.
Everything below that I describe as done is done in the tree I am about to push, not on any ref
you can fetch today — including the two commitments: the NaN limit in the changelog's [1.0.1]
section, and the [:100] coupling in the truncation test's docstring. Both were measured before
being written.

Your pdf.js line is applied in that same unpushed tree, verbatim, as
getDocument({ url, isEvalSupported: false }). The finding, the reproduction and the
headless-Chrome measurement are yours; the release text says so and does not imply we re-ran the
browser half. Confirm we applied it as you measured it when you get to it.


Two questions. Both change the tree, so I would rather wait for you than guess.

1. Does the stale Documents card in the Executive Summary leave your second blocker open?

My reading is that the per-document filter fix addresses the blocker as you described it, and that
the Executive Summary card is a separate defect — it is rendered once from the aggregate and never
re-rendered on selection, so it is stale by design rather than by this cut. If you read it as part
of the same blocker, say so and a main.js change enters 1.0.1. If you read it as separate, I will
open it as its own issue against 2.0.0.

2. Do you want the _json_for_script performance change in this release, or deferred with a
note?

You measured 467 ms → 51 ms, byte-identical output. I have not taken it, for one reason: it is a
performance change in a security patch, and shipping it means asserting byte-identity, which needs
a property test I have not written. If you want it in, I will write that test and re-measure here
rather than republish your numbers as ours. If you are content to defer, it goes to 2.0.0 with your
measurement credited.


Two corrections to my own text since your review. Neither is in the code; both were in what we
were about to publish.

  • The release notes claimed a strands-agents-evals integration suite gave identical results on a
    1.0.0 and a 1.0.1 wheel. The evidence does not support that: both arms of that run import
    stickler from a source checkout, on an older tree, with the patch toggled — it is a
    with-and-without control, not a wheel comparison. The claim is now stated as what was actually
    measured. If you think the release needs the wheel-level comparison, I will build both wheels and
    run it.
  • The notes said the diff "touches nothing else" beyond the reporting module and the version files.
    That was false — it also touches the changelog, uv.lock and five test files. The sentence now
    names the reporting module and the three version files and excludes the tests and the changelog
    by category rather than listing all five test files, so it is accurate but not exhaustive.

Two follow-ups are now open, and both are yours, not mine.

I should have credited you in both bodies when I opened them and did not. Both are now edited to
credit you for what you found and to link back to this PR. If you would rather be named
differently, or not at all, say so and I will change it.

Correcting myself on one of those threads: my reply on thread 5 says that issue is "drafted and not
yet opened". That is no longer true — it is #453. The reply stands otherwise.

#454 is now linked from the changelog sentence that describes the gallery limitation, so that
limitation points at its tracker instead of asserting one.

One note on merge mechanics, since it is not visible from the PR UI:

  • A squash will erase @harrycav as author of those four, and co-author trailers in the squash body
    are the only way to preserve it under squash. The ruleset does also permit merge and rebase,
    which keep his authorship natively — but either breaks the one-commit-per-release shape and
    changes which commit the tag should target, so I plan to squash with trailers unless you prefer
    otherwise.

Three asks, then: the two numbered questions, and a confirmation that the pdf.js line went in as
you measured it. Nothing else here needs you.

@digalaviz
digalaviz requested a review from vawsgit October 27, 2026 21:22
@digalaviz

Copy link
Copy Markdown
Contributor Author

@vawsgit — the review request that just went out is premature. The head is still 09b6afe, the tree you reviewed on the 26th, and the diff is unchanged. There is nothing new in it.

What I need are the two numbered questions in my previous comment: whether the stale Documents card in the Executive Summary leaves your second blocker open, and whether the _json_for_script change goes into this release. Both determine what the cut contains, so neither is mine to decide alone.

I will push the re-cut once you have answered, and request review then, on the new SHA, with a summary of what changed between them.

@digalaviz digalaviz changed the title Release/1.0.1 release(v1.0.1): escape document values and field names, mitigate CVE-2024-4367 Oct 27, 2026
@sromoam

sromoam commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

@digalaviz, answering Q2 as maintainer: defer it. It's filed as #457 (1.0.2) with @vawsgit's measurements credited. Please add a line to the [1.0.1] notes saying reports embedding per-document results generate about 10× slower than 1.0.0, linking #457.

Please push the recut now rather than waiting on Q1. Take the reading that the Executive Summary Documents card is separate and was already wrong at v1.0.0. Open it as its own issue, and if @vawsgit reads it differently, it's one more commit. That way @vawsgit reviews a final SHA in one pass.

Also, please update the [1.0.1] date to the day you expect to tag, and retitle the PR before the squash.

@vawsgit, the outstanding asks are Q1 and confirming the pdf.js line went in as you measured it. If we can't get an approval by about 15:00 CDT, we'll recut for 29 Oct.

@sromoam

sromoam commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@digalaviz, thanks for all the work on this. We're releasing 1.0.1 from dev the usual way, so I'm closing this PR and moving the fixes dev doesn't have yet into #464: your four commits as is, plus the pdf.js line and the doc_id loader fix @vawsgit specified. If your unpushed recut has anything beyond that, please push it onto that branch.

sromoam added a commit that referenced this pull request Oct 30, 2026
fix(report): carry the #452 report hardening onto dev, and mitigate CVE-2024-4367
mangeshraut712 pushed a commit to mangeshraut712/stickler that referenced this pull request Nov 1, 2026
… doc_id as a string

pdf.js 3.11.174 runs script from a crafted PDF font unless eval is off.
Pass isEvalSupported: false to getDocument, the upstream mitigation.

The per-document view compares ids as strings, so an integer doc_id from a
DataFrame matched nothing and the page kept showing aggregate numbers.
_load_individual_results now converts it, matching the tables' str().

Both fixes as specified by vawsgit in the awslabs#452 review.
mangeshraut712 pushed a commit to mangeshraut712/stickler that referenced this pull request Nov 1, 2026
@digalaviz
digalaviz deleted the release/1.0.1 branch November 8, 2026 20:32
sromoam added a commit that referenced this pull request Nov 20, 2026
… JSON output (#604)

* fix(366): refuse a RootModel when the evaluator is built

`eval_for()` accepted a `RootModel` and returned a spec. What happened next
depended on the root type, and one of the four outcomes was silent:

  RootModel[list[Point]]     AttributeError: 'list' object has no attribute 'keys'
  RootModel[int]             AttributeError: 'int' object has no attribute 'copy'
  RootModel[dict[str, int]]  ValidationError, missing `root`
  RootModel[Point]           scored 1.0 for two values differing in every field

The three errors came from `ConfigurationHelper.from_json`, where the dump of a
root value arrives as something other than a mapping. They arrived once per
document rather than once at configuration time, and named neither `RootModel`
nor the field they could not key. The fourth reported a perfect match for a
wrong prediction, which is the outcome worth closing.

The check sits beside the `BaseModel` guard already at the top of
`structured_model_for`, so both public entry points inherit it: `eval_for`
reaches it for anything that is not a `StructuredModel`, and `evaluate()` calls
`eval_for`. The message names the class and points at declaring the root value
as a named field on a `BaseModel`.

Issue #366 offered two directions and called the refusal useful on its own even
if root-value comparison stays out of scope. This takes that one: a root value
is still not compared, and a `RootModel` held in a field is untouched, since it
fails on its own terms with a pydantic `ValidationError` that names the field.

Suite: 2793 passed, 12 skipped, 1 xfailed, against 2779 on dev.

Closes #366

* chore(ci): validate a pull request commit once, not twice

`run_pytest.yaml`, `lint.yaml` and `security.yaml` all declared
`on: [push, pull_request]`. On a branch in this repository with an open pull
request both events fire, so every push validated the same commit twice. On
`854fc00e` (PR #384) that is six runs of three workflows, fourteen jobs: ten
tests, two lint, two security.

The two copies are not guaranteed to agree, which is the sharper reason to drop
one. On that same commit the `pull_request` copy passed all five Python
versions while the `push` copy failed 3.10, on a wall-clock assertion that
measured 41.69s against a 35s budget. One commit, two verdicts.

`push` is now limited to `dev` and `main`, which keeps those branches validated
while a pull request from a feature branch reports through `pull_request`
alone. A pull request whose head is `dev`, as a release promotion to `main`
would be, still fires both.

`run_pytest.yaml` and `lint.yaml` also take a concurrency group so a superseded
pull-request head stops running. A push gets a group of its own, keyed on
`github.run_id`: a group holds one running and one pending run, so sharing a
group per branch would let a third push cancel the pending one no matter what
`cancel-in-progress` says, and that flag only protects the run already
executing.

`security.yaml` takes the trigger change and no concurrency.
`security-pr-comment.yaml` wakes on its completion, a cancellation included,
and downloads the `security-reports` artifact; a cancelled scan uploads none,
and that consumer fails rather than skipping on a missing artifact, as it did
on `b32d3ffd`. Limiting `push` already removes the duplicate run.

No behaviour change to the library, so there is no CHANGELOG entry.

* fix: restore stdout when print_confusion_matrix output_file write fails

Use contextlib.redirect_stdout to ensure sys.stdout is always restored,
even when an error occurs during file writing. Previously, any exception
between stdout reassignment and restoration would leave stdout pointing
at a closed file, breaking all subsequent print() calls in the process.

Also catch only OSError from open() instead of all exceptions, and add
missing bulk_info_summary to file output branch.

Fixes #385

* fix: narrow scope to stdout restoration only

Remove OSError narrowing and bulk_info_summary addition from the previous
commit to focus solely on fixing the stdout restoration bug described in
issue #385.

* refactor(296): remove the dead ConfusionMatrixCalculator methods

calculate_list_confusion_matrix, calculate_nested_field_metrics and
calculate_single_nested_field_metrics only called each other, and their
only way in was three StructuredModel wrappers that nothing calls. All
six had zero executed lines across the full suite. Remove them, the
HungarianHelper, NonMatchesHelper and List imports that only they used,
and the refactoring notes that listed the wrappers.

StructuredListComparator._calculate_nested_field_metrics is a separate,
live method with the same name and is untouched. So are
ConfusionMatrixCalculator.__init__, classify_field_for_confusion_matrix
and StructuredModel._classify_field_for_confusion_matrix, which
StructuredListComparator calls.

The 1e-10 threshold window that algorithms/README.md and the
HungarianMatcher.calculate_metrics docstring attribute to
ConfusionMatrixCalculator lived in the deleted
calculate_nested_field_metrics. The method that remains compares with a
bare >=, so both now name only ThresholdHelper and ComparisonHelper.

Also run ruff format on the calculator file, which only strips the
trailing whitespace from 9 blank docstring lines.

Closes #296

* fix(383): always call a declared comparator, and drop Tuple/Set

Review on #384 (digalaviz):

- A declared comparator is now called for any pair of non-structured
  values, in both compare_with() and compare(). The strict scalar list
  applies only to an inferred comparator, where an arbitrary object
  would reach Levenshtein as a near-identical repr. This restores
  compare() for bytes and custom classes, and fixes compare_with() for
  them. ComparableFieldConfig carries comparator_explicit, read from the
  same _comparator_explicit bit the object-grade substitution uses.
- Drop Tuple/Set: no set ordering, no tuple/set branch, and an empty
  tuple or set is no longer absent. Inferred-comparator tuples and sets
  keep their pre-#383 behaviour in each reader, tracked in #391. With a
  declared comparator they arrive as the caller supplied them, so a
  set-aware comparator works.
- Mark the CHANGELOG entry Breaking and list what moves for existing
  callers; scope the stickler.evaluate() sentence to the zero-config
  path. #392 tracks merging the two readers.

* fix(292): format the budget key as a number in Bulk_Confidence_AUROC

ErrorCaptureAtBudgetMetric keys budgets with strings such as "0.10" so the
dict round-trips through JSONL, and cell 11 of the notebook applied the %
format code to those strings, so it raised ValueError: Unknown format code
'%' for object of type 'str'. Convert the key with float() before
formatting, as the confidence metrics docs already do.

Store the outputs of a full run, so a reader sees the real numbers.

* fix!: treat a None list element as absent

A None element in a list is now left out before matching: it is never
paired, counted or scored, and a list of only None is an empty list. A
float NaN element counts as None; an empty string is still a value. This
holds for list fields of models and of primitives, in compare_with() and
compare(), and reports keep each element's original index.

Counting a None as an element credited two of them as a true positive
and counted a missed row as a false discovery (or, in a list of models, a
true positive), so recall stayed at 1.0.

It also removes the order dependence of List[Optional[Model]]: element
kind and the Hungarian match_threshold were read from [0], so a leading
None skipped the class gate (#386) and took the parent's threshold (#322).

The rule is defined in docs/docs/Advanced/classification-logic.md,
"None elements in a list".

Closes #386. Closes #322.

* fix(366): refuse a RootModel in a nested field or list element

The guard read the class passed in and nothing below it, so a `RootModel` held
in a field or as a list element still reached the builder. Both produced a
shadow carrying a single `root` field that no dumped value ever filled: both
sides read None, and two values differing in every field scored 1.0. That is
the same silent outcome the top-level refusal closed.

The check now sits at the top of `_build`, which assembles the shadow class for
every model the zero-config builder mirrors, beside the refusals for a
recursive graph, a reserved field name and a model with no fields. One check
covers the class passed in and every model reached from it, at any depth.
`_build`, `_field_definition` and `_shadow_for` carry a `_path` argument so the
message names the field rather than only the class: `Holder.pt` for a field,
`Holder.items[]` for a list element, since the two reach the builder through
different branches.

The builder descends through a nested model and a `List[BaseModel]` element,
and those are exactly the positions that carried the bug. A `RootModel` reached
only through a `Dict` value, a `Tuple`, a `Set` or a union is still built,
unchanged, because it is compared as canonical JSON rather than mirrored: two
differing values score 0.0 to 0.667 there, never a false 1.0.

The previous commit said a `RootModel` held in a field was untouched because it
failed on its own terms with a pydantic `ValidationError` naming the field.
That holds for `RootModel[list[...]]`, which raised once per document, and not
for `RootModel[Model]`, which raised nothing and scored 1.0. The test that
asserted it is inverted here, and the CHANGELOG entry corrected.

An explicitly configured `StructuredModel` is returned as configured and never
mirrored, so the refusal does not reach inside one: its fields keep the
comparators the caller declared. `auto/README.md` records that boundary, and
that the order of the refusals is not a precedence guarantee, since a model
tripping two of them reports whichever its fields reach first.

* fix(pretty_print): do not report success when non-match records are absent

`print_non_matches` and `print_evaluation_results` printed "No non-matches
found - all fields matched successfully!" for `EvalResult.raw` or any
`compare_with()` dict computed without `document_non_matches=True`, including
one with a wrong field. Such a dict has no `non_matches` key, and the printers
fell back to `confusion_matrix["non_matches"]`, a placeholder the engine always
writes empty.

`_extract_non_matches` now returns None when the results carry no records,
distinct from an empty list, and only trusts a populated placeholder. Missing
records print a note naming `document_non_matches=True`; an empty list prints
"No non-matches found." without the `all_fields_matched` wording removed in
#287. A bulk `ProcessEvaluation` built with `document_non_matches=False` gets
the same note.

Closes #298.

* fix(333): export a list of mappings with object items

`to_json_schema()` fell back to `{"type": "string"}` for a list element it
did not recognise, so `List[Dict[...]]` re-imported as `List[str]` and the
round-tripped model raised `ValidationError` on the data the original
accepted. A mapping element now exports as `{"type": "object"}` (nullable
when the element is optional), which the importer reads back as `dict`.

The exported clip setting already matches what the field resolves to: the
object-grade substitution writes it into the metadata the exporter reads, so
with the items typed correctly the round trip scores as the original did.
Tests pin both, plus the stickler-config path.

Closes #333.

* fix(pretty_print): error on non-result input; actionable note for EvalResult.raw

Review follow-ups on the #298 fix.

- `print_non_matches` on input that is not a result (an arbitrary object,
  None, a bare list of records) printed the "pass document_non_matches=True"
  note, which sends the owner of a list of records after something they
  already did. It now prints an error, as `print_confusion_matrix` does.
- The note now names the remedy for `EvalResult.raw` first: `evaluate()`
  takes no `document_non_matches`, so passing the `EvalResult` itself is the
  only actionable advice for the issue's own case.
- CHANGELOG: an `evaluator_format=True` dict always carries a `non_matches`
  list, so it still prints the success line without records. Say so rather
  than claim every `compare_with()` dict is covered.
- Docstring note moved above `Args`.
- Tests: non-result input, bulk with records and no failures, and the
  EvalResult hint on `.raw`.

* fix(333): correct the round-trip claims and pin the documented limits

The CHANGELOG said to_stickler_config() already exported this shape as
List[Dict]; it writes List[Mapping] for a Mapping element, which
model_from_json() refuses. The docs paragraph sat under a both-methods
heading without saying so, and neither text said the value type is lost
(values are no longer coerced) or that a singular mapping field still
exports as a string (#349). Kept-settings claims now name weight and are
scoped to what ComparableField declared, since a bare field keeps nothing.

Tests: assert weight survives, and pin the two documented limits so the
docs fail when the shapes start working.

* chore: add digalaviz as a maintainer

`CODEOWNERS` requested one person on every pull request, so every review in the
queue waited on the same reviewer, and a change request could only be withdrawn
by them. Adding the second maintainer to the default owner line is what makes
the automatic request reach both.

`MAINTAINERS.md` is the list `CONTRIBUTING.md` points contributors at, and its
"Becoming a maintainer" section puts nomination and approval with the current
maintainers, so this lands as a pull request for the existing maintainer to
approve rather than as a direct commit.

* test(365): pin the stickler surface Strands Evals 1.6.0 reads

strands-agents-evals 1.6.0 scores structured output with stickler
(StructuredOutputSimilarity, StructuredOutputReport). Its suite pins a released
stickler, so only a test here fails on the commit that breaks it.

- tests/integrations/strands_corpus.py: five models covering the shapes users
  pass as structured_output_model, 42 cases, and a verbatim copy of 1.6.0's
  _passed gate.
- test_strands_evals_contract.py (no strands dependency): import paths,
  eval_for kwargs, evaluate/explain shapes, every EvalResult attribute,
  that raw["confusion_matrix"]["overall"] carries integer tp/fa/fd/fp/tn/fn,
  recall = tp/(tp+fn), matched = score >= threshold, the nothing-to-find guard,
  and aggregate_from_comparisons on stripped and JSON-reloaded raws.
- test_strands_evals_snapshot.py + strands_evals_snapshot.json: exact scores,
  verdicts and aggregate metrics for 40 typical cases.
  STICKLER_UPDATE_STRANDS_SNAPSHOT=1 regenerates it.
- test_strands_evals_e2e.py: the real evaluator through Experiment, offline;
  skipped without strands_evals, fails if stickler is not this checkout.
- CI: a strands-evals job installs strands-agents-evals==1.6.0 without its
  [stickler] extra and runs tests/integrations on Python 3.10 and 3.14.

Refs #365.

* ci(365): exempt strands-agents-evals from the cooldown up to the 1.6.0 release

* fix(411): report missing non-match records instead of a clean document

The HTML report's Non-Matches Analysis section rendered "No non-matches
found." for a compare_with() dict computed without document_non_matches=True,
including one whose name field scored 0.0, and for a bulk ProcessEvaluation
built with document_non_matches=False.

DataExtractor.extract_non_matches returned [] both when records had been
collected and were empty and when they were never collected, so the renderer
had nothing to distinguish them by. It now returns None for the second case and
the section says the records are missing and how to collect them. An empty list
still renders the success message.

tests/reporting/html/test_data_extractors.py pinned the conflation by asserting
[] for a ProcessEvaluation whose non_matches is None; that assertion is now
is None. Every other test in the directory patches the extractor, which is why
the defect survived them, so the new coverage drives real comparison dicts and a
real bulk evaluator through SectionGenerator without patching.

* fix(349)!: export plain models and nested lists, refuse model unions

to_json_schema() and to_stickler_config() fell back to "string" / "str" for
any annotation missing from their type tables. A plain BaseModel, a list of
plain models and a list of lists all took that fallback, so the re-imported
field was str (or List[str], or an unknown type in the config) and could not
load the data the original model accepted. The guard meant to stop a nested
model reaching the fallback checked `isinstance(field_type, type)`, which is
False for Union[Card, Bank], so that union exported as "string" too.
from_json_schema() builds exactly that union from a multi-arm anyOf, so a
schema-only round trip broke.

- A plain BaseModel is scored as one object, as a mapping is, so it exports
  as a free-form {"type": "object"} ("dict" in a Stickler config, List[dict]
  for a list) and re-imports as dict with its comparison settings. Its own
  field types are not exported.
- A list of lists exports as nested arrays, so List[List[float]] and
  List[List[Dict]] reload. The element goes through the existing primitive
  list branch, so that branch stays the one place that writes a list
  property.
- to_stickler_config() has no type for a union with a model arm, or for a
  StructuredModel inside a nested list, so both exporters raise ValueError
  for these and follow one rule. JSON Schema could express the union (anyOf),
  and that export could follow; a model inside a nested list would also
  need importer work. Optional and
  Annotated wrappers are stripped at every level before the check.

Mapping fields and List[Dict] elements are left alone here: the first is
handled in #360, the second in #405.

Refs #349 (parts B and C)

* fix(333): round-trip an undeclared list of mappings and a Mapping element on the config path

Review feedback on #405.

- A `List[Dict]` field declared without `ComparableField` exported no
  comparison keys, so `from_json_schema()` rebuilt it as ExactComparator at
  1.0 with clip on (0.5 became 0.0) and `model_from_json()` refused it for
  having no comparator. Both exporters now write the comparator, threshold,
  weight and clip the field resolves. Scalar lists are unchanged (#348).
- `to_stickler_config()` writes every mapping element as `List[Dict]`. It
  wrote `List[Mapping]` / `List[Counter]`, which `model_from_json()` refused.
  The test that pinned that refusal now asserts the round trip.
- Docs name the shapes still exported as a string: a list whose element is a
  union or another list (#349).

* docs(352): state the 1.0 default for enum/const on any type and on array items

Review round 2 on #369:

- Extension Reference: `enum`/`const` default to 1.0 on any type, and the
  format/enum/const rule also applies to array `items`. Scalar rows now say
  "plain". An array of free-form objects defaults to 1.0, like a single one.
- README `x-aws-stickler-threshold` default matches the table, including that a
  declared comparator keeps the 1.0.
- README schema example annotates its Overall Score (0.919).
- The Evaluation guide no longer calls the README the complete reference, which
  made the two documents point at each other.
- tests/test_readme_examples.py: covers non-string enum/const and array items,
  runs the quick-start block too, derives each annotated line's field from its
  `field_scores[...]` key instead of a hand-written label map, and reads files
  as UTF-8.
- The `clean = (` guard now scans README.md, like `_authored_prose`.

* fix(349): unwrap Annotated before exporting nested models

Both exporters stripped Optional but not Annotated before dispatching, so a
nested model declared as Optional[Annotated[Card, Field(...)]] or
List[Annotated[Card, "m"]] skipped the recursive branch and was refused as a
scalar. The field and the list element now go through
strip_annotation_wrappers, so they export as the model, and an annotated
scalar exports as its own type instead of a string.

_refuse_scalar_export now takes the field's whole annotation and counts list
levels, so a single List[Card] is no longer reported as a nested list. Both
list branches pass it the whole field.

The CHANGELOG entry and the test docstring now say which shapes the refusal
does not reach yet.

Refs #349

* fix(422): escape field names in the HTML field performance table

The table wrote each field name into the page raw, while the chart beside
it escaped the same name. The function's local html string shadowed the
html module, so the escape could not simply be copied across; rename it,
and the same shadowing local in generate_confusion_matrix_heatmap and
SectionGenerator.generate_confusion_matrix.

Fixes #422

* docs(352): split the README's object rows into with-properties and free-form, link the Extension Reference absolutely

A free-form {"type": "object"}, or an array of them, resolves to
ExactComparator at 1.0, not recursive comparison at 0.7 or Hungarian at 0.5.
Relative docs links do not resolve on the PyPI project page.

* fix(333): export the resolved comparison for every mapping list, keep optional elements nullable

Review follow-ups on #405:
- docs: a list of lists exports nested arrays since #414; drop "or another
  list" from the string-export sentence.
- to_stickler_config() writes List[Optional[Dict]] for an optional mapping
  element, so the re-imported model accepts None elements again.
- A declared ComparableField whose annotation resolves only at
  model_rebuild() exported Levenshtein with clip on while the engine scored
  ANLS* with clip off (0.95 vs 0.5 after the round trip). Mapping lists now
  always export get_comparison_info(), declared or not, and the stale
  comparator_config is dropped.

* test(365): address review on the Strands Evals contract

- CI and README: constrain the strands-agents-evals install to uv.lock
  (uv export --no-emit-project + -c). Unconstrained, it moved idna 3.15 to
  3.20. README now uses the same command, including the cooldown cutoff
  without which 1.6.0 does not resolve, and the bump steps move the cutoff.
- conftest.py: the "is this checkout" check now covers every file in
  tests/integrations, not only the e2e.
- TestGuard uses STRANDS_DEFAULT_THRESHOLD instead of 0.7 literals.
- TestAggregate evaluates only the requested model's cases; the snapshot
  builds one spec per model instead of one per case.

* fix(333): state each re-imported spelling, document the late-resolved fix

Self-review follow-ups on #405:
- docs and CHANGELOG: an optional element re-imports as List[Optional[dict]]
  (from_json_schema) or List[Optional[Dict]] (model_from_json), not List[dict].
- CHANGELOG: a declared ComparableField whose annotation resolves only at
  model_rebuild() now exports ANLS* with clip off, not Levenshtein with clip
  on (0.5, not 0.95, after the round trip).
- to_stickler_config() keeps a declared comparator_config in its key position
  instead of moving it after default.

* test(365): fail closed on the lock export and finish the review follow-ups

- README: write the uv.lock constraints to a mktemp file chained with &&,
  not a fixed /tmp path. With <(...) a failed export installs unconstrained
  (idna resolved to 3.20, rc 0); the chain stops instead.
- CI: uv export -q, so the step no longer echoes the 221-line export. The
  comments now say the constraints cover uv.lock's default (no-extras)
  export; packages locked only under extras (boto3, httpx) can move.
- Bump steps name the ==1.6.0 pin and the cutoff in both the workflow and
  the README command.
- .github/workflows/README.md: the strands-evals row says the install is
  constrained to uv.lock.
- Contract suite: STRANDS_DEFAULT_THRESHOLD replaces the last 0.7 literal,
  and _evaluate shares one spec per model and threshold, as the evaluator
  does (eval_for calls 790 -> 116).

* fix(422): str() the field name, test the chart's escaping, truncate before escaping

Review follow-ups: a non-str key in a hand-built results dict no longer
raises in the chart or table; the chart gets the same escaping test as the
table; the non-matches table truncates before escaping, so the cut cannot
split an entity such as &amp;.

* fix(431): keep document data from ending the report's <script> block

The report embeds each document's values as JSON inside <script>, and
json.dumps leaves < as is, so a value carrying </script><script>... ran as
its own script when the report was opened. Write <, >, &, U+2028 and
U+2029 as \uXXXX in both embedded blobs; the page's JavaScript reads the
same data.

Fixes #431

* test(431): guard the field-threshold blob with a schema-derived field name

Review found that reverting only thresholds_json left every test green,
though that path runs injected script in Chrome via a JSON Schema
property name. Add that case, and name the route in the CHANGELOG.

* chore(deps): bump astral-sh/setup-uv

Bumps the github-actions group with 1 update: [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv).


Updates `astral-sh/setup-uv` from 10.0.1 to 10.3.0
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/v10.0.1...1c37ad07a6a961277cf70c0d37d6f313000f5884)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>

* test(399): snapshot the None-in-a-list shapes

tagged/none_element and tagged/leading_none carried snapshot=False while the
change that moves them was an open PR. That change merged on 2026-10-16
(#399, 9a6f13d, merge commit e403b9b), so the hold-out no longer protects a
review in flight: it hides a merged behaviour change from every gate that would
register it. test_snapshot_matches runs in the five test jobs as well as the two
strands-evals ones, so seven green jobs on dev carry the blind spot.

Both shapes were always in CORPUS, exercised by the contract and e2e tests; they
were simply absent from the golden file. They now enter it with their current
values, regenerated with STICKLER_UPDATE_STRANDS_SNAPSHOT=1. The JSON diff is
additive: 40 cases to 42, models 4 to 5, no existing value changed.

Building the same snapshot against v1.0.0 (e028427) with the same corpus differs
in 22 recorded values -- 6 in tagged/leading_none, 2 in tagged/none_element, 14
under models.Tagged. test_pass is among them: tagged/leading_none goes False to
True. The change is merged but not published; PyPI still serves v1.0.0, so that
column is what consumers run today. Recording the current values is the point:
the next movement of these shapes turns those jobs red instead of passing
unnoticed, whichever version number #443 settles on.

CorpusCase.snapshot is kept. It is the right mechanism the next time a shape has
to be held out; SNAPSHOT_CORPUS still reads it, and no case sets it to False
today, so the filter is a no-op for now.

The module docstring described the exempt shapes as moved by "an open 1.0.1
change". It is not open any more, so the docstring says what is true now.

The CHANGELOG entry is there because the snapshot module's own docstring and
tests/integrations/README.md require one for any snapshot change, not because
anything user-visible changed.

Refs #443.

* test(381): snapshot the NaN shapes

The Strands corpus had no NaN case, so the snapshot gate could not see
6a259d8 moving test_pass. Add three Lead shapes: NaN where a number is
expected (now fails at the default threshold), NaN vs NaN, and NaN vs None
(now passes). No existing case's values change; the Lead aggregate moves
because it averages over three more cases.

* docs(381): list the NaN change as Breaking

6a259d8 changes confusion counts and can move a pass/fail verdict in
either direction, including a Strands Evals test_pass going from pass to
fail at its default threshold (#443). It went in as fix: under Fixed;
move its entry to Changed as Breaking.

* docs(381): point the snapshot note at the NaN change by issue, not section

* fix(454): coerce document_files keys and paths in the gallery

html.escape requires str. Integer keys or paths (common when doc_id
comes off a DataFrame column) raised AttributeError and generate_report
returned success=False with no page. Coerce both sides before escape so
int 1001 and "1001" also agree as the gallery key.

* fix(453): escape :.3f/:1f cells after formatting

A numeric subclass whose __format__ returns markup could land in the
field-performance table/chart and the confusion-matrix percentage cells.
Escape the formatted string at each of the five sites. Gauge stays
unescaped: int(score * 100) forces a plain int.

* chore(deps): bump the github-actions group with 2 updates

Bumps the github-actions group with 2 updates: [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish).


Updates `astral-sh/setup-uv` from 10.3.0 to 10.3.1
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/1c37ad07a6a961277cf70c0d37d6f313000f5884...18d369b23da25a81e9458561248e1aafff6a70fa)

Updates `pypa/gh-action-pypi-publish` from 1.14.2 to 1.14.3
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/dc37677b2e1c63e2034f94d8a5b11f265b73ba33...7245906fb61fa33a13554f9d5fb856fe61758086)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: pypa/gh-action-pypi-publish
  dependency-version: 1.14.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: report-only list fixes: raw_similarity_score, evaluator-format precision/recall and non_matches (#330, #413) (#420)

* fix(lists): report the unclipped score as raw_similarity_score

A list node reported the clipped, coverage-scaled mean in
raw_similarity_score, the same number as threshold_applied_score, so it
contradicted its name and compare(). unordered_list_metrics now also
returns raw_overall_score, the same mean with no element clipped, and
both list comparators report it as raw_similarity_score.

Report-only: similarity_score, threshold_applied_score, field_scores,
overall_score and every confusion count are unchanged. Nothing that
feeds a score, a count, bulk mean_score, or confidence metrics reads
raw_similarity_score on a list node.

Refs #330.

* fix(evaluator_format): read precision and recall from confusion counts

Without include_confusion_matrix=True, the evaluator-format overall was a
conversion of the score that charged every lost point to precision once
the score reached 0.5, and each list field's overall always was. One TP
and one FN ([A, B] vs [A]) read precision 0.5 and recall 1.0, the wrong
way round, while the same call with the confusion matrix said 1.0 and
0.5.

format_for_evaluator now receives the compare_recursive result and reads
the root's and each list node's counts, so both equal that node's
derived block and honour recall_with_fd. A node with only true negatives
keeps the score conversion. Other fields and anls_score are unchanged.
Evaluator-format output only: scores and counts are unchanged.

* fix(evaluator_format): omit non_matches unless records were requested

compare_with(evaluator_format=True) always wrote "non_matches": [], so
"not collected" read as "no non-matches" and print_non_matches printed a
success message over a document with a wrong field. The key is now
present only with document_non_matches=True, as in the default
compare_with() dict, so the #404 printers report the records as missing.

The HTML report had the same ambiguity: DataExtractor.extract_non_matches
returns [] either way. DataExtractor.has_non_match_records tells the two
apart, and the non-match section now says records were not collected
instead of "No non-matches found." when they were not.

Scores and counts are unchanged.

Refs #330. Closes #413.

* fix: evaluator-format metrics from counts on every path; self-review fixes

- evaluator_format overall always reads the compare_recursive counts, so it
  no longer depends on include_confusion_matrix (an all-TN document read
  1.0 without it, 0.0 with it; now 0.0, as `derived` does). The cm-derived
  branch is gone.
- Every field with a TP, FP or FN reads its counts, not a score conversion:
  an unclipped FD scalar read precision 0.5 recall 1.0, now 0.0/0.0.
- explain(): a list's verdict no longer compares its coverage-scaled raw
  mean to the per-element threshold.
- print_non_matches: lead with document_non_matches=True; the EvalResult
  .raw hint only for a default compare_with() dict.
- CHANGELOG: #413 moved to Changed as Breaking, migration advice no longer
  conflates not-collected with clean; explain() note on #330; P/R entry
  covers scalar fields and the all-TN case.
- Docs: regenerated the evaluator-format example from the page's own
  Invoice pair; confusion_matrix["non_matches"] documented as an
  always-empty placeholder; architecture row says who reads
  raw_similarity_score on a scalar.

* revert: keep evaluator-format metric rules as 114c9eb had them

Reverts the counts-everywhere change from e42b07a (all-TN overall and
per-field metrics) to keep 1.0.1 within the PR's original scope; deferred
to a 1.1.0 issue. The overall-from-cm branch, the count fallback and the
per-field score conversion are 114c9eb's again, as are their tests and
CHANGELOG entry. The regenerated guide example measures the same under
the reverted rule; its bullets now describe it.

Kept from e42b07a: #413 as Breaking under Changed with the corrected
migration advice, the confusion_matrix["non_matches"] placeholder note,
the explain() note and list verdict wording, the architecture row (now
also naming explain() and DataExtractor.extract_similarity_score), and
the printer message order.

* docs: correct the raw_similarity_score readers and the evaluator-format list shape

* review: narrow list raw-score claims, drop list-of-models verdict, per-item overall in CHANGELOG

- raw_similarity_score on List[StructuredModel] stays clipped inside each
  item: say so in the CHANGELOG, architecture.md and the comparator docstring.
- explain() no longer gives a list of models a verdict naming the field
  threshold; the list clips its pairs at 0.01, so the wording named the
  wrong cause (no verdict, as on dev).
- CHANGELOG: per-item items[i] overall moves too; a TN-only node still
  depends on include_confusion_matrix (#434). Code comment says the same.
- evaluator-format metric dict built in one place.
- Tighten a print_non_matches assertion that could not fail.

* docs(changelog): measured TN-only and list-of-models raw-score wording

- Only a TN-only document's overall depends on include_confusion_matrix;
  a TN-only list field's overall is 1.0 either way (#434).
- List[StructuredModel] raw score moves only where a pair's own score is
  below the list's 0.01 floor (0.005 reported 0.0, now 0.005).
- Drop the duplicate bare (#330).

* refactor(395): remove the remaining dead confusion-matrix paths (#398)

* refactor(395): remove the remaining dead confusion-matrix paths

StructuredModel._calculate_object_level_metrics has no caller. The one
call site is inside StructuredListComparator, which does not inherit
from StructuredModel and calls its own copy. ConfusionMatrixBuilder's
calculator property and _calculator slot are never read. Both had zero
executed lines across the full suite. Remove them, the HungarianHelper
import that only the first used, and the docstrings that describe the
builder as coordinating a ConfusionMatrixCalculator.

classify_field_for_confusion_matrix now returns only the six counts.
Its one caller, StructuredListComparator._handle_non_hierarchical_field,
adds up those counts for every matched pair and primitive sub-field and
never read the derived metrics that came with them. It is now a
staticmethod that takes the ground truth model, so the StructuredModel
wrapper no longer builds a ConfusionMatrixCalculator on every call.

The StructuredModel branch in classify_field_for_confusion_matrix
stays. is_structured_field_type does not recognise a list element
sub-field annotated Union[A, B] or Any, so model values on such a field
reach the classifier. Without the branch the default
LevenshteinComparator would score the text of the two models, and a
pair that scores 0.0 as models would count as a TP. A new test pins it.

Also correct the StructuredModel size in the refactoring notes (2029
lines now, not ~1486), and name the shims #390 removed and what does
their work now.

Refs #395

* docs(395): say which StructuredModel shims remain

The refactoring notes still said the private wrappers "were not
removed" right above the paragraph listing the four that were. Say the
ones that still have callers are kept as forwarding wrappers, and link
the _calculate_object_level_metrics removal to #398 instead of the issue.

Also stop listing ConfusionMatrixCalculator as the component that
calculates the matrix in the ComparisonEngine, AggregateMetricsCalculator
and DerivedMetricsCalculator docstrings, number the builder's inline
step comments to match its docstring, and give the Levenshtein score in
the model-valued sub-field test as about 0.96 (measured 0.9583).

Refs #395

* docs(395): call the classified list sub-fields non-list, not primitive

Model-valued sub-fields annotated Union or Any also reach the classifier,
so "non-list" describes what it handles; simple list sub-fields still go
through the element-level dispatch.

* fix(336): warn about the nested-field pairs the matcher kept, not every cell (#382)

* fix(336): warn about the nested-field pairs the matcher kept, not every cell

compare() is the cost function for a list of StructuredModel rows, so the
class gate on a nested field ran, and warned, for every cell of the cost
matrix. An all-correct List[Holder] scored 1.0 with tp=2 and still warned
that a Cat was compared against a Dog, and warn_once then had nothing left
for the real mismatch that followed.

The gate is now silent while HungarianMatcher fills a cost matrix. The
selected pairs are scored again through compare_with outside the matrix,
which is where the warning now comes from. Verdicts are unchanged.

* fix(336): set the matrix flag where the kept pairs are scored again

HungarianMatcher.match set filling_cost_matrix for every caller, including
a bare matcher and an Any field's list, whose cell scores are the result.
Nothing re-scores those pairs, so the gate's only warning was lost: a kept
Cat-vs-Dog pair through HungarianMatcher(StructuredModelComparator()) and an
Any field declared with that comparator each warned once on dev and not at
all here. Scores and counts were unchanged.

HungarianHelper.get_complete_matching_info now sets the flag around its
calculate_metrics call instead, the one path whose kept pairs are scored
again through compare_with. The None filtering from #399 is unchanged.

Tests: the flag-scope tests go through HungarianHelper, a bare matcher is
checked not to set it, and the bare matcher, Any-field and dict-value cases
each warn exactly once.

* fix(336): test the kept pair, wrap the matrix flag, correct the docs

The bare-matcher and Any-field tests passed on a discarded Cat-vs-Dog
cell's warning, so they would still pass if the kept pair never warned.
They now use rows paired by label where only the kept pairs cross
classes and every discarded cell is same-class. With the kept-pair
warning suppressed, both fail; the previous versions passed.

The mapping test passes with or without the deferral, because that
warning is keyed per field. It is renamed and documented as a guard
against over-silencing only.

HungarianHelper no longer imports the private ContextVar. hungarian.py
gains scoring_cost_matrix(), a context manager that sets and restores
it, and the reset is tested for ValueError and KeyboardInterrupt.

filling_cost_matrix() is true for the whole HungarianHelper match,
including the solve, and false for a bare matcher; its summary and the
flag-scope test name now say so. The CHANGELOG entry states the real
scope: warnings are deferred to kept pairs when HungarianHelper matches
StructuredModel rows, while a bare HungarianMatcher and an Any field
whose list does not start with a model warn on every cell, as before.

* fix(336): scope the docs to what the flag does, test the kept pair

The CHANGELOG headline claimed no warning about a discarded pair at all.
It is now scoped to StructuredModel list rows, and names the residual: a
bare matcher, or an Any field whose list starts with a scalar, can still
spend the field's one message on a discarded cell.

filling_cost_matrix() is described as true while HungarianHelper scores
and solves the matrix, not for the whole call and not as false during
the re-score, which nested lists perform under the outer flag. The
scoring_cost_matrix() docstring no longer promises a reset for a signal
that lands between the set and the try.

TestASelectedMismatchStillWarns uses the fixture where only the kept
pairs cross classes, so it fails if no kept pair warns. An autouse
fixture asserts the flag is clear before and after each test, and the
flag-scope test is renamed to what it checks.

* refactor(336): keep the pair-warning flag in hungarian_helper, document it once

The flag's only setter (HungarianHelper) and only reader
(ConfigurationHelper.can_compare_object_pair) are both in
structured_object_evaluator/models, so it moves out of
stickler.algorithms.hungarian, which this PR no longer touches. The two
names now share a verb: deferring_pair_warnings() and the
defer_pair_warnings() context manager.

The rule is explained once, in deferring_pair_warnings(). The context
manager, the gate docstring and the helper point there, and the
algorithms README section is dropped. get_complete_matching_info states
that a caller needing the warnings must score the kept pairs again.

No behaviour change.

* fix(336): set the pair-warning flag inside the try

A KeyboardInterrupt between the set and the try left the flag true for
the rest of the context, which in a Jupyter kernel is the session, so
every later class-mismatch and mapping warning was silenced.

* fix(336): restore the pair-warning flag without a token

79b08e4 moved the set inside the try, but a pending KeyboardInterrupt is
raised when ContextVar.set returns, after the value has changed and
before the token is stored. The token stayed None, the finally skipped
the reset, and the flag stayed true. defer_pair_warnings() now reads the
previous value first and sets it back in the finally, so no token is
needed. A test proxies the ContextVar so that set() changes the value and
then raises KeyboardInterrupt; it failed on 79b08e4 and passes now.

Also: the gate docstring's "see there" on one line, the test identifiers
renamed from "matrix flag" to pair-warning deferral, and one line in the
models README for anyone adding a pair-level warning.

---------

Co-authored-by: Spencer Romo <sromo@amazon.com>

* fix(423): refuse in specs_for whatever structured_model_for refuses (#430)

* fix(423): refuse in specs_for whatever structured_model_for refuses

specs_for had no RootModel check, so after #366 it returned specs for the
root's internal attribute (pt.root.x), paths that are never scored, for a
class the builder refuses. Run the builder first (cached) so both raise the
same TypeError. A configured StructuredModel is never built and is skipped.

Fixes #423

* fix(423): don't run the builder check from EvalSpec.explain()

A spec holds either the shadow the builder already built, so the check
cannot fail, or a hand-written eval_model, which the builder's verdict on
source_cls does not bear on. Running it there made explain() raise for
EvalSpec(Node, NodeSM) with a recursive Node, which worked on dev.

Pin the #423 symptom directly (RootModel message naming the field), add a
recursive-model case for specs_for, and say in the CHANGELOG which other
classes it now refuses.

---------

Co-authored-by: Spencer Romo <sromo@amazon.com>

* fix(417)!: use one threshold tolerance at every classification gate (#421)

* fix(417)!: use one threshold tolerance at every classification gate

A primitive list element was classified with
ThresholdHelper.is_above_threshold, which accepts a score up to 1e-10
under the threshold. The field and nested-model gates in
FieldComparator, the List[StructuredModel] pair count and recursion
gate, the non_matches and field_comparisons collectors, the list item
sub-field classifier, EvalResult.matched,
HungarianMatcher.calculate_metrics and the evaluator_format fallback
metrics all used a bare >=. A score of 0.7 + 0.1 (0.7999999999999999)
against 0.8, such as the Laptop pair in threshold-gated-evaluation.md,
was an FD at those gates and a TP on a List[str] element.

Route every gate through ThresholdHelper.is_above_threshold. A score
inside the tolerance now counts as a TP, keeps its score instead of
being clipped to 0.0, and opens a list pair for field-by-field
evaluation. Scores further under the threshold are unchanged.

HungarianMatcher imports the helper inside calculate_metrics, so
stickler.algorithms does not load the evaluator package at import time.

Fixes #417

* fix(417): use the tolerant test in binary_compare and the field configs

BaseComparator.binary_compare, ComparisonInfo.compare and
ComparableFieldConfig.compare still used a bare comparison, so 0.7 + 0.1
against 0.8 was (0, 1) from binary_compare and was clipped to 0.0 by the
field configs. They now go through ThresholdHelper, as does the unused
StructuredModel._calculate_object_level_metrics. binary_compare imports
the helper inside the method, like HungarianMatcher.calculate_metrics.

Add a Meeting a Threshold section to thresholds-and-metrics.md and link
it from each page that states the >= rule. Correct the Good Match Laptop
scenario, where name scores 0.4 and is an FD inside a TP pair, and the
algorithms README note on unordered_list_metrics. The CHANGELOG entry
names the new gates and the two thresholds that keep an exact
comparison.

* docs(417): regenerate the threshold gating example from a real run

The Result Structure block and the Unmatched Items scenario in
threshold-gated-evaluation.md did not match what the page's own example
produces. With three products on each side, Hungarian matching pairs
Cable with New Product as an FD at 0.133, so there is no FN or FA, and
the Mouse pair scores 0.6725. Show the example inputs, replace the block
with the real counts and non_matches, retitle the heading over the
0.7999999999999999 pair, and say when an item is left unmatched. The
Laptop test now runs the whole example, plus the FN and FA cases.

Scope the docstrings in hungarian.py, base.py and the algorithms README
to the gates listed in Meeting a Threshold, and use
ThresholdHelper.is_below_threshold for the explain() verdict.

---------

Co-authored-by: Spencer Romo <sromo@amazon.com>

* fix(333): export a from_pydantic() mapping element as an object

from_pydantic() declares a mapping as Annotated[Any, BeforeValidator(jsonable_mapping)],
which is_mapping_annotation() does not recognise, so to_json_schema() still
exported its list items as "string" and the re-imported model rejected its
own data. Recognise that wire type in the list export.

* docs(333): state the from_pydantic() config spelling and the default_factory limit (#435)

* docs(333): state the from_pydantic() export limits, and pin the #435 xfail to ValidationError

* fix(report): accept a non-string document identifier

The non-matches table escaped doc_id and field_path without converting
them first, while the three columns beside them converted.
evaluate_dataframe reads doc_id straight off a DataFrame column, so an
integer id — ordinary for one read from CSV, parquet or a database —
raised and generate_report() returned success=False having written no
page at all. Optional[str] on update() is an annotation, not a runtime
check, and evaluate_dataframe declares nothing.

No issue covers this one; found while reviewing #444.

Adds a unit test on the table and an end-to-end regression from a
DataFrame carrying an integer doc_id.

(cherry picked from commit bccff4356c2225a5eacedeedbb783edcebf4029f)

* fix(report): escape the confusion counts in the field performance table

tp/fd/fa/fn were written into the table with no escaping and no format
spec, unlike the precision/recall/f1 cells beside them, whose :.3f
rejects a string by accident. generate_report() publicly accepts a plain
dict, so a caller assembling their own metrics — rather than passing a
ProcessEvaluation, where these are library-computed ints — could put
markup there and have it parsed. The confusion-matrix cell gets the same
treatment, though sum() rejects a non-numeric before it is reached.

Not reachable from document data, and identical on v1.0.0. Closing it
here because #422 fixed the same class one function above in this file,
and because a release headlined on stopping a document value running as
script should not leave a demonstrated route in the same table. No issue
covers these four cells.

The regression asserts on what a parser sees — no on* attribute, no
script body — rather than on substring absence, since escaping leaves
the characters present as inert text.

(cherry picked from commit 810bace28ef61cee3f957eccfb55d8cff775d1c2)

* docs: say what the U+2028/U+2029 entries actually do

json.dumps escapes both under its default ensure_ascii=True, so the two
translate entries never fire on today's output. They are defensive
depth, not the active guard, and the comment claimed otherwise.

(cherry picked from commit b07190cdccc418c3b014f113d96da2e1be36a056)

* chore(deps): bump mkdocs-material to 9.7.7 (GHSA-xvg9-69gf-fjrf)

Fixes a DOM-based XSS in the search suggestions, affecting >=7.2.0,<9.7.7.
The docs site enables the search plugin, and merging this release triggers
docs.yml (push to main, filtered to src/**, docs/** and the workflow
itself), which would otherwise rebuild and redeploy the public site on the
vulnerable version.

Scope: the lockfile governs this repo's CI and the docs deploy, since the
docs group is a dependency-group rather than an extra. The wheel does
carry mkdocs-material, under the `dev` extra and unpinned, so anyone
installing stickler-eval[dev] already resolves whatever PyPI serves and is
unaffected either way. Taken from #346; that PR's transformers bump is
deliberately left out of this hotfix.

(cherry picked from commit 1959b2fcaac098894d7b7a65ce9d8c01b2cebcd1)

* fix(report): disable pdf.js eval (CVE-2024-4367), and embed a numeric doc_id as a string

pdf.js 3.11.174 runs script from a crafted PDF font unless eval is off.
Pass isEvalSupported: false to getDocument, the upstream mitigation.

The per-document view compares ids as strings, so an integer doc_id from a
DataFrame matched nothing and the page kept showing aggregate numbers.
_load_individual_results now converts it, matching the tables' str().

Both fixes as specified by vawsgit in the #452 review.

* docs(changelog): record the report hardening carried over from #452

* test(report): pin the PDF viewer's only loader call, its reachability and its pdf.js

Three tests in a new test_pdf_viewer.py, alongside the existing
test_the_pdf_viewer_disables_eval:

- the page has exactly one pdfjsLib.getDocument(...) call and it carries
  isEvalSupported: false. A check for the safe form alone still passes when a
  second loader is added without the option, e.g. getDocument(u);
- the viewer is not embedded without individual_results_jsonl_path;
- the pdf.js <script> tag still loads 3.11.174 and has no integrity hash, so
  the upgrade is a deliberate change. Its failure messages say to invert the
  integrity assertion then, not delete it.

* test(report): cover the doc_id conversion's edge cases

Nine tests on _load_individual_results: zero, float and NaN ids become
strings; a string id, None and a missing key are left alone; a line that is
not an object does not drop the records after it; ids that differ only by type
now map to the same string; and every id embedded by generate_report is a
string, including one above 2**53. Several guard against a mis-fix rather
than the fix: dropping the dict guard, converting None, testing the id for
truthiness, or converting only int each pass the existing tests.

* test(report): let the truncation test catch escape-then-truncate on the prediction

The fixture gave prediction_value the value 'short', so only the ground-truth
column could tell truncate-then-escape from escape-then-truncate. Both columns
now carry 97 characters and an ampersand, and both are asserted.

* docs(changelog): record the report-generation slowdown tracked in #457

Reports generated with individual_results_jsonl_path take longer to write
since the script-block escaping: 467 ms against 42 ms at 1.0.0 for 1,000
documents, per #457. Evaluation results are unaffected.

* fix(306): accept default_factory on ComparableField (#360)

* fix(306): accept default_factory on ComparableField

ComparableField forwarded its own `default` to Field() unconditionally, so a
caller-supplied `default_factory` collided with it and pydantic rejected the
pair. Every collection field was affected, which is the case pydantic's own
documentation tells users to write `default_factory` for.

Forward `default` only when the caller did not supply a factory. The parameter
now defaults to a sentinel rather than None so that an explicitly written
`default` is still passed through alongside a factory, letting pydantic raise
as it normally would instead of one of the two being dropped here. An omitted
`default` keeps its historical None, which the schema generator already reads
as a construction-tolerance marker rather than a real default.

* docs(306): changelog entry for the default_factory fix

Recorded under [Unreleased] per the PR checklist, since the accepted argument
set is user-visible.

* fix(306): keep default_factory=None from turning a field required

The guard added for #306 tested for the KEY, not its value:

    if "default_factory" in clean_field_kwargs:

`None` is pydantic's own signature default for `default_factory`, so a caller
forwarding kwargs through a wrapper or a config-driven builder can pass it
explicitly without meaning anything by it. Read as "a real factory was
supplied", it dropped our own default, and a field that was optional with
`None` became required:

    ComparableField(default_factory=None, comparator=ExactComparator())

    before  is_required=False  default=None            N().note = None
    after   is_required=True   default=PydanticUndefined
            N()  ->  ValidationError: note  Field required

Checking the value says what the branch actually means: it exists because a
real factory conflicts with our default, and `None` is not a real factory.

* fix(306): export a factory's value, not PydanticUndefined

Both exporters read `FieldInfo.default`, and neither knew about factories.
They could not have: on `dev` a `default_factory` field dies at class
definition, so these paths were unreachable until #306 made them reachable.

`to_stickler_config()` wrote `PydanticUndefined` through verbatim, which is
not serialisable, from a method whose whole purpose is producing a config you
can write to a file:

    json.dumps(cfg)  ->  TypeError: Object of type PydanticUndefinedType
                         is not JSON serializable

and the in-process round trip rebuilt the field as required, so
`M2(name='a')` raised `ValidationError: tags  Field required`.

`to_json_schema()` failed the same way but quietly: the default vanished, and
`from_json_schema()` rebuilt `tags` as `None` rather than `[]`, so the failure
surfaced later at the first `.append()`, away from its cause.

Both now go through one helper. For `list`, `dict` and `set` it calls the
factory and exports the value it produces, which round-trips and is what a
reader expects; any other factory leaves the key out rather than being
invoked, since a caller's callable could read a clock or a database and an
export should not run it.

A set is exported as a list. Exporting the set itself reproduces the first
failure above one value type over, and `List[str] =
ComparableField(default_factory=set)` is legal:

    json.dumps(M.to_stickler_config())
      ->  TypeError: Object of type set is not JSON serializable

JSON has no set, and the factory is the builtin called with no arguments, so
the value is always empty and the conversion is unambiguous.

* docs(306): record the exporter half of the default_factory fix

The entry described the field accepting a factory and stopped there, but the
two exporters changed as well and both are user-visible: a config that would
not serialise now does, and a schema round trip returns `[]` where it used to
return `None`.

* fix(306): export a factory default on List[StructuredModel] fields

Both exporters' list-of-models branches skipped resolve_exportable_default, so subs: List[Sub] = ComparableField(default_factory=list) exported no default and rebuilt as None through model_from_json and from_json_schema.

* fix(306): give the unset default a readable repr in the signature

* fix(306): export mapping fields as objects and share the default export

* test(306): arm the identity factory after the class is built

On Python < 3.13, pydantic's inspect.signature(factory) at class definition
reaches inspect._signature_is_builtin, which tests `obj in (type, object)`
and so calls the factory's __eq__. The trap fired before the export ran,
failing the 3.10, 3.11 and 3.12 CI jobs. Arm it once the class exists so
the test checks only the export's identity match.

* fix(306): export Annotated list factories; state default + default_factory; mark the mapping export Breaking

- _exports_as_container strips Annotated as well as Optional
  (ConfigurationHelper.strip_annotation_wrappers), so
  Optional[Annotated[List[...], ...]] = ComparableField(default_factory=list)
  exports "default": [] and rebuilds as [] through both exporters, not None.
- default=... beside default_factory mirrors pydantic's Field: ignored, the
  field is optional. README, docstring and CHANGELOG now say so instead of
  claiming every pairing raises; a test pins it against pydantic.
- The mapping-export CHANGELOG entry moves to Changed and is marked
  Breaking, as the matching #349 export-type change is.
- model-export.md states how a Dict field and a default_factory export
  and round-trip.

* fix(306): keep Optional list and mapping fields nullable through to_stickler_config

A Stickler config has no nullable flag; model_from_json() widens a field to
Optional only when its default is None. Exporting a factory's [] or {} (or a
literal empty one) on an Optional field therefore rebuilt it non-nullable,
rejecting the None the original accepts. dev exported no default, so this
regressed with the factory export.

- to_stickler_config() writes no empty [] / {} default on a nullable field
  (Annotated stripped); it rebuilds with None, which scores the same.
  to_json_schema() keeps the default: its "null" type already round-trips.
- model_from_json() widens a list_structured_model field with a None default
  to Optional, as the primitive path does (#149); it rebuilt as List[Model]
  and rejected None, on dev too.
- Round-trip test over Optional[Annotated[List[str]]],
  Optional[Annotated[List[Model]]], Optional[List[int]], Optional[Dict[str,
  int]]: both rebuilt models accept None and score all 16 unset/None/empty/
  value pairs as the original.
- Docs: model-export.md states the Optional rule; CHANGELOG scopes the
  List[Dict] "string" note to to_json_schema(); README names both
  default=... and default=PydanticUndefined as accepted beside a factory.

* fix(306): keep a non-Optional List[Model] non-nullable over repeated config round trips

The list-of-models branch of to_stickler_config() did not write a literal
default, so the first rebuild's `[]` went missing in the second export and
model_from_json()'s new None-default widening made the field Optional.

- Write an empty literal `[]` there, as field_to_stickler_config() does. A
  non-empty literal holds model instances, which are not JSON, so it is
  still not exported (include_literal=True would break json.dumps()).
- The nullable check reuses is_optional_union(unwrap_annotated(...)).
- Correct the docstring: the JSON Schema rebuild accepts None because
  JsonSchemaImporter widens every non-required field, not because "null"
  is in the exported type.
- Tests: double config round trip of List[Model] with a factory and with a
  literal [] stays non-nullable; a hand-written non-required
  list_structured_model accepts None and a required one stays List[Model].
- Docs: model-export.md and CHANGELOG say the Optional rule covers empty
  defaults only, and that the rebuilt default is None (model_dump() shows
  null); dynamic-models.md states model_from_json()'s None-default widening.

* docs(306): scope the config nullability rules to what they cover

- dynamic-models.md: the None-default widening applies to primitive and
  list_structured_model fields; a structured_model field is never widened.
- model-export.md and CHANGELOG: the Optional rule covers an empty list or
  mapping default only (`""` is written). A List[Model] default that is not
  written (a non-empty literal, a tuple, a factory other than list, dict or
  set) rebuilds as Optional with a None default, Optional original or not;
  None scores the same as [].
- json_schema_field_converter.py docstring: "as before #306", not "as on dev".

---------

Co-authored-by: Spencer Romo <sromo@amazon.com>

* docs: correct the mean_score docstring and the [Plain, NoteSM] table row (#249, #338) (#403)

* docs(249): stop promising mean_score for leaves under list parents

The _accumulate_field_metrics docstring said mean_score is recorded at
every node, "including leaves under list parents". It is not: those
leaves carry CM counts only, which the user docs and tests already
state. Reword the docstring to match. No behaviour change.

Refs #249 (per-leaf scores for list children remain open, post-1.0).

* docs(338): split the [Plain, NoteSM] row by annotation

The element-gate table is headed with a bare Optional[List[Any]], but its
[Plain, NoteSM] vs [Plain, Note2SM] row was measured with a declared
comparator. Bare, the pair scores 0.0 under the list-wide gate and 0.5
now, because the bare annotation refuses the Plain pair on its own
([Plain] vs [Plain] scores 0.0), not because of the cross-class rule.

Split the row into bare and declared cases in comparison_helper.py and
the test docstring. The released 1.0.0 CHANGELOG section is left as is;
an Unreleased entry corrects it. No behaviour change.

Closes #338.

* docs(249,338): fix claims the first two commits left wrong

- `_accumulate_field_metrics`: list-of-StructuredModel element fields
  arrive under `fields`, not `nested_fields`; compare_with no longer
  emits `nested_fields` (its emitter went in ad19ac8). Note that only a
  finite score is summed.
- bulk-evaluation.md and understanding-results.md said compare_with
  "only emits the score at the list parent". An object node inside a
  list element is scored too (`items.addr` gets a mean_score); only the
  leaves are not.
- CHANGELOG: move the #338 correction from `### Fixed` with a
  `**Documentation:**` prefix to a `### Documentation` section, the
  heading earlier releases use.

Refs #249, #338

* docs(249,338): address review on #403

- Guides: leaves and primitive lists anywhere inside a List[StructuredModel]
  element have no mean_score, and every path inside an element counts only
  pairs that met the match threshold (a pair below it emits no element fields).
- _accumulate_field_metrics docstring: same scope, replacing "leaves under a
  list parent".
- _ClassGatedComparator and test-class docstrings: both [Plain, NoteSM] rows
  enforced the cross-class rule under the list-wide gate (bare fd=2).
- Pin the bare row: [Plain] vs [Plain] = 0.0, bare [Plain, NoteA] vs
  [Plain, NoteB] = 0.5 (tp=1, fd=1).
- Fix the two surviving "emits only at the list parent" comments in
  test_bulk_structured_model_evaluator.py.
- CHANGELOG: Unreleased Documentation entry for the mean_score guide fix.

* docs: list the paths inside a list element that get mean_score

Inside a List[StructuredModel] element, only the element's own object and
List[StructuredModel] fields (items.addr, items.parts) carry a mean_score,
and each document's value is the first matched element pair's score.
Every other path inside an element, including objects two or more levels
down (items.addr.geo), has confusion-matrix counts only. Fix the CHANGELOG,
both guides and the _accumulate_field_metric…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants