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.
73 lines
3.9 KiB
Python
73 lines
3.9 KiB
Python
#!/usr/bin/env python3
|
|
# #region FullFlow.FinanceTableDiagnostic [C:3] [TYPE Module] [SEMANTICS fixture,browser,table,diagnostic]
|
|
# @BRIEF Retain actual exact-chart table structure before changing production selection.
|
|
# @INVARIANT Observation only; this command does not claim traversal receipts or coverage.
|
|
import argparse
|
|
import asyncio
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from playwright.async_api import async_playwright
|
|
|
|
from release import private_environment
|
|
|
|
|
|
# #region FullFlow.FinanceTableDiagnostic.Snapshot [C:2] [TYPE Function]
|
|
# @POST Bounded exact-chart structure excludes cookies, requests, credential values and cell contents.
|
|
async def snapshot(page):
|
|
return await page.evaluate('''() => ({root_count:document.querySelectorAll('#chart-id-6').length,
|
|
charts:[...document.querySelectorAll('#chart-id-6')].map(root=>({
|
|
tables:[...root.querySelectorAll('table')].map(table=>({
|
|
id:table.id,classes:table.className,visible:!!table.getClientRects().length,
|
|
headers:table.querySelectorAll('thead th').length,rows:table.querySelectorAll('tbody tr').length,
|
|
parent_tag:table.parentElement.tagName,parent_classes:table.parentElement.className,
|
|
markup:table.cloneNode(false).outerHTML})),
|
|
current:[...root.querySelectorAll('.pagination li.active a')].map(node=>node.textContent.trim())
|
|
}))})''')
|
|
# #endregion FullFlow.FinanceTableDiagnostic.Snapshot
|
|
|
|
|
|
# #region FullFlow.FinanceTableDiagnostic.Observe [C:3] [TYPE Function]
|
|
# @POST Authenticated initial/next/returned-first DOM counts are retained independently of production selection.
|
|
async def observe(args):
|
|
private_environment(args.env_file)
|
|
args.output.mkdir(parents=True,exist_ok=False)
|
|
report = {'scope':'Exact chart DOM diagnostic only; no complete traversal claim'}
|
|
async with async_playwright() as playwright:
|
|
browser = await playwright.chromium.launch(headless=True)
|
|
page = await browser.new_page(viewport={'width':1600,'height':1000})
|
|
try:
|
|
await page.goto('http://127.0.0.1:18111/login/',wait_until='domcontentloaded')
|
|
await page.locator('#username').fill('admin')
|
|
await page.locator('#password').fill(os.environ['FIXTURE_PASSWORD'])
|
|
await page.locator('input[type="submit"],button[type="submit"]').click()
|
|
await page.wait_for_url(lambda url:'/login' not in url,timeout=30000)
|
|
await page.goto('http://127.0.0.1:18111/superset/dashboard/2/',wait_until='domcontentloaded')
|
|
await page.locator('#chart-id-6 tbody tr').first.wait_for(state='visible',timeout=90000)
|
|
report['initial'] = await snapshot(page)
|
|
chart = page.locator('#chart-id-6')
|
|
await chart.locator('.pagination a[href="#page-1"]').click()
|
|
await page.wait_for_function("() => document.querySelector('#chart-id-6 tbody tr td')?.textContent.trim()==='201'",timeout=90000)
|
|
report['next'] = await snapshot(page)
|
|
await chart.locator('.pagination a[href="#page-0"]').click()
|
|
await page.wait_for_function("() => document.querySelector('#chart-id-6 tbody tr td')?.textContent.trim()==='1'",timeout=90000)
|
|
report['returned_first'] = await snapshot(page)
|
|
finally:
|
|
args.output.joinpath('report.json').write_text(json.dumps(report,indent=2,ensure_ascii=False)+'\n')
|
|
await browser.close()
|
|
# #endregion FullFlow.FinanceTableDiagnostic.Observe
|
|
|
|
|
|
# #region FullFlow.FinanceTableDiagnostic.Main [C:1] [TYPE Function]
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('--env-file',type=Path,required=True)
|
|
parser.add_argument('--output',type=Path,required=True)
|
|
asyncio.run(observe(parser.parse_args()))
|
|
# #endregion FullFlow.FinanceTableDiagnostic.Main
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
# #endregion FullFlow.FinanceTableDiagnostic
|