mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-10-10 04:47:36 +02:00
ci: denní kontrola API digiarchivu a AMČR OAI
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.
This commit is contained in:
1 parent
7c0401c11b
commit
dde76203b2
10 files changed
+2140
No files matched your search
@@ -0,0 +1,57 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Contract test
|
||||
|
||||
- [x] 1.1 Probe and fix the test inputs: a small bbox where `akce`,
|
||||
`lokalita`, `samostatny_nalez` and `pian` all 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
|
||||
- [x] 1.2 Write `tests/api_contract.py` with the status model, retries and
|
||||
outputs from design.md (decisions 3, 4, 7) and checks for: i18n
|
||||
`cs.json`, every OAI set in `amcr_codelists.slovnicek` (first page shape
|
||||
+ `resumptionToken` paging), facet fields `f_vedouci` / `f_nalezce` item
|
||||
shape, main query per entity (keys and value types the plugin reads,
|
||||
`numFound` int), 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
|
||||
without `response`), unknown entity, login with deliberately wrong
|
||||
credentials; verify a local run is all OK
|
||||
- [x] 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
|
||||
|
||||
- [x] 2.1 Write `tests/api_plugin_live.py` (package import of
|
||||
`amcr_viewer`, fake `iface` / canvas, thresholds from design.md
|
||||
decision 6, same status model and outputs); verify it passes in
|
||||
`qgis/qgis:ltr`
|
||||
- [x] 2.2 #67 regression: run it against the plugin from the commit before
|
||||
the #67 fix (`git archive` into scratch) → FAIL on `vedouci` and
|
||||
`nalezce`; verify and record the output
|
||||
|
||||
## 3. Workflow and reporting
|
||||
|
||||
- [x] 3.1 Write `.github/workflows/api_monitor.yml` per design.md
|
||||
(decisions 1, 8, 9, 10): pinned action SHAs as in `code_quality.yml`,
|
||||
pinned `requests`, artifacts with result files, reporting job with
|
||||
`issues: write` only; verify with `actionlint`
|
||||
- [x] 3.2 Reporting script (inline step or `tests/api_monitor_report.py`)
|
||||
with `API_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
|
||||
- [x] 3.3 Outage simulation (unroutable base URL override) → all
|
||||
UNAVAILABLE, exit 0; verify
|
||||
|
||||
## 4. Documentation and checks
|
||||
|
||||
- [x] 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
|
||||
- [x] 4.2 Run the `AGENTS.md` check set (check_sources, bandit,
|
||||
detect-secrets `--all-files`, flake8 `--isolated` on `amcr_viewer/`,
|
||||
ruff, smoke test in `qgis/qgis:ltr` and `:stable` – unchanged plugin
|
||||
code, must stay green) and `openspec validate add-daily-api-monitor
|
||||
--strict`; verify all clean
|
||||
- [ ] 4.3 After merge into `main`: manual `workflow_dispatch` on `main`,
|
||||
inspect the summary and that no issue was opened on a clean run
|
||||
Reference in new issue
Block a user