mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-10-08 20:07:36 +02:00
Plánovaný workflow api_monitor.yml (denně 05:17 UTC + ruční spuštění) ověřuje kontrakt API, na kterém plugin závisí: - tests/api_contract.py – stejné dotazy jako plugin, kontrola klíčů, typů a tvarů odpovědí (OK / DRIFT / FAIL / UNAVAILABLE) - tests/api_plugin_live.py – vlastní funkce pluginu (fetch_set, load_amcr_data) proti živému API v qgis/qgis:ltr - tests/api_monitor_report.py – jedno sledovací issue se štítkem api-monitor; čistý běh ho zavře, výpadek ho nemění Neběží na PR, aby výpadek digiarchivu neshodil PR. Popis v AGENTS.md, OpenSpec změna add-daily-api-monitor. Připraveno s pomocí AI (Claude), ověřeno proti produkčnímu API.
2.8 KiB
2.8 KiB
Tasks
1. Contract test
- 1.1 Probe and fix the test inputs: a small bbox where
akce,lokalita,samostatny_nalezandpianall return 1–499 anonymous records, and a larger area for pagination; record the probe numbers in the script header; verify by a probe run in scratch - 1.2 Write
tests/api_contract.pywith the status model, retries and outputs from design.md (decisions 3, 4, 7) and checks for: i18ncs.json, every OAI set inamcr_codelists.slovnicek(first page shaperesumptionTokenpaging), facet fieldsf_vedouci/f_nalezceitem shape, main query per entity (keys and value types the plugin reads,numFoundint), pagination without overlap, bbox restriction, PIAN batch geometry, every filter key the dialog builds (values taken from live facets), date range, error answer for an invalid parameter (HTTP 200 withoutresponse), unknown entity, login with deliberately wrong credentials; verify a local run is all OK
- 1.3 Verify the drift detection: temporarily set the facet
expectation to the old
{"name":…}shape → DRIFT reported with the field and both shapes; revert
2. Live plugin test
- 2.1 Write
tests/api_plugin_live.py(package import ofamcr_viewer, fakeiface/ canvas, thresholds from design.md decision 6, same status model and outputs); verify it passes inqgis/qgis:ltr - 2.2 #67 regression: run it against the plugin from the commit before
the #67 fix (
git archiveinto scratch) → FAIL onvedouciandnalezce; verify and record the output
3. Workflow and reporting
- 3.1 Write
.github/workflows/api_monitor.ymlper design.md (decisions 1, 8, 9, 10): pinned action SHAs as incode_quality.yml, pinnedrequests, artifacts with result files, reporting job withissues: writeonly; verify withactionlint - 3.2 Reporting script (inline step or
tests/api_monitor_report.py) withAPI_MONITOR_DRY_RUN=1; verify the four cases (new issue, same fingerprint, changed fingerprint, recovery) and that a run with only UNAVAILABLE leaves the issue untouched - 3.3 Outage simulation (unroutable base URL override) → all UNAVAILABLE, exit 0; verify
4. Documentation and checks
- 4.1
AGENTS.md: new subsection on the API monitor (what it runs, local commands, how to read the issue, 60-day schedule disable, manual dispatch for version branches); verify by reading the diff - 4.2 Run the
AGENTS.mdcheck set (check_sources, bandit, detect-secrets--all-files, flake8--isolatedonamcr_viewer/, ruff, smoke test inqgis/qgis:ltrand:stable– unchanged plugin code, must stay green) andopenspec validate add-daily-api-monitor --strict; verify all clean - 4.3 After merge into
main: manualworkflow_dispatchonmain, inspect the summary and that no issue was opened on a clean run