Repository navigation
Validate titles over every reference shape, with or without an excerpt - #155
Conversation
…146) Title-only validation passed the whole reference value to _extract_reference_id, so a list, or an object with no identifier, gave None and the title was skipped without a word: a wrong title passed with exit 0. The excerpt path already handled these shapes (#140); its reference resolution is now _resolve_references, shared by both. With no excerpt to check: - a title field is checked against the one reference, or, with several, passes if it is any one's title (_validate_title_any, mirroring _validate_excerpt_any); otherwise one error names each reference; - without a title field, each reference object carrying its own title, listed or not, is checked against its own reference; - a reference with no usable identifier is reported. Title-only validation runs only when no excerpt was attempted, so an unusable reference is not reported twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qm4PkMsSN3FVpzvBdZYahC
|
Claude finished @caufieldjh's task in 1m 7s —— View job Review: title validation for every reference shape (#146)
Summary: the PR looks good. Moving the reference resolution into Possible issues
Code quality
TestsThe coverage is good: the tests were written first, they reproduce the issue, and the CLI test checks the exit code. Missing:
Performance and security
|
…refixes Review follow-up on #146. - With no title field, an unusable reference object's error named a nonexistent "title" field; it now names the object's own title path, e.g. reference[0].title. _resolve_references returns the unusable raw values with their paths, so each caller builds its errors with the path it leaves unchecked, instead of unpacking them from the result. - _validate_title_any names references skipped by prefix, as _validate_excerpt_any does. - ResolvedReference names the resolver's fields. - Tests: all references skipped, an excerpt with an unusable reference and a title reported once, a title field winning over an object's own title. Docs: how a title field is used beside an excerpt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qm4PkMsSN3FVpzvBdZYahC
|
Addressed in 917c57a.
The other tests you suggested are added: an excerpt with an unusable reference plus a title is reported once, and a title field wins over an object's own title. Full suite: 2220 passed. Doctests, mypy and ruff are clean. Generated by Claude Code |
|
Claude finished @caufieldjh's task in 58s —— View job Review of the follow-up commit (917c57a)
Summary: the commit deals with every point from the previous review, and I found nothing that blocks the merge. The cleanest part is changing The previous points, one by one
Minor points (none block the merge)
Code quality, performance, security
Test coverageWith this commit the coverage looks complete for the shapes described in the PR. That includes the regression where the same unusable reference could be reported twice, which now has its own test. |
|
Thanks. These stay as they are:
Generated by Claude Code |
With an excerpt and several references, the title field was ignored, so the same wrong title failed without an excerpt but passed with one. It is now checked once against the cited references and passes if it is any one's title, as in title-only validation; it replaces any title a reference object carries, as it already did for a single reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qm4PkMsSN3FVpzvBdZYahC
|
Claude finished @caufieldjh's task in 49s —— View job Review of the latest commit (351e714): a title field checked beside an excerpt and several references
Summary: this commit closes the gap that point 5 of the first review raised. Before it, a wrong title failed when there was no excerpt but passed when there was one. The approach is sound. The excerpt is checked against every reference with no title ( Possible issues (none block the merge)
Code quality
TestsThe new cases are good and include the
Performance and security
|
|
351e714 resolves point 5 from the first review: a title field beside an excerpt and several references is now checked against all the cited references, and passes if it is any one's title. I've updated the PR description and Generated by Claude Code |
With several references, the title check sat inside the excerpt-field loop, so a class with two excerpt slots reported a wrong title twice and counted it twice. The check is now recorded in the loop and run once after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qm4PkMsSN3FVpzvBdZYahC
|
Claude finished @caufieldjh's task in 28s —— View job Review of the latest commit (9079bde): the title field is now checked once per instance
Summary: this commit fixes point 1 from the last review. The title check used to sit inside the Correctness
Minor points (none block the merge)
Tests
Performance and security
|
|
Addressed the 351e714 review in 9079bde:
Full suite: 2226 passed. Doctests, mypy and ruff are clean. Generated by Claude Code |
Fixes #146.
Problem
When an instance has a title but no excerpt, the plugin validates the title on its own. That branch passed the whole reference value to
_extract_reference_id, which returnsNonefor a list and for an object with noid. The title was then skipped without a word, so a wrong title passed with exit 0. This is the title-only counterpart of #140, which fixed the same gap for excerpts.A related gap: with an excerpt and several references, the title field was ignored entirely. So the same wrong title failed without an excerpt but passed with one.
Changes
plugins/reference_validation_plugin.py:_resolve_references, shared by both paths. It handles lists, objects, and fields tried in turn. It returnsResolvedReferences plus the unusable raw values with their paths, so each caller builds its "no usable identifier" error with the path it leaves unchecked. Behaviour for excerpts is unchanged; the existing A multivalued reference slot makes excerpts silently unchecked (exit 0) #140 tests pin it._validate_titles_onlyreplaces the old inline branch:title, listed or not, is checked against its own reference.Reference at '...' has no usable identifier, so 'reference[0].title' cannot be checked). It is reported only when that leaves a title unchecked._validate_title_anymirrors_validate_excerpt_any:_validate_title_any, once per instance however many excerpt slots the class has. It replaces the reference objects' own titles in the excerpt check, as it already did for a single reference. So the excerpt may come from one cited paper while the title names another.Docs:
docs/how-to/validate-titles.mddescribes the rules for each reference shape, with and without an excerpt.Behaviour changes to note
These cases may change results for existing data:
title, with no excerpt and no title field beside it, now has that title checked. This applies to a single object as well as a list. (may add errors)Tests
tests/test_title_only_shapes.py, written first; each group failed before its fix:id.id(the error namesreference[0].title).Full suite: 2226 passed. Doctests, mypy and ruff are clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Qm4PkMsSN3FVpzvBdZYahC