Files
ss-tools/scripts/full_flow_finance/browser_page_replace.py
busya bcc69f4bbe feat(dashboard-testing): add sampled traversal and ClickHouse test lab
Add versioned metric graph authority, owned browser evidence, paginated and all-tab traversal, deterministic sampling policies, and analyst-facing run inspection.

Provision the DEV/PREPROD/PROD Superset, Gitea and million-row ClickHouse lab; retain reproducible lifecycle evidence and explicit incomplete-traversal limits.
2026-10-02 10:54:42 +03:00

39 lines
2.1 KiB
Python

# #region FullFlow.FinanceFreshPageProbe [C:3] [TYPE Module] [SEMANTICS fixture,readonly,page-lifecycle,exact-context]
# @BRIEF Test a fresh page within the actual authenticated context while explicitly closing the old renderer page.
# @INVARIANT No state injection, cookie copying, query bypass or coverage receipt; source identity remains exact.
from src.services.dashboard_testing.execution.providers.browser_pagination_reconstruct import reconstruct
# #region FullFlow.FinanceFreshPageProbe.Replace [C:3] [TYPE Function]
# @POST Original page closes, its callbacks detach, and the replacement uses the exact observed document-entry URL.
# @RATIONALE Same-page navigation plus collection failed public268 despite partial heap reclamation; a different owned page must be measured before changing runtime lifecycle.
async def replace(reader, ordinal, source):
old = reader.page
entry = reader.document_url
if not entry:
raise ValueError('BROWSER_TRAVERSAL_DOCUMENT_IDENTITY_UNAVAILABLE')
new = await old.context.new_page()
old.remove_listener('request',reader.observe_request)
old.remove_listener('response',reader.observe_response)
observer = getattr(reader,'context_observer',None)
if observer:
old.remove_listener('request',observer)
reader.page = new
reader.root = new.locator(f'#chart-id-{reader.limits.chart_id}')
reader.position,reader.exchange,reader.initialized = 0,None,False
new.on('request',reader.observe_request)
new.on('response',reader.observe_response)
if observer:
new.on('request',observer)
reader.stage = 'owned_page_replacement'
await old.close()
if not old.is_closed():
raise ValueError('BROWSER_TRAVERSAL_OLD_PAGE_CLOSE_FAILED')
await new.goto(entry,wait_until='domcontentloaded',timeout=120000)
await reader.root.locator(reader.limits.table_selector).wait_for(state='visible',timeout=120000)
await reader.prepare()
await reconstruct(reader,ordinal,source)
reader.last_maintenance_ordinal = ordinal
# #endregion FullFlow.FinanceFreshPageProbe.Replace
# #endregion FullFlow.FinanceFreshPageProbe