Repository navigation
Description
Follow-up split from #1966 / #1967 (ESA scope3data/embedded-sales-agent#1362).
Problem
Every get_reporting_status summary and periods response repeats scope-wide data that grows with the account, not with the page:
scope.delivery_config_generations: about 4 JSON nodes per configuration generation.- For a
periodhorizon that starts beforescope.ledger_retained_from, oneHISTORY_UNAVAILABLEissue per generation (status_projection._project, "history-unavailable-v1"): about 12 nodes each. - The scope-level
issueslist also carries per-obligation issues (for example oneREPORT_OVERDUEper missing report) for the whole evaluated scope.
#1967 bounds each periods page to 8,000 nodes and makes the records give way to this fixed part. Measured on the in-memory ledger: with 334 hourly generations (staging's account 6082151998) and a horizon, the fixed part is about 5,500 nodes and pages still fit, with fewer records each. Past about 500 generations with a horizon, the fixed part alone exceeds the page budget. Past about 600 it exceeds the 10,000-node cap a buyer's SDK applies, and paging cannot help. With 334 generations and no delivered revisions, (3) alone makes the fixed part 16,876 nodes.
Why this isn't in #1967
- The scope can't be filtered per page. The response schema defines
scopeas the "Exact denominator evaluated for summary or periods health", anddelivery_config_generationsas the "Exact independently reconciled configuration generations in the denominator". Top-levelhealthandissuesdescribe that whole denominator._scope_to_wiredocuments that it is derived from configurations "so every page of one cursor reports the identical scope". Listing only the generations that own a returned period would make health and scope disagree and change from page to page. - Filtering by horizon doesn't fix the staging case. A denominator restricted to generations whose active lifetime overlaps the horizon is allowed by the spec. But staging's generations were all created within days, so any realistic horizon still overlaps all of them.
- The real driver is semantic.
status_retained_fromtakes the latest per-generation boundary,max(as_of - retention, min(activated_at, as_of)). Soledger_retained_fromjumps to the newest generation's activation, and any horizon before it reportscoverage_complete: falsewith oneHISTORY_UNAVAILABLEper generation, even though nothing was owed before that activation and no history was lost. Changing this changes health (action_requiredto healthy) in summary, periods and status push, because they share one projection. It needs its own review, and possibly spec clarification ofledger_retained_from("for every selected configuration generation").
Proposal (for discussion)
- Restrict the denominator to generations whose active interval
[activated_at, deactivated_at or publication stop + SLA + recovery window)overlaps the horizon, applied identically in summary, periods and push. Also count generations that own an obligation in the horizon. - Compute
ledger_retained_fromfrom retention only (and per-generation activation only where history before activation was actually owed), so a re-version doesn't make history "unavailable". - Emit one
HISTORY_UNAVAILABLEper uncovered horizon (with the affected generations bounded or summarized) rather than one per generation, keeping issue ids stable for notifications. allOf/5 of the response schema only requires at least one. - Decide how the scope-level
issueslist stays bounded for accounts with many open obligation issues (for example, aggregate per generation and code, and keep per-obligation detail on the period records).
Check against the TS SDK and the interop corpus before changing issue ids or the denominator rule.
Activity
test(reporting): page a heavily re-versioned account within the node …
fix: page get_reporting_status by max_results and size; validate a se…