Skip to content

fix: keep statute "note" as a distinct citation identity - #345

Open
aseem-ai wants to merge 1 commit into
freelawproject:mainfrom
aseem-ai:fix/statute-note-identity
Open

fix: keep statute "note" as a distinct citation identity#345
aseem-ai wants to merge 1 commit into
freelawproject:mainfrom
aseem-ai:fix/statute-note-identity

Conversation

@aseem-ai

@aseem-ai aseem-ai commented Sep 4, 2026

Copy link
Copy Markdown

Fixes

Fixes #323

Summary

42 U.S.C. § 1983 note is a different provision than 42 U.S.C. § 1983. A note holds
enacted-but-uncodified material filed under the nearest section, so the section number is
an address, not an identity. eyecite dropped the designator, and the two citations came
back equal.

The designator now lands in groups rather than metadata. That is deliberate:
ResourceCitation.__hash__ is built from groups, so a note: bool field would have
needed its own __hash__ override on FullLawCitation to affect identity, while one
group key reuses the identity vocabulary the model already has. section keeps its plain
section number and no existing key changes value.

et seq. is untouched and stays a pin_cite, because it really is part of the section.

Because "note" is ordinary English, LAW_NOTE_REGEX only matches when nothing continues
it — end of text, or . , ; ) ( or a year parenthetical — and only lowercase,
directly after the cite. So § 1983 notes that liability attaches and
§ 1983. Note that the court do not attach. Both are in the tests, and both go red if
the guard is removed.

The issue's third example, 42 U.S.C. § 5195c(b) note, is still a miss. That is the
lettered-section tokenizer problem in #146 (PR #331), not this one, so it is left alone.

Tests

  • python -m unittest tests.test_FindTest.FindTest.test_find_law_citations — 15 failures
    before the change (5 new rows x 3 tokenizers), passes after.
  • python -m unittest tests.test_ModelsTest — the two new tests failed before with
    FullLawCitation('42 U.S.C. § 1983') == FullLawCitation('42 U.S.C. § 1983') and
    '42 U.S.C. § 1983' != '42 U.S.C. § 1983 note'.
  • python -m unittest discover -s tests -p 'test_*.py' — 57 tests, OK.
  • pre-commit run --all-files and mypy . — clean.

AI Disclosure

  • No AI tools were used to create the content of this PR.
  • Parts of this PR were created with the help of an AI tool, and I have carefully reviewed all of its content and take full responsibility for it.

A note is a different provision than the section it is filed under, so
the designator now lands in groups, which is what builds a citation's
identity, rather than being dropped or folded into pin_cite.

Fixes freelawproject#323

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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.

Statute "note" designations are silently dropped (resolve to the wrong provision)

1 participant