Fix: sc13g period of report label lookup#787
Open
sheran wants to merge 4 commits intodgunning:mainfrom
Open
Conversation
FilingHomepage.get_filing_dates picked the Period of Report block by
position (grouping_divs[1]). On multi-filer Schedule 13D/G filings
that slot is the Group Members / Filer(s) block, and .text.strip()
on a div containing multiple <div class="info"> children concatenates
every filer's name with no separator — returning a run-together
string of filer names as the period of report. Downstream callers
(e.g. sec-edgar-mcp) then crash with "Invalid isoformat string: ...".
Build a {label -> value} map by pairing each <div class="infoHead">
with its adjacent <div class="info"> sibling within each
formGrouping, and look up Filing Date / Accepted / Period of Report
by label. Return None for period when no such block exists. A
positional fallback for the two always-present date fields preserves
behaviour on homepages with no infoHead labels.
Adds tests/issues/regression/test_issue_sc13g_period_of_report.py
with four HTML-fixture cases covering the multi-filer case, the
traditional layout, a non-index-1 period block, and the missing-block
case.
This reverts commit a8e9740.
FilingHomepage.get_filing_dates picked the Period of Report block by
position (grouping_divs[1]). On multi-filer Schedule 13D/G filings
that slot is the Group Members / Filer(s) block, and .text.strip()
on a div containing multiple <div class="info"> children concatenates
every filer's name with no separator — returning a run-together
string of filer names as the period of report. Downstream callers
(e.g. sec-edgar-mcp) then crash with "Invalid isoformat string: ...".
Build a {label -> value} map by pairing each <div class="infoHead">
with its adjacent <div class="info"> sibling within each
formGrouping, and look up Filing Date / Accepted / Period of Report
by label. Return None for period when no such block exists. A
positional fallback for the two always-present date fields preserves
behaviour on homepages with no infoHead labels.
Adds tests/issues/regression/test_issue_sc13g_period_of_report.py
with four HTML-fixture cases covering the multi-filer case, the
traditional layout, a non-index-1 period block, and the missing-block
case.
Adds `pytestmark = pytest.mark.fast` so these network-free HTML-fixture tests are picked up by `hatch run test-fast`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash on multi-filer Schedule 13D/G filings where
Filing.period_of_reportreturned aconcatenation of filer names instead of a date or
None. Downstream callers (e.g.sec-edgar-mcp) then crashed withInvalid isoformat string: ....Root cause
FilingHomepage.get_filing_datespicked the "Period of Report" block by position(
grouping_divs[1]). On multi-filer joint filings that slot is the Group Members / Filer(s)block, and
.text.strip()on a div containing multiple<div class="info">childrenconcatenates every filer's name with no separator.
Fix
Build a
{label -> value}map by pairing each<div class="infoHead">with its adjacent<div class="info">sibling within eachformGrouping, and look up "Filing Date" / "Accepted" /"Period of Report" by label. Return
Nonefor period when no such block exists. A positionalfallback for the two always-present date fields preserves behaviour on homepages with no
infoHeadlabels.Tests
New regression suite
tests/issues/regression/test_issue_sc13g_period_of_report.pywith fourHTML-fixture cases:
formGrouping[1]is Filer(s) → period isNone, not concatenated namesformGrouping[1]is Period of Report → correct date returnedNoneVerified live against a real multi-filer SC 13G filing: vanilla 5.30.0 returns the concatenated
filer-names string; with this fix it returns
None.Test plan
hatch run test-fast tests/issues/regression/test_issue_sc13g_period_of_report.pypasses(4/4)
hatch run test-fastregression check (2368 passed; pre-existing failures unrelatedto this area)
Note: re-applies work temporarily merged to main as `a8e9740f` and reverted in `50e36ba6`.