@cyanheads/secedgar-mcp-server 0.21.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +17 -17
- package/CLAUDE.md +17 -17
- package/README.md +8 -6
- package/changelog/0.21.x/0.21.1.md +29 -0
- package/dist/mcp-server/tools/annual-report-reads.d.ts +9 -6
- package/dist/mcp-server/tools/annual-report-reads.d.ts.map +1 -1
- package/dist/mcp-server/tools/annual-report-reads.js +10 -6
- package/dist/mcp-server/tools/annual-report-reads.js.map +1 -1
- package/dist/mcp-server/tools/blockquote.d.ts +13 -0
- package/dist/mcp-server/tools/blockquote.d.ts.map +1 -0
- package/dist/mcp-server/tools/blockquote.js +18 -0
- package/dist/mcp-server/tools/blockquote.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.d.ts +10 -3
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.js +169 -68
- package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-filing.tool.js +31 -21
- package/dist/mcp-server/tools/definitions/get-filing.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts +1 -0
- package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-financials.tool.js +167 -95
- package/dist/mcp-server/tools/definitions/get-financials.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.d.ts +20 -0
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.js +73 -8
- package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +439 -425
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-filings.tool.js +152 -42
- package/dist/mcp-server/tools/definitions/search-filings.tool.js.map +1 -1
- package/dist/mcp-server/tools/filing-dates.d.ts +2 -0
- package/dist/mcp-server/tools/filing-dates.d.ts.map +1 -1
- package/dist/mcp-server/tools/filing-dates.js +6 -0
- package/dist/mcp-server/tools/filing-dates.js.map +1 -1
- package/dist/services/edgar/call-scope.d.ts +9 -0
- package/dist/services/edgar/call-scope.d.ts.map +1 -1
- package/dist/services/edgar/call-scope.js +3 -0
- package/dist/services/edgar/call-scope.js.map +1 -1
- package/dist/services/edgar/concept-series.d.ts +47 -9
- package/dist/services/edgar/concept-series.d.ts.map +1 -1
- package/dist/services/edgar/concept-series.js +83 -11
- package/dist/services/edgar/concept-series.js.map +1 -1
- package/dist/services/edgar/edgar-api-service.d.ts +31 -15
- package/dist/services/edgar/edgar-api-service.d.ts.map +1 -1
- package/dist/services/edgar/edgar-api-service.js +170 -28
- package/dist/services/edgar/edgar-api-service.js.map +1 -1
- package/dist/services/edgar/filing-headers.d.ts +22 -10
- package/dist/services/edgar/filing-headers.d.ts.map +1 -1
- package/dist/services/edgar/filing-headers.js +98 -15
- package/dist/services/edgar/filing-headers.js.map +1 -1
- package/dist/services/edgar/fiscal-periods.d.ts +14 -1
- package/dist/services/edgar/fiscal-periods.d.ts.map +1 -1
- package/dist/services/edgar/fiscal-periods.js +47 -18
- package/dist/services/edgar/fiscal-periods.js.map +1 -1
- package/dist/services/edgar/ownership-parser.d.ts +19 -0
- package/dist/services/edgar/ownership-parser.d.ts.map +1 -1
- package/dist/services/edgar/ownership-parser.js +79 -0
- package/dist/services/edgar/ownership-parser.js.map +1 -1
- package/dist/services/edgar/types.d.ts +2 -0
- package/dist/services/edgar/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/server.json +3 -3
- package/skills/secedgar-guide/SKILL.md +6 -5
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** secedgar-mcp-server
|
|
4
|
-
**Version:** 0.21.
|
|
4
|
+
**Version:** 0.21.1
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.26`
|
|
6
6
|
**Engines:** Bun ≥1.4.4, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/server` ^2.4.0
|
|
@@ -56,7 +56,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
56
56
|
| `secedgar_get_insider_transactions` | Form 4 / 4-A insider transactions parsed from ownership XML, of an issuer's insiders or, under `role: "reporting_owner"`, of one filer across issuers | `company`, `role?`, `transaction_type?`, `limit?`, `filed_after?`, `filed_before?` |
|
|
57
57
|
| `secedgar_get_institutional_holdings` | 13F-HR quarterly institutional holdings parsed from the information table, composed with same-period 13F-HR/A amendments | `company`, `quarter?`, `limit?`, `offset?`, `consolidate?` |
|
|
58
58
|
| `secedgar_find_holders` | Reverse 13F lookup — which institutional managers reported holding an issuer | `issuer`, `cusip?`, `quarter?`, `limit?` |
|
|
59
|
-
| `secedgar_get_beneficial_owners` | 5%+ blockholders of an issuer from structured SCHEDULE 13D/13G XML, or one holder's own schedules across issuers (`role: "filer"`) | `issuer`, `role?`, `form_kind?`, `include_amendments?`, `limit?` |
|
|
59
|
+
| `secedgar_get_beneficial_owners` | 5%+ blockholders of an issuer from structured SCHEDULE 13D/13G XML, or one holder's own schedules across issuers (`role: "filer"`) | `issuer`, `role?`, `form_kind?`, `include_amendments?`, `filed_after?`, `filed_before?`, `offset?`, `limit?` |
|
|
60
60
|
| `secedgar_get_fund_holdings` | Fund portfolio holdings from the quarterly NPORT-P report | `fund`, `series_id?`, `report_date?`, `limit?`, `offset?` |
|
|
61
61
|
| `secedgar_fetch_frames` | Fetch SEC XBRL frames for one concept × one period across all reporting companies | `concept`, `period`, `taxonomy?`, `unit?`, `limit?`, `offset?`, `sort?` |
|
|
62
62
|
| `secedgar_compare_companies` | Period-aligned comparison of 2-10 named companies across 1-8 concepts; a longer list (up to 100) is answered to the cap, the rest returned unread in `deferred_companies` / `deferred_concepts` | `companies`, `concepts`, `taxonomy?`, `period_type?`, `periods?` |
|
|
@@ -82,7 +82,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
82
82
|
|
|
83
83
|
## Domain Notes
|
|
84
84
|
|
|
85
|
-
- **Rate limit:** 10 req/s per IP. Every SEC request goes through one process-wide `createPacer` queue in `EdgarApiService` that spaces request *starts* `1000 / EDGAR_RATE_LIMIT_RPS` ms apart, with no concurrency cap and no wait budget — an ordinary burst drains at the configured rate and is never shed, and this server's own traffic can never exceed it, so `rateLimitRps` stays at 10 and headroom for a co-tenant on the outbound IP is the operator's call via `EDGAR_RATE_LIMIT_RPS`. A 429 is **not** retried: SEC holds the block until the request rate has stayed under the threshold for ten minutes and every request sent meanwhile restarts that clock, so the ~3s retry budget (`MAX_RETRIES` 3 × `BASE_BACKOFF_MS` 1000, exponential) cannot outlast it (#112). Instead a 429 closes the service's **block gate** for `EDGAR_RATE_LIMIT_COOLDOWN_SECONDS` (default 600). While it is closed nothing is sent: a call fails locally as `RateLimited` with `retryAfter` set to the whole seconds remaining (never below 1), and the gate is re-read at dispatch, so a call already queued in the pacer when the 429 landed — or a 5xx, no-response, or body-failure retry sleeping through its backoff — is refused too. The first call after the cool-down is sent alone as a probe while every other call waits on it: any HTTP answer but a 429 reopens normal pacing, a probe 429 closes the gate for the full cool-down again, and a probe that gets no HTTP answer (a network error, or no headers within the per-attempt cap) proves nothing, so the next call probes in its place — and every call that waited on it counts that probe as one of its own no-response attempts, so calls queued behind a silent SEC each settle within their own three-attempt ladder instead of probing in turn, 15 s apiece (#173). **The gate lives in the service, not in the pacer's `cooldown` option** — that gate holds queued calls until it reopens and then releases them all at the pacing rate, so it can neither refuse locally nor keep the reopening to one request. The upstream 429 and the local refusal carry one `data.reason: 'rate_limited'`, declared (`thrownBy: 'service'`, `retryable: true`) on every tool that reaches SEC, plus `data.retryable: true` — `ctx.fail` copies a contract entry's `retryable` onto `data`, a service throw does not, so both throw sites set it themselves (#122) — and one recovery hint naming SEC's ten-minute window and the seconds to wait; SEC's HTML block page stays out of the payload: the 429's body is cancelled unread (#188). Reads the local mirror can answer keep answering during a block: their live reads (the ticker file, a filer's submissions or point read, an open period's frame) are refused locally like any other, and the mirror answers in their place (Local mirror below). 500/502/503/504 still retry with the backoff, and so does an attempt that gets no HTTP response at all — a `fetch` rejection (Bun sets the transport code on the error itself, Node's undici on its `cause`) or no response headers within `ATTEMPT_HEADERS_TIMEOUT_MS` (15 s from dispatch; pacer queue time and the body read are outside it) (#173). Each tool call's `CallScope` carries a failure budget, `CALL_FAILURE_BUDGET_MS` (40 s, `call-scope.ts`): the time SEC spends failing the call — unanswered-attempt and 5xx waits, backoff, body-idle time — is charged to it and healthy progress never is, attempt and body-idle waits are clamped to what is left, a backoff is slept only while the budget outlasts it, and once it is spent no further attempt or backoff starts and the request fails as `sec_unreachable` or, after a 5xx, `sec_unavailable`, so a call against an unresponsive SEC settles inside the MCP client's 60 s default; the caller's `ctx.signal` reaches every pacer wait, fetch, body read, and backoff, and a cancel rethrows untouched, never retried or counted as an SEC failure (#179). Every body is read inside that ladder, in `rawFetch`'s one body reader (`readBody`), so a 2xx whose body fails after its headers — the connection breaks off, invalid chunk framing or compression, or no bytes for `BODY_IDLE_TIMEOUT_MS` (15 s between reads, never across the whole body, so a body still arriving is never cut) — retries the same way; a probe whose headers arrive has already reopened the gate, and only its own call retries the body. That reader decodes through `BodyTextDecoder` (`body-text-decoder.ts`, #273): a JSON read stays UTF-8, and every other read decodes in the `Content-Type` charset, else the `<meta>` charset in the body's first 1,024 bytes, else UTF-8, each label read through `TextDecoder`'s table (`iso-8859-1` decodes as windows-1252, as browsers read it); a head read settles the charset on its first chunk, so it stops where it always did, and the captured error body stays UTF-8. The error body is read there too: a non-retryable status's or a last-attempt 5xx's body is captured through `readBody` (`errorBodyHead`: the first 500 bytes, `…` when cut short, never a partial code point) as a log-only diagnostic — it rides the error's `cause`, whose `data` the call's failure log record writes, never the error's own `data`, which the caller receives (#244) — so one that stalls after its headers ends at the 15 s idle limit or the budget left — keeping what arrived, its wait charged to the budget — and the caller's cancel ends it at once as cancellation (#202). A body the ladder has no use for — a 404's, a retried 5xx's (released before its backoff), a 429's, an answer landing as the caller cancels — is cancelled unread (#188); an error a spent budget ends with from a retried 5xx therefore logs no body. A 200 that reads whole but is not JSON where JSON is expected fails on its one request, unretried (#181). EDGAR full-text search answers a failure of its search backend with a 200 whose JSON carries `errorType` (its OpenSearch client's error class) in place of hits; `searchFilings` and `resolveEntityByName` opt in to classifying that body (`ReadOptions.backendFailure`), so `ConnectionError`, `TimeoutError`, and `NoLivingConnectionsError` fail the attempt on this ladder like a 5xx — same attempts, backoff, block-gate and pacer re-admission, budget, and cancel — and end as `efts_degraded_response` with `retryable: true`, while any other `errorType` (a `ResponseError` is the cluster refusing the request) fails on its one request with `retryable: false`; both carry `upstreamErrorType` and `upstreamErrorMessage`, bounded like the error body, never the body's `trace` or `requestId`, and the entity lookup throws instead of reading the body as no match (#206). So does a submissions document or archive page whose JSON lacks what its readers index — `filings.recent`'s (or the page's) six columns `accessionNumber`, `filingDate`, `form`, `primaryDocument`, `primaryDocDescription`, `reportDate` as arrays, an array `filings.files`, array `tickers` and `exchanges` — checked in `getSubmissions` / `fetchArchivePage` before the cache write, so nothing is cached and the next call refetches (#186). Empty arrays pass; lengths and optional columns are not checked. When the last attempt gets no complete, readable answer — whatever the earlier ones got — the call fails as `ServiceUnavailable` with `data.reason: 'sec_unreachable'`, `retryable: true`, `url`, and a hint, declared beside `rate_limited` on the same tools; the message says which case (no response, a body that failed to read, a body that is not the JSON the request reads) and names host, attempts, and the transport code or the timeout, never the request URL, and the runtime's own text rides `cause` to the log only (#173, #181). When the last attempt answers 500, 502, 503, or 504 — whatever the earlier ones got — the call fails as `ServiceUnavailable`, a 504 too (it is SEC's gateway failing, as #173 codes this service's own header timeout; `data.status` keeps 504), with `data.reason: 'sec_unavailable'`, `retryable: true`, and a hint that SEC failed on its side and the same call can be retried in a minute, declared beside `sec_unreachable` on the same tools; its message reads like `sec_unreachable`'s (`SEC EDGAR (www.sec.gov) answered HTTP 503 on the last of 3 attempts.`, or `… on attempt 2 of 3; retries stopped at this call's 40 s budget for SEC failures.`), and the rest of `data` is the status mapping's: `url`, `status`, `statusText`, `statusCode`, and `retryAfter` when SEC sends `Retry-After` (#233), with SEC's body on the `cause` chain for the log (#244). `createApp({ teardown })` disposes the pacer through `disposeEdgarApiService()` (#116)
|
|
85
|
+
- **Rate limit:** 10 req/s per IP. Every SEC request goes through one process-wide `createPacer` queue in `EdgarApiService` that spaces request *starts* `1000 / EDGAR_RATE_LIMIT_RPS` ms apart, with no concurrency cap and no wait budget — an ordinary burst drains at the configured rate and is never shed, and this server's own traffic can never exceed it, so `rateLimitRps` stays at 10 and headroom for a co-tenant on the outbound IP is the operator's call via `EDGAR_RATE_LIMIT_RPS`. A 429 is **not** retried: SEC holds the block until the request rate has stayed under the threshold for ten minutes and every request sent meanwhile restarts that clock, so the ~3s retry budget (`MAX_RETRIES` 3 × `BASE_BACKOFF_MS` 1000, exponential) cannot outlast it (#112). Instead a 429 closes the service's **block gate** for `EDGAR_RATE_LIMIT_COOLDOWN_SECONDS` (default 600). While it is closed nothing is sent: a call fails locally as `RateLimited` with `retryAfter` set to the whole seconds remaining (never below 1), and the gate is re-read at dispatch, so a call already queued in the pacer when the 429 landed — or a 5xx, no-response, or body-failure retry sleeping through its backoff — is refused too. The first call after the cool-down is sent alone as a probe while every other call waits on it: any HTTP answer but a 429 reopens normal pacing, a probe 429 closes the gate for the full cool-down again, and a probe that gets no HTTP answer (a network error, or no headers within the per-attempt cap) proves nothing, so the next call probes in its place — and every call that waited on it counts that probe as one of its own no-response attempts, so calls queued behind a silent SEC each settle within their own three-attempt ladder instead of probing in turn, 15 s apiece (#173). **The gate lives in the service, not in the pacer's `cooldown` option** — that gate holds queued calls until it reopens and then releases them all at the pacing rate, so it can neither refuse locally nor keep the reopening to one request. The upstream 429 and the local refusal carry one `data.reason: 'rate_limited'`, declared (`thrownBy: 'service'`, `retryable: true`) on every tool that reaches SEC, plus `data.retryable: true` — `ctx.fail` copies a contract entry's `retryable` onto `data`, a service throw does not, so both throw sites set it themselves (#122) — and one recovery hint naming SEC's ten-minute window and the seconds to wait; SEC's HTML block page stays out of the payload: the 429's body is cancelled unread (#188). Reads the local mirror can answer keep answering during a block: their live reads (the ticker file, a filer's submissions or point read, an open period's frame) are refused locally like any other, and the mirror answers in their place (Local mirror below). 500/502/503/504 still retry with the backoff, and so does an attempt that gets no HTTP response at all — a `fetch` rejection (Bun sets the transport code on the error itself, Node's undici on its `cause`) or no response headers within `ATTEMPT_HEADERS_TIMEOUT_MS` (15 s from dispatch; pacer queue time and the body read are outside it) (#173). Each tool call's `CallScope` carries a failure budget, `CALL_FAILURE_BUDGET_MS` (40 s, `call-scope.ts`): the time SEC spends failing the call — unanswered-attempt and 5xx waits, backoff, body-idle time — is charged to it and healthy progress never is, attempt and body-idle waits are clamped to what is left, a backoff is slept only while the budget outlasts it, and once it is spent no further attempt or backoff starts and the request fails as `sec_unreachable` or, after a 5xx, `sec_unavailable`, so a call against an unresponsive SEC settles inside the MCP client's 60 s default; the caller's `ctx.signal` reaches every pacer wait, fetch, body read, and backoff, and a cancel rethrows untouched, never retried or counted as an SEC failure (#179). Every body is read inside that ladder, in `rawFetch`'s one body reader (`readBody`), so a 2xx whose body fails after its headers — the connection breaks off, invalid chunk framing or compression, or no bytes for `BODY_IDLE_TIMEOUT_MS` (15 s between reads, never across the whole body, so a body still arriving is never cut) — retries the same way; a probe whose headers arrive has already reopened the gate, and only its own call retries the body. That reader decodes through `BodyTextDecoder` (`body-text-decoder.ts`, #273): a JSON read stays UTF-8, and every other read decodes in the `Content-Type` charset, else the `<meta>` charset in the body's first 1,024 bytes, else UTF-8, each label read through `TextDecoder`'s table (`iso-8859-1` decodes as windows-1252, as browsers read it); a head read settles the charset on its first chunk, so it stops where it always did, and the captured error body stays UTF-8. The error body is read there too: a non-retryable status's or a last-attempt 5xx's body is captured through `readBody` (`errorBodyHead`: the first 500 bytes, `…` when cut short, never a partial code point) as a log-only diagnostic — it rides the error's `cause`, whose `data` the call's failure log record writes, never the error's own `data`, which the caller receives (#244) — so one that stalls after its headers ends at the 15 s idle limit or the budget left — keeping what arrived, its wait charged to the budget — and the caller's cancel ends it at once as cancellation (#202). A body the ladder has no use for — a 404's, a retried 5xx's (released before its backoff), a 429's, an answer landing as the caller cancels — is cancelled unread (#188); an error a spent budget ends with from a retried 5xx therefore logs no body. A 200 that reads whole but is not JSON where JSON is expected fails on its one request, unretried (#181). EDGAR full-text search answers a failure of its search backend with a 200 whose JSON carries `errorType` (its OpenSearch client's error class) in place of hits; `searchFilings` and `resolveEntityByName` opt in to classifying that body (`ReadOptions.backendFailure`), so `ConnectionError`, `TimeoutError`, and `NoLivingConnectionsError` fail the attempt on this ladder like a 5xx — same attempts, backoff, block-gate and pacer re-admission, budget, and cancel — and end as `efts_degraded_response` with `retryable: true`, while any other `errorType` (a `ResponseError` is the cluster refusing the request) fails on its one request with `retryable: false`; both carry `upstreamErrorType` and `upstreamErrorMessage`, bounded like the error body, never the body's `trace` or `requestId`, and the entity lookup throws instead of reading the body as no match (#206). So does a submissions document or archive page whose JSON lacks what its readers index — `filings.recent`'s (or the page's) six columns `accessionNumber`, `filingDate`, `form`, `primaryDocument`, `primaryDocDescription`, `reportDate` as arrays, an array `filings.files`, array `tickers` and `exchanges` — checked in `getSubmissions` / `fetchArchivePage` before the cache write, so nothing is cached and the next call refetches (#186). Empty arrays pass; lengths and optional columns are not checked. When the last attempt gets no complete, readable answer — whatever the earlier ones got — the call fails as `ServiceUnavailable` with `data.reason: 'sec_unreachable'`, `retryable: true`, `url`, and a hint, declared beside `rate_limited` on the same tools; the message says which case (no response, a body that failed to read, a body that is not the JSON the request reads) and names host, attempts, and the transport code or the timeout, never the request URL, and the runtime's own text rides `cause` to the log only (#173, #181). When the last attempt answers 500, 502, 503, or 504 — whatever the earlier ones got — the call fails as `ServiceUnavailable`, a 504 too (it is SEC's gateway failing, as #173 codes this service's own header timeout; `data.status` keeps 504), with `data.reason: 'sec_unavailable'`, `retryable: true`, and a hint that SEC failed on its side and the same call can be retried in a minute, declared beside `sec_unreachable` on the same tools; its message reads like `sec_unreachable`'s (`SEC EDGAR (www.sec.gov) answered HTTP 503 on the last of 3 attempts.`, or `… on attempt 2 of 3; retries stopped at this call's 40 s budget for SEC failures.`), and the rest of `data` is the status mapping's: `url`, `status`, `statusText`, `statusCode`, and `retryAfter` when SEC sends `Retry-After` (#233), with SEC's body on the `cause` chain for the log (#244). **Side-read tier (#283).** A side read (`CallScopeOptions.sideRead`) is handed to the pacer only while no primary read is queued there, one at a time. With none queued it takes the next slot as before (the turn is taken synchronously, so a primary asked just after it doesn't overtake it). A primary arriving behind waiting side reads starts ahead of all of them, behind at most the one already handed over. A side read that leaves while waiting sends nothing and costs no slot; it leaves when its signal fires (caller cancel or its own deadline), when a 429 closes the block gate (refused at once with the same `rate_limited` refusal), at disposal (`RequestCancelled`), or after 100 pacer gaps (10 s at 10 req/s; a `Timeout` error saying "not sent"). A side read whose turn comes after the gate closed is refused before entering the pacer. The post-cool-down probe can be a side read. `createApp({ teardown })` disposes the pacer through `disposeEdgarApiService()` (#116), which also rejects waiting side reads
|
|
86
86
|
- **Parameter names:** one name per concept across tools — `company` (the entity a tool reads; on `get_institutional_holdings` that is the 13F filer), `filed_after` / `filed_before` (inclusive filing-date bounds), `forms`. Every tool carrying one of those keys declares `inputAliases` for the other spellings in use — `ticker`, `cik`, `ticker_or_cik` → `company`; `start_date`, `date_from` → `filed_after`; `end_date`, `date_to` → `filed_before`; `form_types` → `forms` — so a caller carrying a name from one tool to the next is not rejected (#115). An alias is declared only where it maps to exactly one key of that tool and its value shape fits: a singular `form_type` cannot fill the `forms` array, so it is left out rather than widening the schema. A tool whose only company input carries another name takes the same company-identifier spellings onto it — `company`, `ticker`, `cik`, `ticker_or_cik` → `issuer` on `find_holders` and `get_beneficial_owners`, and those plus `name` and `search` → `query` on `company_search` — since the key it moves into has no other reading there; the canonical names stay, because renaming them would break existing callers (#152). `fund` (a fund or series) and `companies` (an array) are not aliased. `company_search`'s `filing_limit` → `limit` on `search_filings`, `get_material_events`, and `get_beneficial_owners`, whose one count input counts filings; rewritten before validation, it meets `limit`'s own cap and bound in either `EDGAR_CLAMP_OVERSIZED_LIMITS` mode. A `limit` counting managers, transactions, positions, companies, or data points takes no such alias, and `company_search` takes no `limit` alias, since there it would read as a count of companies (#212). Every tool with the date pair accepts either bound alone. `search_filings` fills the missing one before routing, since EDGAR full-text search ignores a one-sided custom range: a lone `filed_after` runs through today (UTC), a lone `filed_before` starts at 2001-01-01, or at 1993-01-01 when it falls before 2001, and the full-text path discloses a filled window in `effectiveQuery` as `(filed <after> to <before>)` (#185). A date bound must name a real Gregorian day, and an explicit `filed_after` later than `filed_before` fails `invalid_arguments` (-32602) before any request, naming the field, an alias included (`filing-dates.ts`: `filingDateField`, `checkFilingDates`; equal bounds are a one-day window). The date pair is checked by one object `.superRefine()` (`report_date` by a field `.refine()`), which emits nothing to JSON Schema, so every advertised `inputSchema` is unchanged, which `tests/mcp-server/tools/advertised-input-schemas.test.ts` pins against `tests/fixtures/input-schemas/tools-list.json`. `company_search` checks only when `include_filings` is true, and `search_filings` judges only the bounds the caller sent, so the #185 fills stay zero-match results. `get_fund_holdings`' `report_date` is held to the calendar too (`calendarDateString`). `get_institutional_holdings` fails a malformed `quarter` as `invalid_quarter` before resolving the company and takes `YYYY-QN` in either letter case (`calendar-quarter.ts`, shared with `find_holders`), where `find_holders`' schema takes uppercase only (#272)
|
|
87
87
|
- **User-Agent required:** `"AppName contact@email.com"` on every SEC request or IP gets blocked
|
|
88
88
|
- **CIK zero-padding:** the `data.sec.gov` APIs (submissions, companyfacts, companyconcept) require the 10-digit zero-padded CIK (`String(cik).padStart(10, '0')`). Archive paths under `www.sec.gov/Archives/edgar/data/` take it unpadded — SEC answers the padded path with a 301, and `fetch` follows it inside the same pacer slot, so every archive read would cost two requests. `filingArchiveUrl` (exported from `edgar-api-service.ts`) strips the zeros for all seven archive reads and for `get_filing`'s `filing_url` (#156)
|
|
@@ -96,15 +96,15 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
96
96
|
- **`compare_companies` lists:** `companies` takes the first 10 inputs as given and `concepts` the first 8 distinct known concepts (merged spellings count once, unknown names none); the rest come back in `deferred_companies` / `deferred_concepts` behind `EDGAR_CLAMP_OVERSIZED_LIMITS`, through `batchClamp` in `limit-clamp.ts`, and the 10 x 8 bound keeps the inline-matrix cell ceiling valid (#201). The notice names the re-call — three when both lists defer: deferred companies with the 8 compared concepts, the 10 companies read with deferred concepts, and the two deferred lists together — since a re-call pairing one deferred list with the other full input list passes the other cap and repeats cells another re-call reads; a lone deferred company is paired with one of the 10 in its two re-calls, and that company leaves the second. An input resolving to a CIK an earlier input already holds is read once, under the earlier input, with a caveat like the concept merge's; it still takes a slot (#217).
|
|
97
97
|
- **Unknown concept names:** `findUnknownConcept` in `concept-map.ts` runs in `get_financials`, `compare_companies`, and `fetch_frames` before company resolution or any SEC request. After trimming, a catalog name or alias in any case or separator form passes, as does a lowerCamelCase spelling of one, and so does anything matching `/^[A-Z][A-Za-z0-9]*$/` — every item element in us-gaap, ifrs-full, dei, and srt has that shape and SEC matches tags case-sensitively, so no input that could return data is rejected, and a well-formed tag that 404s stays `no_data` / `no_concept_data` (#45). Everything else fails as `unknown_concept` (`NotFound`) and never reaches a request URL, where the tag is interpolated as a path segment. The hint is a formula from the `DERIVATIONS` table (`free_cash_flow`, `ebitda`, `working_capital`; read before the tag-shape test, since no taxonomy element is named `EBITDA`) or up to three catalog names by Dice trigram score ≥ 0.3 against name and label, ties by name — the label is the only route from `capital_spending` to `capex`. `total_debt` deliberately has no formula: `debt` excludes current maturities. **Aliases (#240):** a catalog entry's `aliases` are its label keyed like a name (`capital_expenditures`, `cash_and_cash_equivalents`; `&` as `and`, so `research_and_development_expense`) or that label minus its sign qualifier (`income_tax_expense`, `pre_tax_income`), 18 in all, and only spellings with one reading: `total_debt`, `total_equity` (the noncontrolling-interest total is `equity`'s related tag), `eps`, `cost_of_revenue`, `cost_of_sales`, `net_sales`, `ppe`, and `diluted_shares` each name more than one quantity and stay unknown. Names and aliases resolve through one `Map` built at load, which throws on a key two entries claim, and `DERIVATIONS` is a `Map` too, so `__proto__` and `constructor` read nothing off `Object.prototype` and fail as `unknown_concept` rather than passing as a concept with no tags; `Constructor` is tag-shaped and stays a raw tag. An input opening lowercase that misses as typed is split at its camelCase humps and looked up again in both tables (`operatingIncome` → `operating_income`, `freeCashFlow` → its formula): as typed first, so `capEx` stays `capex`, and never for an uppercase-initial input, since no item element opens lowercase while a split `InterestExpense` would read the four-tag `interest_expense` ladder and `SharesOutstanding` a `dei` tag. Suggestions score the split form; aliases are not scored, so no snake_case input's suggestions moved. `secedgar_search_concepts` matches an alias (four spell out a label's `&`, so no label substring holds them), but neither it nor `secedgar://concepts` lists aliases. `compare_companies` fails only when every concept is unknown; otherwise it answers the rest and lists each unknown once in `unknown_concepts`, never as a per-company gap (#128). Known concepts are deduped the same way, by what they resolve to — the catalog entry, or the trimmed raw tag — so `revenue`, `Revenue`, and ` revenue` are compared once under the first spelling, as are `capex`, `capital_expenditures`, and `capitalExpenditures`, and a caveat names the merged inputs; a catalog name and a raw tag it walks (`revenue` and `Revenues`) are different concepts and stay separate (#145). `trigramScorer` lives in the `trigram-similarity.ts` leaf so the catalog scores names without importing the HTTP service.
|
|
98
98
|
- **Taxonomy retry on `no_concept_data`:** when no tag answers under the requested taxonomy, `get_financials` reads companyfacts once (the #13 probe) and leads the hint with the retry that payload supports — `Retry with taxonomy: "ifrs-full" — eps_diluted resolves there to DilutedEarningsLossPerShare.` for a friendly name (resolved under each other accepted taxonomy through `resolveConceptTarget`, first tag in ladder order carrying a framed value), `DilutedEarningsLossPerShare is reported under ifrs-full — retry with taxonomy: "ifrs-full".` for a raw tag. It names only `us-gaap`, `ifrs-full`, or `dei` (companyfacts also carries `srt`, `invest`, `ffd`), fires in every direction whether or not the requested namespace is present (Toyota reports both and `cogs` only under us-gaap), and the namespace summary follows, or stands alone when no retry applies. It never answers from the other taxonomy itself: `taxonomy` defaults to `us-gaap`, so an explicit choice cannot be told from an omitted one (#164). The helpers are shared from `concept-series.ts`. `taxonomyRetry` returns the value to pass as `taxonomy`, the namespace it resolves to, and the tag, and returns nothing when the requested taxonomy already holds a framed value for the concept. `get_snapshot` and `compare_companies` read it from the companyfacts payload in hand and name it on each gap as `retry_taxonomy` / `retry_tag`: the input value, so `us-gaap` for `shares_outstanding` (whose tag sits under `dei`), never `dei`. `newerTaxonomy` adds a profile caveat when the other taxonomy's newest reported period is later than the requested one's, `dei` never compared: Toyota reads most concepts under us-gaap from fiscal 2020 while its statements run five years further under ifrs-full, so no single gap names the retry. `compare_companies` prefixes that caveat with the company and says to retry in a separate call, since `taxonomy` applies to every company in a call. Its `no_comparable_data` hint lists the levers in order: the taxonomy retry, then each related tag a gap's company reports past the concept (`relatedTagAhead`), named as a raw concept to pass, with `period_type` only when the requested one holds none of that tag's periods, then the `period_type: "quarterly"` hint for off-year-end snapshots; with none of them it falls back to the generic next steps (#271, #270).
|
|
99
|
-
- **Series staleness:** two causes, one symptom, one caveat — `seriesStalenessCaveats(tag, label, newest, reference)` in `concept-series.ts` owns both, so a series is never flagged twice in different words. A friendly name's tag array is walked in order, so a tag SEC retired can win when every current tag reports nothing for the filer; SEC ships that tell in the taxonomy `label` (`"… (Deprecated 2018-01-31)"`), already in hand — no extra upstream call. Generalized rather than pinned to one pair: `revenue` and `cogs` both carry retired fallbacks (#98). A *current* tag whose series simply ends carries no tell at all, so the fallback signal is the gap itself: **730 days**, two full fiscal years behind the reference. The floor has to clear one year plus a filing window — an annual-only concept sits a fiscal year back until the next report lands, and a 20-F is due four months after year end — which puts a healthy filer around 500 days. Each tool passes the freshest reference it has without an extra call: `get_snapshot` and `compare_companies` pass `newestReportedPeriod(facts, taxonomy)`, the newest standard period the filer reports across the whole concept catalog — it isolates a line lagging its siblings and collapses to silence for a filer that stopped filing, whose every line is equally old, and it deliberately reads the whole catalog rather than the requested concepts, or a single-concept comparison would measure a series against itself. The reference skips the `dei` namespace — cover-page facts track the filing, not the statements, so they stay current for a registrant that stopped reporting under this taxonomy; counting them put Toyota's us-gaap profile (last reported fiscal 2020) six years behind a cover-page date and flagged all 28 of its lines at once. `get_financials` passes today, because one companyconcept payload holds no filer-wide period, except where the #269 caveat below fires: then it passes that companyfacts payload's `newestReportedPeriod`. All three measure the *full deduped set*, not the period-filtered slice — an annual view trailing a live quarterly series is a property of the filter. The retirement stamp wins when both apply; it names the concrete cause. `get_financials` therefore reads the clock, so its tests pin one (`vi.useFakeTimers({ toFake: ['Date'] })`) (#102). **A related tag the filer reports past the series replaces that caveat (#258):** `conceptLineCaveats` (`concept-series.ts`) returns a pointer in place of the staleness caveat when a related tag (`relatedTagsFor`) runs past the concept's newest value, or the concept's own tags hold nothing. The pointer names the related tag reaching furthest, its note, its newest period, and that passing the tag as `concept` reads it, naming `period_type: "quarterly"` when that period is a quarter, whatever the concept's own newest is (a call at the annual default stops short of it); a filer whose own tags reach every related tag's newest period reads as without it. `get_snapshot` and `compare_companies` read each related tag from the companyfacts payload in hand (`relatedTagReadings`), so a gap gets the pointer too and no request is added. `get_financials` reads each related tag's companyconcept beside the concept's own reads, best-effort: one attempt per read (`CallScope`'s `singleAttempt`) under a 3 s deadline, so a 404, failure, or stall leaves the response as without it, while a caller's cancel still fails the call. The pointer follows any taxonomy retry in the `no_concept_data` hint and is the `no_frame_data` recovery hint. **An annual report SEC's XBRL data holds none of the statement facts of (#269):** SEC's companyfacts and companyconcept stopped carrying IFRS filings' `ifrs-full` facts from late March 2026 while the filings stay flagged `isXBRL`, and the missing year sits under the 730-day floor, so nothing else names it. Under `ifrs-full`, `get_snapshot`, `compare_companies`, and `get_financials` therefore read each company's submissions feed once (`AnnualReportReads`, `src/mcp-server/tools/annual-report-reads.ts`, a tool-layer module since `concept-series` cannot import the service) and take its newest original XBRL annual report from `recent` through `newestXbrlAnnualReport` (10-K, 10-KT, 20-F, or 40-F with `isXBRL` 1 and a period; amendments and 6-Ks never count, since an `/A` often tags only its cover page). `annualReportGapCaveat` fires when that report's period ends after the newest reported period and no `ifrs-full` or `us-gaap` fact carries its accession, saying SEC's XBRL data holds none of the report's statement facts, that the newest values come from earlier filings, and to read the report with `secedgar_get_filing`; `compare_companies` prefixes it with the company. The reads never run under `us-gaap` or in strict mirror mode (mirror on, live fallback off), take one attempt under a scope of their own, and are built right after the call's own reads so they queue behind them in the pacer; with the mirror on they start once those settle, since a point read for a held filer reads the same feed into the service's cache. They get a grace deadline of 3 s (`ANNUAL_REPORT_GRACE_MS`) plus one pacer gap per queued read, armed when the call's own reads settle. A failed, 404, or stalled read leaves the response as without the caveat, and the caller's cancel still fails the call. `get_financials` reads companyfacts only when its series ends before the report's period with no value from it, reusing a payload in hand and adding one pacer gap to the deadline, and where the caveat fires that payload's newest period replaces today as the staleness reference, so the gap is named once, by its cause.
|
|
100
|
-
- **XBRL deduplication:** Filter to entries with `frame` field to get one value per standard calendar period. SEC frames the latest-filed fact for a period, and since the pay-versus-performance rule a DEF 14A re-tags five years of annual `NetIncomeLoss`, so the proxy's figure — often rounded, sometimes mis-scaled or sign-flipped (TheRealReal's CY2024 at +134.2B against the 10-K's −134.2M) — holds the frame. A frame held by any Schedule 14A/14C form (`isProxyForm`) is answered with the latest-filed fact from another form with the same tag, unit key, `start`, and `end` (`reportingFormTwin`), keeping the frame; with no such fact the proxy value stands. Only proxy holders are replaced — a periodic-form allow-list would revert Bank of America's CY2013, framed on a 2016 8-K recast (10,539M) that no later 10-K repeats. The swap runs per tag and per unit key BEFORE cross-tag priority, so tag 0's proxy-held frame takes its twin from tag 0 and is never handed to a lower tag, and it costs two regex tests per framed value when no holder needs correcting. SEC also frames any year-long duration as `CY####`, including the trailing-twelve-month figure a 10-Q discloses, so a later 10-Q can hold an annual frame for a year the filer has not closed (Amazon's CY2026 `NetIncomeLoss` is 135.3B for July 2025–June 2026). An annual frame held by a 10-Q/10-QT takes the latest same-period fact from a form that is neither a quarterly report nor a proxy (the 10-K, in practice), else stays only when it covers a closed fiscal year a later 10-Q happens to disclose — ended before filing, and ending within a week of a fiscal-year end — else drops out of the series (#142). The fiscal-year ends come from a year-long fact from any other form in the same tag and unit key; when there is none, from the filer's own (`fiscalYearEnds`, #148): for each 10-K, 10-KT, 20-F, or 40-F accession (amendments included), the latest end among its year-long facts that ended before filing, across every tag and unit. Every year-long annual-report fact would admit off-cycle quarter ends (Merck's and P&G's 09-30, Toyota's 06-30) and keep a trailing figure ending there. The frame stays untested only when the filer has no such accession. Amazon's April–March `EffectOfExchangeRate…` CY2020/CY2021 and July–June `OtherAdjustmentsForNoncashItems…` CY2008/CY2009, each held by one 10-Q, drop; Deere's November–October `RestructuringAndRelatedCostIncurredCost` years stay. Leaving every twinless 10-Q holder out would delete real years: across seven filers' companyfacts, 9 of 74 such holders are closed fiscal years reported only in a later 10-Q (Merck's `AccountsReceivableSale` CY2020). `frameHolderFact` owns both holder rules; its `FiscalYearEndsSource` is called only for a holder its own series cannot test, so each path pays for the filer's ends only then: `seriesFromCompanyFacts` scans the payload in hand once (`filerFiscalYearEnds`), `get_financials` reads companyfacts only when a first resolution meets such a holder (reusing a served-empty read) and treats that read as best-effort — the first pass is already a complete series, so a failed read keeps the frame untested and a caveat names the 10-Q-held years shown, while a cancelled call still fails — and the mirror's `getFrames` reads that filer's rows through the `cik` index within a 16 MiB per-call budget (`FISCAL_YEAR_END_READ_BUDGET`; past it, rows keep the untested frame). The mirror's `getFrames` applies the holder rules and marks its response `holderFormsResolved`; the live frames API carries no form, so `fetch_frames` caveats annual `NetIncomeLoss` frames (#123) and annual frames for a calendar year still inside its 10-K window, through April of the next year (#142). When a friendly name maps to multiple tags, same-frame collisions resolve by **tag priority** — the lower-index tag wins (index 0 = preferred total, e.g. IFRS `Revenue` over the `RevenueFromContractsWithCustomers` sub-line), ties within one tag by latest `filed` (restatement). Tag-array order in `concept-map.ts` is therefore semantic (#44). **Frames compete only within one unit key, and a series reads one unit** (#146): a 20-F filer frames a year in its reporting currency and in a USD convenience translation, and letting every unit compete swapped the unit wherever the other unit's fact was filed later — Harmony's revenue read ZAR except a 1,264M USD CY2016, with nothing on the row to say so. `resolveFrameSeriesByUnit` runs the holder rules and tag priority inside each unit key (the `coverage` winner is still picked across all units), and `rankSeriesUnits` orders the units: newest value's end, then more framed periods, then alphabetical. Newest-first follows a presentation-currency change (Prudential plc's GBP runs to 2018, its USD from 2017); the period count settles the convenience-translation tie (Alibaba's CNY over USD on the same newest year). Never the catalog mapping's `unit` — it reads `USD` under `ifrs-full` too, and keying on it handed 169 of 193 multi-unit catalog tags in a 33-filer sample to their translation. `get_financials` names each other unit with its period count and span in a caveat and reads one through its `unit` input (an SEC unit key; the `-per-` spelling and a unique case-insensitive match are accepted; an unreported key fails as `no_unit_data`, listing the keys the concept reports), and its staleness caveat measures the newest value across units, so a translation the filer stopped publishing is not reported as a stopped series; once every unit has stopped, the caveat describes the series shown, by its own end. `get_snapshot` and `compare_companies` read the default unit with no unit caveat — it would fire on 25-plus lines for every convenience-translation filer — so `compare_companies`' units caveat fires only across companies. Unit keys are never normalized: Costco's 2008 and FedEx's 2007 EPS, mistagged `pure` / `shares`, leave their series and are named in the caveat. `fetch_frames` is unaffected — the frames API and the mirror's `getFrames` are unit-scoped already. The rules live once in `concept-series.ts` (`resolveFrameSeriesByUnit` / `resolveFrameSeries` over `CompanyConceptUnit`s carrying a `tagIndex`, their source `tag`, and their unit key; `seriesFromCompanyFacts` for the whole-company reads) — every tool reading XBRL facts goes through it so their numbers agree. `resolveConceptTarget` in `concept-map.ts` is the matching taxonomy+tag resolution (mapping taxonomy wins over the `us-gaap` default; `ifrs-full` uses `ifrsTags` when present) and carries the `tagSelection` for the array it picked. `fetch_frames` resolves through it too, so its `taxonomy` input — `us-gaap` or `dei`, the only namespaces SEC publishes frames for — picks the namespace a raw tag is read from, a catalog name keeps its own mapped taxonomy under the default, and an explicit `dei` reads a catalog name's tags from `dei` exactly as `get_financials` does (#143). **`priority` is the default and coverage ranking is never the general rule** — it answers "which element does this filer maintain", which is the question only when the elements mean the same thing. Where they mean different things the array order is the answer and period count is noise: Molson Coors keeps eleven calendar years under a 2018-retired revenue element and ten under the assessed-tax-inclusive one against five under `Revenues`, so ranking `revenue` by coverage hands it either the dead tag or its gross-of-excise line in place of the continuous net series; Smucker and Spotify survive it only on a coincidental tie in period count (#101). `preferredTagIndex` picks the winning tag under either rule. Every resolved value names its own source tag — `get_financials` rows, `get_snapshot` points, and `compare_companies` cells each carry one — and the line-level `tag`/`label`/`unit` follow the tag behind the newest value (`describingTag`): under `coverage` that is the winner, and under `priority` a successor appended behind an older leader answers the recent frames, so describing the line by the leader would name a tag that produced none of its current values (#125). A companyconcept or companyfacts unit served as anything but an array is dropped at the service edge (SEC serves Visa's and Coca-Cola's `NetIncomeLoss` companyconcept as `"units":{"USD":{}}`); a companyconcept payload left with no units reads as served-empty, and `get_financials` answers every such tag from one companyfacts read, which it reuses for the no-data probe (#141). The two rules also differ in what the losers contribute: under `priority` the array is a ladder, so a lower tag fills frames the leader does not report, while under `coverage` the tags are alternates and only the winner contributes — gap-filling from an alternate splices two definitions into one series, and the filers reporting both tags disagree where they overlap (Ferrari tags CY2022 at EUR 16.2M under the employee element and EUR 20.9M under the IFRS 2.51(a) total), so the filled series prints a step that is a tag switch rather than a business fact. Seven percent of the 224 IFRS filers reporting either `stock_based_compensation` tag have that shape; a winner-only series that then ends years back is what the staleness caveat is for.
|
|
101
|
-
- **Fiscal-period caveats:** SEC reports a filer's fiscal Q4 as the 10-K residual, never as a discrete quarterly fact, so the calendar quarter that a filer's fiscal Q4 *spans* carries no frame-tagged quarterly value. That is not always the quarter holding the fiscal year-end date — a January year-end closes a fiscal Q4 running Nov–Jan, which SEC frames as calendar Q4 — and calendar-year filers are affected too (no discrete Q4). `fiscal-periods.ts` owns both directions: `fiscalQ4Caveats(period)` for the cross-company frame view (`fetch_frames`), `missingQuarterCaveats(frames)` for the per-filer series view (`get_financials`, `get_snapshot`, `compare_companies`) (#95). The per-filer detection is data-driven — no maintained filer list — and reads only the newest 4 years carrying quarterly frames, applying the per-year quorum inside that window rather than before it, because SEC frame-tagged all four calendar quarters before ~CY2021 and drops the fiscal-Q4 quarter after; a whole-history read would let the older years mask the live gap, and filtering first would let a filer whose recent years are too sparse silently describe the older regime. **Keep that slice-then-filter order.** The detector reports a *set* of absent quarters, not one: a filer whose remaining fiscal quarters also span non-calendar durations loses two (Costco tags only calendar Q1 and Q4), and the per-year quorum is two of four — low enough to admit that shape, high enough to bound the absent set at two and keep a one-quarter stub year from dragging a third in (#100). Message wording and the derivation advice differ between the one- and two-quarter cases; the three consuming tools all iterate `caveats`, so nothing downstream assumes at most one entry.
|
|
102
|
-
- **`get_financials` period default:** with `period_type` unset the series defaults to `annual` (clean FY series); if the annual filter empties a non-empty series whose frames are all instant (`CY####Q#I` — balance-sheet, shares-outstanding, raw instant tags), it falls back to the full series so the first call returns data (#48). An explicit `period_type` is honored. `annual` on an instant series returns the framed instants whose `end` is one of the filer's fiscal-year ends (`filerFiscalYearEndsWithComparatives` — each annual report's own year, the #148 rule, plus the comparative years it restates, the same set `compare_companies` aligns on, so MSFT reaches its first XBRL 10-K's `CY2009Q2I` and `CY2008Q2I`), read from companyfacts only on that path — which otherwise fails — and reusing a payload already read. Selection keys on `end`, never on the frame holder's form or quarter: BSX's 2025-12-31 instant, framed on its Q2-2026 10-Q while the 10-K's own fact carries no frame, is kept with the 10-Q's provenance, and a June year end lands on `Q2I`. A cover-date concept (`shares_outstanding` for a 10-K filer, dated weeks after the year end) has no year-end instant, and a failed or `null` read selects nothing; both still fail `no_period_data`, with a hint naming which (#167). Any other explicit `period_type` that excludes everything still errors.
|
|
99
|
+
- **Series staleness:** two causes, one symptom, one caveat — `seriesStalenessCaveats(tag, label, newest, reference)` in `concept-series.ts` owns both, so a series is never flagged twice in different words. A friendly name's tag array is walked in order, so a tag SEC retired can win when every current tag reports nothing for the filer; SEC ships that tell in the taxonomy `label` (`"… (Deprecated 2018-01-31)"`), already in hand — no extra upstream call. Generalized rather than pinned to one pair: `revenue` and `cogs` both carry retired fallbacks (#98). A *current* tag whose series simply ends carries no tell at all, so the fallback signal is the gap itself: **730 days**, two full fiscal years behind the reference. The floor has to clear one year plus a filing window — an annual-only concept sits a fiscal year back until the next report lands, and a 20-F is due four months after year end — which puts a healthy filer around 500 days. Each tool passes the freshest reference it has without an extra call: `get_snapshot` and `compare_companies` pass `newestReportedPeriod(facts, taxonomy)`, the newest standard period the filer reports across the whole concept catalog — it isolates a line lagging its siblings and collapses to silence for a filer that stopped filing, whose every line is equally old, and it deliberately reads the whole catalog rather than the requested concepts, or a single-concept comparison would measure a series against itself. The reference skips the `dei` namespace — cover-page facts track the filing, not the statements, so they stay current for a registrant that stopped reporting under this taxonomy; counting them put Toyota's us-gaap profile (last reported fiscal 2020) six years behind a cover-page date and flagged all 28 of its lines at once. `get_financials` passes today, because one companyconcept payload holds no filer-wide period, except where the #269 caveat below fires: then it passes that companyfacts payload's `newestReportedPeriod`. All three measure the *full deduped set*, not the period-filtered slice — an annual view trailing a live quarterly series is a property of the filter. The retirement stamp wins when both apply; it names the concrete cause. `get_financials` therefore reads the clock, so its tests pin one (`vi.useFakeTimers({ toFake: ['Date'] })`) (#102). **A related tag the filer reports past the series replaces that caveat (#258):** `conceptLineCaveats` (`concept-series.ts`) returns a pointer in place of the staleness caveat when a related tag (`relatedTagsFor`) runs past the concept's newest value, or the concept's own tags hold nothing. The pointer names the related tag reaching furthest, its note, its newest period, and that passing the tag as `concept` reads it, naming `period_type: "quarterly"` when that period is a quarter, whatever the concept's own newest is (a call at the annual default stops short of it); a filer whose own tags reach every related tag's newest period reads as without it. `get_snapshot` and `compare_companies` read each related tag from the companyfacts payload in hand (`relatedTagReadings`), so a gap gets the pointer too and no request is added. `get_financials` reads each related tag's companyconcept beside the concept's own reads, best-effort: one attempt per read (`CallScope`'s `singleAttempt`) under a 3 s deadline, so a 404, failure, or stall leaves the response as without it, while a caller's cancel still fails the call. The pointer follows any taxonomy retry in the `no_concept_data` hint and is the `no_frame_data` recovery hint. **An annual report SEC's XBRL data holds none of the statement facts of (#269):** SEC's companyfacts and companyconcept stopped carrying IFRS filings' `ifrs-full` facts from late March 2026 while the filings stay flagged `isXBRL`, and the missing year sits under the 730-day floor, so nothing else names it. Under `ifrs-full`, `get_snapshot`, `compare_companies`, and `get_financials` therefore read each company's submissions feed once (`AnnualReportReads`, `src/mcp-server/tools/annual-report-reads.ts`, a tool-layer module since `concept-series` cannot import the service) and take its newest original XBRL annual report from `recent` through `newestXbrlAnnualReport` (10-K, 10-KT, 20-F, or 40-F with `isXBRL` 1 and a period; amendments and 6-Ks never count, since an `/A` often tags only its cover page). `annualReportGapCaveat` fires when that report's period ends after the newest reported period and no `ifrs-full` or `us-gaap` fact carries its accession, saying SEC's XBRL data holds none of the report's statement facts, that the newest values come from earlier filings, and to read the report with `secedgar_get_filing`; `compare_companies` prefixes it with the company. The reads never run under `us-gaap` or in strict mirror mode (mirror on, live fallback off), take one attempt under a scope of their own, and are built right after the call's own reads so they queue behind them in the pacer; with the mirror on they start once those settle, since a point read for a held filer reads the same feed into the service's cache. They get a grace deadline of 3 s (`ANNUAL_REPORT_GRACE_MS`) plus one pacer gap per queued read, armed when the call's own reads settle. A failed, 404, or stalled read leaves the response as without the caveat, and the caller's cancel still fails the call. `get_financials` reads companyfacts only when its series ends before the report's period with no value from it, reusing a payload in hand and adding one pacer gap to the deadline, and where the caveat fires that payload's newest period replaces today as the staleness reference, so the gap is named once, by its cause. **The #258 related-tag reads and the #269 feed and companyfacts reads are side reads (#283):** under contention from other primary reads they can wait out their deadline unsent, and the response answers without the pointer or caveat, logging the same warning as a failed read. The #148 fiscal-year-end companyfacts read stays primary.
|
|
100
|
+
- **XBRL deduplication:** Filter to entries with `frame` field to get one value per standard calendar period. SEC frames the latest-filed fact for a period, and since the pay-versus-performance rule a DEF 14A re-tags five years of annual `NetIncomeLoss`, so the proxy's figure — often rounded, sometimes mis-scaled or sign-flipped (TheRealReal's CY2024 at +134.2B against the 10-K's −134.2M) — holds the frame. A frame held by any Schedule 14A/14C form (`isProxyForm`) is answered with the latest-filed fact from another form with the same tag, unit key, `start`, and `end` (`reportingFormTwin`), keeping the frame; with no such fact the proxy value stands. Only proxy holders are replaced — a periodic-form allow-list would revert Bank of America's CY2013, framed on a 2016 8-K recast (10,539M) that no later 10-K repeats. The swap runs per tag and per unit key BEFORE cross-tag priority, so tag 0's proxy-held frame takes its twin from tag 0 and is never handed to a lower tag, and it costs two regex tests per framed value when no holder needs correcting. SEC also frames any year-long duration as `CY####`, including the trailing-twelve-month figure a 10-Q discloses, so a later 10-Q can hold an annual frame for a year the filer has not closed (Amazon's CY2026 `NetIncomeLoss` is 135.3B for July 2025–June 2026). An annual frame held by a 10-Q/10-QT takes the latest same-period fact from a form that is neither a quarterly report nor a proxy (the 10-K, in practice), else stays only when it covers a closed fiscal year a later 10-Q happens to disclose — ended before filing, and ending within a week of a fiscal-year end — else drops out of the series (#142). The fiscal-year ends come from a year-long fact from any other form in the same tag and unit key; when there is none, from the filer's own (`fiscalYearEnds`, #148): for each 10-K, 10-KT, 20-F, or 40-F accession (amendments included), the latest end among its year-long facts that ended before filing, across every tag and unit. Every year-long annual-report fact would admit off-cycle quarter ends (Merck's and P&G's 09-30, Toyota's 06-30) and keep a trailing figure ending there. The frame stays untested only when the filer has no such accession. Amazon's April–March `EffectOfExchangeRate…` CY2020/CY2021 and July–June `OtherAdjustmentsForNoncashItems…` CY2008/CY2009, each held by one 10-Q, drop; Deere's November–October `RestructuringAndRelatedCostIncurredCost` years stay. Leaving every twinless 10-Q holder out would delete real years: across seven filers' companyfacts, 9 of 74 such holders are closed fiscal years reported only in a later 10-Q (Merck's `AccountsReceivableSale` CY2020). `frameHolderFact` owns both holder rules; its `FiscalYearEndsSource` is called only for a holder its own series cannot test, so each path pays for the filer's ends only then: `seriesFromCompanyFacts` scans the payload in hand once (`filerFiscalYearEnds`), `get_financials` reads companyfacts only when a first resolution meets such a holder (reusing a served-empty read) and treats that read as best-effort — the first pass is already a complete series, so a failed read keeps the frame untested and a caveat names the 10-Q-held years shown, while a cancelled call still fails — and the mirror's `getFrames` reads that filer's rows through the `cik` index within a 16 MiB per-call budget (`FISCAL_YEAR_END_READ_BUDGET`; past it, rows keep the untested frame). The mirror's `getFrames` applies the holder rules and marks its response `holderFormsResolved`; the live frames API carries no form, so `fetch_frames` caveats annual `NetIncomeLoss` frames (#123) and annual frames for a calendar year still inside its 10-K window, through April of the next year (#142). When a friendly name maps to multiple tags, same-frame collisions resolve by **tag priority** — the lower-index tag wins (index 0 = preferred total, e.g. IFRS `Revenue` over the `RevenueFromContractsWithCustomers` sub-line), ties within one tag by latest `filed` (restatement). Tag-array order in `concept-map.ts` is therefore semantic (#44). **Frames compete only within one unit key, and a series reads one unit** (#146): a 20-F filer frames a year in its reporting currency and in a USD convenience translation, and letting every unit compete swapped the unit wherever the other unit's fact was filed later — Harmony's revenue read ZAR except a 1,264M USD CY2016, with nothing on the row to say so. `resolveFrameSeriesByUnit` runs the holder rules and tag priority inside each unit key (the `coverage` winner is still picked across all units), and `rankSeriesUnits` orders the units: newest value's end, then more framed periods, then alphabetical. Newest-first follows a presentation-currency change (Prudential plc's GBP runs to 2018, its USD from 2017); the period count settles the convenience-translation tie (Alibaba's CNY over USD on the same newest year). Never the catalog mapping's `unit` — it reads `USD` under `ifrs-full` too, and keying on it handed 169 of 193 multi-unit catalog tags in a 33-filer sample to their translation. `get_financials` names each other unit with its period count and span in a caveat and reads one through its `unit` input (an SEC unit key; the `-per-` spelling and a unique case-insensitive match are accepted; an unreported key fails as `no_unit_data`, listing the keys the concept reports), and its staleness caveat measures the newest value across units, so a translation the filer stopped publishing is not reported as a stopped series; once every unit has stopped, the caveat describes the series shown, by its own end. `get_snapshot` and `compare_companies` read the default unit with no unit caveat — it would fire on 25-plus lines for every convenience-translation filer — so `compare_companies`' units caveat fires only across companies. Unit keys are never normalized: Costco's 2008 and FedEx's 2007 EPS, mistagged `pure` / `shares`, leave their series and are named in the caveat. `fetch_frames` is unaffected — the frames API and the mirror's `getFrames` are unit-scoped already. The rules live once in `concept-series.ts` (`resolveFrameSeriesByUnit` / `resolveFrameSeries` over `CompanyConceptUnit`s carrying a `tagIndex`, their source `tag`, and their unit key; `seriesFromCompanyFacts` for the whole-company reads) — every tool reading XBRL facts goes through it so their numbers agree. `resolveConceptTarget` in `concept-map.ts` is the matching taxonomy+tag resolution (mapping taxonomy wins over the `us-gaap` default; `ifrs-full` uses `ifrsTags` when present) and carries the `tagSelection` for the array it picked. `fetch_frames` resolves through it too, so its `taxonomy` input — `us-gaap` or `dei`, the only namespaces SEC publishes frames for — picks the namespace a raw tag is read from, a catalog name keeps its own mapped taxonomy under the default, and an explicit `dei` reads a catalog name's tags from `dei` exactly as `get_financials` does (#143). **`priority` is the default and coverage ranking is never the general rule** — it answers "which element does this filer maintain", which is the question only when the elements mean the same thing. Where they mean different things the array order is the answer and period count is noise: Molson Coors keeps eleven calendar years under a 2018-retired revenue element and ten under the assessed-tax-inclusive one against five under `Revenues`, so ranking `revenue` by coverage hands it either the dead tag or its gross-of-excise line in place of the continuous net series; Smucker and Spotify survive it only on a coincidental tie in period count (#101). `preferredTagIndex` picks the winning tag under either rule. Every resolved value names its own source tag — `get_financials` rows, `get_snapshot` points, and `compare_companies` cells each carry one — and the line-level `tag`/`label`/`unit` follow the tag behind the newest value (`describingTag`): under `coverage` that is the winner, and under `priority` a successor appended behind an older leader answers the recent frames, so describing the line by the leader would name a tag that produced none of its current values (#125). A companyconcept or companyfacts unit served as anything but an array is dropped at the service edge (SEC serves Visa's and Coca-Cola's `NetIncomeLoss` companyconcept as `"units":{"USD":{}}`); a companyconcept payload left with no units reads as served-empty, and `get_financials` answers every such tag from one companyfacts read, which it reuses for the no-data probe (#141). The two rules also differ in what the losers contribute: under `priority` the array is a ladder, so a lower tag fills frames the leader does not report, while under `coverage` the tags are alternates and only the winner contributes — gap-filling from an alternate splices two definitions into one series, and the filers reporting both tags disagree where they overlap (Ferrari tags CY2022 at EUR 16.2M under the employee element and EUR 20.9M under the IFRS 2.51(a) total), so the filled series prints a step that is a tag switch rather than a business fact. Seven percent of the 224 IFRS filers reporting either `stock_based_compensation` tag have that shape; a winner-only series that then ends years back is what the staleness caveat is for. **Year-to-date rows (#284) form their own series, never mixed with frames:** under `period_type: "ytd"` they dedup per `start/end` interval within each unit key under the concept's tag rule (under `priority` the lower tag index wins a shared interval and lower tags fill gaps; under `coverage` only the frame-coverage winner contributes); within one tag the latest `filed` wins, usually next year's comparative, so `fiscal_year`/`fiscal_period` name that filing. Holder-form rules never apply, since a year-to-date duration carries no frame.
|
|
101
|
+
- **Fiscal-period caveats:** SEC reports a filer's fiscal Q4 as the 10-K residual, never as a discrete quarterly fact, so the calendar quarter that a filer's fiscal Q4 *spans* carries no frame-tagged quarterly value. That is not always the quarter holding the fiscal year-end date — a January year-end closes a fiscal Q4 running Nov–Jan, which SEC frames as calendar Q4 — and calendar-year filers are affected too (no discrete Q4). `fiscal-periods.ts` owns both directions: `fiscalQ4Caveats(period)` for the cross-company frame view (`fetch_frames`), `missingQuarterCaveats(frames)` for the per-filer series view (`get_financials`, `get_snapshot`, `compare_companies`) (#95). The per-filer detection is data-driven — no maintained filer list — and reads only the newest 4 years carrying quarterly frames, applying the per-year quorum inside that window rather than before it, because SEC frame-tagged all four calendar quarters before ~CY2021 and drops the fiscal-Q4 quarter after; a whole-history read would let the older years mask the live gap, and filtering first would let a filer whose recent years are too sparse silently describe the older regime. **Keep that slice-then-filter order.** The detector reports a *set* of absent quarters, not one: a filer whose remaining fiscal quarters also span non-calendar durations loses two (Costco tags only calendar Q1 and Q4), and the per-year quorum is two of four — low enough to admit that shape, high enough to bound the absent set at two and keep a one-quarter stub year from dragging a third in (#100). Message wording and the derivation advice differ between the one- and two-quarter cases; the three consuming tools all iterate `caveats`, so nothing downstream assumes at most one entry. Quarterly caveats run only under `quarterly`/`all`. **One quarter a year (#284):** a `quarterly`/`all` series whose recent-window years (at least two) each carry one framed quarter — most 10-Q cash-flow lines, which a filer reports only as year-to-date totals — draws a caveat when the shown unit has year-to-date values; it names `period_type: "ytd"` and the subtraction derivation, and never fires with the missing-quarter caveat.
|
|
102
|
+
- **`get_financials` period default:** with `period_type` unset the series defaults to `annual` (clean FY series); if the annual filter empties a non-empty series whose frames are all instant (`CY####Q#I` — balance-sheet, shares-outstanding, raw instant tags), it falls back to the full series so the first call returns data (#48). An explicit `period_type` is honored. `annual` on an instant series returns the framed instants whose `end` is one of the filer's fiscal-year ends (`filerFiscalYearEndsWithComparatives` — each annual report's own year, the #148 rule, plus the comparative years it restates, the same set `compare_companies` aligns on, so MSFT reaches its first XBRL 10-K's `CY2009Q2I` and `CY2008Q2I`), read from companyfacts only on that path — which otherwise fails — and reusing a payload already read. Selection keys on `end`, never on the frame holder's form or quarter: BSX's 2025-12-31 instant, framed on its Q2-2026 10-Q while the 10-K's own fact carries no frame, is kept with the 10-Q's provenance, and a June year end lands on `Q2I`. A cover-date concept (`shares_outstanding` for a 10-K filer, dated weeks after the year end) has no year-end instant, and a failed or `null` read selects nothing; both still fail `no_period_data`, with a hint naming which (#167). Any other explicit `period_type` that excludes everything still errors. **`period_type: "ytd"` (#284)** returns only year-to-date values: durations from a 10-Q, 10-QT or 6-K (amendments included) longer than 121 and shorter than 335 days (SEC's frame tolerances, quarter 91±30 and year 365±30), keyed `start/end` (`period` holds the interval), never mixed with frames; `all` holds none. Under `ytd` there is no `no_frame_data` and the #148 companyfacts year-end read is skipped. An empty result fails `no_period_data` (`period_type: "ytd"`) with a hint naming an instant concept (no value carries a `start`) or saying no interim value spans more than a quarter and less than a year. Unit ranking and the units caveat run over the YTD units (spans written `a to b`). The report-gap caveat is measured on the framed series; the staleness caveat and related-tag pointer on the later of the framed series and the newest YTD row shown, a YTD row named by its interval.
|
|
103
103
|
- **8-K item codes:** SEC replaced the original single-integer item numbering with the current `x.xx` scheme in Release 33-8400, effective **2004-08-23**, so EDGAR's `items` field carries two disjoint vocabularies. `eight-k-items.ts` decodes by the code's **shape**, never the filing date — dotted is current, a bare integer is legacy — because filers reported pre-changeover events under the old numbers for months after the effective date, and a date-keyed table would mislabel exactly those. The two vocabularies reuse integers for unrelated events (legacy `5` is Other Events, current `5.02` is officer departures; legacy `12` is the ancestor of `2.02`), so a dotted `items` filter never matches a pre-2004 filing — `get_material_events`' zero-hit notice says so and echoes the codes actually present. The tables back four surfaces: the tool's `items` enum, the decoded per-filing rows, the decoded `items` on `search_filings`' 8-K and 8-K/A rows (#277), and the `secedgar://filing-types` resource. `isMaterialEventForm` in `eight-k-items.ts` is the one 8-K / 8-K/A test (the 8-K12B family stays out), and `eightKItemColumns` the one derivation of the `item_codes` / `item_labels` / `item_regime` dataframe columns, so the two tools' tables union. A code matching a shape but absent from that regime's table comes back with no label rather than a guess.
|
|
104
|
-
- **EFTS quirks:** `dateRange=custom` must be set when using date params; the singular `entity` param is ignored — `cik:`/`ticker:` targeting passes the resolved CIK via the plural `ciks` param (server-side scope, independent of the filing's name text, so former-name filings on the same CIK are matched); `ciks` only scopes in, so one bare entity token scopes a search (a `+` before it removed with it, and one inside a quoted phrase too, the phrase read without it) while a token led by `-` or a `NOT` term, or a second entity token, fails `unsupported_entity_scope` before any request — full-text search ignores a `-ticker:` term, and a second token sent as text matches nothing (#243); `size` is ignored entirely and every request answers with 100 hits, so `find_holders` pages with `from` alone and expresses its budget in pages (5 → 500 rows). The result window is 10,000 documents, so a `from` past 9,900 is refused as a `ResponseError` body, with or without `q` and whatever the match total; `search_filings` sends `offset` as `from` only under `sort=relevance` with no entity scope on a 2001-onward range, fails a deeper `offset` there as `offset_out_of_range` before any request (`MAX_RELEVANCE_OFFSET`, which `find_holders`' continuation recipe also names), and keeps the schema's 9,999 for its other paths, which page the rows they assembled (#214). A hit is one matching **document**, not a filing: `_id` is `<accession>:<filename>`, a filing whose body and exhibits both match arrives once per document, and `hits.total.value` and the `form_filter` aggregation (keyed on `root_forms`, amendments folded in) count documents. `search_filings` collapses hits to one row per accession (first-ranked hit's fields, plus `matched_documents` in rank order, and `_source.items` decoded into `items` on 8-K and 8-K/A rows, which every hit of such a filing carries, an exhibit's included: `[]` when EDGAR records none, absent on every other form, Form 1-U hits too, whose `items` use 1-U's own numbering and stay undecoded, and on full-index rows, since `master.idx` lists no items; submissions-feed rows take the feed's own `items` column, pre-2001 codes included (#277)) and counts `total` / `form_distribution` from those filings; no EFTS parameter yields a search's filing count (`collapse`/`aggs` are ignored), so `total` is exact only when one window held every match, else a lower bound beside `total_documents`. **A browse is the exception:** a forms- or entity-only request (no `q`) matches each filing's primary document alone (S-1 January 2025: 200 hits over two pages, 200 distinct accessions, every `file_type` the form), so `hits.total.value` is the filing count and `total` is EDGAR's count — exact when the relation is `eq`, at any offset — trusted while the window shows one document per accession, else back to the window lower bound; `dataset.truncated` still flags a window short of it, and `form_distribution` covers the filings in hand. The straddling merge keeps the window count for its 2001-onward side, since its `total` counts assembled rows. Under `sort=relevance`, `from` counts documents and the 100-hit window runs past the page, so a page lists the filings among its own `limit` documents (the window's first rows, which can number fewer than `limit`) and only a filing straddling a page edge recurs on the next page (#124). `search_filings` returns `next_offset`, `offset` plus the applied `limit` (a clamped `limit` steps by the applied value) in each path's offset unit — documents under `sort=relevance`, the call's assembled filings elsewhere — present only when that offset returns rows (#259). A relevance page is last when `offset + limit ≥ total_documents` on a relation of `eq`, never by `offset` plus the documents fetched, since EDGAR answers up to 100 from `from` whatever `limit` is, and no `next_offset` is named past 9,900. `truncated` and the paging notice mark filings past the page, or matches no offset reaches (a date-sorted or entity window short of the match set, an archive or scan cap, the 9,900 cap), where the notice says how to narrow; `total_is_exact: false` on a relevance page past offset 0 does not set `truncated` by itself. A `gte` document total renders as `10000+` in the window and paging notices. A backend failure arrives as a 200 too, with `errorType`, `errorMessage`, `trace`, and `requestId` in place of `hits`; its handling is in the rate-limit note above (#206). Caller text is escaped before it reaches full-text search: `searchFilings`' `q` and `resolveEntityByName`'s `keysTyped` both go through `escapeEftsText`, which doubles each backslash and writes each control character (category Cc) as `\uXXXX`, so a term holding either is searched as typed. The escape lives in the service, not a tool, so `find_holders`' `search_key` re-sent through `search_filings` runs the same search. `find_holders` quotes the conformed name minus one trailing qualifier — a `\` or `/`, one to six letters, an optional closing `\` or `/` (`/[\\/][A-Za-z]{1,6}[\\/]?$/`, then a trim) — since 13F information tables print the issuer without it: `"US BANCORP"` matches 2,315 documents in the 2026-Q2 filing window, the phrase with its `\DE\` qualifier 2, and `PROGRESSIVE CORP/OH/` is searched as `"PROGRESSIVE CORP"`. A slash inside a name (`CULLEN/FROST BANKERS, INC.`) and an undelimited state token (`UNIVERSAL DISPLAY CORP PA`) stay, and `resolved_issuer_name` keeps the registry title (#205). Two registrants whose titles match once that qualifier is gone (`FIRST BANCORP /PR/` and `FIRST BANCORP /NC/`; `INDEPENDENT BANK CORP /MI/` and `INDEPENDENT BANK CORP`) search one phrase and get the same holders, and keeping the qualifier is no fix (`"FIRST BANCORP /PR/"` matches 9 documents in that window, `"FIRST BANCORP"` 458, FBP's CUSIP 353), so a name search with at least one match checks the in-memory registry (`getAllEntries`, no request) for every other current registrant (a ticker-file row, never a former name) whose title, minus its own qualifier, equals the phrase case-insensitively, and names each with CIK and ticker in a sentence pointing to `cusip`. The sentence joins the tool's `notices` list, since `ctx.enrich.notice` and `ctx.enrich.truncated`'s guidance are last-wins (#224). A notice naming a `secedgar_search_filings` call as JSON — `find_holders`' first-page and continuation recipes, `company_search`'s withheld-filings recipe — puts it in a code span (`markdown().inlineCode`, fenced past any backtick run), since `content[]` renders as Markdown and outside code the quoted phrase's `\"` loses its backslash, as would a caller's form type typed into `company_search`'s `forms` (#220)
|
|
105
|
-
- **Submissions archive walk:** the submissions feed's `filings.recent` holds the last year or 1,000 filings, whichever is more — so 26,000+ rows for JPMorgan, and a filing day is never split (Microsoft's window runs to 1,002 rows to finish its oldest day); everything older lives on `filings.files[]` archive pages
|
|
104
|
+
- **EFTS quirks:** `dateRange=custom` must be set when using date params; the singular `entity` param is ignored — `cik:`/`ticker:` targeting passes the resolved CIK via the plural `ciks` param (server-side scope, independent of the filing's name text, so former-name filings on the same CIK are matched); `ciks` only scopes in, so one bare entity token scopes a search (a `+` before it removed with it, and one inside a quoted phrase too, the phrase read without it) while a token led by `-` or a `NOT` term, or a second entity token, fails `unsupported_entity_scope` before any request — full-text search ignores a `-ticker:` term, and a second token sent as text matches nothing (#243); `size` is ignored entirely and every request answers with 100 hits, so `find_holders` pages with `from` alone and expresses its budget in pages (5 → 500 rows). The result window is 10,000 documents, so a `from` past 9,900 is refused as a `ResponseError` body, with or without `q` and whatever the match total; `search_filings` sends `offset` as `from` only under `sort=relevance` with no entity scope on a 2001-onward range, fails a deeper `offset` there as `offset_out_of_range` before any request (`MAX_RELEVANCE_OFFSET`, which `find_holders`' continuation recipe also names), and keeps the schema's 9,999 for its other paths, which page the rows they assembled (#214). A hit is one matching **document**, not a filing: `_id` is `<accession>:<filename>`, a filing whose body and exhibits both match arrives once per document, and `hits.total.value` and the `form_filter` aggregation (keyed on `root_forms`, amendments folded in) count documents. `search_filings` collapses hits to one row per accession (first-ranked hit's fields, plus `matched_documents` in rank order, and `_source.items` decoded into `items` on 8-K and 8-K/A rows, which every hit of such a filing carries, an exhibit's included: `[]` when EDGAR records none, absent on every other form, Form 1-U hits too, whose `items` use 1-U's own numbering and stay undecoded, and on full-index rows, since `master.idx` lists no items; submissions-feed rows take the feed's own `items` column, pre-2001 codes included (#277)) and counts `total` / `form_distribution` from those filings; no EFTS parameter yields a search's filing count (`collapse`/`aggs` are ignored), so `total` is exact only when one window held every match, else a lower bound beside `total_documents`. **A browse is the exception:** a forms- or entity-only request (no `q`) matches each filing's primary document alone (S-1 January 2025: 200 hits over two pages, 200 distinct accessions, every `file_type` the form), so `hits.total.value` is the filing count and `total` is EDGAR's count — exact when the relation is `eq`, at any offset — trusted while the window shows one document per accession, else back to the window lower bound; `dataset.truncated` still flags a window short of it, and `form_distribution` covers the filings in hand. The straddling merge keeps the window count for its 2001-onward side, since its `total` counts assembled rows. Under `sort=relevance`, `from` counts documents and the 100-hit window runs past the page, so a page lists the filings among its own `limit` documents (the window's first rows, which can number fewer than `limit`) and only a filing straddling a page edge recurs on the next page (#124). `search_filings` returns `next_offset`, `offset` plus the applied `limit` (a clamped `limit` steps by the applied value) in each path's offset unit — documents under `sort=relevance`, the call's assembled filings elsewhere — present only when that offset returns rows (#259). A relevance page is last when `offset + limit ≥ total_documents` on a relation of `eq`, never by `offset` plus the documents fetched, since EDGAR answers up to 100 from `from` whatever `limit` is, and no `next_offset` is named past 9,900. `truncated` and the paging notice mark filings past the page, or matches no offset reaches (a date-sorted or entity window short of the match set, an archive or scan cap, the 9,900 cap), where the notice says how to narrow; `total_is_exact: false` on a relevance page past offset 0 does not set `truncated` by itself. A `gte` document total renders as `10000+` in the window and paging notices. A backend failure arrives as a 200 too, with `errorType`, `errorMessage`, `trace`, and `requestId` in place of `hits`; its handling is in the rate-limit note above (#206). Caller text is escaped before it reaches full-text search: `searchFilings`' `q` and `resolveEntityByName`'s `keysTyped` both go through `escapeEftsText`, which doubles each backslash and writes each control character (category Cc) as `\uXXXX`, so a term holding either is searched as typed. The escape lives in the service, not a tool, so `find_holders`' `search_key` re-sent through `search_filings` runs the same search. `find_holders` quotes the conformed name minus one trailing qualifier — a `\` or `/`, one to six letters, an optional closing `\` or `/` (`/[\\/][A-Za-z]{1,6}[\\/]?$/`, then a trim) — since 13F information tables print the issuer without it: `"US BANCORP"` matches 2,315 documents in the 2026-Q2 filing window, the phrase with its `\DE\` qualifier 2, and `PROGRESSIVE CORP/OH/` is searched as `"PROGRESSIVE CORP"`. A slash inside a name (`CULLEN/FROST BANKERS, INC.`) and an undelimited state token (`UNIVERSAL DISPLAY CORP PA`) stay, and `resolved_issuer_name` keeps the registry title (#205). Two registrants whose titles match once that qualifier is gone (`FIRST BANCORP /PR/` and `FIRST BANCORP /NC/`; `INDEPENDENT BANK CORP /MI/` and `INDEPENDENT BANK CORP`) search one phrase and get the same holders, and keeping the qualifier is no fix (`"FIRST BANCORP /PR/"` matches 9 documents in that window, `"FIRST BANCORP"` 458, FBP's CUSIP 353), so a name search with at least one match checks the in-memory registry (`getAllEntries`, no request) for every other current registrant (a ticker-file row, never a former name) whose title, minus its own qualifier, equals the phrase case-insensitively, and names each with CIK and ticker in a sentence pointing to `cusip`. The sentence joins the tool's `notices` list, since `ctx.enrich.notice` and `ctx.enrich.truncated`'s guidance are last-wins (#224). A notice naming a `secedgar_search_filings` call as JSON — `find_holders`' first-page and continuation recipes, `company_search`'s withheld-filings recipe — puts it in a code span (`markdown().inlineCode`, fenced past any backtick run), since `content[]` renders as Markdown and outside code the quoted phrase's `\"` loses its backslash, as would a caller's form type typed into `company_search`'s `forms` (#220). **Forms filter (#286):** full-text search reads `forms` by `root_forms`, so a listed base form matches on its root and its amendments come with it, a listed `/A` form matches only that exact form, and a list holding both kinds must satisfy both at once. `search_filings` drops a listed `X/A` when `X` is listed. A list still holding both kinds runs as two full-text requests, one per kind, each from offset 0, merged: a browse sums EDGAR's two filing counts (exact when both are exact); a search with terms counts the filings in hand (exact only when both windows held every match); date sorts reorder the merged rows; `sort=relevance` with terms interleaves by `_score`, while a split browse under relevance is newest first; `offset` indexes the merged filings, so there is no document-offset paging past the windows, and such documents are flagged `truncated`, `total_is_exact: false`, with a hint to search one forms group per call. The 2001-onward side of a straddling range runs one window per group; the pre-2001 archive routes are unchanged. A browse's `effective_query` names the forms actually searched (`["10-K","10-K/A"]` reads `(browse: forms 10-K)`)
|
|
105
|
+
- **Submissions archive walk:** the submissions feed's `filings.recent` holds the last year or 1,000 filings, whichever is more — so 26,000+ rows for JPMorgan, and a filing day is never split (Microsoft's window runs to 1,002 rows to finish its oldest day); everything older lives on `filings.files[]` archive pages, up to about 375 KB each (JPMorgan's average about 374 KB). Every tool that reads past `recent` goes through `SubmissionsArchiveWalk` (`submissions-archive.ts`): one `ARCHIVE_PAGE_SCAN_CAP` (10) for all, pages read one at a time through the service's pacer and page cache, and no page selected when the lower bound falls on or after `recent`'s oldest date — so a call answered by `recent` sends no archive request. The caller picks the order — `newest-first` (`company_search`, `search_filings`' pre-2001 arm, `get_material_events`, `get_insider_transactions`' window, `get_beneficial_owners`' window), or `oldest-first` forward from a date (`get_institutional_holdings`' quarter lookup, since newest-first cannot reach JPMorgan's 2020-Q4 13F-HR on page 41 of 70 under the cap) — and can stop after any page; `scannedThrough` (the oldest page start read) and `truncated` (selected pages left unread, whether the cap, an early stop, or a caller that never started the walk left them) are reported the same way everywhere. `olderPagesUnread` says whether the manifest lists a page starting before every page read — any page, when none was read — so it counts pages the date bounds never selected and ignores unread pages newer than the scan reached; `company_search` and `get_material_events` return it as `older_filings_unexamined` beside `history_scanned_through`, present exactly when that is, and `format()` prints `(older filings not examined)` unless it is false, then `(no older filings on EDGAR)`; `get_insider_transactions`' line names the oldest Form 4 reached and claims nothing about older filings (#248). Worst case per call is the submissions document plus 10 pages plus the tool's own document reads (`get_insider_transactions`: 111; `get_beneficial_owners`' window: the submissions document, 10 pages, and 50 documents, 61). `get_material_events` without a date window walks only to fill `limit`: it enters the walk when fewer than `limit` `recent` rows pass the `items` filter — the same count as the stop test, so unrelated recent 8-Ks never stand in for matches (#139) — and stops on the page that fills it with rows passing that filter, and its `dataset.truncated` is true whenever selected pages went unread — including when `recent` alone fills `limit` and no page is read, since the dataframe then holds only the recent window (#134); a result short of `limit` with selected pages unread (only the cap ends a walk that short) gets a notice naming the pages read, the oldest date reached, and the lever — `filed_before=<that date>` alone or in a window when undated, narrowing the window with `filed_before=<that date>` when dated, since a newest-first walk reaches older filings only through an earlier upper bound — appended to the zero-match or empty-window notice when one fires, since `ctx.enrich.notice` is last-wins; an empty-window notice the cap cut short claims no 8-K only "as far back as the scan reached" and drops its widen-the-range advice (#139); the zero-8-K notice also tallies the Form 6-K rows (and 6-K/A) of every block the call reads inside the caller's window, at no added request, since a foreign private issuer files 6-K where a domestic one files 8-K (#274): with none it says "Widen the date range" only for a window read in full and otherwise points to `secedgar_company_search`; with some it names the count and the newest filing date (`in that window`, `in that history`, or `in the filings read` on a page-capped scan) and a `secedgar_search_filings` call as a code span (`{"query":"cik:<CIK>","forms":["6-K"]}` plus the caller's `filed_after` / `filed_before`); an undated scan that read every page says "read back to its first filing on <date>" and gives no widen advice, since nothing older exists, and a page-capped scan keeps its depth sentence; `get_institutional_holdings` stops on the first page holding a 13F-HR or 13F-NT for the quarter, and runs the #86 operating-company routing only when neither `recent` nor the pages read hold any 13F-HR or 13F-NT — a notice-only manager asked for a quarter it filed nothing for gets the quarter miss, which names the filer (`resolved_cik`, `resolved_name`) and carries no `latest_quarter` (#117, #133, #254); without a `quarter`, a manager whose `recent` holds 13F-NT notices and no 13F-HR gets the notice message for its newest notice rather than the #86 classification (#133). **Page selection widens both date bounds by a day:** a manifest page's `filingFrom` / `filingTo` can sit a day off its own rows in either direction (JPMorgan's page 041 is listed to 2021-02-17 but holds 42 filings dated 2021-02-18; Apple's page 001 is listed a day past its newest row), so an exact overlap test skipped the page holding a window's edge day. The slack costs at most one extra page per bound, and every caller filters rows by their own filing dates (#137)
|
|
106
106
|
- **13F amendment composition:** `get_institutional_holdings` composes a quarter from the original 13F-HR and its same-period 13F-HR/A amendments (`composeHoldings`), ordered by `acceptanceDateTime`, then filing date, then accession — never `amendmentNo`, since filers skip numbers and two amendments can land on one day. A `RESTATEMENT` replaces everything composed so far, earlier `NEW HOLDINGS` included, so the base is the last restatement whose table reads (the original when none does) and nothing before it is read (`superseded`). A `NEW HOLDINGS` after the base appends its rows, unless its table repeats every composed row (CUSIP, class, put/call, discretion, shares, share type; value is left out because its unit changed on 2023-01-03) — a mislabeled resubmission that would double the portfolio — in which case it applies as a restatement. Each accession's values normalize by its own filing date. An amendment whose type, index, or table cannot be read, or whose table has no rows, is `not_applied` instead of blanking the quarter. The original's table is always read (it backs `total_holdings_in_filing`); each amendment table is two more requests on the call's `CallScope`, and a 429 or a spent budget stops further optional reads (#198).
|
|
107
|
-
- **Filing metadata outside `recent`:** `get_filing` takes `form`, `filing_date`, and `period_ending` from `recent` when the accession is there, else from the filing's own SEC header — the raw `<TYPE>` / `<FILING-DATE>` / `<PERIOD>` in `index-headers.html`, which the tool already fetches to type the documents, and only when that page 404s (common before 2014) the sub-1 KB `<accession>.hdr.sgml`. `FILING-DATE` is the filing date, not the acceptance timestamp, and matches the submissions feed; an S-8 or Form 4 header has no `PERIOD`. `company_name` stays the current registrant name (#126), read from the feed of the CIK whose directory served the filing. The same feed names the filings that amend or withdraw the one read, at no added request (`later_filings`, oldest first, #268): for a periodic report (10-K, 10-KT, 10-Q, 10-QT, 20-F, 40-F) the `/A` of that form carrying the same non-empty `reportDate` (the Exchange Act file number is shared by every 10-K, 10-Q, and 8-K, so it identifies nothing); for a registration statement (S-1, S-3, S-4, S-11, F-1, F-3, F-4, F-6, F-10, SF-1, SF-3) its `/A` or an `RW` under the same `333-` file number,
|
|
107
|
+
- **Filing metadata outside `recent`:** `get_filing` takes `form`, `filing_date`, and `period_ending` from `recent` when the accession is there, else from the filing's own SEC header — the raw `<TYPE>` / `<FILING-DATE>` / `<PERIOD>` in `index-headers.html`, which the tool already fetches to type the documents, and only when that page 404s (common before 2014) the sub-1 KB `<accession>.hdr.sgml`. `FILING-DATE` is the filing date, not the acceptance timestamp, and matches the submissions feed; an S-8 or Form 4 header has no `PERIOD`. `company_name` stays the current registrant name (#126), read from the feed of the CIK whose directory served the filing. The same feed names the filings that amend or withdraw the one read, at no added request (`later_filings`, oldest first, #268): for a periodic report (10-K, 10-KT, 10-Q, 10-QT, 20-F, 40-F) the `/A` of that form carrying the same non-empty `reportDate` (the Exchange Act file number is shared by every 10-K, 10-Q, and 8-K, so it identifies nothing); for a registration statement (S-1, S-3, S-4, S-11, F-1, F-3, F-4, F-6, F-10, SF-1, SF-3) its `/A` or an `RW` under the same `333-` file number, matched exactly, so a co-registrant's suffixed number never matches its base (EFFECT, 424B, and POS AM rows under that number are not amendments of it; N-2 stays out, since its `/A` as often carries only an `811-` number). A later amendment of an amendment is named, since an amendment is read by its base form. Only `recent` is read, which lists filings newest first, so the rows above a listed filing's are those filed after it, and a filing the window omits is placed among the rows by its own header filing date (`checkLaterFilings`, `laterFilingsNotice`). A registration statement's `333-` number comes from its own feed row inside the window; outside it, from the header's `<FILER>` or `<SUBJECT-COMPANY>` block for the CIK whose feed is read (a 2025 F-6 has no `<FILER>` block; the issuer's `<SUBJECT-COMPANY>` holds it), at no extra request, and a CIK whose blocks carry different numbers is left out. With neither header source the form is unknown and nothing is said. Dated before the window's oldest row, every row is checked and the notice ends `Amendments filed before <oldest> were not looked for.`, after the named filings or after `No amendment of it was filed from <oldest> on.`. Dated inside the window, only rows dated after it count as later, and with none the notice says `No amendment of it was filed after <date>.`. Dated on or after every row (the cached feed, up to `EDGAR_TICKER_CACHE_TTL` old, can lag a filing just made), nothing is checked: `The filer's submissions feed lists neither this filing nor any filed after <date>, so later amendments of it were not looked for.` A listed filing splits same-day rows at its own row, since the feed orders a day by acceptance time; an omitted filing's same-day matches are named `<form> <accession> was filed the same day (<date>); the feed does not show whether before or after this one.`, never as later. When the match key cannot be read nothing is looked for and the notice says so, so an absent `later_filings` never reads as none: a registration statement with no number for the resolved CIK, a number outside the `333-` series, or a feed that records no file numbers, `Amendments and withdrawals of it were not looked for, since its 333- file number could not be read.`; a periodic report with no period of report, `Amendments of it were not looked for, since its period of report could not be read.`; a header with no `FILING-DATE`, `Amendments of it were not looked for, since its filing date could not be read.` (#268). The notice leads `get_filing`'s guidance and `content[]` carries a `Later filings:` line
|
|
108
108
|
- **Filer lookup (#203, #215, #256):** without `cik`, `get_filing`'s candidate CIKs are the filers EDGAR full-text search records for the accession, then the accession number's own prefix (the filer's CIK, or a filing agent's). A search SEC cannot answer (`ServiceUnavailable` — `sec_unreachable`, `sec_unavailable` for a 500, 502, 503, or 504 once its retries are spent (#233), `efts_degraded_response` — or the `Timeout` a 408 or 425 maps to) degrades to the prefix alone, so `get_filing` never surfaces `efts_degraded_response` and does not declare it; the caller's cancellation and `rate_limited` still end the call. When no candidate serves the filing — a directory listed the target and the archive answered 404, or no directory answered at all — `resolveFilingArchive` reads `<accession>-index.html` under the prefix CIK (`tryGetFilingPartyCiks`): SEC serves it there for any existing accession, an agent's prefix included even when that directory has no `index.json` (a 1999 SC 13D's agent path, a 2025 Donnelley 10-K's), and answers 404 for an accession that does not exist. Its party links (`browse-edgar?CIK=<10 digits>`: Filer, Subject, Filed by) are scanned in one forward pass (`filingPartyCiks`), and up to three CIKs not yet tried are searched the same way, #158 fallback included. A document no listing names skips the page, since every party's directory lists the same files. The page costs one request on a path that failed before and none when a candidate serves the filing; an unavailable page read degrades like the search. Misses after that name `cik` in their hints, never the document that just failed, and say when a filer lookup was unavailable — except `filing_not_served`, below. `tryGetFilingIndex` drops the entries SEC lists with no filename (a pre-2001 submission's documents, which exist only inside `<accession>.txt`), and a blank `document` reads as omitted. **An existing filing the archive does not list (#256):** SEC's archive answers 404 for an existing filing's `index.json` at times, and caches that answer for minutes, longer than the call's 40 s failure budget. When every `index.json` read answers 404 but a source shows the filing exists — the cik-less full-text hit already in hand, `<accession>-index.html` answering 200, or, with `cik`, one `findFilingCiks` sent only on this path when the page did not answer 200, whose untried CIKs (up to three) are searched like the page's parties — the call fails `filing_not_served` (`ServiceUnavailable`, `retryable: true`), naming the CIKs tried and the evidence, with no in-call retry. A cache hit whose metadata re-read fails does the same, naming the cached CIK, since the cached text shows the filing exists, and drops the entry, so the next call resolves the filing in full and a filing SEC has since removed fails `filing_not_found` there. `filing_not_found` means no EDGAR source lists the accession. A 404 from the full-text endpoint, which it never answers for a search it ran, reads as the lookup being unavailable at both search sites (`lookUpFilingCiks`); with `cik`, a miss after an unavailable lookup ends `or retry in a minute`. The success path sends none of these requests
|
|
109
109
|
- **Primary document (#161):** the primary `get_filing` reads when `document` is omitted, lists under `documents.primary`, and names in its error catalogs is the name SEC records (`recordedPrimaryNames`): the submissions feed's `primaryDocument` when the accession sits in `recent` (last path segment — an XML form is recorded through its stylesheet path, `xslF345X06/form4.xml`), else the document the header page types with the submission's form. Only with neither does the largest readable document stand in, and the viewer-page guard there matches `R\d+.html?`, not every name starting with `R` (`Report10K.htm`). Size alone picked an 8-K's press-release exhibit over the form and a 13F-HR's information table over its cover page. The header page and the feed are read together right after an index is found and before the body, since every outcome — the error catalogs included — names the primary from them. **An XML form reads as SEC renders it (#216):** the stylesheet path the feed records serves SEC's HTML rendering of the form under the filing's archive directory, while the raw XML's tags strip to one unlabeled line — Maplebear's SCHEDULE 13D/A (0001193125-26-442148) reads as 13,443 characters on one line raw and as 857 labeled lines rendered, Items 1 and 4–7 detected as headings. The rendering prints filer-written text (a 13D's Items, a reporting person's cover-page note) in `div.largetext`, styled `white-space: pre-wrap`, so that div takes html-to-text's `pre` formatter in `CONVERT_OPTIONS`, with a plain div's one line break around it: collapsed, Item 4 ran `as follows: On October 28` together. The 13D and 13G stylesheets carry that one pre-wrap class; the Form 4, Form 144, and Form D ones none. A selector, not a regex pre-pass: a pass matching `<div class="largetext">` missed the cover-page notes, whose div carries a `style` attribute. With `document` omitted, `searchArchive` reads the rendering first (`renderingToRead`) and the raw file when the rendering answers 404 or SEC is unavailable for it, degrading like the #203 index-page read (`unlessSecUnavailable`), so a rate-limit refusal or the caller's cancel still ends the call. `primary_document` and `filing_url` name the path read; `documents` keeps the raw file as the primary; a caller-named raw file reads as it always has, and a caller-named stylesheet path the feed records for the filing reads the rendering. The rendering is read only while the index lists the raw file at `MAX_RENDERED_RAW_BYTES` (600,000) or less — a raw file listed with no size reads as filed: a holdings report renders at about 20 times its raw size (Vanguard 500 Index's NPORT-P 0000036405-26-000325: 500,525 bytes raw, 9,777,862 rendered, 4.2 million characters of text), and `html-to-text` silently cuts input past 16,777,216 characters, 28 times the bound, while a 13D/A renders at under 3 times (25,851 → 69,523 bytes) and a Form 4 rendering runs about 16 KB. The success path still sends one document request. Only the feed records the path, so a filing outside `recent` reads its raw file. `get_insider_transactions`, `get_beneficial_owners`, and `get_fund_holdings` parse the raw XML through `rawDocumentName` and are unaffected. The Form 144 rendering (`xsl144X01`) is ISO-8859-1 declared only by a `<meta>` tag, and SEC sends it as `text/html` with no charset, as it does every archive read (the browse-edgar Atom feed sends `charset=utf-8`), so its no-break spaces decode through `BodyTextDecoder` rather than reading as U+FFFD (#273)
|
|
110
110
|
- **Filing content:** HTML → text via `html-to-text` library; pre-2005 filings produce noisier output. The library walks the DOM recursively, so `CONVERT_OPTIONS` caps it at `limits.maxDepth: 512` with a `[…]` ellipsis where the cut falls — without it deep markup overflowed the stack and one such candidate failed `search_filings`' whole pre-2001 text scan (#118). The bound must hold on both runtimes the server ships under: a fresh Node process overflows near 1,360 levels of nested lists (its most stack-hungry shape), Bun near 13,000; real HTML filings measure under 25 levels. Legacy SGML `<PAGE>` markers are replaced with a line break before parsing (`neutralizePageMarkers`) — the parser never closes them, so a text document otherwise nests one level per page and a long one would be cut at the cap; with them gone the deepest measured `.txt` sits under 100 (an EX-27 schedule's unclosed tags). Both changes leave every sampled filing's text byte-identical. `limits` deep-merges with the library defaults, so its 16,777,216-character `maxInputLength` (silent truncation, no ellipsis) still applies. **Plain-text SGML bodies keep their lines (#136):** the parser collapses every newline run to a space, so a plain `<TEXT>` body — a pre-2001 full submission, a 2000s ASCII primary document — lost the line structure `detectHeadings` anchors on (Apple's 1996 10-K came back as 104 lines with an empty outline). `preservePlainTextBodies` runs inside the one `convert()` call: a body is HTML when `<html`, `<body`, `<p`, `<div`, `<br`, `<font`, `<tr`, `<td`, or `<xml` opens anywhere in it (`\b`-bounded, so `<PAGE>`, `<PDF>`, and EX-27's `<PP&E>` don't trip `<p`; no `<table`, since EDGAR ASCII tables are `<TABLE>`); any other body has every tag dropped, `&`/`<`/`>` escaped, and goes in a `<pre>`. The list is broad because misreading HTML as plain wrecks it, while the reverse is only the old output. Tags are dropped rather than parsed: the parser formats `<TABLE>`/`<CAPTION>` as blocks inside the `<pre>`, and a stray `<word` in prose would swallow text up to the next `>`. The `<TEXT>` wrapper matches case-sensitively — EDGAR writes it uppercase, and an inline SVG `<text>` is not a body — and the scan is one forward `indexOf` pass, since a lazy `<TEXT>([\s\S]*?)</TEXT>` regex goes quadratic on openers with no closer. Input with no plain body reaches the parser unchanged, so current HTML and 2000–2004 SGML-wrapped HTML convert byte-identically; their outlines change only where an unpunctuated Item cross-reference opens a line and drops out as wrapped prose (see Heading detection). Kept indentation grows plain extractions about 19%. **Every document of a submission holding an HTML document (#159):** the parser converts only `<body>` elements when the input has one, so an HTML-era submission (HTML primary, plain EX-10/EX-27 exhibits) lost every plain exhibit, and the pre-2001 scan could not match exhibit text. When the input holds `<body`, each plain body's `<pre>` goes inside a `<body>` of its own, so every document converts in document order, separated by the block break the parser already puts between two HTML documents — no per-document label, as multi-HTML submissions never had one. Uuencoded payloads (GRAPHIC, a PDF behind `<PDF>`, whose encoded bytes can pass the HTML test) and machine-readable files by `<FILENAME>` extension (`.xml`/`.xsd`/`.css`/`.js`/`.json` — a modern full submission's XBRL and renderer files read as plain) stay outside, dropped as before, and so does the SEC header, as it always was for these submissions. Input with no `<body>` — a plain-only submission — converts whole, header included. Over 93 corpus files only the 10 submissions mixing HTML and plain documents change: each old text is a prefix of the new one and all 186 old outline entries keep their offsets. The primary is document 1, so its headings come first and exhibit headings only fill what the 50-entry cap leaves; cross-document keep-later dedup moved none. **The XBRL renderer's files are cut (#160):** in the same `<body>` case, a document whose `<TYPE>` is `XML` is removed from the input. That is the type EDGAR gives every file its renderer generates (`R1.htm`…, `Show.js`, `report.css`, `FilingSummary.xml`, described `IDEA: XBRL DOCUMENT`). The viewer pages carry `<body>` elements, and so does 2011's `Show.js`, in a string literal, so the R-file tables followed the filed documents. The rule keys on the type, not the `R\d+.htm` name: across 79 sampled 2014–2026 indexes every one of 1,081 R files is typed `XML`, no filed document is, and inline-XBRL primaries carry their form type. Only the 4 corpus submissions holding renderer files change, each new text a prefix of the old. Indented headings stay undetected (centered S-4 headings; Items indented in 2 of 29 sampled 10-Ks): admitting indentation fills the outline cap with centered cover legends and promotes indented TOC rows. The one exception is a same-line titled Item opening on a single NBSP (#176, see Heading detection). **A primary the archive does not serve (#158, #213):** many 2000–2001 indexes list sequence-numbered documents (`0001.htm`, `0001.txt`, `0002.txt`) that answer 404 under those names. SEC serves them under the accession-prefixed name (`<accession>-0001.htm`, each a `<DOCUMENT>`-wrapped copy: TOSCO's 10-Q 0000899681-00-000406 answers 404 as `0001.htm` and 200 with 74,863 bytes prefixed), so a sequence-numbered name that 404s is read again under that spelling in the same directory before the next candidate CIK is tried (`archiveSpellings`). `primary_document` and `filing_url` then name the spelling read, `documents` keeps the index's names, and a caller-named `document` resolves in either spelling, the given one read first (`requestedReadNames`). With `document` omitted, the prefixed read is optional like the rendering read (#216, `unlessSecUnavailable`): one SEC cannot serve (no response, or a 5xx — a 504 included — once its retries are spent) counts as not served and leads on to the full submission below, while a rate-limit refusal, a 403, or the caller's cancel still ends the call; a caller-named spelling's read fails as any read does. Only for a filing serving neither spelling, when no candidate CIK serves the index's primary, does `resolveFilingArchive` read the full submission `<accession>.txt` instead: `primary_document` and `filing_url` name the `.txt`, and the notice (composed into the truncation guidance, since `notice` is last-wins) names the unserved file. The fallback runs after the CIK loop, so a CIK that serves the primary still wins, and a served primary costs no extra request. A caller-named `document` is never swapped — a listed one served under neither spelling fails `document_not_found` with a hint naming `<accession>.txt`. The extract cache stores the document and CIK each text came from, so a cache hit reports the same primary, notice, `cik`, and `filing_url` as the miss that filled it, with no candidate-CIK search. **Tables print one row per line (#257):** the `table` selector takes the `tableRows` formatter (`formatTableRows`, then `printTableRows`). html-to-text's own `table` format prints a plain block unless the table is listed in its deprecated `tables` option, so rows and cells got no breaks: an inline-XBRL statement came back as one line with labels run into figures, and a table whose cells hold `<p>` lost its rows. Rows are the table's `tr` elements, read through `thead`/`tbody`/`tfoot` and any other wrapper holding rows up to `MAX_TABLE_WRAPPER_DEPTH` (8) levels; loose content (a caption, stray text, cells outside a row) prints in place as a field of its own, and rowspan is ignored. A row prints as one line by how many of its fields hold text. Two or more: tab-separated fields, each field's own line breaks and nested tabs folded to one space and its ends trimmed (NBSP included), a cell spanning N columns followed by N−1 empty fields (capped at `MAX_TABLE_COLSPAN`, 100), trailing tabs trimmed. One: a layout row (a spacer beside a paragraph, a caption, a wrapper around a nested table), printed as the block layout did, with line breaks and nested rows kept, no tabs, and only html-to-text's whitespace trimmed (NBSP indentation kept), so prose a filer places in a table cell keeps its paragraphs (the 13D/A Item 4 text, #216). None: dropped. Every trim and empty-row test passes over the #239 sentinels: a row holding only sentinels is dropped and its sentinels move to the start of the next kept row, so the marked conversion strips to the unmarked one byte for byte. `dataTable` was measured and rejected: +24.8% size, 814 multi-word cell texts no longer contiguous (a cell's second line lands beside its neighbours' first), marked ≠ unmarked on 12 of 14 filings (its column widths count the sentinels). Over those 14 filings the tab layout keeps the non-whitespace character sequence, the marked = unmarked text, and the links on all 14, at −0.96% size. Plain-text SGML bodies and documents without `<table>` convert as before. Heading detection and section matching read a tab as the cell separator (below). **In-document links are read in the same conversion (#239):** given a links array, `filingToExtract` marks the string `convert()` receives — after `preservePlainTextBodies`, so the body rules above run first — with a sentinel (U+FDD0, a decimal index, U+FDD1) before the first text character of each fragment link (`<a href="#…">`) and of each linked target, and `stripSentinels` takes them back out of the output in one pass, recording each one's offset. A target is the first element whose `id` is the fragment, else the first `<a>` whose `name` is, as a browser resolves it. The first text character after a start tag passes over tags, comments, `script`/`style` bodies, and html-to-text's whitespace (` \t\r\n\f`, U+200B), literal or as a character reference (`;` optional, as the parser reads it). A sentinel right after the start tag changed the text: a blank line where an empty target `div` opens a block, a leading space where a target's text opens on ` ` or an empty link sits before a `​` cell. At the next text character all 61 sampled 2008–2026 documents (57 with links) convert byte-identically to the unmarked conversion. No links are read, and the text converts unmarked, when the input already holds U+FDD0 or U+FDD1 (literal or as a numeric reference) or when the marked input would pass the parser's 16,777,216-character `maxInputLength`; a target with no text after it (a proxy card's images) records no link. The scan is one forward pass: a start tag reads `<` to the next `>`, a `<` with no `>` after it or a comment, `script`, or `style` with no closer ends the scan, and the marks waiting for text are all placed at the next text character. `search_filings`' pre-2001 scan passes no links array and converts as before. The links are cached with the extract (`CachedExtract.links`), so a cache hit lands `section` where the miss did (Section matching)
|
|
@@ -112,8 +112,8 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
112
112
|
- **Section matching:** `get_filing`'s `section` compares through `foldForHeadingMatch` (`filing-to-text.ts`) on **both** operands — Unicode whitespace runs collapse to one space, U+2018/U+2019 → `'`, U+201C/U+201D → `"`, then lowercase. Comparison-time only: `FilingHeading.heading`, the `outline` output, `content[]`, and every character offset keep the document's own bytes. EDGAR headings carry NBSP runs and typographic quotes, so a caller re-sending an outline heading through a UI that normalizes either one never byte-matched the heading it came from — which broke the `section_not_found` recovery loop the error's own hint points at (#106). No fuzzy matching — `"item 8"` resolves only to Item 8 — but every tier runs on folded operands, so a single-spaced needle also reaches a heading whose marker carries an NBSP run or a double space (`Item 9.` in a 2004 10-K). Folding only one operand does not fix the round trip. One boundary (`sectionMatchRank`): a needle ending in a number never continues into a longer one, and within a substring tier a match where the number ends ranks ahead of one that runs on into a letter. A trailing digit never runs on into another digit, so `item 1` matches `Item 1.` and `Item 1A` but never `Item 12`, and `item 5` reaches an 8-K's `Item 5.02` while `item 5.0` does not. A value ending in a number matches only that number, the number alone first: `item 9` reaches Item 9 — a table-of-contents row for it included — ahead of Items 9A–9C, `item 1` reaches Item 1 and then Item 1A, never Items 10–16, and `part i` never reaches Part II. A trailing roman numeral (a final word of `i`, `v`, `x`) must end at a space, punctuation, or the heading's end, so `part i` never matches `PART II`, `PART III`, `PART IV`, or `PART II, III`: Sono-Tek's 10-Q (0001171520-26-000305), which prints Part I only inside a one-line TOC, landed `part i` on `PART II - OTHER INFORMATION`, and Microsoft's FY2026 10-K on `PART II, III` (348204). `part i` now falls through to the line tier (Microsoft: the body `PART I` at 6900) or misses with the outline (Sono-Tek; an S-1, whose Part I is the unlabeled prospectus). Plain-text outlines keep TOC rows worded differently from their body heading, and a TOC row for Item 10–16 precedes the body Item 1 — a bare substring test landed `item 1` on another Item in 6 of 37 plain 10-K/10-Q outlines and 1 of 270 HTML landings (#136). **Resolution order (#169, #166, #177)**, first hit wins, over every detected heading (`detectHeadings(text)`, which takes no cap, run once per call — the 50-entry cap belongs to the rendered outline alone; with the first 50 only, a heavy 10-K's financial-statement captions put Items 9B–16 out of reach) and the document's own lines: (1) **exact** (`resolveSection`) — a heading whose `headingKey` (the dedup key: the fold, a terminal-punctuation strip, and the marker separator folded to one space) equals the needle's, or whose title after its Item/Part marker does — failing that, the same with a leading sub-item label removed (below); a bare marker (`ITEM 1.`, `Part II`) has no title and is never a candidate, or GSBD's `item 1` jumps to a bare TOC `ITEM 1.`. The tier exists for #170's widened all-caps class: CCC's `SPECIAL NOTE REGARDING FORWARD-LOOKING STATEMENTS AND RISK FACTORS` (7562) otherwise takes `risk factors` from `Item 1A. Risk Factors.` (67351). (2) **Item/Part substring** — the first Item or Part heading (`isStructuralHeading`, bare and run-in markers included) that `sectionMatchRank` matches: a value inside an Item title names that Item, while a line equal to it is often a table-row label (CCC's `compensation` → `Item 11. Executive Compensation` at 493087, not the `Compensation` cell at 418658). (3) **an equal line** and (5) **a table-row label, else a prefix line, else a column-header row** — a document line (`matchSectionLine`, `filing-to-text.ts`, which reports whether its line ranks in tier 3; `findSectionLine` is its offset alone), for a mixed-case subheading the outline never lists (`Liquidity and Capital Resources`): a line whose `headingKey` equals the needle's and that labels no table row (3), else — only when no such line exists — the first equal line that labels one (5, below), else one that starts with it (5) at a word boundary within `MAX_TITLE_CHARS` (a date-suffixed title: `Consolidated Schedule of Investments as of June 30, 2026`), unless a one-word needle runs on into a longer Title Case title (`continuesIntoLongerTitle`: the next word opens on a capital in a line that is not all caps). One word heads many unrelated titles — `business` landed on `Business Combinations.` (C3is), `Business Seasonality and Product Introductions` (Apple 10-Q), and a cross-reference line `Business Overview—Governmental regulations…` (DRDGOLD); a needle of two or more words keeps its continuation (`Human Capital` → `Human Capital Management`), and a suffix opening lowercase or on punctuation (`(continued)`, `—Parent Company Only`) always does. The cost: `forward-looking` no longer reaches `Forward-Looking Statements`, nor `revenue` `Revenue Recognition`; both miss with the outline. Equality goes first because a prefix match alone lands `Competition` on an earlier line that merely begins with the word. **A summary entry yields to other equal lines (#275):** an equal line whose next line with content is a parenthesized page reference alone on its line (`(page 34)`, `(See page 126)`, `(pages 34 and 35)`, a range, a lettered page such as `(page A-1)`) is a merger proxy's summary entry, not the section. It still ranks in tier 3, but lands only when no other equal line does, and ahead of the row-label, prefix, and column-header fallbacks; its link is not followed, since some filing agents link a page reference to the top of the printed page. A same-line `Title (page N)` is not an equal line and stays a prefix line. **A table-row label ranks in tier 5, ahead of a prefix line (#184):** an equal line labels a row when its next line with content (spacer lines passed over) is a figure row, or is a label — at most 60 characters, opening uppercase, ending on no `.`, `:`, `;`, or `,`, closing quotes and brackets passed over (a cross-reference `See “Item 18. Financial Statements.”` over its page number is no label) — whose next line with content is one (`labelsTableRow`; Microsoft's segment table `Revenue` / `Client` / `$ 9,350 …`). A figure row is a lone currency or nil cell (`$`, `-`, `–`, `—`), or a line whose text after its last letter holds a digit and, when the line has a letter, opens on a dotted leader, a tab, or two or more spaces behind a label of at most 60 characters (`isFigureRow`: `Product sales....... $4,759`; ``$ 7,746 $ `7,835``, a stray backtick in a 2004 cell); one space never qualifies (`The effective rate was 21%.`), and past the label bound the line is a table set on one line, which a heading may sit over (AMC Robotics' S-1 0001493152-26-047958: MD&A `Revenue` at 177926 over `Three months ended June 30, 2026 2025 $ Change …`). **A table row compares by its label (#257):** a line holding a tab (a table row, see Filing content) compares by its first text field. An equal label whose later fields are figures ranks as a row label (tier 5, `labelsRow`), as does one whose lines below read as a figure row; an equal label followed by text fields stays an equal line, unless two or more fields follow and every one reads as a column header (at most 60 characters, holding a letter, ending on no period, no digit before its last letter, so a footnote mark after it passes: `isColumnHeaderRow`): that row heads a table's columns and ranks last in tier 5, after every prefix line, landing only when nothing else matches. JPMorgan Chase's DEF 14A (0000019617-26-000096) heads its voting table `Proposal→Voting options→Vote requirement→Effect of abstentions1→…`, and as an equal line the header took `proposal` from the proxy summary's `PROPOSAL 1:` line; a side heading beside its text (`Competition→We face intense competition…`), a two-column row (Apple's `Proposal→Recommendation of the Board`), and a row of figures with their units (`Revenue→$193.5 billion (1)→…`) keep the equal-line reading. Over the 14 corpus filings and 11 more drawn outside them, × 77 values, the rule moves that one landing. A row whose label is not the value ranks as a prefix line, landing at the row's start, when a later field opens on the value with a digit past it in that field (`laterFieldLabelsFigure`): JPMorgan Chase's DEF 14A prints its highlights as label-and-figure cells (`Revenue $182.4B Reported→…→Net income $57.0B→…` over `$185.6B Managed1,2→…→Earnings per share (“EPS”) $20.02→…`), and read by its first field alone the row passed `net income` to a segment's `Net income $18.2B` row and left `earnings per share` unanswered. A field opening lowercase, equal to the value, or holding no digit past it (`Human capital management` in a skills matrix) does not count; without the digit test the rule moved JPMorgan's 10-Q MD&A back onto its TOC row and `human capital` onto skills-matrix cells. Over the same 25 filings × 77 values it moves 4 landings: those two, Microsoft's DEF 14A `net income` onto its fiscal-year highlights row, and Goldman Sachs' onto a pay-versus-performance header row. `isFigureRow` reads the fields after the label as figures when every one is letter-free and at least one holds a digit, whatever ends the label (`Basic (A/B)→$→18.00`), and a row of nil cells too (`—→—`, `Goodwill→—→—`); a column-header row of years stays a header (`Three months ended June 30,→2026→2025→$ Change`). All 13 `Revenue` lines in Microsoft's 2004 10-K (0001193125-04-150689) label rows, and as tier-3 lines took `revenue` from `SEGMENT PRODUCT REVENUE/OPERATING INCOME (LOSS)` (81018) to the selected-data row at 66987; Aware's `Revenue:` over `Product sales....... $4,759` (112947) took it from `CONTRACT REVENUE` (49489). Demoted rather than skipped, a row label still lands when no heading contains the value (`total revenue` keeps its income-statement row), under the plain line notice. The test reads at most two content lines past an equal line. Over 26 corpus filings × 104 section values it labels 124 lines on the resolution path, none a detected heading, and moves 22 landings and no outline entry: 15 from a row label onto a heading or prose subheading for the value (Microsoft FY2026 `revenue` → its MD&A `Revenue` subheading at 217873; `earnings per share` → the EPS note in both Microsoft 10-Ks), 2 onto a table's caption line, 1 onto another row label (BAB's `goodwill`, from its balance-sheet row to a note table's), and 4 onto a heading that only contains the words (Arxis `net income` → `NOTE 16. NET INCOME (LOSS) PER SHARE`, and Nutanix's → `NOTE 11. NET INCOME (LOSS) PER SHARE` past a `Net income` row of `—` cells; CCC `net income` → the all-caps row label `NET INCOME (LOSS) INCLUDING NON-CONTROLLING INTEREST`, a detected heading; CCC `revenues` → `COST OF REVENUES` at 332106, since all four of its `Revenues` lines label rows). In both line tiers a line is skipped when it opens lowercase (a wrapped sentence or bullet); when it sits under a line ending on a comma or semicolon, or opens on an unpunctuated Item marker followed by a lowercase word (a wrapped cross-reference, the `followsMidSentence` / `isWrappedProse` guards heading detection applies: `…in Part II,\nItem 8 on this Form 10-K…`); or when it is a TOC row (`isTocRow`). A TOC row ends in a page cell set off by **two or more** spaces or a tab (`TOC_PAGE_TAIL_RE`; one space would read the year in `as of June 30, 2026` as a page number), unless it is a table row holding a figure cell before that cell — a field after its first with no letter (`holdsFigureCells`): Apple's 2005 income-statement row `Net income→→$→295→→$→63` ends like a TOC row, and as one it was skipped, sending `net income` to a note's prefix line and `goodwill` to `section_not_found`, while a TOC row's fields before its page cell are titles, its first a title, marker, or number (`1.→Business→4`); over 25 filings × 77 values that moves 4 landings, each onto its statement row, and no outline entry or TOC flag. Or its next line with content is a page cell (`PAGE_CELL_LINE_RE`: a number, `F-3`, or a lowercase roman `ii`, which counts only on its own line — `Part iv` is not a page cell); either form may put a `Page` or `Pages` word before the number, and after one may list pages and ranges (`Pages 3-5, 18`), spacer lines passed over (an HTML TOC table puts NBSP rows between its cells). A line holding no tab between two table rows that each end in a page cell behind fields holding letters is a TOC group label. A line that is not a marker, followed directly by an Item/Part marker, is a TOC title cell with no page column; a marker run straight into its title counts (`MARKER_LINE_RE` takes `TITLE_RUN_IN`, #180: `Item 2Properties`). A marker line — a Part over its first Item — is a TOC row when that Item row is: the Item line ends in a page cell, the line below it holds or ends in one (a title cell, or Aware's wrapped `of Equity Securities....... 12`), or, for a bare marker, the line below its title holds one. Microsoft's FY2026 10-K prints body `PART IV` only as page furniture, so `part iv` reaches the line tier, where `PART IV / Item 15. / Exhibit and Financial Statement Schedules / 93` was taken; it now lands on the body's first `PART IV` (352884). A body Part sits over its Item too, but prose follows, not a page cell. The first remaining line wins, at its first non-blank character; one linear pass serves tiers 3 and 5, run only after tiers 1 and 2 miss or tier 2's match is a table-of-contents row that gives way (below), so a value landing on a tier-4 heading now pays that pass (7–11 ms on a 1 MB S-1). A cut page's guidance after a `section` landing says to pass `next_offset` as `offset` without `section`, which outranks `offset` — kept, it returns the same page. A line landing says so in the notice, composed into the truncation guidance when the page is cut (`notice` is last-wins): `No detected heading matches section '<value>', so this page starts at the first document line that does.` — no new output field. An equal line that outranked a heading merely containing the value says `No detected heading equals section '<value>', so this page starts at the first document line that does, ahead of headings that only contain it.` instead, since that heading does match by substring. Every #166 acceptance offset holds. (4) **other substring** — the first other heading that `sectionMatchRank` matches, after the equal line: a heading that merely holds the word took Arxis' S-1 `business` to `NOTE 3. BUSINESS COMBINATIONS` (544705) past its `Business` heading line (323578), and CCC's `revenue` to `COST OF REVENUES` (332106) past the MD&A `Revenue` subheading (256790). An exact or Item/Part heading still beats an equal line (Reddit's `use of proceeds` → the `USE OF PROCEEDS` heading); every other heading ranks after one. Over 67 corpus filings × 103 section values the order moved 24 landings, each one the validation predicted: 17 onto the section named (Microsoft FY2026 `general` → `GENERAL` at 8720, not `GENERAL RISKS`; DRDGOLD's `risk`, `directors`, `management`, and `employees` → body Items instead of TOC rows), and 7 onto a different place that is defensible but that a reader may like less, since an Item heading or a line equal to the value now outranks a heading that only holds it — JPM's 10-Q `risk` lands on Item 3, a one-sentence cross-reference, not `FIRMWIDE RISK MANAGEMENT`; `revenue` in Microsoft's 2004 and FY2026 10-Ks and Aware's on a selected-data, MD&A-table, or income-statement row label rather than a heading containing the word — the three landings tier 5's row labels move (#184, above); `summary` on Item 16 `Form 10-K Summary`; Intel's 2000 `consolidated balance sheets` on an Item 14 index row. (6) `section_not_found`. **A proxy statement keeps its headings ahead of the lines:** for a proxy or information statement form (`PROXY_FORM_RE`: DEF 14A, DEFA14A, DEFM14A, PRE 14A, DEF 14C, …), tier 1 is followed by the first heading of any kind that `sectionMatchRank` matches, then the line tiers — its ITEM headings are ballot proposals, not the Regulation S-K item taxonomy, and its lines equal to a value are mostly table cells. Under tiers 2–4 Goldman Sachs' DEF 14A (0001193125-26-117433) took `compensation` from the CD&A (123680) to `ITEM 2. … (SAY ON PAY)` (274744) and `summary` from `EXECUTIVE SUMMARY` (16953) to a Pay versus Performance column header (282286). The form is read before `section` resolves, so the `.hdr.sgml` fallback request (#126) now precedes a `section_not_found`. **Inside each heading tier a body heading ranks ahead of a table-of-contents row (#174):** a heading is a TOC row when its title line — its own line, or the next line with content after a bare or joined marker — is one by `isTocRow` (the line tiers' test), or the next line with content below it ends in a page cell (a TOC title wrapped onto a second line, Aware's `of Equity Securities....... 12`), or the title wraps once with its page cell on its own line under the wrap — the title line, one continuation line, and a `PAGE_CELL_LINE_RE` line on three consecutive lines, the continuation in the title line's case: no lowercase letter under an all-caps title line, an opening lowercase one under a mixed-case one (`of Equity Securities`) (#183). DRDGOLD's TOC row `ITEM 14.` / `MATERIAL MODIFICATIONS TO THE RIGHTS OF SECURITY HOLDERS AND USE OF` / `PROCEEDS` / `79` took `item 14` and `material modifications to the rights of security holders` at 8146 from the body heading at 433144. A body heading over one line of body text and a page number has the same three lines: across 26 filings the step without the consecutive-line and case conditions flags 47 body headings (`Item 4. Mine Safety Disclosures` / `Not applicable.` / `31`, spacer lines between or not, and DRDGOLD's `NOTE 22 ASSET HELD FOR SALE` over its page footer and `F-50`); with them it flags only that TOC row (8146) and its title cell (8155), moves those two landings, and changes no outline. An all-caps body heading over a one-word all-caps line and a page number on consecutive lines (`ITEM 4. MINE SAFETY DISCLOSURES` / `NONE` / `31`) still reads as a TOC row and lands as its tier's only match; `isTocHeading` in `filing-to-text.ts` owns the test, finding the line start from the newline before the offset since an NBSP-led Item's offset sits one past it. A TOC row still lands when it is its tier's only match. Three TOC shapes survive dedup: a row worded apart from its body heading (First Bancorp's 8-K `Item 9.01 Financial Statements and Exhibits. Page 1` took `item 9` at 2041 from the body Item at 2402), a bare all-caps marker over its title and page cells (DRDGOLD's FY2026 20-F `ITEM 3.` / `KEY INFORMATION` / `6` took `item 3` at 6174 from `ITEM 3. KEY INFORMATION` at 34346, and nearly every other `item N` the same way), and the title cell itself (`key information`). TOC rows are ranked, never dropped or pushed behind the line tiers: the test also reads a body heading over a page number (CCC's `Item 6. Reserved.` at 234199, Reddit's S-1 `PART II` at 1021631), and behind the line tiers CCC's and Microsoft's `item 6` left the body heading for a bare TOC marker line. With the dedup-key fold, the ranking moved 83 landings over the corpus, each from a TOC row onto a body heading (DRDGOLD 35, Worthington Steel 20, GSBD 9, Amazon's 2003 10-K 8, Aware 6, First Bancorp 4, CCC 1), and no other: 78 onto the body heading the row copies, 5 onto another the value names (Amazon 2003's `part ii`–`part iv` onto its body Parts, Aware's `management` from its TOC Item 12 to body Item 7, Worthington Steel's `other information` from its TOC Item 5 to body `PART II. OTHER INFORMATION`). **A table-of-contents row that links forward lands on its section (#239):** not a tier — once resolution has picked a heading (any heading tier, the proxy order's included) that is a TOC row (`isTocHeading`), `linkedSectionStart` (`filing-to-text.ts`) looks for an in-document link (Filing content) whose text starts on the row: the heading's own line; for a heading not printed at its offset (a bare marker joined to a later title), that title's line too; then the next line with content when it is a page cell. A link counts only when its target lies past the row, so a back-link (a body heading linking to the TOC) never moves a landing, and the next row's link is not on the row. The page starts at the line holding the target's first text, since print layout can split a heading around its target (`Executive ` before it, `Compensation` after). A body heading, a line landing, a miss, and a row with no forward link land as before; the step adds no output field or notice. A row that links to its section lands on that section; an Item or Part table-of-contents row that only contains the value, and whose title opens on it, gives way to the document line equal to or starting with the value (a cross-reference index row to the section it indexes), under the notice `No detected heading outside the table of contents matches section '<value>', so this page starts at the first document line that does.` Anthropic, PBC's S-1/A (0001628280-26-068676) prints its TOC in capitals, which detection lists as headings, and each section's own heading in mixed case, which it does not, so `risk factors` took the TOC row at 10444, alone in tier 1; it now lands at 102219 (`28` / `Table of Contents` / `Risk Factors`). Ranking the row behind an equal line does not fix that filing: its offering summary's `Risk factors` (81235) and `Use of proceeds` (78206) rows come first. Over 61 sampled 2008–2026 documents × 60 section values the step moves 20 landings, each off a TOC row onto its section, and no other; a link step ahead of the heading tiers, or for line landings and misses, moved 132 body-heading landings (19 by more than 2,000 characters) and 19 line landings, some onto other sections. **A leading 20-F sub-item label is ignored (#175):** 20-F filers label sub-items (`3D. RISK FACTORS`, `B. Business Overview`), so a plain-phrase value never equalled the line. Tier 1 and both line tiers also compare the heading or line key with a leading label removed (`withoutSubItemLabel`: `/^(?:\d{1,2}[a-z]|[a-z])\. /` on the folded key, anchored, so constant-time), and the one-word longer-title rule judges the line after its label — Regencell's `B. Business Overview` keeps `business` a miss while `business overview` lands (151573). The value itself is never stripped, so `3D. RISK FACTORS` still matches its own line; a line opening on an initial (`L. John Doerr`) strips the same way and so matches only a value equal to the rest of the line. The landing is the line's first character, label included (DRDGOLD `risk factors` → 34503). Tier 1 strips only once no heading equals the value as printed, so an earlier `A. RISK FACTORS` never takes `risk factors` from a later `Item 1A. Risk Factors`; a labelled body heading still ranks ahead of a TOC row. The line tiers keep the first line equal either way: across the corpus the labelled line they land on is the 20-F sub-item itself and a later unlabelled one is narrower (DRDGOLD `business overview` → `4B. BUSINESS OVERVIEW` at 176975, not `Business overview` at 269017). Over the corpus the strip moved 23 landings, all in the three 20-Fs: 19 misses now land on the labelled sub-item, and 4 earlier landings move onto one (DRDGOLD `compensation` from the `Compensation of key management` subheading inside Item 6B, 328266, to `6B. COMPENSATION` at 324690); no filing without labelled sub-item lines changed. **The outline cut (#169):** past 50 detected headings the outline is every Item/Part heading (`isStructuralHeading`, bare and run-in markers included) plus the earliest other headings up to 50, in offset order (`selectOutline`) — shared by the first-page `outline` and the `section_not_found` message and data. When the Item/Part headings alone pass 50, each bare marker that a later titled heading for the same Item or Part repeats is left out first (`outlineStructuralHeadings`): DRDGOLD's FY2026 20-F renders all 31 TOC Items as bare markers (`ITEM 3.`), which filled the cut and pushed body Items 16A–19 out; its outline now runs `ITEM 1.` through `ITEM 19. EXHIBITS` from the body. A bare marker no titled heading repeats stays, and `section` still matches every heading. The miss message heads a cut outline `Outline (50 of N detected headings):` (else `Outline:`), and a cut first page appends `The outline lists 50 of N detected headings, every Item and Part heading among them; section matches all of them.` to the truncation guidance — `…among them, bare table-of-contents copies of titled ones aside; …` when bare markers were left out (DRDGOLD: `The outline lists 50 of 142 detected headings, every Item and Part heading among them, bare table-of-contents copies of titled ones aside; section matches all of them.`), and no Item/Part clause when the kept Item/Part headings alone pass 50, which reaches `structuredContent.notice` and `content[]` — no new output field, since the outline is emitted only on a truncated first page. A document of 50 or fewer headings renders as before.
|
|
113
113
|
- **Phrase search (`find`, #238):** `get_filing`'s `find` locates a phrase in the document text, for the phrases callers sent as `section` and got `section_not_found` (`net revenue retention` occurs 7 times in Anthropic, PBC's S-1/A, 0001628280-26-068676, and is no heading). `findPhrase` (`filing-to-text.ts`) folds both operands as `foldForHeadingMatch` does — curly quotes to ASCII, each whitespace run to one space, lowercase — but one code point at a time, each folded code unit keeping the offset of the code point it came from, so a phrase broken across a line or set with an NBSP matches and every offset reported is a document offset: that phrase first occurs at 21404, folded offset 21063, and a lowercase form longer than its source (U+0130) shifts no later offset. One forward Knuth–Morris–Pratt pass over the folded units with a ring of the last phrase-length offsets: linear in the text, memory bounded by the phrase and the list whatever the count. Substring and non-overlapping, counted from the document start whatever the search start, so a continuation never re-counts. `section` outranks `find`, and `find` outranks `offset`, which becomes where the search starts: the page opens at the first occurrence at or after it — at its line's start when that is at most 200 characters back, else at the first word starting within those 200, so a page can open before `offset`. `occurrences` lists up to 20 `{ offset, context }` (the match and up to 40 characters either side, whitespace runs as one space, no edge splitting a surrogate pair; `format()` renders each through `escapeMarkdownInline`) and `occurrences_total` counts the document; when more follow, the notice names the next call, the same `find` with `offset` at the last listed match's end, composed into the truncation guidance (`notice` is last-wins), whose paging sentence then says to pass `next_offset` without `find`. No outline with `find`. A miss is `phrase_not_found` (`NotFound`), its message saying how many occur before `offset` and its hint naming only the rule that fired (absent from the document, or present only before `offset`); an `offset` past the end is a search start, so it misses this way, never as `offset_out_of_range`. A blank `find` reads as omitted, as a blank `document` does — form clients send `""` — rather than failing as a blank `section` does. `section_not_found`'s recovery, in the contract and both runtime hints, points a phrase that is not a heading at `find`.
|
|
114
114
|
- **Binary filing documents:** a filing index routinely carries scanned pages, PDF exhibits, `Financial_Report.xlsx`, and `-xbrl.zip` — `filingToExtract` runs `html-to-text` over whatever bytes arrive and never inspects a content type, so requesting one used to return decoded binary as `content` with no error (#96). `get-filing.tool.ts` detects them with one rule, `binaryType`: the filename extension (`binaryTypeFromName`), the one signal every filing carries, plus a header-page `GRAPHIC` type for a scan named oddly — the header page is read before the body (#161). Two halves, both needed — `documents[]` entries carry `binary: true`, and `resolveFilingArchive` throws `binary_document` before `tryGetFilingDocument` runs, since the `document` input is an unconstrained string and a catalog marker alone cannot stop a caller. Extension-driven and bucket-independent on purpose: a PDF exhibit is typed `EX-99.*` and files under `exhibits`, not among the graphics.
|
|
115
|
-
- **Dataframes:** `secedgar_search_filings`, `secedgar_get_financials`, `secedgar_fetch_frames`, `secedgar_compare_companies`, `secedgar_get_insider_transactions`, `secedgar_get_institutional_holdings`, `secedgar_get_material_events`, `secedgar_find_holders`, `secedgar_get_beneficial_owners`, `secedgar_get_fund_holdings`, and `secedgar_company_search` (its full filtered filing history) materialize their full result set as `df_<id>` on a shared DuckDB-backed canvas (one per tenant). The bridge reaches that canvas only through `DataCanvas.acquireShared`, so concurrent first stagings share one canvas, and when the stored canvas is gone the replacement purges the `df-meta/` records first, so describe never lists a table the canvas no longer holds; describe, drop, and the expiry sweep never mint a canvas; a query does, whatever it names, since the engine alone decides what names a table and answers one it cannot bind as `missing_table` (#251). `secedgar_dataframe_describe` without `name` (or with `name: ""`) is refused `listing_unavailable` over HTTP with `MCP_AUTH_MODE=none`, where every caller shares one canvas; stdio and authenticated HTTP still list, and by-name describe, query, and drop are unchanged. A `name` not shaped `df_XXXXX_XXXXX` describes as no entries and drops nothing. The two ownership tools register the full parsed set (inline response is a preview capped at `limit`); `get_insider_transactions` scans at least `INSIDER_CANVAS_FILING_SCAN` recent filings when canvas is available (so small inline limits don't under-scan the window), capped at 100 (#63); the scan reads whole filing dates (#261): it stops at the end of the date on which `limit` transactions and the scan floor are in hand, the no-canvas and floor stops included, and a date whose Form 4s would carry it past the cap is cut (`capAtWholeDate`), so `filed_before` the day before the oldest date read resumes it without a gap or a repeat, while a single date holding more Form 4s than the cap is read up to the cap; the undated path reads the submissions document through `windowForm4Rows`, the selector the dated path applies to each block too; with a `filed_after` / `filed_before` window it reads the in-window Form 4 / 4-A rows with an XML primary document — `recent`, then the archive pages overlapping the window, newest first, stopping once the scan cap plus a sentinel row are in hand — and with a canvas parses every one up to 100 instead of the 40-filing floor, since the window already bounds the set; `dataset.truncated` is then the sentinel or unread overlapping pages (#127); `history_scanned_through` appears on every path as the date of the last filing reached, one whose document failed to load included, and `dataset.truncated` equals the continuation condition: Form 4 filings exist, or may exist, past those read, because the scan stopped short of the batch, the 10-page archive cap ended a dated walk, or an undated scan read the whole recent window while `filings.files` lists archive pages (worded `may exist`) (#261). The notice ends with the way on, after the `role` lever when both apply: `filed_before=<day before the oldest date read>`, or `filed_before=<that date>` with a note that the rows already read from it repeat, so a caller dedupes on `accession_number`, for a date holding more Form 4s than a cap below 100 (adding `limit=20` without a canvas, the least that scans 100) and for a walk the archive cap ended, which names the walk's reach since that date may continue on an unread page; at the 100 cap an inclusive date would return the same filings, so the notice names the day before. Without a canvas, or when staging fails, no dataset holds the rows `limit` cut from `transactions[]`, so `cutContinuation` resumes at the filing date of the first row cut, `<C>`: `filed_before=<C>`, saying the rows shown from `<C>` repeat and that call's rows for `<C>` replace them, not a dedupe on `accession_number`, since a filing's rows can straddle the cut. When every row shown is from `<C>` it also names a `limit` that reads past them, and a date over the 100-transaction inline cap is read once at `limit=100` (`filed_before=<C> with limit=100`, named when `limit` is below 100) and then stepped past with `filed_before=<day before>`; it replaces only the notice's closing continuation, so `dataset.truncated` still follows the scan; a company's submissions feed also lists the Form 4s it filed as a reporting owner of another issuer (JPMorgan's 10% stake in a BlackRock fund), so under the issuer role a row the feed lists under a file number other than the company's own is skipped unread (#265): no document request, and no slot in the scan cap, the floor, the continuation, or `dataset.truncated`. The company's own numbers are those on its rows of every form other than 3, 4, 5 and their amendments, on any date, from `recent` and each archive page read, so a row skipped early can turn out to be read, never the reverse. The rows the scan passes (those filed on or after the oldest filing read, or all of them when every own Form 4 was read) count in `filings_scanned` and `filings_other_issuer` and extend `history_scanned_through`, so `filings_scanned` can exceed the 100 filings one call reads, and a window of only skipped rows returns the other-issuer notice, not an error. A row with no number, or the company's own, is still read, and a parsed document whose `issuerCik` differs from the resolved CIK, compared with zero-padding stripped, adds no row inline or to the dataframe and is counted in `filings_other_issuer` — it still counts toward `filings_scanned`, the scan floor, and `history_scanned_through` — though a skipped filing adds no transactions, so a no-canvas call reads on through such filings until `limit` transactions are in hand, to the end of that filing date, within the same scan cap (#157); under `role: "reporting_owner"` (#260) the scan reads only the Form 4 rows the submissions feed lists with a `fileNumber` (EDGAR lists a Form 4 with the issuer's file number in each reporting owner's feed and none in the issuer's own, unless the issuer is a reporting owner of itself, as CTT Pharmaceutical is on its CEO's Form 4s, when the row carries the issuer's own number; the rows without one are counted, not read, to word an empty result), takes the reporting owner whose CIK matches rather than the first listed, applies no #157 exclusion (so `filings_other_issuer` stays 0), and stamps each row with the filing's own issuer (`issuer_cik` zero-padded, `issuer_name` and `issuer_ticker` as filed); a filing whose owners omit the CIK is logged and adds no rows. The top-level `issuer_*` fields keep naming the resolved `company`, the name from the submissions document when the ticker file has none, and every notice that reports filings naming another issuer ends `Pass role: "reporting_owner" to read them as this filer's own trades.`; its `shares_traded` is an unsigned magnitude paired with a `direction` (acquire/dispose) column, so net activity is `SUM(CASE WHEN direction='dispose' THEN -shares_traded ELSE shares_traded END)` over the rows where `amended_by IS NULL`, since a row a Form 4/A restates names that 4/A there (#46, #267); `get_financials`' dataframe materializes the source-filing fiscal keys as `source_filing_fy`/`source_filing_fp` (renamed from bare `fiscal_year`/`fiscal_period` — every comparative period restated in one filing carries that filing's fy/fp, so `period_end` is the time key for ORDER BY/GROUP BY/windowing) (#72); `compare_companies`' dataframe holds the FULL aligned series across every period while the inline matrix is capped at `periods`, and each row carries both the aligned `period` key and the underlying XBRL `frame` (they differ for point-in-time concepts) (#85). In an annual matrix an instant enters only on one of the filer's fiscal-year ends and takes the key of the annual duration ending that day. The ends come from the companyfacts payload already in hand (`filerFiscalYearEndsWithComparatives` in `concept-series.ts`, shared with `get_financials`' annual view of an instant): each annual report's own year (the #148 rule) plus the comparative years it restates — its year-long facts ending a whole number of years earlier, within a week — so the first XBRL 10-K's prior-year balance keys too, while a year-long figure ending off the report's calendar (a December filer's trailing year to 09-30) stays out. The #148 test of a 10-Q-held annual frame keeps `filerFiscalYearEnds` (each report's own year only): it matches day of year, where a comparative year adds nothing but a wider tolerance. The key is the first `CY####` frame on any concept in the payload ending then, so a balance lands beside its fiscal year's income lines even when none is requested; with no framed duration ending on it, the calendar year in which that fiscal year's second half starts (SEC's own framing: a year ending 06-30 is that year, one ending 06-27 or 05-31 the year before — Seagate's and Western Digital's years ending 2025-06-27 are `CY2024`; SEC departs from it for the year both ended 2012-06-29, framed `CY2012`, which is why a framed key wins). Interim and cover-date instants stay out of the annual matrix, and a company-concept left with none gets a gap plus a caveat pointing at quarterly; when that empties the whole matrix, `no_comparable_data` says the values were all off fiscal-year ends and its hint names `period_type: "quarterly"` (omitting `period_type` keeps annual), after any taxonomy or related-tag lever (see Taxonomy retry). Quarterly keys are unchanged. The year ends are read lazily, only when an annual matrix meets an instant (#171). The period-ends caveat checks every inline column — the newest can hold one company alone — spelling out the newest column whose ends differ and naming the others; the inline window is the newest periods of the union across companies, so a company-concept pair whose values all predate it is named in `caveats` — one line per concept, each company with its newest period and the dataframe pointer — and never in `gaps`, which keeps meaning no value in any period (#144). Each row set carries an all-nullable schema (framework's `inferSchemaFromRows` always emits `nullable: true` since mcp-ts-core 0.10.4). Per-table TTL is delegated to the framework via `RegisterTableOptions.ttlMs` (resolved in mcp-ts-core#140); bridge still tracks metadata expiry in `ctx.state` for provenance. Every producer emits the describe-then-query pointer on the branch that registers the dataframe, composed once by `dataframeGuidance(dataset)` in the bridge so the wording cannot drift; where a truncation call already fires there it rides as that call's `guidance`, since `ctx.enrich.notice` is last-wins across `notice`/`truncated` and a second call would clobber the first (#104). `secedgar_dataframe_query` detects a `row_limit`-bound result from `QueryResult.truncated` rather than `rowCount > rows.length` — `row_limit` is pushed into the query as the provider's cap, so a capped result comes back with `rowCount === rows.length` and the arithmetic cannot see it; `rowCount` is then the cap and not a total, so that branch names the cap instead of printing "of N rows", `row_count_capped` carries the same disclosure into `format()`, and the fallback comparison stays for the `registerAs` path, where `truncated` is never set. A SQL `LIMIT` exactly equal to the cap is indistinguishable from a result that holds that many rows and is reported as exact (#109). `secedgar_dataframe_query` runs framework's SQL gate with `denySystemCatalogs: true` to block `information_schema`, `pg_catalog`, `sqlite_master`, and `duckdb_*` catalog access; since mcp-ts-core 0.13.19 that also refuses a column alias, table alias, or CTE spelled like a DuckDB metadata view (`pg_class`, `duckdb_tables`) as `system_catalog_access`, whose hint says to rename it. A statement that is not a SELECT (`WITH … INSERT` included) fails as the gate's `non_select_statement`, rewrapped with the gate's own hint and without its `statementType` (#74); the gate's `invalid_sql` is rewrapped the same way, its `binderMessage` kept (#251). Both keep the gate's per-class hint with its generic describe-tool reference naming `secedgar_dataframe_describe`, except the Catalog- and IO-class `invalid_sql` hints, which send the caller to a listing that HTTP with auth none refuses: a missing function, type, collation, or schema gets the bridge's own hint, and the IO class gets `SQL_READ_ONLY_HINT`, as `sql_read_only` does (#242). Raw DuckDB execution errors (missing table, syntax) are caught in `bridge.query` and re-thrown as structured `missing_table`/`invalid_sql` reasons, with DuckDB's "Did you mean …?" hint stripped so internal catalog names don't leak (#47). The framework's own classifications pass through untouched and are declared on the tool's contract (`thrownBy: 'service'`, since the handler never names them): a SELECT that prepares and then fails on the data — a `Conversion` / `Invalid Input` / `Out of Range` error, e.g. `CAST('abc' AS INTEGER)` — is `ValidationError` with `sql_execution_error` (mcp-ts-core 0.13.4; `DatabaseError` with no reason before), and the gate's `multi_statement`, `denied_function`, `sql_read_only`, and `plan_operator_not_allowed` rejections arrive with their own recovery hints — since mcp-ts-core 0.13.15 the gate also denies engine-setting and SQL-from-string functions (`current_setting`, `query_table`) as `denied_function` and a file named as a table (`FROM 'data.csv'`) as `sql_read_only`, and since 0.13.16 it refuses any unqualified `current_schema`, since the parse tree cannot tell the bare function from a column of that name — a staged or aliased column so named is read qualified (`c.current_schema`). `get_beneficial_owners` registers one row per reporting person rather than one per filing, since powers and percent of class are per person, and each row carries the filing's `purpose_of_transaction` and the person's `notes` uncut, the text the inline result bounds (#200); `get_fund_holdings` registers every position in the report while the inline list is one `limit`-sized page from `offset`, and its rows carry the fund keys (`series_id`, `registrant_cik`, `report_period_date`, `accession_number`) so a portfolio joins the 13F and 13D/G rows on `cusip`. Insider rows carry `issuer_cik` (each filing's own issuer under `role: "reporting_owner"`) and `issuer_name`, and no `cusip`, 13F rows the reverse; 13D/G rows carry both (under `role: "filer"`, `issuer_*` is each schedule's subject, not the resolved filer). Insider rows also carry `reporting_person_cik`; `joint_filers` (the other owners of a joint filing as `Name (CIK x, relationship)` joined by `; `, NULL on a single-owner filing, one row per transaction since the XML ties none to an owner, #264); and `form`, `amends_filing_date`, and `amended_by` (#267). `search_filings` rows carry `item_codes`, `item_labels`, and `item_regime` (null on a row without items), the columns `get_material_events` stages, so the two tables union (#277).
|
|
116
|
-
- **Beneficial ownership (13D/13G):** SEC replaced the legacy `SC 13D` / `SC 13G` text filings with structured XML under the `SCHEDULE 13D` / `SCHEDULE 13G` names on **2024-12-18**; the changeover is near-total, so a current-name filter matches nothing older and a legacy-name filter matches almost nothing recent: a few filings keep the legacy name after it, still text, such as a tender offer's combined `SC TO-T/A` + `SC 13D/A` amendment (EDGAR's quarterly indexes list 36 `SC 13D/A` accessions from 2025-Q1 through 2026-Q3). The two schedules are **separate schemas, not one shape with optional fields** — 13D repeats `reportingPersons/reportingPersonInfo` with the power fields flat on each person and the percentage in `percentOfClass`; 13G repeats `coverPageHeaderReportingPersonDetails` with the powers nested inside `reportingPersonBeneficiallyOwnedNumberOfShares`, the percentage in `classPercent`, no reporting-person CIK anywhere, and no purpose-of-transaction field at all (its item 4 is structured ownership data, which is what makes it the passive form). `beneficial-ownership-parser.ts` therefore branches per schema and dispatches on the submission type, falling back to whichever repeated reporting-person element the document carries. **Ownership powers and percent of class are per reporting person, including on joint filings** — a fund, its adviser, and its controlling principal each report the same underlying shares, so the parsed owner list is never collapsed to a group total and the percentages must not be summed. Discovery runs off the company's own `getSubmissions()`: SEC lists a schedule in the feed of every CIK party to it, so no entity-scoped EFTS step is needed. **A feed holds both sides, told apart by `fileNumber` (#276):** EDGAR files a schedule under its subject company's `005-` file number and lists it in two feeds, the subject's, whose row carries that number, and the filer's, whose row carries none — the inverse of a Form 4 (#260). `sideOf` reads an empty `fileNumber` as the filer's side, and a feed without the column as all subject-side. Each `role` selects its side before any document is read — `issuer` (default) the subject-side rows, `filer` the filer-side ones, so a holder's own 13D/Gs across issuers — and counts the other side's matching schedules for a notice that names the role reading them; `total_structured_filings` and `legacy_filings_before_coverage` count the role's side. An empty side with the other populated is a zero-filing success whose notice says so; `no_filings_found` fires only
|
|
115
|
+
- **Dataframes:** `secedgar_search_filings`, `secedgar_get_financials`, `secedgar_fetch_frames`, `secedgar_compare_companies`, `secedgar_get_insider_transactions`, `secedgar_get_institutional_holdings`, `secedgar_get_material_events`, `secedgar_find_holders`, `secedgar_get_beneficial_owners`, `secedgar_get_fund_holdings`, and `secedgar_company_search` (its full filtered filing history) materialize their full result set as `df_<id>` on a shared DuckDB-backed canvas (one per tenant). The bridge reaches that canvas only through `DataCanvas.acquireShared`, so concurrent first stagings share one canvas, and when the stored canvas is gone the replacement purges the `df-meta/` records first, so describe never lists a table the canvas no longer holds; describe, drop, and the expiry sweep never mint a canvas; a query does, whatever it names, since the engine alone decides what names a table and answers one it cannot bind as `missing_table` (#251). `secedgar_dataframe_describe` without `name` (or with `name: ""`) is refused `listing_unavailable` over HTTP with `MCP_AUTH_MODE=none`, where every caller shares one canvas; stdio and authenticated HTTP still list, and by-name describe, query, and drop are unchanged. A `name` not shaped `df_XXXXX_XXXXX` describes as no entries and drops nothing. The two ownership tools register the full parsed set (inline response is a preview capped at `limit`); `get_insider_transactions` scans at least `INSIDER_CANVAS_FILING_SCAN` recent filings when canvas is available (so small inline limits don't under-scan the window), capped at 100 (#63); the scan reads whole filing dates (#261): it stops at the end of the date on which `limit` transactions and the scan floor are in hand, the no-canvas and floor stops included, and a date whose Form 4s would carry it past the cap is cut (`capAtWholeDate`), so `filed_before` the day before the oldest date read resumes it without a gap or a repeat, while a single date holding more Form 4s than the cap is read up to the cap; the undated path reads the submissions document through `windowForm4Rows`, the selector the dated path applies to each block too; with a `filed_after` / `filed_before` window it reads the in-window Form 4 / 4-A rows with an XML primary document — `recent`, then the archive pages overlapping the window, newest first, stopping once the scan cap plus a sentinel row are in hand — and with a canvas parses every one up to 100 instead of the 40-filing floor, since the window already bounds the set; `dataset.truncated` is then the sentinel or unread overlapping pages (#127); `history_scanned_through` appears on every path as the date of the last filing reached, one whose document failed to load included, and `dataset.truncated` equals the continuation condition: Form 4 filings exist, or may exist, past those read, because the scan stopped short of the batch, the 10-page archive cap ended a dated walk, or an undated scan read the whole recent window while `filings.files` lists archive pages (worded `may exist`) (#261). The notice ends with the way on, after the `role` lever when both apply: `filed_before=<day before the oldest date read>`, or `filed_before=<that date>` with a note that the rows already read from it repeat, so a caller dedupes on `accession_number`, for a date holding more Form 4s than a cap below 100 (adding `limit=20` without a canvas, the least that scans 100) and for a walk the archive cap ended, which names the walk's reach since that date may continue on an unread page; at the 100 cap an inclusive date would return the same filings, so the notice names the day before. Without a canvas, or when staging fails, no dataset holds the rows `limit` cut from `transactions[]`, so `cutContinuation` resumes at the filing date of the first row cut, `<C>`: `filed_before=<C>`, saying the rows shown from `<C>` repeat and that call's rows for `<C>` replace them, not a dedupe on `accession_number`, since a filing's rows can straddle the cut. When every row shown is from `<C>` it also names a `limit` that reads past them, and a date over the 100-transaction inline cap is read once at `limit=100` (`filed_before=<C> with limit=100`, named when `limit` is below 100) and then stepped past with `filed_before=<day before>`; it replaces only the notice's closing continuation, so `dataset.truncated` still follows the scan; a company's submissions feed also lists the Form 4s it filed as a reporting owner of another issuer (JPMorgan's 10% stake in a BlackRock fund), so under the issuer role a row the feed lists under a file number other than the company's own is skipped unread (#265): no document request, and no slot in the scan cap, the floor, the continuation, or `dataset.truncated`. The company's own numbers are those on its rows of every form other than 3, 4, 5 and their amendments, on any date, from `recent` and each archive page read, so a row skipped early can turn out to be read, never the reverse. The rows the scan passes (those filed on or after the oldest filing read, or all of them when every own Form 4 was read) count in `filings_scanned` and `filings_other_issuer` and extend `history_scanned_through`, so `filings_scanned` can exceed the 100 filings one call reads, and a window of only skipped rows returns the other-issuer notice, not an error. A row with no number, or the company's own, is still read, and a parsed document whose `issuerCik` differs from the resolved CIK, compared with zero-padding stripped, adds no row inline or to the dataframe and is counted in `filings_other_issuer` — it still counts toward `filings_scanned`, the scan floor, and `history_scanned_through` — though a skipped filing adds no transactions, so a no-canvas call reads on through such filings until `limit` transactions are in hand, to the end of that filing date, within the same scan cap (#157); under `role: "reporting_owner"` (#260) the scan reads only the Form 4 rows the submissions feed lists with a `fileNumber` (EDGAR lists a Form 4 with the issuer's file number in each reporting owner's feed and none in the issuer's own, unless the issuer is a reporting owner of itself, as CTT Pharmaceutical is on its CEO's Form 4s, when the row carries the issuer's own number; the rows without one are counted, not read, to word an empty result), takes the reporting owner whose CIK matches rather than the first listed, applies no #157 exclusion (so `filings_other_issuer` stays 0), and stamps each row with the filing's own issuer (`issuer_cik` zero-padded, `issuer_name` and `issuer_ticker` as filed); a filing whose owners omit the CIK is logged and adds no rows. The top-level `issuer_*` fields keep naming the resolved `company`, the name from the submissions document when the ticker file has none, and every notice that reports filings naming another issuer ends `Pass role: "reporting_owner" to read them as this filer's own trades.`; its `shares_traded` is an unsigned magnitude paired with a `direction` (acquire/dispose) column, so net activity is `SUM(CASE WHEN direction='dispose' THEN -shares_traded ELSE shares_traded END)` over the rows where `amended_by IS NULL`, since a row a Form 4/A restates names that 4/A there (#46, #267); `get_financials`' dataframe materializes the source-filing fiscal keys as `source_filing_fy`/`source_filing_fp` (renamed from bare `fiscal_year`/`fiscal_period` — every comparative period restated in one filing carries that filing's fy/fp, so `period_end` is the time key for ORDER BY/GROUP BY/windowing) (#72); `compare_companies`' dataframe holds the FULL aligned series across every period while the inline matrix is capped at `periods`, and each row carries both the aligned `period` key and the underlying XBRL `frame` (they differ for point-in-time concepts) (#85). In an annual matrix an instant enters only on one of the filer's fiscal-year ends and takes the key of the annual duration ending that day. The ends come from the companyfacts payload already in hand (`filerFiscalYearEndsWithComparatives` in `concept-series.ts`, shared with `get_financials`' annual view of an instant): each annual report's own year (the #148 rule) plus the comparative years it restates — its year-long facts ending a whole number of years earlier, within a week — so the first XBRL 10-K's prior-year balance keys too, while a year-long figure ending off the report's calendar (a December filer's trailing year to 09-30) stays out. The #148 test of a 10-Q-held annual frame keeps `filerFiscalYearEnds` (each report's own year only): it matches day of year, where a comparative year adds nothing but a wider tolerance. The key is the first `CY####` frame on any concept in the payload ending then, so a balance lands beside its fiscal year's income lines even when none is requested; with no framed duration ending on it, the calendar year in which that fiscal year's second half starts (SEC's own framing: a year ending 06-30 is that year, one ending 06-27 or 05-31 the year before — Seagate's and Western Digital's years ending 2025-06-27 are `CY2024`; SEC departs from it for the year both ended 2012-06-29, framed `CY2012`, which is why a framed key wins). Interim and cover-date instants stay out of the annual matrix, and a company-concept left with none gets a gap plus a caveat pointing at quarterly; when that empties the whole matrix, `no_comparable_data` says the values were all off fiscal-year ends and its hint names `period_type: "quarterly"` (omitting `period_type` keeps annual), after any taxonomy or related-tag lever (see Taxonomy retry). Quarterly keys are unchanged. The year ends are read lazily, only when an annual matrix meets an instant (#171). The period-ends caveat checks every inline column — the newest can hold one company alone — spelling out the newest column whose ends differ and naming the others; the inline window is the newest periods of the union across companies, so a company-concept pair whose values all predate it is named in `caveats` — one line per concept, each company with its newest period and the dataframe pointer — and never in `gaps`, which keeps meaning no value in any period (#144). Each row set carries an all-nullable schema (framework's `inferSchemaFromRows` always emits `nullable: true` since mcp-ts-core 0.10.4). Per-table TTL is delegated to the framework via `RegisterTableOptions.ttlMs` (resolved in mcp-ts-core#140); bridge still tracks metadata expiry in `ctx.state` for provenance. Every producer emits the describe-then-query pointer on the branch that registers the dataframe, composed once by `dataframeGuidance(dataset)` in the bridge so the wording cannot drift; where a truncation call already fires there it rides as that call's `guidance`, since `ctx.enrich.notice` is last-wins across `notice`/`truncated` and a second call would clobber the first (#104). `secedgar_dataframe_query` detects a `row_limit`-bound result from `QueryResult.truncated` rather than `rowCount > rows.length` — `row_limit` is pushed into the query as the provider's cap, so a capped result comes back with `rowCount === rows.length` and the arithmetic cannot see it; `rowCount` is then the cap and not a total, so that branch names the cap instead of printing "of N rows", `row_count_capped` carries the same disclosure into `format()`, and the fallback comparison stays for the `registerAs` path, where `truncated` is never set. A SQL `LIMIT` exactly equal to the cap is indistinguishable from a result that holds that many rows and is reported as exact (#109). `secedgar_dataframe_query` runs framework's SQL gate with `denySystemCatalogs: true` to block `information_schema`, `pg_catalog`, `sqlite_master`, and `duckdb_*` catalog access; since mcp-ts-core 0.13.19 that also refuses a column alias, table alias, or CTE spelled like a DuckDB metadata view (`pg_class`, `duckdb_tables`) as `system_catalog_access`, whose hint says to rename it. A statement that is not a SELECT (`WITH … INSERT` included) fails as the gate's `non_select_statement`, rewrapped with the gate's own hint and without its `statementType` (#74); the gate's `invalid_sql` is rewrapped the same way, its `binderMessage` kept (#251). Both keep the gate's per-class hint with its generic describe-tool reference naming `secedgar_dataframe_describe`, except the Catalog- and IO-class `invalid_sql` hints, which send the caller to a listing that HTTP with auth none refuses: a missing function, type, collation, or schema gets the bridge's own hint, and the IO class gets `SQL_READ_ONLY_HINT`, as `sql_read_only` does (#242). Raw DuckDB execution errors (missing table, syntax) are caught in `bridge.query` and re-thrown as structured `missing_table`/`invalid_sql` reasons, with DuckDB's "Did you mean …?" hint stripped so internal catalog names don't leak (#47). The framework's own classifications pass through untouched and are declared on the tool's contract (`thrownBy: 'service'`, since the handler never names them): a SELECT that prepares and then fails on the data — a `Conversion` / `Invalid Input` / `Out of Range` error, e.g. `CAST('abc' AS INTEGER)` — is `ValidationError` with `sql_execution_error` (mcp-ts-core 0.13.4; `DatabaseError` with no reason before), and the gate's `multi_statement`, `denied_function`, `sql_read_only`, and `plan_operator_not_allowed` rejections arrive with their own recovery hints — since mcp-ts-core 0.13.15 the gate also denies engine-setting and SQL-from-string functions (`current_setting`, `query_table`) as `denied_function` and a file named as a table (`FROM 'data.csv'`) as `sql_read_only`, and since 0.13.16 it refuses any unqualified `current_schema`, since the parse tree cannot tell the bare function from a column of that name — a staged or aliased column so named is read qualified (`c.current_schema`). `get_beneficial_owners` registers one row per reporting person rather than one per filing, since powers and percent of class are per person, and each row carries the filing's `purpose_of_transaction` and the person's `notes` uncut, the text the inline result bounds (#200); `get_fund_holdings` registers every position in the report while the inline list is one `limit`-sized page from `offset`, and its rows carry the fund keys (`series_id`, `registrant_cik`, `report_period_date`, `accession_number`) so a portfolio joins the 13F and 13D/G rows on `cusip`. Insider rows carry `issuer_cik` (each filing's own issuer under `role: "reporting_owner"`) and `issuer_name`, and no `cusip`, 13F rows the reverse; 13D/G rows carry both (under `role: "filer"`, `issuer_*` is each schedule's subject, not the resolved filer). Insider rows also carry `reporting_person_cik`; `joint_filers` (the other owners of a joint filing as `Name (CIK x, relationship)` joined by `; `, NULL on a single-owner filing, one row per transaction since the XML ties none to an owner, #264); and `form`, `amends_filing_date`, and `amended_by` (#267); `rule10b5_1` BOOLEAN, NULL when unknown (a staged set that is all NULL is typed VARCHAR, as every all-NULL column is); and `footnotes` VARCHAR, NULL when the row cites none, each reference `F3 (transaction_code): <text>` (or `F9 (transaction_code)` when the filing defines no such footnote), one per line, a text keeping its own inner line breaks (#285). `search_filings` rows carry `item_codes`, `item_labels`, and `item_regime` (null on a row without items), the columns `get_material_events` stages, so the two tables union (#277).
|
|
116
|
+
- **Beneficial ownership (13D/13G):** SEC replaced the legacy `SC 13D` / `SC 13G` text filings with structured XML under the `SCHEDULE 13D` / `SCHEDULE 13G` names on **2024-12-18**; the changeover is near-total, so a current-name filter matches nothing older and a legacy-name filter matches almost nothing recent: a few filings keep the legacy name after it, still text, such as a tender offer's combined `SC TO-T/A` + `SC 13D/A` amendment (EDGAR's quarterly indexes list 36 `SC 13D/A` accessions from 2025-Q1 through 2026-Q3). The two schedules are **separate schemas, not one shape with optional fields** — 13D repeats `reportingPersons/reportingPersonInfo` with the power fields flat on each person and the percentage in `percentOfClass`; 13G repeats `coverPageHeaderReportingPersonDetails` with the powers nested inside `reportingPersonBeneficiallyOwnedNumberOfShares`, the percentage in `classPercent`, no reporting-person CIK anywhere, and no purpose-of-transaction field at all (its item 4 is structured ownership data, which is what makes it the passive form). `beneficial-ownership-parser.ts` therefore branches per schema and dispatches on the submission type, falling back to whichever repeated reporting-person element the document carries. **Ownership powers and percent of class are per reporting person, including on joint filings** — a fund, its adviser, and its controlling principal each report the same underlying shares, so the parsed owner list is never collapsed to a group total and the percentages must not be summed. Discovery runs off the company's own `getSubmissions()`: SEC lists a schedule in the feed of every CIK party to it, so no entity-scoped EFTS step is needed. **A feed holds both sides, told apart by `fileNumber` (#276):** EDGAR files a schedule under its subject company's `005-` file number and lists it in two feeds, the subject's, whose row carries that number, and the filer's, whose row carries none — the inverse of a Form 4 (#260). `sideOf` reads an empty `fileNumber` as the filer's side, and a feed without the column as all subject-side. Each `role` selects its side before any document is read — `issuer` (default) the subject-side rows, `filer` the filer-side ones, so a holder's own 13D/Gs across issuers — and counts the other side's matching schedules for a notice that names the role reading them; `total_structured_filings` and `legacy_filings_before_coverage` count the role's side. An empty side with the other populated is a zero-filing success whose notice says so; `no_filings_found` fires only on an undated call with both sides empty; a dated window with no match is a success with a notice. The #189 check of each parsed `issuer_cik` against the resolved CIK stays as the issuer side's backstop, since the cover page has the last word on whose holders it reports, and `filer` applies none: each filing carries its own subject as `issuer_cik` / `issuer_name`, and so do its dataframe rows. Under `role: "filer"` with schedules left unread, the notice leads with `Pass limit: <n> to read all <n> in one call.` when one call can read them all (at most 20, and never after a page-capped walk), and names a `secedgar_search_filings` `cik:` call that lists only the schedules full-text search has indexed, which can miss some (Elliott's lists 16 of its 19). **Date window and `offset` (#279):** `filed_after` / `filed_before` (aliases `start_date` / `date_from` and `end_date` / `date_to`) and `offset` (default 0) work under both roles. A window reads `recent`, then archive pages newest-first from `max(filed_after, 2024-12-18)`; one ending before 2024-12-18 reads no page. The walk stops once the role-side schedules past `offset` exceed 50 documents, or at the 10-page cap. `offset` skips that many of the window's role-side matches, ordered newest first by filing date, then acceptance time, then accession number; without a window it pages `recent` only. A truncated notice ends `To continue, repeat the call with filed_before=<D> and offset=<n>, its other arguments unchanged.`: D is the filing date of the last schedule examined while matches remain past it in the blocks read (when a capped walk leaves none unexamined, the oldest date the blocks read reach, or `filed_before` if that is earlier, so the next walk starts past the pages read) and n = offset + examined − matches dated after D, so a heavy filer's busy day is never skipped or read twice. `truncated` / `dataset.truncated` is true when matches remain past those examined or the page cap stopped the walk; an undated call keeps its `recent`-only truncation. When the cap ends the walk the notice reads `The archive scan stopped after N pages, at filings from <date>; older schedules in the window were not read.`, `cap` is 10, and no `Pass limit` lever is offered; with no role-side schedule found the empty notice says `as far back as the scan reached`. `total_structured_filings` counts the window's role-side matches from `offset` on, in the blocks read; `legacy_filings_before_coverage` counts role-side legacy filings in the window and the blocks read. A window ending before 2024-12-18 adds the coverage sentence to its empty notice; an `offset` past every match gets `Offset N is at or past the M matching schedules <scope>; lower it to read them.`; an inverted window is `invalid_arguments` before any request. The dataframe's `queryParams` records `filed_after`, `filed_before`, and `offset` when set. **Filer text is data, kept as filed and bounded per field:** Item 4 `purpose_of_transaction` and each person's cover-page `notes` keep their line breaks (CR and CRLF as filed) and come back whole up to 5,000 and 2,000 characters; past that, the value is its first N characters with nothing appended and `purpose_truncated` / `notes_truncated` say so, on both surfaces. Item 4 is the substantive 13D field: 5,000 sits just above the 90th percentile of 48 sampled Item 4s (4,916), where 1,200 cut 34 of them, and uncut the 20 longest sampled make a 136.5 KB response; 2,000 clears the longest of 77 sampled notes (1,852), and a bound stays because reporting persons per filing are unbounded. When anything was cut, the cut count and the pointer to the whole text — the dataframe's uncut columns, or `secedgar_get_filing` on the accession — ride the tool's one composed notice. `format()` renders each value as a blockquote through `escapeMarkdownInline`, every line prefixed `> ` (indented under a note's list item) and the cut marker after it, behind a blank line so the marker and the next block cannot lazily continue the quote; reporting-person names, `security_class`, `issuer_name`, and the cover-page codes render escaped too (#200).
|
|
117
117
|
- **NPORT-P series routing:** a fund's public portfolio report covers **exactly one series**, a registrant trust holds many (iShares Trust: 390 listed series, 200+ reports for a single period), and the series identity appears **only inside the document** — neither the submissions feed nor EFTS carries `seriesId` on an NPORT-P row. Routing is therefore series-first: EDGAR's company browse accepts a series ID in place of a CIK (`getFundSeriesFilings`), which is the one SEC surface mapping a series to its accessions and which also names the registrant, so a bare series ID resolves in one request. The browse feed's registrant outranks any registrant the `fund` input implied, since `series_id` can name a series of an entirely different trust and the archive path is keyed on the registrant. The bounded header scan (`tryGetFilingDocumentHead` + `parseNportHeader`, cap `SERIES_SCAN_LIMIT`) is the fallback and the disambiguator for a trust whose series carry no listed ticker; SEC's archive host **ignores `Range`** (a ranged request answers 200 with the whole body), so the saving is client-side stream cancellation only — and the cutoff cannot cut below one read chunk, which Bun sets at 262,144 bytes, so `HEADER_MAX_BYTES` binds only on a document arriving in several chunks. **A registrant's own NPORT-P list is never the candidate set for a series-structured trust**: series fiscal quarters are staggered, so the list interleaves funds and one report at the newest period does not mean one fund — it means the fund whose quarter ends latest. The scan therefore runs on the newest batch even when that batch holds one report, and a series found there re-routes through the browse feed; only a report naming no series at all (a closed-end fund, which also carries no `classId`) is answered from the registrant's list. Candidates are ordered by **reported period, not filing date**: an `NPORT-P/A` restating an old period is filed after every report of the periods that followed it. Reports publish on a ~60-day lag, so `report_period_date` and `publication_lag_days` are first-class output and the `as_of` enrichment states both.
|
|
118
118
|
- **Local mirror (opt-in, `EDGAR_MIRROR_ENABLED`):** routes `resolveCik`, `tryGetCompanyConcept`, `tryGetCompanyFacts`, and `tryGetFrames` to a local SQLite mirror (framework `MirrorService`) of `company_tickers.json` + the `companyfacts.zip` bulk archive. **Under `EDGAR_MIRROR_FALLBACK_LIVE` (default on) each read goes live wherever SEC may hold something newer than the store, and the store answers when that live read fails with anything but the caller's cancel (#234).** The ticker index reads `company_tickers.json` every TTL (ETF/mutual-fund tickers above). A point read (`tryGetCompanyConcept`, `tryGetCompanyFacts`, through `pointRead`) for a filer the store holds goes live only when the filer's newest `isXBRL` filing, on any form (companyfacts takes 8-K and 424B2 facts too), was accepted on or after the day before the companyfacts checkpoint, the bulk archive's `Last-Modified` (`companyFactsCheckpoint`); otherwise the store answers, and a tag it lacks is `null` with no live read, as SEC's 404 for an unreported tag is (#141). Live, a 404 answers the store's row where it holds one, since SEC never drops a fact from a filer's companyfacts once reported, and `null` where it does not, marking nothing. That recency comes from `getSubmissions` and its cache (`filerRecency`): one submissions read per filer per TTL, none in a call that already holds the document. Point reads asking while a filer's read is in flight share it, joining another call's read only when it cannot outspend their own failure budget, and ask again under their own scope when the call that started it is cancelled; the submissions cache holds at most 160 MiB of documents by the service's size estimate (`CACHE_BYTE_LIMITS`, 448 MiB with the archive-page and full-index caches), dropping the one used longest ago, and the failure marks at most `FILER_FAILURE_LIMIT` (4,096) filers. A failed recency or live read leaves the store answering that filer without asking SEC for `FILER_RETRY_MS` (60 s), or the failure's `retryAfter` when longer, so a 429 never turns an answer the store holds into a failure. A read the call's own failure budget ended, SEC failing none of its attempts (never sent, or its only attempt cut short of its 15 s wait), marks nothing; a call whose failure budget is already spent reads the store. A filer the store does not hold (`holdsFiler`), a store with no checkpoint, or a layer that never synced reads live, and a live failure there stands, since the store holds no answer. A frames period goes live while its filing window was open at the checkpoint (`frameWindowClosesMs`: `CY####` until November 1 of the next year, a quarterly or instant period until the first day of the seventh month after its quarter), the store's frame answering a live failure and the failure standing when the store has none; a closed period answers from the store, which applies the holder-form rules (#123, #142), live on a miss. Strict mode sends nothing for any of these reads: a miss is `null`, and a layer that never synced throws. Bootstrap out-of-band with `bun run mirror:init`; refresh nightly via cron (HTTP) or `bun run mirror:refresh`. Each ticker sync deletes, in the transaction that writes the rest, every stored symbol neither file lists any more, fund rows only when `company_tickers_mf.json` loaded; a `company_tickers.json` listing no ticker, or a refresh that would delete more than a quarter of either kind's stored rows, fails the sync and leaves the store as it was, and `mirror:init` applies such a drop. Both layers sync on every init and refresh, which rejects with the first failure once both have run (#247). Under `FALLBACK_LIVE` the refresh schedule sets how many reads go live, not how stale answers get; in strict mode it is how current they are. The three `mirror:*` commands also ship in the production Docker image — run them against a deployed container with `docker exec <container> bun run mirror:<init|refresh|verify>`. Node/Bun only — skipped on Workers. Frames are assembled from the company-facts store, so `loc` (business location) is absent. A companyfacts entry's `cik` is a number for some filers and a zero-padded string for others (about a fifth); the ingester accepts both, and an entry whose `cik` names no filer is counted in the completion notice's `skipped` rather than dropped silently, so a store built earlier lacks the string-`cik` filers until the first refresh after deploy, with no migration (#263). The ingester stores a tag's own name when SEC serves it with no label (`InterestExpenseNonoperating`), so every read path treats a stored label equal to a camel-case compound tag as no label (`storedLabel`) — callers fall back to the concept's label, and `getFrames` answers an empty `label` as the live frames API does; a one-word element's label is the word itself (`Revenues`) and is kept. Read-side, so stored rows need no migration. No FTS5 — every routed lookup is exact/indexed (cik+taxonomy+tag point, taxonomy+tag scan, cik scan for the whole-company read, ticker/CIK). Mirror ingests MF fund symbols from `company_tickers_mf.json`; on the mirror path a live MF merge supplements them when `FALLBACK_LIVE` is on (superseding the mirror's bare fund rows with series/class, and covering a mirror synced before MF ingestion), so funds resolve there too (#43, #135).
|
|
119
119
|
|
|
@@ -142,14 +142,14 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
142
142
|
|
|
143
143
|
| Module | Path | Purpose |
|
|
144
144
|
|:-------|:-----|:--------|
|
|
145
|
-
| `EdgarApiService` | `src/services/edgar/edgar-api-service.ts` | Paced HTTP client with the rate-limit block gate, CIK resolution, all SEC API calls |
|
|
145
|
+
| `EdgarApiService` | `src/services/edgar/edgar-api-service.ts` | Paced HTTP client with the rate-limit block gate and the side-read tier in front of the pacer (#283), CIK resolution, all SEC API calls |
|
|
146
146
|
| `submissions-archive` | `src/services/edgar/submissions-archive.ts` | `SubmissionsArchiveWalk` — the one walk over `filings.files[]` archive pages: shared page cap, caller-chosen order, early stop, scan depth and truncation |
|
|
147
|
-
| `call-scope` | `src/services/edgar/call-scope.ts` | `CallScope` — one tool call's `ctx.signal` plus its 40 s SEC failure budget (`CALL_FAILURE_BUDGET_MS`), passed to every `EdgarApiService` method that reaches SEC (#179); its `singleAttempt` option, which `rawFetch`'s retry gate honors, gives each request one attempt (#258) |
|
|
148
|
-
| `filing-headers` | `src/services/edgar/filing-headers.ts` | SEC submission-header parsers: per-document types and the submission's form / filing date / period |
|
|
147
|
+
| `call-scope` | `src/services/edgar/call-scope.ts` | `CallScope` — one tool call's `ctx.signal` plus its 40 s SEC failure budget (`CALL_FAILURE_BUDGET_MS`), passed to every `EdgarApiService` method that reaches SEC (#179); its `singleAttempt` option, which `rawFetch`'s retry gate honors, gives each request one attempt (#258), and its `sideRead` option has each request yield its pacer slot to primary reads (#283) |
|
|
148
|
+
| `filing-headers` | `src/services/edgar/filing-headers.ts` | SEC submission-header parsers: per-document types and the submission's form / filing date / period, and each party's file number by CIK; the header and index-headers parsers are linear in their input's length |
|
|
149
149
|
| `concept-map` | `src/services/edgar/concept-map.ts` | Static friendly name → XBRL tag mapping; `resolveConceptTarget` picks the taxonomy + tag list; `findUnknownConcept` rejects names that are neither |
|
|
150
150
|
| `trigram-similarity` | `src/services/edgar/trigram-similarity.ts` | Dice trigram scorer behind company and concept near-match suggestions |
|
|
151
|
-
| `concept-series` | `src/services/edgar/concept-series.ts` | Shared frame dedup + tag selection (priority or per-filer coverage); one value per standard calendar period within each unit key, and the default-unit ranking; filer fiscal-year ends; series-staleness caveats; related-tag readings and the pointer that replaces a staleness caveat (`relatedTagsFor`, `relatedTagReadings`, `relatedTagAhead`, `conceptLineCaveats`); the taxonomy-retry and newer-taxonomy helpers (`taxonomyRetry`, `hasFramedValue`, `newerTaxonomy`); the annual-report-gap helpers (`newestXbrlAnnualReport`, `annualReportGapCaveat`, #269) |
|
|
152
|
-
| `fiscal-periods` | `src/services/edgar/fiscal-periods.ts` | Fiscal-Q4 frame caveat
|
|
151
|
+
| `concept-series` | `src/services/edgar/concept-series.ts` | Shared frame dedup + tag selection (priority or per-filer coverage); one value per standard calendar period within each unit key, and the default-unit ranking; filer fiscal-year ends; series-staleness caveats; related-tag readings and the pointer that replaces a staleness caveat (`relatedTagsFor`, `relatedTagReadings`, `relatedTagAhead`, `conceptLineCaveats`); the taxonomy-retry and newer-taxonomy helpers (`taxonomyRetry`, `hasFramedValue`, `newerTaxonomy`); the annual-report-gap helpers (`newestXbrlAnnualReport`, `annualReportGapCaveat`, #269); the year-to-date series (`isYearToDate`, `resolveYtdSeriesByUnit`) |
|
|
152
|
+
| `fiscal-periods` | `src/services/edgar/fiscal-periods.ts` | Fiscal-Q4 frame caveat, per-filer missing-quarter detection, and the one-quarter-a-year caveat |
|
|
153
153
|
| `eight-k-items` | `src/services/edgar/eight-k-items.ts` | 8-K item-code decode tables for both numbering regimes; shape-driven `decodeEightKItem`; the shared 8-K form test `isMaterialEventForm` and dataframe columns `eightKItemColumns` |
|
|
154
154
|
| `xml-nodes` | `src/services/edgar/xml-nodes.ts` | Prefix-insensitive tag lookup + value coercion shared by the SEC XML parsers |
|
|
155
155
|
| `ownership-parser` | `src/services/edgar/ownership-parser.ts` | Form 4 ownership XML, 13F information tables, and the 13F cover page (filer name, period) |
|