Skip to content

Fix: sc13g period of report label lookup#787

Open
sheran wants to merge 4 commits intodgunning:mainfrom
sheran:fix/sc13g-period-of-report-label-lookup
Open

Fix: sc13g period of report label lookup#787
sheran wants to merge 4 commits intodgunning:mainfrom
sheran:fix/sc13g-period-of-report-label-lookup

Conversation

@sheran
Copy link
Copy Markdown

@sheran sheran commented Apr 18, 2026

Summary

Fixes a crash on multi-filer Schedule 13D/G filings where Filing.period_of_report returned a
concatenation of filer names instead of a date or None. Downstream callers (e.g.
sec-edgar-mcp) then crashed with Invalid isoformat string: ....

Root cause

FilingHomepage.get_filing_dates picked 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"> children
concatenates 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 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.

Tests

New regression suite tests/issues/regression/test_issue_sc13g_period_of_report.py with four
HTML-fixture cases:

  • formGrouping[1] is Filer(s) → period is None, not concatenated names
  • formGrouping[1] is Period of Report → correct date returned
  • Period block at position 2 → still found by label
  • No period block → None

Verified 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.py passes
    (4/4)
  • Full hatch run test-fast regression check (2368 passed; pre-existing failures unrelated
    to this area)

Note: re-applies work temporarily merged to main as `a8e9740f` and reverted in `50e36ba6`.

sheran added 4 commits April 17, 2026 22:24
  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.
  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`.
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.

1 participant