Repository navigation
fix(sections): end an 8-K's last item at a preformatted signature statement (GH #1563) - #1564
Conversation
…tement (GH dgunning#1563) An 8-K whose primary document is one preformatted (<pre>) block of plain text kept the SIGNATURE block inside its last item, the behavior dgunning#1393 had already fixed for other layouts. dgunning#1534 split a no-<TABLE> plain-text body at blank lines (document_builder._add_text), so a bare SIGNATURE heading and the sentence Form 8-K's General Instructions prescribe arrive as one paragraph when the source has no blank line between them. Strategy 5c's _SIGNATURE_STATEMENT was anchored at ^Pursuant to, so it no longer matched and the last item ran on through the signature block. _SIGNATURE_STATEMENT now accepts an optional leading SIGNATURE(S) label before the prescribed sentence. Filing 0000710782-24-000002 (CIK 710782, filed 2024-02-05, Item 8.01, primary document 8k01.htm, one <pre> of 3,411 characters): before: Item 8.01 = 1,348 chars, SIGNATURE at offset 3,037 included after: Item 8.01 = 972 chars, ending "...global competitiveness." Regression test: tests/issues/regression/test_issue_1563.py (offline, fixture tests/fixtures/issues/0000710782-24-000002.html).
|
Thanks, this is a clean fix with a well-documented root cause. I verified:
Fixing the regex rather than the #1534 split is the right call: the change applies only to 8-Ks, only after the last item, and still requires "caused this report to be signed". Two optional nits: a module-scoped fixture would avoid parsing the document three times, and the changelog bullet could drop the root-cause clause (we keep that in the PR and commit). Neither blocks the merge. |
…viour dgunning's review noted the document was parsed three times and that the changelog bullet duplicated the root cause we keep in the PR and commit. The fixture is now module-scoped and the bullet states the behaviour only. No assertion or fixture content changes; 3 tests still pass.
|
Both nits taken in 93c3cee. Fixture: the document is now parsed once per module via a module-scoped Changelog: dropped the root-cause clause from No assertion, fixture content or expected-length changes. Neither nit blocked the merge, so this is purely polish before you merge. |
What this changes
An 8-K whose primary document is one preformatted (
<pre>) block of plain text keeps the SIGNATURE block out of its last item again. Item 8.01 of 0000710782-24-000002 went back to its pre-#1534 length.Fixes #1563
Root cause
#1393 ends an 8-K's last item at the signature statement when the filing has no
SIGNATURESheading — Strategy 5c ofpattern_section_extractor.py, matching_SIGNATURE_STATEMENT, anchored at^Pursuant to the requirements of the Securities Exchange Act of 1934.#1534 then made a no-
<TABLE>plain-text body split at blank lines (document_builder._add_text). In this filing the source has no blank line between the bareSIGNATUREheading and that prescribed sentence, so the two now arrive as one paragraph startingSIGNATURE Pursuant to .... The^-anchored pattern no longer matched, Strategy 5c found no boundary, and the last item ran on through the signature block._SIGNATURE_STATEMENTnow accepts an optional leadingSIGNATURE/SIGNATURESlabel before the prescribed sentence. Thecaused this (report|amendment) to be signedrequirement is unchanged, so a paragraph that merely cites the Exchange Act still is not a boundary.Verification
8k01.htm, one<pre>block, 3,411 chars;SIGNATUREat offset 3,037). Item 8.01 is 972 chars after the fix (was 1,348), ending...enhancing the company's global competitiveness.; the signature statement is still exposed as thesignaturessection (374 chars, containsBaobing He).tests/issues/regression/, and its docstring links the issue:tests/issues/regression/test_issue_1563.py, offline against the real document stored attests/fixtures/issues/0000710782-24-000002.html.None— unchanged by this PR.changelog.d/1563.fixed.md.Red → green: reverting the one-line regex change makes all three assertions in
test_issue_1563.pyfail with1348 != 972and'SIGNATURE' in text; restoring it passes.test_issue_879.py(the #879/#1393 SIGNATURE suite, offline class) andtest_issue_1ho_8k_section_detection.pystill pass: 28 passed, 7 skipped. Suite run locally withEDGAR_IDENTITYset; cassette-backed tests were not run (they need the repo's recorded cassettes, which I did not fetch).6.0
docs/upgrade/6.0.mdsays what users see now and what to do instead — not applicable.AI assistance
deepseek/deepseek-flash.Working context
Reproduced first:
parse_html(8k01.htm, ParserConfig(form="8-K"))gaveitem_801at 1,348 chars withSIGNATUREincluded, matching the report exactly. InstrumentingParagraphNodes showed the signature paragraph's normalized text isSIGNATURE Pursuant to the requirements of the Securities Exchange Act of 1934, the Registrant has duly caused this report to be sig...— the^Pursuantanchor is what broke, not the node type or the blank-line split itself. That ruled out a fix indocument_builder(#1534) and left the pattern. After the fix the filing yields two sections:item_801(972) andsignatures(374).