mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-24 06:26:29 +01:00
Compare commits
No commits in common. "dfc5d07f5225ed15609f9709748ed2efd6cc4d1d" and "f304eadc53a7a7113c5cef6af21ba0de25d490be" have entirely different histories.
dfc5d07f52
...
f304eadc53
34
.github/workflows/app-errors-tests.yml
vendored
34
.github/workflows/app-errors-tests.yml
vendored
@ -1,34 +0,0 @@
|
||||
name: app_errors tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
# The workflow's own file counts as app_errors: editing only this file would
|
||||
# otherwise trigger nothing, so a fix to the job itself could never prove
|
||||
# itself.
|
||||
paths: ['app_errors/**', '.github/workflows/app-errors-tests.yml']
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths: ['app_errors/**', '.github/workflows/app-errors-tests.yml']
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app_errors
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
cache: pip
|
||||
cache-dependency-path: app_errors/requirements.txt
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt && pip install --no-deps -e .
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: python -m pytest -v
|
||||
@ -1,6 +1,6 @@
|
||||
# utils
|
||||
|
||||
Monorepo of shared gates and libraries (app_errors, dep_freshness, file_length, md_naming,
|
||||
Monorepo of shared gates and libraries (dep_freshness, file_length, md_naming,
|
||||
repo_contract, coverage_gaps, crdt-sync, gatelock, freedays, sickdays, earned_time, music_theory, game_recording,
|
||||
flutter_web_drive (headless Flutter-web E2E driver + MCP), ...).
|
||||
`godot_dev_tools/` is a Godot addon (GDScript): `godot_dev_tools/test.sh` runs its GUT tests.
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
# App errors and slow waits become board tickets
|
||||
|
||||
kuhy's rule (2026-11-17): every error, and every wait the user sees over 1 s, in
|
||||
any of his apps is reported automatically. The board then turns each one into a
|
||||
ticket that fixes itself. This doc covers the apps' half and the PC ingest. The
|
||||
board's half is todoImplementer `DOCS-errors.md`, with the contract in
|
||||
`contracts/app-error.schema.json`. The design is kartka's pipeline
|
||||
(`~/src/kartka`, `docs/DOCS-error-reports.md`), made shared.
|
||||
|
||||
## Pipeline
|
||||
|
||||
1. **Apps report.** Each report is one *entry* (see `app_errors/README.md`):
|
||||
- Flutter, `crdt_sync_flutter` 0.9.0: `installAppErrors` hooks
|
||||
`FlutterError.onError` and `PlatformDispatcher.onError`. `WaitWatch` turns
|
||||
a spinner shown over 1 s into `perf.slow`. The device deduplicates (30 s,
|
||||
20 a minute) and redacts each report, and queues it in
|
||||
`SharedPreferences`. It uploads to RTDB `/<app>/errors/<device>/<id>` with
|
||||
the build (versionCode).
|
||||
- Python/Tk, `gatelock` 0.15.0: `gatelock.error_report.install` hooks
|
||||
`sys.excepthook`, `threading.excepthook` and Tk callback errors.
|
||||
`watch_stalls(root, rep)` reports a frozen Tk loop over 1 s.
|
||||
`rep.wait(...)` and `rep.begin(...)` time a wait.
|
||||
- Godot, `godot_dev_tools` 0.2.0, `addons/app_errors`: an `OS.add_logger`
|
||||
logger catches script errors and `push_error`. A frame over 1 s, or
|
||||
`report_wait` over 1 s, becomes `perf.slow`.
|
||||
- PC apps (Tk and Godot) append to the local spool
|
||||
`~/.local/state/app-errors-spool/<app>.jsonl`. They need no RTDB, because
|
||||
the ingest runs on the same PC.
|
||||
2. **The PC ingests.** `app-errors-ingest.timer` runs `app-errors ingest` every
|
||||
5 min. It reads RTDB through an already seeded crdt-sync session
|
||||
(`firebase_backup`) and reads the spool. It merges reports by signature
|
||||
(Dart signatures are kartka-identical), deletes what it read, and writes
|
||||
`~/.local/state/app-errors/<app>.json` as a contract `report`.
|
||||
3. **The board files tickets.** It scans that folder every 60 s and makes one
|
||||
ticket per `app:signature` (todoImplementer `DOCS-errors.md`).
|
||||
|
||||
`app-errors resolve <app> <signature>` sets `open: false`. A later report opens
|
||||
the error again only when it is a regression: a newer build when both sides
|
||||
know the build, else a report made after the resolve. The board never calls
|
||||
`resolve` on its own, because folder sources have no resolve hook. It tracks
|
||||
shipped fixes by `fixed_build`.
|
||||
|
||||
## Choices made (no questions asked, per the brief)
|
||||
|
||||
- kartka keeps its own ingest for now. The shared ingest skips `/kartka`, and
|
||||
the board's `kartka` adapter still reads kartka's `state.json`. Two readers
|
||||
would race on deletes. To move kartka over, switch the board's default
|
||||
source off (`error_sources`) and retire `kartka-errors.timer`. Its ticket
|
||||
ids stay the same, because the signatures match.
|
||||
- Tk and Godot use the local spool instead of RTDB: they only run on the PC.
|
||||
- The Godot reporter is its own addon folder, mounted in every build. It is
|
||||
not part of `dev_tools`, which only loads for `--dev` runs.
|
||||
- Reporting is silent: no text, dialog or notification in any app.
|
||||
|
||||
## Install and check
|
||||
|
||||
`scripts/deploy.sh` runs `app_errors/install.sh`. That installs the venv and
|
||||
`~/.local/bin/app-errors`, enables the timer, and checks that the timer is
|
||||
active and the venv imports the live checkout.
|
||||
@ -77,13 +77,6 @@ watcher + pacman hooks). Not a package — installed by running
|
||||
Consumed by `steam-backlog-enforcer` (expects a `guard-lib/install.sh`
|
||||
sibling clone) and referenced by `screen-locker`.
|
||||
|
||||
## app_errors/
|
||||
|
||||
The PC ingest of the shared app error and slow-wait reporting: RTDB and local
|
||||
spool reports in, todoImplementer board tickets out, on a systemd `--user`
|
||||
timer. The reporters live in `crdt_sync_flutter`, `gatelock` and
|
||||
`godot_dev_tools/addons/app_errors`. See [`DOCS-app-errors.md`](DOCS-app-errors.md).
|
||||
|
||||
## gatelock/
|
||||
|
||||
Python lock-window + HMAC log-integrity backend (package: `gatelock`, not
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
# app_errors
|
||||
|
||||
The PC side of kuhy's app error and slow-wait reporting. Every app reports
|
||||
errors, and every wait the user sees over 1 s (`perf.slow`). This ingest merges
|
||||
the reports by signature and writes `~/.local/state/app-errors/<app>.json` in
|
||||
the todoImplementer `contracts/app-error.schema.json` `report` shape. The board
|
||||
reads that folder and turns each open error into a self-fixing ticket
|
||||
(todoImplementer `DOCS-errors.md`).
|
||||
|
||||
Generalised from kartka's `tools/errors`. Dart signatures are byte-identical to
|
||||
kartka's. See `DOCS-app-errors.md` at the repo root for the whole pipeline.
|
||||
|
||||
## Where reports come from
|
||||
|
||||
| Reporter | Runs on | Writes |
|
||||
|---|---|---|
|
||||
| `crdt_sync_flutter` `installErrorReporting` | phone, desktop, web | RTDB `/<app>/errors/<device>/<id>` |
|
||||
| `gatelock.error_report.install` | PC (Tk) | spool `~/.local/state/app-errors-spool/<app>.jsonl` |
|
||||
| Godot `addons/app_errors` (`godot_dev_tools/`) | PC | the same spool |
|
||||
|
||||
The ingest skips `kartka` in RTDB, because kartka still runs its own ingest.
|
||||
|
||||
## Entry (one report, every language)
|
||||
|
||||
`at` (ISO UTC), `kind` (`uncaught.flutter`, `uncaught.python`, `uncaught.gdscript`,
|
||||
`ui.snackbar`, `perf.slow`, ...), `error`, `stack` (list of frames), plus these
|
||||
optional fields:
|
||||
|
||||
- `repo` (`owner/name`, default `kuhyx/<app>`)
|
||||
- `mark` (the substring that marks the app's own frames: `package:todo/`,
|
||||
`leetcode_guard/`, `res://`)
|
||||
- `route`
|
||||
- `operation`, `durationMs`, `waitId` and `still` (slow waits)
|
||||
- `build` (versionCode, 0 when unknown) and `version`
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
app-errors ingest # what the timer runs every 5 min
|
||||
app-errors ingest --keep # leave RTDB entries in place
|
||||
app-errors ingest --no-rtdb # local spool only
|
||||
app-errors resolve <app> <signature> # mark it fixed; a newer build reopens it
|
||||
```
|
||||
|
||||
`app_errors/install.sh` installs the venv
|
||||
(`~/.local/share/app-errors/venv`), the `app-errors` link and
|
||||
`app-errors-ingest.timer`. `scripts/deploy.sh` runs it.
|
||||
|
||||
RTDB access reuses an already seeded crdt-sync session (`--session`, default
|
||||
`firebase_backup`), so the ingest needs no sign-in of its own.
|
||||
|
||||
Tests: `cd app_errors && python -m pytest` (100 % branch coverage).
|
||||
@ -1,2 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""Shared app error and slow-wait ingest: RTDB and spool reports in, board tickets out."""
|
||||
@ -1,66 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""``app-errors``: ``ingest`` (what the timer runs) and ``resolve <app> <signature>``."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import datetime as dt
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from app_errors import ingest, store
|
||||
from app_errors.rtdb import DEFAULT_SESSION, RtdbError, open_rtdb
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Sequence
|
||||
|
||||
|
||||
def _parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="app-errors", description=__doc__)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
run = sub.add_parser("ingest", help="read RTDB and the spool, write the board reports")
|
||||
run.add_argument("--keep", action="store_true", help="leave RTDB entries in place")
|
||||
run.add_argument("--no-rtdb", action="store_true", help="read the local spool only")
|
||||
run.add_argument("--session", default=DEFAULT_SESSION, help="seeded crdt-sync credential store")
|
||||
res = sub.add_parser("resolve", help="mark an error fixed (a newer build reopens it)")
|
||||
res.add_argument("app")
|
||||
res.add_argument("signature")
|
||||
return parser
|
||||
|
||||
|
||||
def _ingest(args: argparse.Namespace) -> int:
|
||||
db, error = None, None
|
||||
if not args.no_rtdb:
|
||||
try:
|
||||
db = open_rtdb(args.session)
|
||||
except RtdbError as e:
|
||||
error = str(e)
|
||||
summary = ingest.run(ingest.default_paths(), db, keep=args.keep)
|
||||
error = error or summary.rtdb_error
|
||||
print(f"app-errors: {summary.merged} new") # noqa: T201 -- terminal-only CLI
|
||||
if error:
|
||||
print(f"app-errors: RTDB: {error}", file=sys.stderr) # noqa: T201
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
def _resolve(args: argparse.Namespace) -> int:
|
||||
paths = ingest.default_paths()
|
||||
state = store.load(paths.state)
|
||||
now = dt.datetime.now(dt.UTC).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
if not store.resolve(state, args.app, args.signature, now=now):
|
||||
print(f"app-errors: unknown error {args.app} {args.signature}", file=sys.stderr) # noqa: T201
|
||||
return 1
|
||||
store.save(paths.state, state)
|
||||
store.write_reports(paths.reports, state)
|
||||
return 0
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
"""Run the CLI; return the exit code."""
|
||||
args = _parser().parse_args(argv)
|
||||
return _ingest(args) if args.command == "ingest" else _resolve(args)
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
sys.exit(main())
|
||||
@ -1,96 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""One ingest pass: RTDB and the local spool in, the board's reports out.
|
||||
|
||||
In: RTDB ``/<app>/errors/<device>/<id>`` and the spool. Out:
|
||||
``<state>/app-errors/<app>.json``, the board's contract report.
|
||||
|
||||
RTDB entries are deleted once the state holding them is saved (``keep``
|
||||
leaves them; ``seen`` stops a second count). kartka is skipped: it still runs
|
||||
its own ingest (``~/src/kartka/tools/errors``), which the board reads through
|
||||
its ``kartka`` adapter, and two readers of ``/kartka/errors`` would race.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from app_errors import spool, store
|
||||
from app_errors.rtdb import RtdbError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app_errors.rtdb import Rtdb
|
||||
|
||||
#: Apps with their own ingest, never read here.
|
||||
SKIP_APPS = frozenset({"kartka"})
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Paths:
|
||||
"""Where the ingest keeps its state, writes reports and reads the spool."""
|
||||
|
||||
state: Path
|
||||
reports: Path
|
||||
spool: Path
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Summary:
|
||||
"""What one pass did."""
|
||||
|
||||
merged: int
|
||||
rtdb_error: str | None
|
||||
|
||||
|
||||
def default_paths() -> Paths:
|
||||
"""Return the paths under ``$XDG_STATE_HOME`` (default ``~/.local/state``)."""
|
||||
base = Path(os.environ.get("XDG_STATE_HOME") or Path.home() / ".local" / "state")
|
||||
return Paths(
|
||||
base / "app-errors-ingest" / "state.json",
|
||||
base / "app-errors",
|
||||
base / "app-errors-spool",
|
||||
)
|
||||
|
||||
|
||||
def _rtdb_entries(
|
||||
db: Rtdb,
|
||||
) -> tuple[list[tuple[str, str, object]], dict[str, dict[str, object]]]:
|
||||
"""Return (app, device/id, entry) for every RTDB report, and the deletes that consume them."""
|
||||
found: list[tuple[str, str, object]] = []
|
||||
deletes: dict[str, dict[str, object]] = {}
|
||||
top = db.get("", shallow=True)
|
||||
for app in sorted(top) if isinstance(top, dict) else []:
|
||||
if app in SKIP_APPS or not store.APP_NAME.match(app):
|
||||
continue
|
||||
devices = db.get(f"{app}/errors")
|
||||
for device, entries in devices.items() if isinstance(devices, dict) else []:
|
||||
for entry_id, entry in entries.items() if isinstance(entries, dict) else []:
|
||||
found.append((app, f"{device}/{entry_id}", entry))
|
||||
deletes.setdefault(app, {})[f"{device}/{entry_id}"] = None
|
||||
return found, deletes
|
||||
|
||||
|
||||
def run(paths: Paths, db: Rtdb | None, *, keep: bool = False) -> Summary:
|
||||
"""Ingest everything once; RTDB failures are returned, the spool still goes in."""
|
||||
state = store.load(paths.state)
|
||||
merged = 0
|
||||
rtdb_error = None
|
||||
deletes: dict[str, dict[str, object]] = {}
|
||||
if db is not None:
|
||||
try:
|
||||
found, deletes = _rtdb_entries(db)
|
||||
except RtdbError as e:
|
||||
found, rtdb_error = [], str(e)
|
||||
merged += sum(store.merge(state, app, key, entry) for app, key, entry in found)
|
||||
merged += sum(store.merge(state, line.app, line.id, line.entry) for line in spool.drain(paths.spool))
|
||||
store.save(paths.state, state)
|
||||
store.write_reports(paths.reports, state)
|
||||
if db is not None and not keep:
|
||||
try:
|
||||
for app, paths_gone in deletes.items():
|
||||
db.patch(f"{app}/errors", paths_gone)
|
||||
except RtdbError as e:
|
||||
rtdb_error = str(e)
|
||||
return Summary(merged, rtdb_error)
|
||||
@ -1,104 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""A minimal RTDB REST client on a seeded crdt-sync Google session.
|
||||
|
||||
Ported from kartka's ``tools/errors`` (``kartka_errors.rtdb``), plus
|
||||
``shallow`` reads to list the apps. The sync account is Google-only, so the
|
||||
session is an already seeded ``~/.config/<store>/firebase_auth.json`` (crdt-
|
||||
sync's ``tool.seed_session`` writes one; it refreshes itself). The request URL
|
||||
carries the ID token (``?auth=``), so no error raised here ever includes it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
import json
|
||||
from typing import Protocol
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
#: The credential store read by default: the backup timer's, a PC-side reader
|
||||
#: of the same database (any seeded store of the sync account works).
|
||||
DEFAULT_SESSION = "firebase_backup"
|
||||
#: Per-request timeout, seconds (token refresh has its own, below).
|
||||
TIMEOUT = 15.0
|
||||
TOKEN_TIMEOUT = 8.0
|
||||
|
||||
type Opener = Callable[..., object]
|
||||
|
||||
|
||||
class RtdbError(RuntimeError):
|
||||
"""An RTDB request failed, or there is no session (the message never names the URL)."""
|
||||
|
||||
|
||||
class Rtdb(Protocol):
|
||||
"""Read and multi-path write access to RTDB."""
|
||||
|
||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
||||
"""Return the decoded JSON at ``path`` (None when absent)."""
|
||||
...
|
||||
|
||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
||||
"""Apply a multi-path update of ``path`` (a None value deletes)."""
|
||||
...
|
||||
|
||||
|
||||
class RestRtdb:
|
||||
"""RTDB over REST with ``?auth=<id token>``."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
database_url: str,
|
||||
id_token: Callable[[], str],
|
||||
opener: Opener = urllib.request.urlopen,
|
||||
) -> None:
|
||||
"""Talk to ``database_url`` with tokens from ``id_token``."""
|
||||
self._url = database_url.rstrip("/")
|
||||
self._id_token = id_token
|
||||
self._open = opener
|
||||
|
||||
def _send(self, method: str, path: str, body: bytes | None, query: str = "") -> object:
|
||||
try:
|
||||
token = self._id_token()
|
||||
except Exception as e: # noqa: BLE001 -- any refresh failure, typed only
|
||||
msg = f"RTDB {method} {path}: token refresh failed ({type(e).__name__})"
|
||||
raise RtdbError(msg) from None
|
||||
req = urllib.request.Request( # noqa: S310 -- https only, built here
|
||||
f"{self._url}/{path}.json?auth={token}{query}",
|
||||
data=body,
|
||||
method=method,
|
||||
headers={"Content-Type": "application/json"},
|
||||
)
|
||||
try:
|
||||
with self._open(req, timeout=TIMEOUT) as res: # type: ignore[attr-defined]
|
||||
return json.loads(res.read() or b"null")
|
||||
except urllib.error.HTTPError as e:
|
||||
msg = f"RTDB {method} {path}: HTTP {e.code}"
|
||||
raise RtdbError(msg) from None
|
||||
except (urllib.error.URLError, OSError, ValueError) as e:
|
||||
msg = f"RTDB {method} {path}: {type(e).__name__}"
|
||||
raise RtdbError(msg) from None
|
||||
|
||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
||||
"""GET ``path``; raises :class:`RtdbError` on any failure."""
|
||||
return self._send("GET", path, None, "&shallow=true" if shallow else "")
|
||||
|
||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
||||
"""PATCH ``data`` into ``path``; raises :class:`RtdbError`."""
|
||||
self._send("PATCH", path, json.dumps(data).encode())
|
||||
|
||||
|
||||
def open_rtdb(session: str = DEFAULT_SESSION) -> RestRtdb:
|
||||
"""Return the client on the seeded ``session``; :class:`RtdbError` without one."""
|
||||
import crdt_sync # noqa: PLC0415 -- only the RTDB path needs it; spool-only runs stay stdlib
|
||||
|
||||
try:
|
||||
config = crdt_sync.FirebaseConfig.load()
|
||||
except Exception as e: # noqa: BLE001 -- a missing or broken config, typed only
|
||||
msg = f"no Firebase config ({type(e).__name__})"
|
||||
raise RtdbError(msg) from None
|
||||
store = crdt_sync.credential_store_for(session)
|
||||
auth = crdt_sync.FirebaseTokenProvider(config.api_key, store, timeout_seconds=TOKEN_TIMEOUT)
|
||||
if not auth.has_session():
|
||||
msg = f"no seeded sign-in session '{session}'; seed one with crdt-sync's tool.seed_session --app {session}"
|
||||
raise RtdbError(msg)
|
||||
return RestRtdb(config.database_url, auth.id_token)
|
||||
@ -1,128 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""Group error reports: one signature per bug, however often it fires.
|
||||
|
||||
Ported from kartka's ``tools/errors`` (``kartka_errors.signature``) and kept
|
||||
byte-identical for Dart entries, so kartka's existing tickets keep their ids
|
||||
when it moves onto this ingest. Generalised in one place only: which stack
|
||||
frames belong to the app. An entry's ``mark`` names them (``package:todo/``
|
||||
for Dart, ``leetcode_guard/`` for Python, ``res://`` for GDScript); without
|
||||
one it is ``package:<app>/``.
|
||||
|
||||
A signature is the error type, the message with its volatile parts (numbers,
|
||||
ids, URLs) masked, and where it happened: the first app frame without line
|
||||
numbers (so an edit elsewhere in the file does not split it), else the route,
|
||||
else the entry kind. A slow wait is its route + operation, never its time.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import hashlib
|
||||
import re
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Mapping, Sequence
|
||||
|
||||
#: The longest normalised message kept in a signature.
|
||||
MAX_MESSAGE = 160
|
||||
#: The entry kind of a user-visible wait over a second.
|
||||
SLOW_KIND = "perf.slow"
|
||||
|
||||
_TYPE = re.compile(r"^(?:Unhandled error: )?([A-Z][\w$]*(?:Exception|Error))\b")
|
||||
#: Dart errors whose ``toString`` does not name their type.
|
||||
_DART_PREFIXES = {
|
||||
"Bad state": "StateError",
|
||||
"Invalid argument": "ArgumentError",
|
||||
"Unsupported operation": "UnsupportedError",
|
||||
"Null check operator": "TypeError",
|
||||
"Concurrent modification": "ConcurrentModificationError",
|
||||
}
|
||||
_URL = re.compile(r"(https?://\S+|<url>)")
|
||||
_UUID = re.compile(r"\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b", re.IGNORECASE)
|
||||
_HEX = re.compile(r"\b(?=[0-9a-f]*\d)[0-9a-f]{8,}\b", re.IGNORECASE)
|
||||
_NUMBER = re.compile(r"\b\d+(\.\d+)?\b")
|
||||
_SPACE = re.compile(r"\s+")
|
||||
_FRAME = re.compile(r"^#\d+\s+")
|
||||
_LINE_COL = re.compile(r"(\.(?:dart|py|gd))(:\d+)+")
|
||||
#: Frames of the reporting plumbing itself, never the bug's location.
|
||||
_PLUMBING = (
|
||||
"package:kartka/app/error_hooks.dart",
|
||||
"package:kartka/core/diagnostics/",
|
||||
"package:crdt_sync_flutter/src/errors/",
|
||||
"gatelock/error_report.py",
|
||||
"res://addons/app_errors/",
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Signature:
|
||||
"""What groups reports of one bug."""
|
||||
|
||||
id: str
|
||||
type: str
|
||||
message: str
|
||||
where: str
|
||||
|
||||
|
||||
def error_type(error: str, kind: str) -> str:
|
||||
"""Return the exception type named by ``error``, else ``kind``."""
|
||||
if match := _TYPE.match(error):
|
||||
return match[1]
|
||||
for prefix, name in _DART_PREFIXES.items():
|
||||
if error.startswith(prefix):
|
||||
return name
|
||||
return kind
|
||||
|
||||
|
||||
def normalise(message: str) -> str:
|
||||
"""Return ``message`` with URLs, uuids, long hex and numbers masked, trimmed."""
|
||||
text = _URL.sub("<url>", message)
|
||||
text = _UUID.sub("<uuid>", text)
|
||||
text = _HEX.sub("<hex>", text)
|
||||
text = _NUMBER.sub("<n>", text)
|
||||
return _SPACE.sub(" ", text).strip()[:MAX_MESSAGE]
|
||||
|
||||
|
||||
def top_frame(stack: Sequence[str], mark: str) -> str | None:
|
||||
"""Return the first frame containing ``mark`` outside the reporting plumbing."""
|
||||
for frame in stack:
|
||||
if mark in frame and not any(p in frame for p in _PLUMBING):
|
||||
return _LINE_COL.sub(r"\1", _FRAME.sub("", frame.strip()))
|
||||
return None
|
||||
|
||||
|
||||
def mark_of(entry: Mapping[str, object], app: str) -> str:
|
||||
"""Return the substring that marks the app's own frames in ``entry``."""
|
||||
mark = entry.get("mark")
|
||||
return mark if isinstance(mark, str) and mark else f"package:{app}/"
|
||||
|
||||
|
||||
def strings(value: object) -> list[str]:
|
||||
"""Return ``value`` as a list of strings; empty when it is not a list."""
|
||||
return [str(v) for v in value] if isinstance(value, list) else []
|
||||
|
||||
|
||||
def _digest(text: str) -> str:
|
||||
return hashlib.sha1(text.encode()).hexdigest()[:10] # noqa: S324 -- a grouping key, not security
|
||||
|
||||
|
||||
def signature(entry: Mapping[str, object], *, app: str) -> Signature:
|
||||
"""Return the signature of one report of ``app``."""
|
||||
kind = str(entry.get("kind", "?"))
|
||||
if kind == SLOW_KIND:
|
||||
operation = str(entry.get("operation") or "?")
|
||||
where = f"route {entry.get('route') or '?'}"
|
||||
return Signature(
|
||||
_digest(f"{SLOW_KIND}|{where}|{operation}"),
|
||||
SLOW_KIND,
|
||||
f"slow wait: {operation}",
|
||||
where,
|
||||
)
|
||||
error = str(entry.get("error", ""))
|
||||
frame = top_frame(strings(entry.get("stack")), mark_of(entry, app))
|
||||
route = entry.get("route")
|
||||
where = frame or (f"route {route}" if route else f"kind {kind}")
|
||||
kind_type = error_type(error, kind)
|
||||
message = normalise(error)
|
||||
return Signature(_digest(f"{kind_type}|{message}|{where}"), kind_type, message, where)
|
||||
@ -1,66 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""The local spool: how PC apps (Tk gate windows, Godot games) report.
|
||||
|
||||
They run on the PC the ingest runs on, so they need no RTDB: each report is
|
||||
one JSON line appended to ``<spool>/<app>.jsonl`` (the writers are
|
||||
``gatelock.error_report`` and the Godot ``app_errors`` addon; this module is
|
||||
the reference writer and the reader). The ingest claims a file by renaming it
|
||||
to ``.jsonl.ingesting`` before reading, so a line appended meanwhile lands in
|
||||
a fresh file and is never lost. The spool sits beside, not inside, the
|
||||
board's ``app-errors/`` folder, which reads every ``*.json`` there.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import hashlib
|
||||
import json
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from app_errors.store import APP_NAME
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator, Mapping
|
||||
from pathlib import Path
|
||||
|
||||
SUFFIX = ".jsonl"
|
||||
CLAIMED = ".jsonl.ingesting"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Line:
|
||||
"""One spooled report: its app, a stable id and the decoded entry."""
|
||||
|
||||
app: str
|
||||
id: str
|
||||
entry: object
|
||||
|
||||
|
||||
def append(folder: Path, app: str, entry: Mapping[str, object]) -> None:
|
||||
"""Append ``entry`` as one line to ``app``'s spool file."""
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
with (folder / f"{app}{SUFFIX}").open("a", encoding="utf-8") as f:
|
||||
f.write(json.dumps(entry, sort_keys=True) + "\n")
|
||||
|
||||
|
||||
def _claim(folder: Path) -> list[Path]:
|
||||
for path in folder.glob(f"*{SUFFIX}"):
|
||||
path.replace(path.with_name(path.name.removesuffix(SUFFIX) + CLAIMED))
|
||||
return sorted(folder.glob(f"*{CLAIMED}"))
|
||||
|
||||
|
||||
def drain(folder: Path) -> Iterator[Line]:
|
||||
"""Yield every spooled line, then delete the files it came from."""
|
||||
if not folder.is_dir():
|
||||
return
|
||||
for path in _claim(folder):
|
||||
app = path.name.removesuffix(CLAIMED)
|
||||
if APP_NAME.match(app):
|
||||
for text in path.read_text(encoding="utf-8").splitlines():
|
||||
try:
|
||||
entry = json.loads(text)
|
||||
except ValueError:
|
||||
continue
|
||||
digest = hashlib.sha1(text.encode()).hexdigest()[:20] # noqa: S324 -- an id, not security
|
||||
yield Line(app, f"spool/{digest}", entry)
|
||||
path.unlink()
|
||||
@ -1,207 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""The local record of every report ingested, grouped by app and signature.
|
||||
|
||||
It is the source of truth once RTDB entries and spool lines are consumed:
|
||||
``seen`` makes a re-read count nothing twice, and each signature keeps its
|
||||
count, first and last time, newest build and its resolution. :func:`report`
|
||||
turns one app's records into the todoImplementer ``app-error`` contract
|
||||
(``contracts/app-error.schema.json``, ``report``).
|
||||
|
||||
Resolve and reopen: ``resolve`` stores the time and the newest build seen. A
|
||||
later report reopens the error only when it is a regression: a newer build
|
||||
when both sides know the build, else a report made after the resolve.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import tempfile
|
||||
from typing import TYPE_CHECKING, NotRequired, TypedDict, cast
|
||||
|
||||
from app_errors.signature import SLOW_KIND, mark_of, signature, strings, top_frame
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Mapping
|
||||
|
||||
#: Entry ids remembered for dedup (oldest dropped first).
|
||||
MAX_SEEN = 5000
|
||||
#: An app name the board accepts (the contract's ``app`` pattern).
|
||||
APP_NAME = re.compile(r"^[a-z0-9][a-z0-9_-]*$")
|
||||
_REPO = re.compile(r"^[^/\s]+/[^/\s]+$")
|
||||
|
||||
|
||||
class Resolved(TypedDict):
|
||||
"""When the error was marked fixed, and the newest build seen then."""
|
||||
|
||||
at: str
|
||||
build: int
|
||||
|
||||
|
||||
class Rec(TypedDict):
|
||||
"""Everything known about one signature of one app."""
|
||||
|
||||
signature: str
|
||||
repo: str
|
||||
kind: str
|
||||
message: str
|
||||
top_frame: str | None
|
||||
route: str | None
|
||||
count: int
|
||||
first_seen: str
|
||||
last_seen: str
|
||||
build: int
|
||||
version_name: str | None
|
||||
longest_ms: NotRequired[int]
|
||||
resolved: Resolved | None
|
||||
|
||||
|
||||
class State(TypedDict):
|
||||
"""The whole state file."""
|
||||
|
||||
version: int
|
||||
seen: dict[str, str]
|
||||
apps: dict[str, dict[str, Rec]]
|
||||
|
||||
|
||||
def empty() -> State:
|
||||
"""Return a state that knows nothing."""
|
||||
return {"version": 1, "seen": {}, "apps": {}}
|
||||
|
||||
|
||||
def load(path: Path) -> State:
|
||||
"""Return the state at ``path``; empty when missing or unreadable."""
|
||||
try:
|
||||
data = json.loads(path.read_text())
|
||||
except OSError, ValueError:
|
||||
return empty()
|
||||
if not isinstance(data, dict) or data.get("version") != 1:
|
||||
return empty()
|
||||
return cast("State", data)
|
||||
|
||||
|
||||
def _atomic_write(path: Path, text: str) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
fd, tmp = tempfile.mkstemp(dir=path.parent, prefix=f".{path.stem}-")
|
||||
with os.fdopen(fd, "w") as f:
|
||||
f.write(text)
|
||||
Path(tmp).replace(path)
|
||||
|
||||
|
||||
def save(path: Path, state: State) -> None:
|
||||
"""Write ``state`` atomically (temp file + rename)."""
|
||||
_atomic_write(path, json.dumps(state, indent=1, sort_keys=True))
|
||||
|
||||
|
||||
def _int(value: object) -> int:
|
||||
return value if isinstance(value, int) and not isinstance(value, bool) and value >= 0 else 0
|
||||
|
||||
|
||||
def _str(value: object) -> str | None:
|
||||
return value if isinstance(value, str) and value else None
|
||||
|
||||
|
||||
def _reopens(resolved: Resolved, at: str, build: int) -> bool:
|
||||
if build and resolved["build"]:
|
||||
return build > resolved["build"]
|
||||
return at > resolved["at"]
|
||||
|
||||
|
||||
def merge(state: State, app: str, entry_id: str, raw: object) -> bool:
|
||||
"""Count one report ``raw`` of ``app`` under its signature; False when seen or not a report."""
|
||||
if not isinstance(raw, dict):
|
||||
return False
|
||||
entry = cast("Mapping[str, object]", raw)
|
||||
at, kind = entry.get("at"), entry.get("kind")
|
||||
if not isinstance(at, str) or not at or not isinstance(kind, str) or not kind:
|
||||
return False
|
||||
key = f"{app}/{entry_id}"
|
||||
if key in state["seen"]:
|
||||
return False
|
||||
state["seen"][key] = at
|
||||
while len(state["seen"]) > MAX_SEEN:
|
||||
del state["seen"][next(iter(state["seen"]))]
|
||||
sig = signature(entry, app=app)
|
||||
build = _int(entry.get("build"))
|
||||
recs = state["apps"].setdefault(app, {})
|
||||
rec = recs.get(sig.id)
|
||||
if rec is None:
|
||||
repo = _str(entry.get("repo"))
|
||||
rec = recs[sig.id] = {
|
||||
"signature": sig.id,
|
||||
"repo": repo if repo and _REPO.match(repo) else f"kuhyx/{app}",
|
||||
"kind": kind,
|
||||
"message": sig.message,
|
||||
"top_frame": top_frame(strings(entry.get("stack")), mark_of(entry, app)),
|
||||
"route": _str(entry.get("route")),
|
||||
"count": 0,
|
||||
"first_seen": at,
|
||||
"last_seen": at,
|
||||
"build": 0,
|
||||
"version_name": None,
|
||||
"resolved": None,
|
||||
}
|
||||
rec["count"] += 1
|
||||
rec["first_seen"] = min(rec["first_seen"], at)
|
||||
rec["last_seen"] = max(rec["last_seen"], at)
|
||||
if build >= rec["build"]:
|
||||
rec["build"] = build
|
||||
rec["version_name"] = _str(entry.get("version")) or rec["version_name"]
|
||||
if kind == SLOW_KIND:
|
||||
rec["longest_ms"] = max(rec.get("longest_ms", 0), _int(entry.get("durationMs")))
|
||||
resolved = rec["resolved"]
|
||||
if resolved is not None and _reopens(resolved, at, build):
|
||||
rec["resolved"] = None
|
||||
return True
|
||||
|
||||
|
||||
def resolve(state: State, app: str, sig: str, *, now: str) -> bool:
|
||||
"""Mark ``app``'s ``sig`` fixed as of ``now``; False when there is no such error."""
|
||||
rec = state["apps"].get(app, {}).get(sig)
|
||||
if rec is None:
|
||||
return False
|
||||
rec["resolved"] = {"at": now, "build": rec["build"]}
|
||||
return True
|
||||
|
||||
|
||||
def _detail(rec: Rec) -> str | None:
|
||||
route = f"route {rec['route']}" if rec["route"] else None
|
||||
if rec["kind"] == SLOW_KIND:
|
||||
longest = f"longest wait {rec.get('longest_ms', 0)} ms"
|
||||
return f"{longest}, {route}" if route else longest
|
||||
return route
|
||||
|
||||
|
||||
def report(state: State, app: str) -> dict[str, object]:
|
||||
"""Return ``app``'s records as a contract ``report``."""
|
||||
errors = [
|
||||
{
|
||||
"app": app,
|
||||
"repo": rec["repo"],
|
||||
"signature": rec["signature"],
|
||||
"kind": rec["kind"],
|
||||
"message": rec["message"],
|
||||
"top_frame": rec["top_frame"],
|
||||
"count": rec["count"],
|
||||
"first_seen": rec["first_seen"],
|
||||
"last_seen": rec["last_seen"],
|
||||
"build": rec["build"],
|
||||
"version_name": rec["version_name"],
|
||||
"detail": _detail(rec),
|
||||
"open": rec["resolved"] is None,
|
||||
}
|
||||
for rec in sorted(state["apps"].get(app, {}).values(), key=lambda r: r["signature"])
|
||||
]
|
||||
return {"version": 1, "errors": errors}
|
||||
|
||||
|
||||
def write_reports(folder: Path, state: State) -> list[Path]:
|
||||
"""Write ``<folder>/<app>.json`` for every app with records; return the paths."""
|
||||
written = []
|
||||
for app in sorted(state["apps"]):
|
||||
path = folder / f"{app}.json"
|
||||
_atomic_write(path, json.dumps(report(state, app), indent=1))
|
||||
written.append(path)
|
||||
return written
|
||||
@ -1,74 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://todoimplementer.local/contracts/app-error.schema.json",
|
||||
"title": "App errors",
|
||||
"description": "What an app writes for the errors loop (DOCS-errors.md): `~/.local/state/app-errors/<app>.json` is a `report`; kartka's own state.json is mapped to the same `record` by an adapter. One record per identical error (signature).",
|
||||
"$defs": {
|
||||
"record": {
|
||||
"type": "object",
|
||||
"description": "One identical error or slow wait. The loop makes one ticket per `app:signature`.",
|
||||
"properties": {
|
||||
"app": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },
|
||||
"repo": { "type": "string", "pattern": "^[^/\\s]+/[^/\\s]+$", "description": "owner/name of the repo that holds the fix." },
|
||||
"signature": { "type": "string", "minLength": 1, "pattern": "^\\S+$", "description": "Stable id of the error: the same error always gets the same one." },
|
||||
"kind": { "type": "string", "minLength": 1, "description": "crash, ui.error, perf.slow, ..." },
|
||||
"message": { "type": "string", "description": "Masked message (no secrets, no user data)." },
|
||||
"top_frame": { "type": ["string", "null"] },
|
||||
"count": { "type": "integer", "minimum": 1 },
|
||||
"first_seen": { "type": "string", "minLength": 1 },
|
||||
"last_seen": { "type": "string", "minLength": 1 },
|
||||
"build": { "type": "integer", "minimum": 0, "description": "Monotonic build of the newest report (Android versionCode); 0 when the source does not know it." },
|
||||
"version_name": { "type": ["string", "null"] },
|
||||
"detail": { "type": ["string", "null"], "description": "Free text: durations, route." },
|
||||
"open": { "type": "boolean", "description": "False once the source marks the error resolved; default true." }
|
||||
},
|
||||
"required": ["app", "repo", "signature", "kind", "message", "count", "first_seen", "last_seen", "build"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"report": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": { "const": 1 },
|
||||
"errors": { "type": "array", "items": { "$ref": "#/$defs/record" } }
|
||||
},
|
||||
"required": ["version", "errors"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"source": {
|
||||
"type": "object",
|
||||
"description": "One entry of settings.json `error_sources`. `resolve` and `build` are argv lists; `{signature}`, `{repo_dir}` and `{commit}` are replaced.",
|
||||
"properties": {
|
||||
"app": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },
|
||||
"repo": { "type": "string", "pattern": "^[^/\\s]+/[^/\\s]+$" },
|
||||
"adapter": { "enum": ["kartka", "contract"] },
|
||||
"path": { "type": "string", "minLength": 1 },
|
||||
"resolve": { "type": "array", "items": { "type": "string" } },
|
||||
"build": { "type": "array", "items": { "type": "string" } }
|
||||
},
|
||||
"required": ["app", "repo", "adapter", "path"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"ledger": {
|
||||
"type": "object",
|
||||
"description": "`<run root>/app-errors.json`: what the loop knows per `app:signature`.",
|
||||
"additionalProperties": { "$ref": "#/$defs/entry" }
|
||||
},
|
||||
"entry": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"state": { "enum": ["ticket", "shipped", "fixed"] },
|
||||
"repo": { "type": "string" },
|
||||
"title": { "type": "string" },
|
||||
"count": { "type": "integer", "minimum": 0 },
|
||||
"starts": { "type": "integer", "minimum": 0 },
|
||||
"commit": { "type": "string" },
|
||||
"shipped_at": { "type": "number" },
|
||||
"fixed_build": { "type": "integer", "minimum": 0 },
|
||||
"installed_at": { "type": "number" },
|
||||
"missing": { "type": "integer", "minimum": 0, "description": "Ticks the part was not on the board (a Ship may be closing it)." }
|
||||
},
|
||||
"required": ["state", "repo", "title", "count", "starts"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,173 +0,0 @@
|
||||
"""The ingest: RTDB and local spools in, one board report per app out."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from app_errors import cli, ingest, spool
|
||||
from app_errors.rtdb import RtdbError
|
||||
|
||||
|
||||
class FakeRtdb:
|
||||
"""An in-memory RTDB: ``get`` honours ``shallow``, ``patch`` deletes on None."""
|
||||
|
||||
def __init__(self, data: dict[str, object]) -> None:
|
||||
self.data = data
|
||||
self.patches: list[tuple[str, dict[str, object]]] = []
|
||||
self.fail = False
|
||||
|
||||
def _at(self, path: str) -> object:
|
||||
node: object = self.data
|
||||
for part in [p for p in path.split("/") if p]:
|
||||
if not isinstance(node, dict) or part not in node:
|
||||
return None
|
||||
node = node[part]
|
||||
return node
|
||||
|
||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
||||
if self.fail:
|
||||
raise RtdbError("down")
|
||||
node = self._at(path)
|
||||
if shallow and isinstance(node, dict):
|
||||
return dict.fromkeys(node, True)
|
||||
return node
|
||||
|
||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
||||
self.patches.append((path, data))
|
||||
for key, value in data.items():
|
||||
parts = [p for p in f"{path}/{key}".split("/") if p]
|
||||
node = self.data
|
||||
for part in parts[:-1]:
|
||||
node = node.setdefault(part, {}) # type: ignore[assignment]
|
||||
if value is None:
|
||||
node.pop(parts[-1], None)
|
||||
else:
|
||||
node[parts[-1]] = value
|
||||
|
||||
|
||||
def _crash(at: str) -> dict[str, object]:
|
||||
return {
|
||||
"repo": "kuhyx/todo",
|
||||
"at": at,
|
||||
"kind": "uncaught.flutter",
|
||||
"error": "Bad state: x",
|
||||
"build": 3,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def dirs(tmp_path: Path) -> ingest.Paths:
|
||||
return ingest.Paths(
|
||||
state=tmp_path / "ingest" / "state.json",
|
||||
reports=tmp_path / "app-errors",
|
||||
spool=tmp_path / "app-errors-spool",
|
||||
)
|
||||
|
||||
|
||||
def test_rtdb_entries_become_reports_and_are_deleted(dirs: ingest.Paths) -> None:
|
||||
db = FakeRtdb({
|
||||
"todo": {"errors": {"dev1": {"e1": _crash("2026-11-17T10:00:00Z"), "e2": _crash("2026-11-17T10:00:01Z")}}},
|
||||
"kartka": {"errors": {"dev": {"k": _crash("2026-11-17T10:00:00Z")}}},
|
||||
"other": {"data": 1},
|
||||
}) # fmt: skip
|
||||
summary = ingest.run(dirs, db)
|
||||
assert summary.merged == 2
|
||||
report = json.loads((dirs.reports / "todo.json").read_text())
|
||||
assert report["errors"][0]["count"] == 2
|
||||
assert not (dirs.reports / "kartka.json").exists() # kartka keeps its own ingest
|
||||
assert db.data["todo"] == {"errors": {"dev1": {}}} # ingested entries are removed from RTDB
|
||||
assert "k" in db.data["kartka"]["errors"]["dev"] # type: ignore[index]
|
||||
|
||||
|
||||
def test_keep_leaves_rtdb_and_still_counts_once(dirs: ingest.Paths) -> None:
|
||||
db = FakeRtdb({"todo": {"errors": {"d": {"e": _crash("2026-11-17T10:00:00Z")}}}})
|
||||
ingest.run(dirs, db, keep=True)
|
||||
ingest.run(dirs, db, keep=True)
|
||||
report = json.loads((dirs.reports / "todo.json").read_text())
|
||||
assert report["errors"][0]["count"] == 1
|
||||
assert db.patches == []
|
||||
|
||||
|
||||
def test_rtdb_down_still_ingests_spool(dirs: ingest.Paths) -> None:
|
||||
spool.append(dirs.spool, "tk-app", {"repo": "kuhyx/tk", "at": "2026-11-17T10:00:00Z",
|
||||
"kind": "uncaught.python", "error": "ValueError: x"}) # fmt: skip
|
||||
db = FakeRtdb({})
|
||||
db.fail = True
|
||||
summary = ingest.run(dirs, db)
|
||||
assert summary.merged == 1
|
||||
assert summary.rtdb_error == "down"
|
||||
assert json.loads((dirs.reports / "tk-app.json").read_text())["errors"][0]["repo"] == "kuhyx/tk"
|
||||
assert list(dirs.spool.glob("*")) == [] # the spool is consumed
|
||||
|
||||
|
||||
def test_no_rtdb_at_all(dirs: ingest.Paths) -> None:
|
||||
assert ingest.run(dirs, None).merged == 0
|
||||
|
||||
|
||||
def test_spool_bad_lines_and_bad_names_are_skipped(dirs: ingest.Paths) -> None:
|
||||
dirs.spool.mkdir(parents=True)
|
||||
(dirs.spool / "ok.jsonl").write_text('not json\n{"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"}\n[]\n')
|
||||
(dirs.spool / "Bad Name.jsonl").write_text('{"at": "x", "kind": "k", "error": "e"}\n')
|
||||
assert ingest.run(dirs, None).merged == 1
|
||||
|
||||
|
||||
def test_leftover_claimed_spool_is_ingested(dirs: ingest.Paths) -> None:
|
||||
dirs.spool.mkdir(parents=True)
|
||||
(dirs.spool / "ok.jsonl.ingesting").write_text('{"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"}\n')
|
||||
assert ingest.run(dirs, None).merged == 1
|
||||
assert list(dirs.spool.glob("*")) == []
|
||||
|
||||
|
||||
def test_rtdb_odd_shapes_are_skipped(dirs: ingest.Paths) -> None:
|
||||
db = FakeRtdb(
|
||||
{
|
||||
"todo": {"errors": {"d": "nope", "e": {"x": "nope"}}},
|
||||
"bad key!": {"errors": {}},
|
||||
}
|
||||
)
|
||||
assert ingest.run(dirs, db).merged == 0
|
||||
|
||||
|
||||
def test_cli_ingest_and_resolve(dirs: ingest.Paths, monkeypatch: pytest.MonkeyPatch,
|
||||
capsys: pytest.CaptureFixture[str]) -> None: # fmt: skip
|
||||
monkeypatch.setattr(ingest, "default_paths", lambda: dirs)
|
||||
spool.append(dirs.spool, "tk", {"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"})
|
||||
assert cli.main(["ingest", "--no-rtdb"]) == 0
|
||||
sig = json.loads((dirs.reports / "tk.json").read_text())["errors"][0]["signature"]
|
||||
assert cli.main(["resolve", "tk", sig]) == 0
|
||||
assert json.loads((dirs.reports / "tk.json").read_text())["errors"][0]["open"] is False
|
||||
assert cli.main(["resolve", "tk", "missing"]) == 1
|
||||
assert "unknown" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_cli_ingest_rtdb_session_missing(dirs: ingest.Paths, monkeypatch: pytest.MonkeyPatch,
|
||||
capsys: pytest.CaptureFixture[str]) -> None: # fmt: skip
|
||||
monkeypatch.setattr(ingest, "default_paths", lambda: dirs)
|
||||
|
||||
def no_session(_app: str) -> FakeRtdb:
|
||||
raise RtdbError("no session")
|
||||
|
||||
monkeypatch.setattr(cli, "open_rtdb", no_session)
|
||||
spool.append(dirs.spool, "tk", {"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"})
|
||||
assert cli.main(["ingest"]) == 1 # the spool still went in, but RTDB is reported broken
|
||||
assert (dirs.reports / "tk.json").exists()
|
||||
assert "no session" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_cli_ingest_with_rtdb(dirs: ingest.Paths, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(ingest, "default_paths", lambda: dirs)
|
||||
db = FakeRtdb({"todo": {"errors": {"d": {"e": _crash("2026-11-17T10:00:00Z")}}}})
|
||||
monkeypatch.setattr(cli, "open_rtdb", lambda _app: db)
|
||||
assert cli.main(["ingest", "--keep", "--session", "x"]) == 0
|
||||
assert (dirs.reports / "todo.json").exists()
|
||||
|
||||
|
||||
def test_default_paths_follow_xdg(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
||||
monkeypatch.setenv("XDG_STATE_HOME", str(tmp_path))
|
||||
paths = ingest.default_paths()
|
||||
assert paths.reports == tmp_path / "app-errors"
|
||||
assert paths.spool == tmp_path / "app-errors-spool"
|
||||
assert paths.state == tmp_path / "app-errors-ingest" / "state.json"
|
||||
@ -1,140 +0,0 @@
|
||||
"""The REST client: URLs, shallow reads, typed errors that never name the token."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import email.message
|
||||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import types
|
||||
from typing import cast
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
import pytest
|
||||
|
||||
from app_errors import ingest, rtdb, store
|
||||
from app_errors.rtdb import RestRtdb, RtdbError
|
||||
|
||||
|
||||
class _Res(io.BytesIO):
|
||||
def __enter__(self) -> _Res:
|
||||
return self
|
||||
|
||||
def __exit__(self, *_: object) -> None:
|
||||
self.close()
|
||||
|
||||
|
||||
def test_get_and_patch_build_urls() -> None:
|
||||
seen: list[tuple[str, str, object]] = []
|
||||
|
||||
def opener(req: urllib.request.Request, timeout: float) -> _Res:
|
||||
seen.append((req.get_method(), req.full_url, req.data))
|
||||
return _Res(b'{"a": true}')
|
||||
|
||||
db = RestRtdb("https://db.example/", lambda: "TOK", opener)
|
||||
assert db.get("", shallow=True) == {"a": True}
|
||||
db.patch("todo/errors", {"d/e": None})
|
||||
assert seen[0][:2] == ("GET", "https://db.example/.json?auth=TOK&shallow=true")
|
||||
assert seen[1][0] == "PATCH"
|
||||
assert json.loads(cast("bytes", seen[1][2])) == {"d/e": None}
|
||||
|
||||
|
||||
def test_empty_body_is_none() -> None:
|
||||
assert RestRtdb("https://x", lambda: "t", lambda req, timeout: _Res(b"")).get("p") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exc",
|
||||
[
|
||||
urllib.error.HTTPError("u", 401, "no", email.message.Message(), None),
|
||||
urllib.error.URLError("down"),
|
||||
OSError("x"),
|
||||
],
|
||||
)
|
||||
def test_failures_are_typed_and_tokenless(exc: Exception) -> None:
|
||||
def opener(req: urllib.request.Request, timeout: float) -> _Res:
|
||||
raise exc
|
||||
|
||||
with pytest.raises(RtdbError) as info:
|
||||
RestRtdb("https://x", lambda: "SECRET", opener).get("p")
|
||||
assert "SECRET" not in str(info.value)
|
||||
|
||||
|
||||
def test_token_failure_is_typed() -> None:
|
||||
def boom() -> str:
|
||||
raise ValueError("SECRET")
|
||||
|
||||
with pytest.raises(RtdbError, match="token refresh failed"):
|
||||
RestRtdb("https://x", boom).get("p")
|
||||
|
||||
|
||||
def _fake_crdt(monkeypatch: pytest.MonkeyPatch, *, session: bool, config_ok: bool = True) -> None:
|
||||
mod = types.ModuleType("crdt_sync")
|
||||
|
||||
class Config:
|
||||
api_key, database_url = "k", "https://db"
|
||||
|
||||
@staticmethod
|
||||
def load() -> Config:
|
||||
if not config_ok:
|
||||
raise FileNotFoundError("cfg")
|
||||
return Config()
|
||||
|
||||
class Provider:
|
||||
def __init__(self, *_: object, **__: object) -> None: ...
|
||||
def has_session(self) -> bool:
|
||||
return session
|
||||
|
||||
def id_token(self) -> str:
|
||||
return "t"
|
||||
|
||||
mod.FirebaseConfig = Config # type: ignore[attr-defined]
|
||||
mod.FirebaseTokenProvider = Provider # type: ignore[attr-defined]
|
||||
mod.credential_store_for = lambda name: name # type: ignore[attr-defined]
|
||||
monkeypatch.setitem(sys.modules, "crdt_sync", mod)
|
||||
|
||||
|
||||
def test_open_rtdb(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
_fake_crdt(monkeypatch, session=True)
|
||||
assert isinstance(rtdb.open_rtdb("s"), RestRtdb)
|
||||
_fake_crdt(monkeypatch, session=False)
|
||||
with pytest.raises(RtdbError, match="no seeded"):
|
||||
rtdb.open_rtdb("s")
|
||||
_fake_crdt(monkeypatch, session=True, config_ok=False)
|
||||
with pytest.raises(RtdbError, match="no Firebase config"):
|
||||
rtdb.open_rtdb("s")
|
||||
|
||||
|
||||
class _PatchFails:
|
||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
||||
if shallow:
|
||||
return {"todo": True}
|
||||
return {"d": {"e": {"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "x"}}}
|
||||
|
||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
||||
raise RtdbError("patch down")
|
||||
|
||||
|
||||
def test_delete_failure_is_reported_after_save(tmp_path: Path) -> None:
|
||||
paths = ingest.Paths(tmp_path / "s.json", tmp_path / "r", tmp_path / "sp")
|
||||
summary = ingest.run(paths, _PatchFails())
|
||||
assert summary == ingest.Summary(1, "patch down")
|
||||
assert (tmp_path / "r" / "todo.json").exists()
|
||||
|
||||
|
||||
def test_old_state_version_and_seen_trim(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
path = tmp_path / "s.json"
|
||||
path.write_text('{"version": 0}')
|
||||
assert store.load(path) == store.empty()
|
||||
monkeypatch.setattr(store, "MAX_SEEN", 2)
|
||||
state = store.empty()
|
||||
for i in range(3):
|
||||
store.merge(
|
||||
state,
|
||||
"a",
|
||||
str(i),
|
||||
{"at": f"2026-11-17T10:00:0{i}Z", "kind": "k", "error": "x"},
|
||||
)
|
||||
assert list(state["seen"]) == ["a/1", "a/2"]
|
||||
@ -1,89 +0,0 @@
|
||||
"""Signatures: one per bug, kartka-identical for Dart, generalised for Python and GDScript."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app_errors.signature import normalise, signature, top_frame
|
||||
|
||||
|
||||
def test_dart_crash_matches_kartka_vector() -> None:
|
||||
# Vector from kartka_errors.signature (kartka 2026-11-17): moving kartka
|
||||
# onto this ingest must not rename its open tickets.
|
||||
entry = {
|
||||
"kind": "uncaught.flutter",
|
||||
"error": "Bad state: no element 42",
|
||||
"stack": [
|
||||
"#0 List.first (dart:core/list.dart:12:3)",
|
||||
"#1 Reader.open (package:kartka/reader/reader.dart:88:7)",
|
||||
],
|
||||
}
|
||||
sig = signature(entry, app="kartka")
|
||||
assert sig.id == "ffcd864656"
|
||||
assert sig.type == "StateError"
|
||||
assert sig.where == "Reader.open (package:kartka/reader/reader.dart)"
|
||||
|
||||
|
||||
def test_slow_wait_matches_kartka_vector() -> None:
|
||||
entry = {
|
||||
"kind": "perf.slow",
|
||||
"operation": "reader.open",
|
||||
"route": "/reader/:id",
|
||||
"durationMs": 2100,
|
||||
}
|
||||
sig = signature(entry, app="kartka")
|
||||
assert sig.id == "29a53e8824"
|
||||
assert sig.message == "slow wait: reader.open"
|
||||
|
||||
|
||||
def test_slow_wait_ignores_duration() -> None:
|
||||
one = {"kind": "perf.slow", "operation": "load", "durationMs": 1100}
|
||||
two = {"kind": "perf.slow", "operation": "load", "durationMs": 9000}
|
||||
assert signature(one, app="a").id == signature(two, app="a").id
|
||||
|
||||
|
||||
def test_mark_picks_app_frame_and_skips_plumbing() -> None:
|
||||
stack = [
|
||||
"#0 ErrorReporter.report (package:crdt_sync_flutter/src/errors/error_reporter.dart:5:1)",
|
||||
"#1 Home.build (package:todo/home.dart:10:2)",
|
||||
]
|
||||
assert top_frame(stack, "package:todo/") == "Home.build (package:todo/home.dart)"
|
||||
|
||||
|
||||
def test_python_frame_line_numbers_dropped() -> None:
|
||||
entry = {
|
||||
"kind": "uncaught.python",
|
||||
"error": "ValueError: bad 12",
|
||||
"stack": [
|
||||
"gatelock/error_report.py:40 in hook",
|
||||
"leetcode_guard/ui.py:123 in solve",
|
||||
],
|
||||
"mark": "leetcode_guard/",
|
||||
}
|
||||
sig = signature(entry, app="leetcode-guard")
|
||||
assert sig.where == "leetcode_guard/ui.py in solve"
|
||||
assert sig.type == "ValueError"
|
||||
assert sig.message == "ValueError: bad <n>"
|
||||
|
||||
|
||||
def test_godot_frame_and_kind_fallback() -> None:
|
||||
entry = {
|
||||
"kind": "uncaught.gdscript",
|
||||
"error": "Invalid access to property 'x'",
|
||||
"stack": [
|
||||
"res://addons/app_errors/error_reporter.gd:9 in _log",
|
||||
"res://scripts/car.gd:77 in _ready",
|
||||
],
|
||||
"mark": "res://",
|
||||
}
|
||||
sig = signature(entry, app="car-rental-sim")
|
||||
assert sig.where == "res://scripts/car.gd in _ready"
|
||||
assert sig.type == "uncaught.gdscript"
|
||||
|
||||
|
||||
def test_no_frame_falls_back_to_route_then_kind() -> None:
|
||||
assert signature({"kind": "ui.snackbar", "error": "x", "route": "/a"}, app="a").where == "route /a"
|
||||
assert signature({"kind": "ui.snackbar", "error": "x"}, app="a").where == "kind ui.snackbar"
|
||||
|
||||
|
||||
def test_normalise_masks_volatile_parts() -> None:
|
||||
text = "GET https://x.y/z 3f2a9c1d00ff 123e4567-e89b-12d3-a456-426614174000 took 15 s"
|
||||
assert normalise(text) == "GET <url> <hex> <uuid> took <n> s"
|
||||
@ -1,144 +0,0 @@
|
||||
"""The merged state: counts, builds, resolve and reopen, and the board report."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import jsonschema
|
||||
|
||||
from app_errors import store
|
||||
|
||||
SCHEMA = json.loads((Path(__file__).parent / "data" / "app-error.schema.json").read_text())
|
||||
|
||||
|
||||
def _crash(at: str, build: int = 7, **extra: object) -> dict[str, object]:
|
||||
return {
|
||||
"app": "todo",
|
||||
"repo": "kuhyx/todo",
|
||||
"at": at,
|
||||
"kind": "uncaught.flutter",
|
||||
"error": "Bad state: boom",
|
||||
"stack": ["#0 Home.build (package:todo/home.dart:3:1)"],
|
||||
"build": build,
|
||||
"version": "1.0.0",
|
||||
**extra,
|
||||
}
|
||||
|
||||
|
||||
def _report(state: store.State, app: str) -> dict[str, object]:
|
||||
report = store.report(state, app)
|
||||
jsonschema.Draft202012Validator({**SCHEMA, "$ref": "#/$defs/report"}).validate(report)
|
||||
return report
|
||||
|
||||
|
||||
def test_ten_identical_errors_are_one_record_with_count_ten() -> None:
|
||||
state = store.empty()
|
||||
for i in range(10):
|
||||
assert store.merge(state, "todo", f"dev/{i}", _crash(f"2026-11-17T10:00:{i:02d}Z"))
|
||||
errors = _report(state, "todo")["errors"]
|
||||
assert isinstance(errors, list)
|
||||
assert len(errors) == 1
|
||||
rec = errors[0]
|
||||
assert rec["count"] == 10
|
||||
assert rec["first_seen"] == "2026-11-17T10:00:00Z"
|
||||
assert rec["last_seen"] == "2026-11-17T10:00:09Z"
|
||||
assert rec["build"] == 7
|
||||
assert rec["version_name"] == "1.0.0"
|
||||
assert rec["open"] is True
|
||||
assert rec["repo"] == "kuhyx/todo"
|
||||
|
||||
|
||||
def test_same_entry_id_counts_once() -> None:
|
||||
state = store.empty()
|
||||
assert store.merge(state, "todo", "dev/a", _crash("2026-11-17T10:00:00Z"))
|
||||
assert not store.merge(state, "todo", "dev/a", _crash("2026-11-17T10:00:00Z"))
|
||||
assert state["apps"]["todo"][next(iter(state["apps"]["todo"]))]["count"] == 1
|
||||
|
||||
|
||||
def test_newest_build_wins() -> None:
|
||||
state = store.empty()
|
||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z", build=9))
|
||||
store.merge(state, "todo", "b", _crash("2026-11-17T11:00:00Z", build=4))
|
||||
assert _report(state, "todo")["errors"][0]["build"] == 9 # type: ignore[index]
|
||||
|
||||
|
||||
def test_slow_wait_detail_names_longest_wait() -> None:
|
||||
state = store.empty()
|
||||
for i, ms in enumerate((1500, 2100)):
|
||||
store.merge(
|
||||
state,
|
||||
"todo",
|
||||
f"w{i}",
|
||||
{"app": "todo", "repo": "kuhyx/todo", "at": f"2026-11-17T10:00:0{i}Z", "kind": "perf.slow",
|
||||
"error": f"list.load waited {ms} ms", "operation": "list.load", "route": "/", "durationMs": ms},
|
||||
) # fmt: skip
|
||||
rec = _report(state, "todo")["errors"][0] # type: ignore[index]
|
||||
assert rec["kind"] == "perf.slow"
|
||||
assert rec["count"] == 2
|
||||
assert "2100 ms" in rec["detail"]
|
||||
assert rec["build"] == 0
|
||||
|
||||
|
||||
def test_resolve_closes_and_older_build_does_not_reopen() -> None:
|
||||
state = store.empty()
|
||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z", build=7))
|
||||
sig = _report(state, "todo")["errors"][0]["signature"] # type: ignore[index]
|
||||
assert store.resolve(state, "todo", sig, now="2026-11-17T12:00:00Z")
|
||||
assert _report(state, "todo")["errors"][0]["open"] is False # type: ignore[index]
|
||||
store.merge(state, "todo", "b", _crash("2026-11-17T13:00:00Z", build=7))
|
||||
assert _report(state, "todo")["errors"][0]["open"] is False # type: ignore[index]
|
||||
store.merge(state, "todo", "c", _crash("2026-11-17T14:00:00Z", build=8))
|
||||
assert _report(state, "todo")["errors"][0]["open"] is True # type: ignore[index]
|
||||
|
||||
|
||||
def test_resolve_without_build_reopens_on_later_report() -> None:
|
||||
state = store.empty()
|
||||
store.merge(state, "tk", "a", _crash("2026-11-17T10:00:00Z", build=0, app="tk"))
|
||||
sig = _report(state, "tk")["errors"][0]["signature"] # type: ignore[index]
|
||||
store.resolve(state, "tk", sig, now="2026-11-17T12:00:00Z")
|
||||
store.merge(state, "tk", "b", _crash("2026-11-17T11:00:00Z", build=0, app="tk"))
|
||||
assert _report(state, "tk")["errors"][0]["open"] is False # type: ignore[index]
|
||||
store.merge(state, "tk", "c", _crash("2026-11-17T13:00:00Z", build=0, app="tk"))
|
||||
assert _report(state, "tk")["errors"][0]["open"] is True # type: ignore[index]
|
||||
|
||||
|
||||
def test_resolve_unknown_signature_is_false() -> None:
|
||||
assert not store.resolve(store.empty(), "todo", "nope", now="2026-11-17T12:00:00Z")
|
||||
|
||||
|
||||
def test_missing_repo_defaults_to_kuhyx_app() -> None:
|
||||
state = store.empty()
|
||||
entry = _crash("2026-11-17T10:00:00Z")
|
||||
del entry["repo"]
|
||||
store.merge(state, "todo", "a", entry)
|
||||
assert _report(state, "todo")["errors"][0]["repo"] == "kuhyx/todo" # type: ignore[index]
|
||||
|
||||
|
||||
def test_bad_entry_is_skipped() -> None:
|
||||
state = store.empty()
|
||||
assert not store.merge(state, "todo", "a", {"kind": 3})
|
||||
assert not store.merge(state, "todo", "b", "nope")
|
||||
assert store.report(state, "todo")["errors"] == []
|
||||
|
||||
|
||||
def test_save_and_load_round_trip(tmp_path: Path) -> None:
|
||||
state = store.empty()
|
||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z"))
|
||||
path = tmp_path / "s" / "state.json"
|
||||
store.save(path, state)
|
||||
assert store.load(path) == state
|
||||
path.write_text("{broken")
|
||||
assert store.load(path) == store.empty()
|
||||
assert store.load(tmp_path / "missing.json") == store.empty()
|
||||
|
||||
|
||||
def test_write_reports_writes_one_file_per_app(tmp_path: Path) -> None:
|
||||
state = store.empty()
|
||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z"))
|
||||
store.merge(state, "tk", "a", _crash("2026-11-17T10:00:00Z", app="tk"))
|
||||
written = store.write_reports(tmp_path, state)
|
||||
assert sorted(p.name for p in written) == ["tk.json", "todo.json"]
|
||||
data = json.loads((tmp_path / "todo.json").read_text())
|
||||
assert data["version"] == 1
|
||||
assert len(data["errors"]) == 1
|
||||
@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ============================================================================
|
||||
# Install the app-errors CLI and its ingest timer for the current user.
|
||||
#
|
||||
# Own venv at ~/.local/share/app-errors/venv, the package installed editable
|
||||
# from this checkout (run it from the live ~/src/utils, never a worktree).
|
||||
# crdt-sync comes from the sibling directory, so the venv runs what is on disk.
|
||||
# Idempotent: rerun it after any change. Exits non-zero unless the timer is
|
||||
# active and one ingest pass over the local spool succeeds.
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
UTILS_DIR="$(dirname "$REPO_DIR")"
|
||||
readonly REPO_DIR UTILS_DIR
|
||||
readonly VENV_DIR="${HOME}/.local/share/app-errors/venv"
|
||||
readonly BIN_DIR="${HOME}/.local/bin"
|
||||
readonly UNIT_DIR="${HOME}/.config/systemd/user"
|
||||
readonly TIMER="app-errors-ingest.timer"
|
||||
|
||||
log() { printf 'install: %s\n' "$1" >&2; }
|
||||
fail() { printf 'install: FAILED -- %s\n' "$1" >&2; exit 1; }
|
||||
|
||||
build_venv() {
|
||||
[[ -x "$VENV_DIR/bin/python" ]] || /usr/bin/python3 -m venv "$VENV_DIR" || fail "venv"
|
||||
"$VENV_DIR/bin/pip" install --quiet "$UTILS_DIR/crdt-sync" || fail "crdt-sync"
|
||||
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" || fail "app-errors"
|
||||
mkdir -p "$BIN_DIR"
|
||||
ln -sf "$VENV_DIR/bin/app-errors" "$BIN_DIR/app-errors"
|
||||
}
|
||||
|
||||
install_timer() {
|
||||
mkdir -p "$UNIT_DIR"
|
||||
install -m 0644 "$REPO_DIR/systemd/app-errors-ingest.service" "$REPO_DIR/systemd/$TIMER" "$UNIT_DIR/"
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now "$TIMER"
|
||||
}
|
||||
|
||||
verify() {
|
||||
systemctl --user is-active --quiet "$TIMER" || fail "$TIMER is not active"
|
||||
"$VENV_DIR/bin/app-errors" ingest --no-rtdb >/dev/null || fail "a spool-only ingest pass failed"
|
||||
log "ok: $TIMER active, ingest runs"
|
||||
}
|
||||
|
||||
main() {
|
||||
log "installing app-errors from $REPO_DIR"
|
||||
build_venv
|
||||
install_timer
|
||||
verify
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@ -1,186 +0,0 @@
|
||||
[project]
|
||||
name = "app-errors"
|
||||
version = "0.1.0"
|
||||
description = "Shared app error and slow-wait ingest: RTDB and local spool reports become todoImplementer error tickets"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["jsonschema==4.26.0", "pytest==9.2.0", "pytest-cov==7.1.0"]
|
||||
|
||||
[project.scripts]
|
||||
app-errors = "app_errors.cli:main"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["app_errors"]
|
||||
|
||||
# py.typed: consumers type-check against the package (PEP 561).
|
||||
[tool.setuptools.package-data]
|
||||
app_errors = ["py.typed"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py314"
|
||||
line-length = 120
|
||||
include = ["*.py", "**/*.py"]
|
||||
exclude = [".git", ".venv", "__pycache__", "build", "dist", ".eggs"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["ALL"]
|
||||
ignore = [
|
||||
"D203",
|
||||
"D213",
|
||||
"COM812",
|
||||
"ISC001",
|
||||
"S603",
|
||||
]
|
||||
fixable = ["ALL"]
|
||||
unfixable = []
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"**/tests/*.py" = ["ANN", "ARG", "CPY001", "D", "EM101", "PLC0415", "PLR2004", "PYI034", "S101", "SLF001", "TC002", "TC003", "TRY003"]
|
||||
"**/_fake_*.py" = ["ANN401", "ARG002"]
|
||||
"**/test_*.py" = ["ANN", "ARG", "CPY001", "D", "EM101", "PLC0415", "PLR2004", "PYI034", "S101", "SLF001", "TC002", "TC003", "TRY003"]
|
||||
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "google"
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
force-single-line = false
|
||||
force-sort-within-sections = true
|
||||
known-first-party = ["app_errors"]
|
||||
|
||||
[tool.ruff.lint.flake8-quotes]
|
||||
docstring-quotes = "double"
|
||||
inline-quotes = "double"
|
||||
|
||||
[tool.ruff.lint.flake8-tidy-imports]
|
||||
ban-relative-imports = "all"
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "double"
|
||||
indent-style = "space"
|
||||
skip-magic-trailing-comma = false
|
||||
line-ending = "auto"
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.14"
|
||||
strict = true
|
||||
warn_return_any = true
|
||||
warn_unused_configs = true
|
||||
disallow_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
check_untyped_defs = true
|
||||
disallow_untyped_decorators = true
|
||||
no_implicit_optional = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_ignores = true
|
||||
warn_no_return = true
|
||||
warn_unreachable = true
|
||||
# crdt_sync ships no py.typed: its names would all be "unfollowed".
|
||||
disallow_any_unimported = false
|
||||
disallow_any_explicit = false
|
||||
disallow_any_generics = true
|
||||
disallow_subclassing_any = true
|
||||
strict_equality = true
|
||||
extra_checks = true
|
||||
ignore_missing_imports = true
|
||||
show_error_codes = true
|
||||
color_output = true
|
||||
exclude = [".venv/"]
|
||||
|
||||
[tool.pylint.main]
|
||||
# The repo root on the path, so pylint resolves the package's own imports the
|
||||
# same way pytest does instead of reporting import-error for them.
|
||||
init-hook = "import sys; sys.path.insert(0, 'app_errors')"
|
||||
analyse-fallback-blocks = true
|
||||
persistent = true
|
||||
jobs = 0
|
||||
py-version = "3.14"
|
||||
ignore = [".venv", "__pycache__"]
|
||||
# Test suites intentionally use patterns (protected-access, fixture-arg
|
||||
# shadowing) that don't apply to source code; ruff's per-file-ignores carry
|
||||
# the equivalent exemptions, so tests stay linted -- by ruff. This is the same
|
||||
# source-only pylint scope wake-alarm / diet-guard / testsAndMisc use. It has
|
||||
# to be `ignore-paths`, not `ignore = ["tests"]`: `ignore` only matches the
|
||||
# basename of what pylint is *given*, and pre-commit hands it explicit file
|
||||
# paths, so a directory name in `ignore` never fires under the hook.
|
||||
ignore-paths = ["^(.*/)?tests/.*$"]
|
||||
ignore-patterns = [".*\\.pyi$"]
|
||||
|
||||
[tool.pylint.basic]
|
||||
# snake_case, plus the ``do_<METHOD>`` names http.server dispatches on: the
|
||||
# stdlib looks handlers up as ``"do_" + command``, so ``do_GET`` is the only
|
||||
# spelling that works and cannot be renamed to satisfy the style.
|
||||
method-rgx = "([^\\W\\dA-Z][^\\WA-Z]{2,}|_[^\\WA-Z]*|__[^\\W\\dA-Z][^\\WA-Z]+__|do_[A-Z]+|of)$"
|
||||
|
||||
[tool.pylint.messages_control]
|
||||
enable = "all"
|
||||
disable = []
|
||||
|
||||
[tool.pylint.design]
|
||||
min-public-methods = 0
|
||||
max-module-lines = 1000
|
||||
max-attributes = 10
|
||||
|
||||
[tool.pylint.typecheck]
|
||||
generated-members = [
|
||||
".*\\.assert_called_once_with",
|
||||
".*\\.assert_called_once",
|
||||
".*\\.assert_called",
|
||||
".*\\.assert_not_called",
|
||||
".*\\.assert_any_call",
|
||||
".*\\.call_args",
|
||||
".*\\.call_args_list",
|
||||
".*\\.call_count",
|
||||
]
|
||||
|
||||
[tool.bandit]
|
||||
exclude_dirs = ["tests", ".venv"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["app_errors/tests"]
|
||||
python_files = ["test_*.py", "*_test.py"]
|
||||
python_classes = ["Test*"]
|
||||
python_functions = ["test_*"]
|
||||
addopts = [
|
||||
"-v",
|
||||
"--strict-markers",
|
||||
"--strict-config",
|
||||
"-ra",
|
||||
"--cov=app_errors",
|
||||
"--cov-branch",
|
||||
"--cov-report=term-missing",
|
||||
"--cov-report=lcov",
|
||||
]
|
||||
filterwarnings = [
|
||||
"error",
|
||||
"ignore::DeprecationWarning",
|
||||
"default::pytest.PytestUnraisableExceptionWarning",
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["app_errors"]
|
||||
branch = true
|
||||
omit = [
|
||||
"*/__pycache__/*",
|
||||
"*/tests/*",
|
||||
"*/.venv/*",
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
fail_under = 100
|
||||
show_missing = true
|
||||
skip_covered = false
|
||||
exclude_lines = [
|
||||
"pragma: no cover",
|
||||
"raise NotImplementedError",
|
||||
"raise AssertionError",
|
||||
"if TYPE_CHECKING:",
|
||||
"^\\s*\\.\\.\\.$",
|
||||
'if __name__ == "__main__":',
|
||||
]
|
||||
partial_branches = ["pragma: no branch"]
|
||||
@ -1,5 +0,0 @@
|
||||
# Exact pins, enforced by the shared dependency-freshness gate.
|
||||
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
|
||||
jsonschema==4.26.0
|
||||
pytest==9.2.0
|
||||
pytest-cov==7.1.0
|
||||
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Ingest app error and slow-wait reports for the todoImplementer board
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=%h/.local/share/app-errors/venv/bin/app-errors ingest
|
||||
Nice=19
|
||||
IOSchedulingClass=idle
|
||||
TimeoutStartSec=120
|
||||
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Ingest app error reports every 5 minutes
|
||||
|
||||
[Timer]
|
||||
OnBootSec=2min
|
||||
OnUnitActiveSec=5min
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@ -185,33 +185,6 @@ what Android does in practice, since `Uri.base` there is `file:///`.
|
||||
Nothing in this package reads `~/.config/crdt-sync/` directly. That is the
|
||||
desktop/Python half, reached over the wrapper's HTTP routes.
|
||||
|
||||
## Error and slow-wait reporting
|
||||
|
||||
Every error, and every wait the user sees over 1 s, goes to the PC's
|
||||
`app-errors` ingest (utils `DOCS-app-errors.md`). The board turns each one into
|
||||
a self-fixing ticket. Generalised from kartka.
|
||||
|
||||
```dart
|
||||
final errors = await installAppErrors(const AppErrorsConfig(
|
||||
app: 'todo', repo: 'kuhyx/todo',
|
||||
build: int.fromEnvironment('APP_BUILD'), // versionCode
|
||||
version: String.fromEnvironment('APP_VERSION'),
|
||||
));
|
||||
errors.connect(
|
||||
sink: () async => (await openFirebase())?.patchValues, // null = signed out
|
||||
deviceId: () async => repository.nodeId,
|
||||
);
|
||||
// MaterialApp(navigatorObservers: [AppErrorsRouteObserver(errors)], ...)
|
||||
// Wrap every loader: WaitWatch.centered('list.load')
|
||||
```
|
||||
|
||||
`installAppErrors` chains `FlutterError.onError` and `PlatformDispatcher.onError`.
|
||||
Reports are deduplicated on the device (30 s window, 20 a minute), redacted,
|
||||
queued in `SharedPreferences` (so offline reports survive), and uploaded to
|
||||
RTDB `/<app>/errors/<device>/<id>` with `repo`, `build` and `version`. A spinner
|
||||
inside `WaitWatch` that stays over 1 s becomes `perf.slow`. Nothing shows on
|
||||
screen.
|
||||
|
||||
## Testing
|
||||
|
||||
The keystore fake ships with the package, so a consuming app does not rebuild
|
||||
|
||||
@ -16,15 +16,6 @@ export 'src/bootstrap.dart';
|
||||
export 'src/device_id.dart';
|
||||
export 'src/e2e_bootstrap.dart';
|
||||
export 'src/e2e_passphrase_button.dart';
|
||||
export 'src/errors/app_errors.dart';
|
||||
export 'src/errors/app_errors_config.dart';
|
||||
export 'src/errors/error_entry.dart';
|
||||
export 'src/errors/error_queue.dart';
|
||||
export 'src/errors/error_reporter.dart';
|
||||
export 'src/errors/error_upload.dart';
|
||||
export 'src/errors/report_redact.dart';
|
||||
export 'src/errors/slow_wait.dart';
|
||||
export 'src/errors/wait_watch.dart';
|
||||
export 'src/google_any_sign_in.dart';
|
||||
export 'src/google_desktop_sign_in.dart';
|
||||
export 'src/google_pkce.dart';
|
||||
|
||||
@ -1,112 +0,0 @@
|
||||
/// App-wide error and slow-wait reporting, in one call (generalised from
|
||||
/// kartka's `error_hooks.dart`): the PC's `app-errors` ingest turns every
|
||||
/// report into a self-fixing ticket on kuhy's board.
|
||||
library;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:crdt_sync_flutter/src/errors/app_errors_config.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_queue.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_reporter.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_upload.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/slow_wait.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// The installed reporting: [reporter] for errors, [waits] for slow waits,
|
||||
/// both into [queue], which [connect] uploads.
|
||||
class AppErrors {
|
||||
/// Reporting for [config] into [queue] (tests; apps call
|
||||
/// [installAppErrors]).
|
||||
AppErrors.forTest(this.config, this.queue, {DateTime Function()? now})
|
||||
: reporter = ErrorReporter(queue, config: config, now: now) {
|
||||
waits = SlowWaitReporter(queue, now: now, route: () => reporter.route);
|
||||
}
|
||||
|
||||
/// The installed instance ([WaitWatch] reads it); null before install.
|
||||
static AppErrors? instance;
|
||||
|
||||
/// The app reported for.
|
||||
final AppErrorsConfig config;
|
||||
|
||||
/// Reports not yet uploaded.
|
||||
final ErrorQueue queue;
|
||||
|
||||
/// Records errors.
|
||||
final ErrorReporter reporter;
|
||||
|
||||
/// Times waits.
|
||||
late final SlowWaitReporter waits;
|
||||
|
||||
/// Starts uploading to RTDB through [sink] (null while signed out) as
|
||||
/// [deviceId]; flushes the backlog after [startDelay].
|
||||
ErrorUploader connect({
|
||||
required Future<ErrorSink?> Function() sink,
|
||||
required Future<String> Function() deviceId,
|
||||
Duration startDelay = const Duration(seconds: 20),
|
||||
}) => ErrorUploader(queue, config: config, sink: sink, deviceId: deviceId)
|
||||
..start()
|
||||
..schedule(startDelay);
|
||||
}
|
||||
|
||||
/// Installs app-wide reporting for [config] once, from `main` after
|
||||
/// `WidgetsFlutterBinding.ensureInitialized`: uncaught framework errors
|
||||
/// (`uncaught.flutter`) and async errors (`uncaught.async`) are queued, then
|
||||
/// handed to the handlers installed before. Shows nothing on screen.
|
||||
Future<AppErrors> installAppErrors(
|
||||
AppErrorsConfig config, {
|
||||
SharedPreferences? preferences,
|
||||
}) async {
|
||||
final queue = await ErrorQueue.open(
|
||||
preferences ?? await SharedPreferences.getInstance(),
|
||||
);
|
||||
final errors = AppErrors.instance = AppErrors.forTest(config, queue);
|
||||
final reporter = errors.reporter;
|
||||
final framework = FlutterError.onError;
|
||||
FlutterError.onError = (details) {
|
||||
if (!details.silent) {
|
||||
reporter.report(
|
||||
'uncaught.flutter',
|
||||
details.exception,
|
||||
stack: details.stack,
|
||||
);
|
||||
}
|
||||
framework?.call(details);
|
||||
};
|
||||
final dispatcher = PlatformDispatcher.instance;
|
||||
final async = dispatcher.onError;
|
||||
dispatcher.onError = (error, stack) {
|
||||
reporter.report('uncaught.async', error, stack: stack);
|
||||
return async?.call(error, stack) ?? false;
|
||||
};
|
||||
return errors;
|
||||
}
|
||||
|
||||
/// Keeps the reporter's route current, so every report names its screen.
|
||||
/// Add it to the app's `navigatorObservers`. Route names only: give routes
|
||||
/// patterns (`/list/:id`), never ids or titles.
|
||||
class AppErrorsRouteObserver extends NavigatorObserver {
|
||||
/// Stamps routes into [errors].
|
||||
AppErrorsRouteObserver(this.errors);
|
||||
|
||||
/// The reporting stamped.
|
||||
final AppErrors errors;
|
||||
|
||||
void _set(Route<dynamic>? route) {
|
||||
final name = route?.settings.name;
|
||||
if (name != null) errors.reporter.route = name;
|
||||
}
|
||||
|
||||
@override
|
||||
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) =>
|
||||
_set(route);
|
||||
|
||||
@override
|
||||
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) =>
|
||||
_set(previousRoute);
|
||||
|
||||
@override
|
||||
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) =>
|
||||
_set(newRoute);
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/// Which app reports, and which build it is.
|
||||
library;
|
||||
|
||||
/// The app's identity in its reports.
|
||||
class AppErrorsConfig {
|
||||
/// The app [app] (as the board shows it), fixed in [repo] (`owner/name`).
|
||||
const AppErrorsConfig({
|
||||
required this.app,
|
||||
required this.repo,
|
||||
this.package,
|
||||
this.build = 0,
|
||||
this.version,
|
||||
});
|
||||
|
||||
/// The app name: the RTDB root key and the board's `app`
|
||||
/// (`^[a-z0-9][a-z0-9_-]*$`).
|
||||
final String app;
|
||||
|
||||
/// The repo that holds the fix (`kuhyx/todo`).
|
||||
final String repo;
|
||||
|
||||
/// The Dart package name, when it is not [app] with `-` as `_`.
|
||||
final String? package;
|
||||
|
||||
/// The build number (Android versionCode); 0 when unknown.
|
||||
final int build;
|
||||
|
||||
/// The version name (`1.2.3`).
|
||||
final String? version;
|
||||
|
||||
/// What marks the app's own stack frames (`package:todo/`).
|
||||
String get mark => 'package:${package ?? app.replaceAll('-', '_')}/';
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
/// One error or slow-wait report, in the shape every reporter (Dart, Python,
|
||||
/// GDScript) writes and utils `app_errors` ingests (its README, "Entry").
|
||||
library;
|
||||
|
||||
/// The kind of a user-visible wait that lasted over a second.
|
||||
const perfSlowKind = 'perf.slow';
|
||||
|
||||
/// One report, before the uploader adds the app's repo, mark and build.
|
||||
class ErrorEntry {
|
||||
/// A report of [kind] at [at].
|
||||
const ErrorEntry({
|
||||
required this.at,
|
||||
required this.kind,
|
||||
required this.error,
|
||||
this.stack = const [],
|
||||
this.route,
|
||||
this.operation,
|
||||
this.durationMs,
|
||||
this.waitId,
|
||||
this.still,
|
||||
});
|
||||
|
||||
/// Decodes [toJson]'s shape; throws on a wrong one ([tryFromJson] does not).
|
||||
factory ErrorEntry.fromJson(Map<String, Object?> json) => ErrorEntry(
|
||||
at: DateTime.parse(json['at']! as String),
|
||||
kind: json['kind']! as String,
|
||||
error: json['error']! as String,
|
||||
stack: [for (final f in json['stack'] as List<Object?>? ?? []) '$f'],
|
||||
route: json['route'] as String?,
|
||||
operation: json['operation'] as String?,
|
||||
durationMs: json['durationMs'] as int?,
|
||||
waitId: json['waitId'] as String?,
|
||||
still: json['still'] as bool?,
|
||||
);
|
||||
|
||||
/// [ErrorEntry.fromJson], or null when [json] is not an entry.
|
||||
static ErrorEntry? tryFromJson(Object? json) {
|
||||
try {
|
||||
return ErrorEntry.fromJson(json! as Map<String, Object?>);
|
||||
} on Object {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// When it happened (UTC).
|
||||
final DateTime at;
|
||||
|
||||
/// `uncaught.flutter`, `uncaught.async`, `perf.slow`, ...
|
||||
final String kind;
|
||||
|
||||
/// The error's text (a slow wait: `<operation> waited <ms> ms`).
|
||||
final String error;
|
||||
|
||||
/// The innermost frames, then the app's own.
|
||||
final List<String> stack;
|
||||
|
||||
/// The route on top when it happened (a pattern, never an id).
|
||||
final String? route;
|
||||
|
||||
/// What a slow wait waited for (`list.load`).
|
||||
final String? operation;
|
||||
|
||||
/// How long a slow wait took.
|
||||
final int? durationMs;
|
||||
|
||||
/// Names one slow wait across its still-going and final reports.
|
||||
final String? waitId;
|
||||
|
||||
/// True for the report of a wait that has not ended yet.
|
||||
final bool? still;
|
||||
|
||||
/// The JSON shape (absent fields are left out).
|
||||
Map<String, Object?> toJson() => {
|
||||
'at': at.toUtc().toIso8601String(),
|
||||
'kind': kind,
|
||||
'error': error,
|
||||
'stack': stack,
|
||||
'route': ?route,
|
||||
'operation': ?operation,
|
||||
'durationMs': ?durationMs,
|
||||
'waitId': ?waitId,
|
||||
'still': ?still,
|
||||
};
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
/// The on-device queue of reports not yet uploaded.
|
||||
library;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crdt_sync_flutter/src/errors/error_entry.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// Reports waiting for upload, persisted in `SharedPreferences` (so web
|
||||
/// builds keep them too): a crash, a lost connection or a signed-out device
|
||||
/// loses nothing. Keeps the newest [maxEntries].
|
||||
class ErrorQueue {
|
||||
ErrorQueue._(this._prefs, this._entries);
|
||||
|
||||
/// The queue stored in [prefs]; a corrupt store opens empty.
|
||||
static Future<ErrorQueue> open(SharedPreferences prefs) async {
|
||||
final entries = <ErrorEntry>[];
|
||||
try {
|
||||
for (final raw in jsonDecode(prefs.getString(key) ?? '[]') as List) {
|
||||
final entry = ErrorEntry.tryFromJson(raw);
|
||||
if (entry != null) entries.add(entry);
|
||||
}
|
||||
} on FormatException {
|
||||
// A corrupt queue is dropped: reporting must never stop the app.
|
||||
}
|
||||
return ErrorQueue._(prefs, entries);
|
||||
}
|
||||
|
||||
/// Preferences key of the queue.
|
||||
static const key = 'app_errors.queue';
|
||||
|
||||
/// Most reports kept.
|
||||
static const maxEntries = 300;
|
||||
|
||||
final SharedPreferences _prefs;
|
||||
final List<ErrorEntry> _entries;
|
||||
final _added = StreamController<ErrorEntry>.broadcast();
|
||||
Future<void> _tail = Future.value();
|
||||
|
||||
/// The id of [entry]: a hash of its JSON, so a re-sent upload is a no-op.
|
||||
static String idOf(ErrorEntry entry) => sha1
|
||||
.convert(utf8.encode(jsonEncode(entry.toJson())))
|
||||
.toString()
|
||||
.substring(0, 20);
|
||||
|
||||
/// What is queued, oldest first.
|
||||
List<ErrorEntry> get entries => List.unmodifiable(_entries);
|
||||
|
||||
/// Fires after each [add].
|
||||
Stream<ErrorEntry> get added => _added.stream;
|
||||
|
||||
/// Completes when every change so far is stored.
|
||||
Future<void> get saved => _tail;
|
||||
|
||||
/// Queues [entry] and stores the queue.
|
||||
void add(ErrorEntry entry) {
|
||||
_entries.add(entry);
|
||||
if (_entries.length > maxEntries) {
|
||||
_entries.removeRange(0, _entries.length - maxEntries);
|
||||
}
|
||||
_save();
|
||||
_added.add(entry);
|
||||
}
|
||||
|
||||
/// Drops the entries whose ids are in [ids] and stores the queue.
|
||||
void remove(Set<String> ids) {
|
||||
_entries.removeWhere((e) => ids.contains(idOf(e)));
|
||||
_save();
|
||||
}
|
||||
|
||||
void _save() {
|
||||
final text = jsonEncode([for (final e in _entries) e.toJson()]);
|
||||
_tail = _tail.then((_) => _prefs.setString(key, text));
|
||||
}
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
/// Records errors the user saw (or that escaped) in the [ErrorQueue].
|
||||
library;
|
||||
|
||||
import 'package:crdt_sync_flutter/src/errors/app_errors_config.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_entry.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_queue.dart';
|
||||
|
||||
/// The one door for the app-wide hooks (from kartka's `ErrorReporter`).
|
||||
///
|
||||
/// It guards the queue against error loops: an identical `kind` + message
|
||||
/// inside [window] is dropped, and at most [maxPerMinute] reports are kept a
|
||||
/// minute. It never throws and never reports from inside a report.
|
||||
class ErrorReporter {
|
||||
/// A reporter into [queue] for [config]'s app, reading time from [now].
|
||||
ErrorReporter(this.queue, {required this.config, DateTime Function()? now})
|
||||
: _now = now ?? DateTime.now;
|
||||
|
||||
/// How long an identical error stays suppressed.
|
||||
static const window = Duration(seconds: 30);
|
||||
|
||||
/// Most reports kept in one minute.
|
||||
static const maxPerMinute = 20;
|
||||
|
||||
/// Innermost frames always kept; the rest are the app's own frames.
|
||||
static const _innerFrames = 2;
|
||||
|
||||
/// Where reports go.
|
||||
final ErrorQueue queue;
|
||||
|
||||
/// The app reported for.
|
||||
final AppErrorsConfig config;
|
||||
|
||||
/// The route on top now (an [AppErrorsRouteObserver] keeps it current).
|
||||
String? route;
|
||||
|
||||
final DateTime Function() _now;
|
||||
final _lastSeen = <String, DateTime>{};
|
||||
DateTime? _minute;
|
||||
int _inMinute = 0;
|
||||
bool _busy = false;
|
||||
|
||||
/// Records [error] (with [stack]) as a [kind] report, unless suppressed.
|
||||
void report(String kind, Object? error, {StackTrace? stack}) {
|
||||
if (_busy) return;
|
||||
_busy = true;
|
||||
try {
|
||||
final at = _now().toUtc();
|
||||
final text = '${error ?? 'unknown error'}';
|
||||
if (_allowed('$kind|$text', at)) {
|
||||
queue.add(
|
||||
ErrorEntry(
|
||||
at: at,
|
||||
kind: kind,
|
||||
error: text,
|
||||
stack: _focus(stack),
|
||||
route: route,
|
||||
),
|
||||
);
|
||||
}
|
||||
} on Object {
|
||||
// An error whose toString throws: nothing sensible to record.
|
||||
} finally {
|
||||
_busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool _allowed(String key, DateTime at) {
|
||||
_lastSeen.removeWhere((_, seen) => at.difference(seen) >= window);
|
||||
if (_lastSeen.containsKey(key)) return false;
|
||||
final minute = _minute;
|
||||
if (minute == null || at.difference(minute) >= const Duration(minutes: 1)) {
|
||||
_minute = at;
|
||||
_inMinute = 0;
|
||||
}
|
||||
if (_inMinute >= maxPerMinute) return false;
|
||||
_inMinute++;
|
||||
_lastSeen[key] = at;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// The innermost frames, then the app's own frames, so a framework-deep
|
||||
/// stack still names the app code that triggered it.
|
||||
List<String> _focus(StackTrace? stack) {
|
||||
if (stack == null) return const [];
|
||||
final frames = [
|
||||
for (final line in '$stack'.split('\n'))
|
||||
if (line.trim().isNotEmpty) line.trim(),
|
||||
];
|
||||
return [
|
||||
...frames.take(_innerFrames),
|
||||
...frames.skip(_innerFrames).where((f) => f.contains(config.mark)),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -1,121 +0,0 @@
|
||||
/// Uploads queued reports to RTDB `/<app>/errors/<device>/<id>`, where the
|
||||
/// PC's `app-errors` ingest collects them (from kartka's `error_upload.dart`).
|
||||
library;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:crdt_sync_flutter/src/errors/app_errors_config.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_entry.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_queue.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/report_redact.dart';
|
||||
|
||||
/// Characters an RTDB key cannot hold.
|
||||
final _unsafeKey = RegExp(r'[.#$\[\]/]');
|
||||
|
||||
/// A multi-path RTDB update of `path` (`FirebaseRestClient.patchValues`).
|
||||
typedef ErrorSink =
|
||||
Future<void> Function(String path, Map<String, Object?> values);
|
||||
|
||||
/// Pushes the [ErrorQueue] to RTDB and drops what was sent.
|
||||
///
|
||||
/// Writes go straight to the RTDB client, never through the sync engine, so
|
||||
/// they bump no `revs/` and no peer fetches them. A retried push is
|
||||
/// idempotent (the id is a hash of the entry). Best-effort: debounced after
|
||||
/// appends, backing off on failure, never throws.
|
||||
class ErrorUploader {
|
||||
/// An uploader of [queue] for [config]'s app; [sink] is null while signed
|
||||
/// out.
|
||||
ErrorUploader(
|
||||
this.queue, {
|
||||
required this.config,
|
||||
required this.sink,
|
||||
required this.deviceId,
|
||||
this.debounce = const Duration(seconds: 5),
|
||||
});
|
||||
|
||||
/// Entries per RTDB write.
|
||||
static const batch = 50;
|
||||
|
||||
/// First retry delay after a failed push; doubles up to [maxBackoff].
|
||||
static const minBackoff = Duration(seconds: 30);
|
||||
|
||||
/// Longest retry delay.
|
||||
static const maxBackoff = Duration(minutes: 15);
|
||||
|
||||
/// The reports waiting.
|
||||
final ErrorQueue queue;
|
||||
|
||||
/// The app's identity, stamped on every upload.
|
||||
final AppErrorsConfig config;
|
||||
|
||||
/// The RTDB writer, or null while signed out.
|
||||
final Future<ErrorSink?> Function() sink;
|
||||
|
||||
/// This install's device id.
|
||||
final Future<String> Function() deviceId;
|
||||
|
||||
/// Quiet time after an append before a flush.
|
||||
final Duration debounce;
|
||||
|
||||
StreamSubscription<ErrorEntry>? _sub;
|
||||
Timer? _timer;
|
||||
Duration _backoff = minBackoff;
|
||||
Future<bool> _tail = Future.value(true);
|
||||
|
||||
/// Flushes [debounce] after each append.
|
||||
void start() => _sub ??= queue.added.listen((_) => schedule());
|
||||
|
||||
/// Flushes after [delay] (default [debounce]), replacing a pending one.
|
||||
void schedule([Duration? delay]) {
|
||||
_timer?.cancel();
|
||||
_timer = Timer(delay ?? debounce, () => unawaited(flush()));
|
||||
}
|
||||
|
||||
/// Stops listening and cancels a pending flush.
|
||||
void dispose() {
|
||||
unawaited(_sub?.cancel());
|
||||
_sub = null;
|
||||
_timer?.cancel();
|
||||
}
|
||||
|
||||
/// Pushes what is queued; true when nothing is left. Flushes run one at a
|
||||
/// time; a failure schedules a retry with backoff.
|
||||
Future<bool> flush() => _tail = _tail.then((_) => _flushOnce());
|
||||
|
||||
Future<bool> _flushOnce() async {
|
||||
final pending = queue.entries;
|
||||
if (pending.isEmpty) return true;
|
||||
try {
|
||||
final write = await sink();
|
||||
if (write == null) throw StateError('signed out');
|
||||
final device = (await deviceId()).replaceAll(_unsafeKey, '_');
|
||||
for (var i = 0; i < pending.length; i += batch) {
|
||||
final chunk = pending.sublist(i, math.min(i + batch, pending.length));
|
||||
await write('${config.app}/errors', {
|
||||
for (final e in chunk) '$device/${ErrorQueue.idOf(e)}': _payload(e),
|
||||
});
|
||||
queue.remove({for (final e in chunk) ErrorQueue.idOf(e)});
|
||||
}
|
||||
_backoff = minBackoff;
|
||||
return true;
|
||||
} on Object {
|
||||
schedule(_backoff);
|
||||
_backoff = _backoff * 2 > maxBackoff ? maxBackoff : _backoff * 2;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object?> _payload(ErrorEntry e) => {
|
||||
for (final MapEntry(:key, :value) in e.toJson().entries)
|
||||
key: switch (value) {
|
||||
final String s => redactForReport(s),
|
||||
final List<Object?> l => [for (final f in l) redactForReport('$f')],
|
||||
_ => value,
|
||||
},
|
||||
'repo': config.repo,
|
||||
'mark': config.mark,
|
||||
'build': config.build,
|
||||
'version': ?config.version,
|
||||
};
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
/// The redaction applied before a report leaves the device (from kartka's
|
||||
/// `report_redact.dart`).
|
||||
library;
|
||||
|
||||
final _urlTail = RegExp(
|
||||
r'''(https?://[^\s?#"'<>]*)([?#])(?!<redacted>)[^\s"'<>]*''',
|
||||
);
|
||||
final _userInfo = RegExp(r'''(https?://)[^\s/?#"'<>@]*@''');
|
||||
final _email = RegExp(r'[\w.+-]+@[\w-]+(\.[\w-]+)+');
|
||||
final _bearer = RegExp(r'\b(Bearer|Basic)\s+[^\s,;]+', caseSensitive: false);
|
||||
final _jwt = RegExp(r'eyJ[\w-]+\.[\w-]+\.[\w-]*');
|
||||
final _named = RegExp(
|
||||
r'\b(cookie|set-cookie|authorization|password|passwd|token|secret|'
|
||||
r'api[_-]?key|session)\b(\s*[:=]\s*)[^\s,]+',
|
||||
caseSensitive: false,
|
||||
);
|
||||
final _home = RegExp(r'/(home|Users)/[^/\s]+/');
|
||||
|
||||
/// [text] with URL queries and user info, emails, bearer and basic
|
||||
/// credentials, JWTs, `name=value` secrets and the user name in home paths
|
||||
/// replaced. Over-redaction is the cheap mistake: a report that loses a word
|
||||
/// is still fixable, one that leaks a token is not.
|
||||
String redactForReport(String text) => text
|
||||
.replaceAllMapped(_urlTail, (m) => '${m[1]}${m[2]}<redacted>')
|
||||
.replaceAllMapped(_userInfo, (m) => '${m[1]}<redacted>@')
|
||||
.replaceAll(_jwt, '<jwt>')
|
||||
.replaceAllMapped(_bearer, (m) => '${m[1]} <redacted>')
|
||||
.replaceAllMapped(_named, (m) => '${m[1]}${m[2]}<redacted>')
|
||||
.replaceAll(_email, '<email>')
|
||||
.replaceAll(_home, '~/');
|
||||
@ -1,132 +0,0 @@
|
||||
/// Reports user-visible waits over a second (from kartka's `slow_wait.dart`).
|
||||
library;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:crdt_sync_flutter/src/errors/error_entry.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/error_queue.dart';
|
||||
|
||||
/// Writes every wait that outlasts [threshold] as one `perf.slow` report
|
||||
/// (route when it began, operation, milliseconds).
|
||||
///
|
||||
/// A wait that ends within [threshold] writes nothing. One still going after
|
||||
/// [stillWaiting] is written at once (a hung load never ends), and its end
|
||||
/// writes a second report with the same wait id. The PC groups by route +
|
||||
/// operation only, so every slow wait of one operation is one ticket. At most
|
||||
/// [maxPerMinute] reports a minute. Never throws.
|
||||
class SlowWaitReporter {
|
||||
/// A reporter into [queue]; [route] reads the route on top.
|
||||
SlowWaitReporter(
|
||||
this.queue, {
|
||||
DateTime Function()? now,
|
||||
String? Function()? route,
|
||||
this.threshold = const Duration(seconds: 1),
|
||||
this.stillWaiting = const Duration(seconds: 5),
|
||||
}) : _now = now ?? DateTime.now,
|
||||
_route = route ?? _noRoute;
|
||||
|
||||
static String? _noRoute() => null;
|
||||
|
||||
/// Most reports kept in one minute.
|
||||
static const maxPerMinute = 30;
|
||||
|
||||
/// Where reports go.
|
||||
final ErrorQueue queue;
|
||||
|
||||
/// A wait must last longer than this to be reported.
|
||||
final Duration threshold;
|
||||
|
||||
/// A wait this long is reported before it ends.
|
||||
final Duration stillWaiting;
|
||||
|
||||
final DateTime Function() _now;
|
||||
final String? Function() _route;
|
||||
DateTime? _minute;
|
||||
int _inMinute = 0;
|
||||
int _serial = 0;
|
||||
|
||||
/// Starts timing a wait on [operation] (`list.load`); call
|
||||
/// [SlowWait.end] when it is over.
|
||||
SlowWait begin(String operation) {
|
||||
final at = _now();
|
||||
return SlowWait._(
|
||||
this,
|
||||
operation: operation,
|
||||
route: _route(),
|
||||
started: at,
|
||||
id: '${at.microsecondsSinceEpoch.toRadixString(36)}-${_serial++}',
|
||||
);
|
||||
}
|
||||
|
||||
void _write(SlowWait w, Duration took, {required bool still}) {
|
||||
final at = _now().toUtc();
|
||||
final minute = _minute;
|
||||
if (minute == null || at.difference(minute) >= const Duration(minutes: 1)) {
|
||||
_minute = at;
|
||||
_inMinute = 0;
|
||||
}
|
||||
if (_inMinute >= maxPerMinute) return;
|
||||
_inMinute++;
|
||||
final ms = took.inMilliseconds;
|
||||
queue.add(
|
||||
ErrorEntry(
|
||||
at: at,
|
||||
kind: perfSlowKind,
|
||||
error: '${w.operation} waited $ms ms',
|
||||
route: w.route,
|
||||
operation: w.operation,
|
||||
durationMs: ms,
|
||||
waitId: w.id,
|
||||
still: still,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// One timed wait of a [SlowWaitReporter].
|
||||
class SlowWait {
|
||||
SlowWait._(
|
||||
this._reporter, {
|
||||
required this.operation,
|
||||
required this.route,
|
||||
required this.started,
|
||||
required this.id,
|
||||
}) {
|
||||
_timer = Timer(_reporter.stillWaiting, _stillGoing);
|
||||
}
|
||||
|
||||
final SlowWaitReporter _reporter;
|
||||
|
||||
/// What is awaited.
|
||||
final String operation;
|
||||
|
||||
/// The route on top when the wait began.
|
||||
final String? route;
|
||||
|
||||
/// When it began.
|
||||
final DateTime started;
|
||||
|
||||
/// Names this wait across its reports.
|
||||
final String id;
|
||||
|
||||
late final Timer _timer;
|
||||
bool _reportedStill = false;
|
||||
bool _ended = false;
|
||||
|
||||
void _stillGoing() {
|
||||
_reportedStill = true;
|
||||
_reporter._write(this, _reporter._now().difference(started), still: true);
|
||||
}
|
||||
|
||||
/// Ends the wait; writes it when it lasted over the threshold. Repeat
|
||||
/// calls do nothing.
|
||||
void end() {
|
||||
if (_ended) return;
|
||||
_ended = true;
|
||||
_timer.cancel();
|
||||
final took = _reporter._now().difference(started);
|
||||
if (_reportedStill || took > _reporter.threshold) {
|
||||
_reporter._write(this, took, still: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
/// Times a loader on screen (from kartka's `wait_watch.dart`).
|
||||
library;
|
||||
|
||||
import 'package:crdt_sync_flutter/src/errors/app_errors.dart';
|
||||
import 'package:crdt_sync_flutter/src/errors/slow_wait.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
/// Times how long its [child] (a loader or spinner) stays on screen and
|
||||
/// reports a wait over a second as `perf.slow` for [operation], so the PC
|
||||
/// files a ticket to cut it.
|
||||
///
|
||||
/// The one shared hook for every loader: wrap the spinner instead of timing
|
||||
/// the future at each call site. Without [AppErrors.instance] (a bare widget
|
||||
/// test) it only shows [child].
|
||||
class WaitWatch extends StatefulWidget {
|
||||
/// Watches [child] as a wait on [operation].
|
||||
const WaitWatch({required this.operation, required this.child, super.key});
|
||||
|
||||
/// Watches a centred spinner, the usual full-page loader.
|
||||
const WaitWatch.centered(this.operation, {super.key})
|
||||
: child = const Center(child: CircularProgressIndicator());
|
||||
|
||||
/// What the user waits for, dotted by area (`list.load`). Never an id.
|
||||
final String operation;
|
||||
|
||||
/// The loader shown while waiting.
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<WaitWatch> createState() => _WaitWatchState();
|
||||
}
|
||||
|
||||
class _WaitWatchState extends State<WaitWatch> with WidgetsBindingObserver {
|
||||
SlowWaitReporter? _reporter;
|
||||
SlowWait? _wait;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final reporter = _reporter = AppErrors.instance?.waits;
|
||||
if (reporter == null) return;
|
||||
_wait = reporter.begin(widget.operation);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
/// A backgrounded app is not a wait the user sees: the wait ends when the
|
||||
/// app leaves the foreground and a new one starts when it returns.
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
_wait ??= _reporter?.begin(widget.operation);
|
||||
} else {
|
||||
_wait?.end();
|
||||
_wait = null;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_wait?.end();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => widget.child;
|
||||
}
|
||||
@ -323,10 +323,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: material_ui
|
||||
sha256: a6b19012df437a356cbc01f8ea22a105e07194c47c9a6009da0032a0ce35c4ab
|
||||
sha256: "474c135fd46b56ff1d35ca982155e8863d28fbc6464d1192acf4ee53a738680e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
version: "1.11.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -4,7 +4,7 @@ description: >-
|
||||
persisted per-install device id, and a one-call bootstrap. Removes the
|
||||
~150 lines of firebase_backend.dart every consuming app was copying.
|
||||
publish_to: 'none'
|
||||
version: 0.9.0
|
||||
version: 0.8.2
|
||||
|
||||
environment:
|
||||
sdk: ^3.12.2
|
||||
@ -35,7 +35,7 @@ dependencies:
|
||||
http: 1.6.0
|
||||
# Flutter 3.50 deprecates package:flutter/material.dart. An app on
|
||||
# material_ui gives flutter/material dialogs no MaterialLocalizations.
|
||||
material_ui: 1.11.1
|
||||
material_ui: 1.11.0
|
||||
shared_preferences: 2.5.6
|
||||
# Opens the system browser for the desktop loopback sign-in.
|
||||
url_launcher: 6.3.3
|
||||
|
||||
@ -1,460 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui' show ErrorCallback, PlatformDispatcher;
|
||||
|
||||
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// A sink recording every patch; [fail] makes the next ones throw.
|
||||
class FakeSink {
|
||||
final patches = <String, Map<String, Object?>>{};
|
||||
bool fail = false;
|
||||
|
||||
Future<void> call(String path, Map<String, Object?> values) async {
|
||||
if (fail) throw StateError('offline');
|
||||
(patches[path] ??= {}).addAll(values);
|
||||
}
|
||||
|
||||
List<Map<String, Object?>> get entries => [
|
||||
for (final v in patches.values.expand((m) => m.values))
|
||||
v! as Map<String, Object?>,
|
||||
];
|
||||
}
|
||||
|
||||
const config = AppErrorsConfig(
|
||||
app: 'todo',
|
||||
repo: 'kuhyx/todo',
|
||||
build: 42,
|
||||
version: '1.2.3',
|
||||
);
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
late DateTime clock;
|
||||
late ErrorQueue queue;
|
||||
|
||||
setUp(() async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
clock = DateTime.utc(2026, 11, 17, 10);
|
||||
queue = await ErrorQueue.open(await SharedPreferences.getInstance());
|
||||
});
|
||||
|
||||
ErrorReporter reporter() =>
|
||||
ErrorReporter(queue, config: config, now: () => clock);
|
||||
|
||||
group('ErrorReporter', () {
|
||||
test('records an error with its app frames', () {
|
||||
reporter().report(
|
||||
'uncaught.flutter',
|
||||
StateError('boom'),
|
||||
stack: StackTrace.fromString(
|
||||
'#0 a (package:flutter/x.dart:1:1)\n'
|
||||
'#1 b (dart:async/y.dart:2:2)\n'
|
||||
'#2 c (package:flutter/z.dart:3:3)\n'
|
||||
'#3 Home.build (package:todo/home.dart:4:4)',
|
||||
),
|
||||
);
|
||||
final e = queue.entries.single;
|
||||
expect(e.kind, 'uncaught.flutter');
|
||||
expect(e.error, 'Bad state: boom');
|
||||
expect(e.stack, [
|
||||
'#0 a (package:flutter/x.dart:1:1)',
|
||||
'#1 b (dart:async/y.dart:2:2)',
|
||||
'#3 Home.build (package:todo/home.dart:4:4)',
|
||||
]);
|
||||
});
|
||||
|
||||
test('drops identical errors inside the window', () {
|
||||
final r = reporter();
|
||||
for (var i = 0; i < 10; i++) {
|
||||
r.report('k', 'same');
|
||||
}
|
||||
expect(queue.entries, hasLength(1));
|
||||
clock = clock.add(ErrorReporter.window);
|
||||
r.report('k', 'same');
|
||||
expect(queue.entries, hasLength(2));
|
||||
});
|
||||
|
||||
test('keeps at most maxPerMinute a minute', () {
|
||||
final r = reporter();
|
||||
for (var i = 0; i < ErrorReporter.maxPerMinute + 5; i++) {
|
||||
r.report('k', 'e$i');
|
||||
}
|
||||
expect(queue.entries, hasLength(ErrorReporter.maxPerMinute));
|
||||
clock = clock.add(const Duration(minutes: 1));
|
||||
r.report('k', 'later');
|
||||
expect(queue.entries, hasLength(ErrorReporter.maxPerMinute + 1));
|
||||
});
|
||||
|
||||
test('never throws on an error whose toString throws', () {
|
||||
reporter().report('k', _Throws());
|
||||
expect(queue.entries, isEmpty);
|
||||
});
|
||||
|
||||
test('stamps the route', () {
|
||||
final r = reporter()..route = '/list';
|
||||
r.report('k', 'x');
|
||||
expect(queue.entries.single.route, '/list');
|
||||
});
|
||||
});
|
||||
|
||||
group('SlowWaitReporter', () {
|
||||
SlowWaitReporter waits() =>
|
||||
SlowWaitReporter(queue, now: () => clock, route: () => '/home');
|
||||
|
||||
test('a wait over a second is one perf.slow entry', () {
|
||||
final w = waits().begin('list.load');
|
||||
clock = clock.add(const Duration(seconds: 2));
|
||||
w
|
||||
..end()
|
||||
..end();
|
||||
final e = queue.entries.single;
|
||||
expect(e.kind, perfSlowKind);
|
||||
expect(e.operation, 'list.load');
|
||||
expect(e.durationMs, 2000);
|
||||
expect(e.route, '/home');
|
||||
expect(e.error, 'list.load waited 2000 ms');
|
||||
expect(e.still, isFalse);
|
||||
});
|
||||
|
||||
test('a wait under a second writes nothing', () {
|
||||
final w = waits().begin('quick');
|
||||
clock = clock.add(const Duration(milliseconds: 900));
|
||||
w.end();
|
||||
expect(queue.entries, isEmpty);
|
||||
});
|
||||
|
||||
test('a hung wait is written while still going, then at its end', () async {
|
||||
final r = SlowWaitReporter(
|
||||
queue,
|
||||
now: () => clock,
|
||||
stillWaiting: const Duration(milliseconds: 5),
|
||||
);
|
||||
final w = r.begin('hung');
|
||||
clock = clock.add(const Duration(seconds: 6));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 30));
|
||||
w.end();
|
||||
expect(queue.entries.map((e) => e.still), [true, false]);
|
||||
expect(queue.entries.first.waitId, queue.entries.last.waitId);
|
||||
});
|
||||
|
||||
test('caps slow entries per minute', () {
|
||||
final r = waits();
|
||||
for (var i = 0; i < SlowWaitReporter.maxPerMinute + 3; i++) {
|
||||
final w = r.begin('op');
|
||||
clock = clock.add(const Duration(milliseconds: 1500));
|
||||
w.end();
|
||||
}
|
||||
expect(queue.entries, hasLength(SlowWaitReporter.maxPerMinute));
|
||||
});
|
||||
});
|
||||
|
||||
group('ErrorQueue', () {
|
||||
test('survives a restart (offline reports are not lost)', () async {
|
||||
reporter().report('k', 'offline');
|
||||
await queue.saved;
|
||||
final again = await ErrorQueue.open(
|
||||
await SharedPreferences.getInstance(),
|
||||
);
|
||||
expect(again.entries.single.error, 'offline');
|
||||
});
|
||||
|
||||
test('keeps the newest maxEntries', () {
|
||||
final r = ErrorReporter(queue, config: config, now: () => clock);
|
||||
for (var i = 0; i < ErrorQueue.maxEntries + 3; i++) {
|
||||
clock = clock.add(const Duration(minutes: 1));
|
||||
r.report('k', 'e$i');
|
||||
}
|
||||
expect(queue.entries, hasLength(ErrorQueue.maxEntries));
|
||||
expect(queue.entries.last.error, 'e${ErrorQueue.maxEntries + 2}');
|
||||
});
|
||||
|
||||
test('a corrupt store opens empty', () async {
|
||||
SharedPreferences.setMockInitialValues({ErrorQueue.key: 'not json'});
|
||||
final q = await ErrorQueue.open(await SharedPreferences.getInstance());
|
||||
expect(q.entries, isEmpty);
|
||||
});
|
||||
});
|
||||
|
||||
group('ErrorUploader', () {
|
||||
test('uploads to /<app>/errors/<device>/<id> with the build', () async {
|
||||
final sink = FakeSink();
|
||||
reporter().report('k', 'Bad state: token=abc123 me@x.org');
|
||||
final up = ErrorUploader(
|
||||
queue,
|
||||
config: config,
|
||||
sink: () async => sink.call,
|
||||
deviceId: () async => 'dev-1',
|
||||
);
|
||||
expect(await up.flush(), isTrue);
|
||||
expect(sink.patches.keys.single, 'todo/errors');
|
||||
final key = sink.patches['todo/errors']!.keys.single;
|
||||
expect(key, startsWith('dev-1/'));
|
||||
final e = sink.entries.single;
|
||||
expect(e['build'], 42);
|
||||
expect(e['version'], '1.2.3');
|
||||
expect(e['repo'], 'kuhyx/todo');
|
||||
expect(e['mark'], 'package:todo/');
|
||||
expect(e['error'], 'Bad state: token=<redacted> <email>');
|
||||
expect(queue.entries, isEmpty);
|
||||
});
|
||||
|
||||
test('offline keeps the queue; back online sends it', () async {
|
||||
final sink = FakeSink()..fail = true;
|
||||
reporter().report('k', 'x');
|
||||
final up = ErrorUploader(
|
||||
queue,
|
||||
config: config,
|
||||
sink: () async => sink.call,
|
||||
deviceId: () async => 'd',
|
||||
);
|
||||
expect(await up.flush(), isFalse);
|
||||
expect(queue.entries, hasLength(1));
|
||||
sink.fail = false;
|
||||
expect(await up.flush(), isTrue);
|
||||
expect(sink.entries, hasLength(1));
|
||||
up.dispose();
|
||||
});
|
||||
|
||||
test('signed out (no sink) keeps the queue', () async {
|
||||
reporter().report('k', 'x');
|
||||
final up = ErrorUploader(
|
||||
queue,
|
||||
config: config,
|
||||
sink: () async => null,
|
||||
deviceId: () async => 'd',
|
||||
);
|
||||
expect(await up.flush(), isFalse);
|
||||
expect(queue.entries, hasLength(1));
|
||||
up.dispose();
|
||||
});
|
||||
|
||||
test('nothing pending is a no-op', () async {
|
||||
final up = ErrorUploader(
|
||||
queue,
|
||||
config: config,
|
||||
sink: () async => throw StateError('never called'),
|
||||
deviceId: () async => 'd',
|
||||
);
|
||||
expect(await up.flush(), isTrue);
|
||||
});
|
||||
|
||||
test('an append schedules a debounced flush', () async {
|
||||
final sink = FakeSink();
|
||||
final up = ErrorUploader(
|
||||
queue,
|
||||
config: config,
|
||||
sink: () async => sink.call,
|
||||
deviceId: () async => 'd',
|
||||
debounce: Duration.zero,
|
||||
)..start();
|
||||
reporter().report('k', 'x');
|
||||
await Future<void>.delayed(const Duration(milliseconds: 20));
|
||||
expect(sink.entries, hasLength(1));
|
||||
up.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
group('installAppErrors', () {
|
||||
late FlutterExceptionHandler? savedFlutter;
|
||||
late ErrorCallback? savedAsync;
|
||||
|
||||
setUp(() {
|
||||
savedFlutter = FlutterError.onError;
|
||||
savedAsync = PlatformDispatcher.instance.onError;
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
FlutterError.onError = savedFlutter;
|
||||
PlatformDispatcher.instance.onError = savedAsync;
|
||||
AppErrors.instance = null;
|
||||
});
|
||||
|
||||
test('chains the framework and async hooks', () async {
|
||||
final seen = <Object>[];
|
||||
FlutterError.onError = (d) => seen.add(d.exception);
|
||||
PlatformDispatcher.instance.onError = (e, s) {
|
||||
seen.add(e);
|
||||
return true;
|
||||
};
|
||||
final errors = await installAppErrors(
|
||||
config,
|
||||
preferences: await SharedPreferences.getInstance(),
|
||||
);
|
||||
expect(AppErrors.instance, same(errors));
|
||||
FlutterError.onError!(
|
||||
FlutterErrorDetails(exception: StateError('framework')),
|
||||
);
|
||||
FlutterError.onError!(
|
||||
FlutterErrorDetails(exception: StateError('quiet'), silent: true),
|
||||
);
|
||||
expect(
|
||||
PlatformDispatcher.instance.onError!(
|
||||
StateError('async'),
|
||||
StackTrace.empty,
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
expect(seen, hasLength(3));
|
||||
expect(errors.queue.entries.map((e) => e.kind), [
|
||||
'uncaught.flutter',
|
||||
'uncaught.async',
|
||||
]);
|
||||
});
|
||||
|
||||
test('without prior hooks the async error is not handled', () async {
|
||||
FlutterError.onError = null;
|
||||
PlatformDispatcher.instance.onError = null;
|
||||
final errors = await installAppErrors(
|
||||
config,
|
||||
preferences: await SharedPreferences.getInstance(),
|
||||
);
|
||||
FlutterError.onError!(FlutterErrorDetails(exception: StateError('f')));
|
||||
expect(
|
||||
PlatformDispatcher.instance.onError!('a', StackTrace.empty),
|
||||
isFalse,
|
||||
);
|
||||
expect(errors.queue.entries, hasLength(2));
|
||||
});
|
||||
|
||||
test('connect starts uploads; the route observer stamps routes', () async {
|
||||
final errors = await installAppErrors(
|
||||
config,
|
||||
preferences: await SharedPreferences.getInstance(),
|
||||
);
|
||||
final sink = FakeSink();
|
||||
final up = errors.connect(
|
||||
sink: () async => sink.call,
|
||||
deviceId: () async => 'd',
|
||||
startDelay: Duration.zero,
|
||||
);
|
||||
AppErrorsRouteObserver(errors).didPush(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const SizedBox(),
|
||||
settings: const RouteSettings(name: '/settings'),
|
||||
),
|
||||
null,
|
||||
);
|
||||
errors.reporter.report('k', 'x');
|
||||
await Future<void>.delayed(const Duration(milliseconds: 20));
|
||||
await up.flush();
|
||||
expect(sink.entries.single['route'], '/settings');
|
||||
up.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
group('WaitWatch', () {
|
||||
tearDown(() => AppErrors.instance = null);
|
||||
|
||||
testWidgets('without AppErrors it only shows the child', (tester) async {
|
||||
await tester.pumpWidget(const WaitWatch.centered('x'));
|
||||
expect(find.byType(CircularProgressIndicator), findsOneWidget);
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets('a spinner shown 2 s is a perf.slow entry', (tester) async {
|
||||
var now = DateTime.utc(2026);
|
||||
final errors = AppErrors.forTest(config, queue, now: () => now);
|
||||
AppErrors.instance = errors;
|
||||
await tester.pumpWidget(
|
||||
const WaitWatch(operation: 'list.load', child: SizedBox()),
|
||||
);
|
||||
now = now.add(const Duration(seconds: 2));
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
expect(queue.entries.single.operation, 'list.load');
|
||||
});
|
||||
|
||||
testWidgets('backgrounding ends the wait, resuming starts one', (
|
||||
tester,
|
||||
) async {
|
||||
var now = DateTime.utc(2026);
|
||||
final errors = AppErrors.forTest(config, queue, now: () => now);
|
||||
AppErrors.instance = errors;
|
||||
await tester.pumpWidget(
|
||||
const WaitWatch(operation: 'op', child: SizedBox()),
|
||||
);
|
||||
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.paused);
|
||||
now = now.add(const Duration(seconds: 30));
|
||||
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
|
||||
now = now.add(const Duration(milliseconds: 100));
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
expect(queue.entries, isEmpty, reason: 'background time is no wait');
|
||||
});
|
||||
});
|
||||
|
||||
test('install reads the default preferences', () async {
|
||||
final saved = (FlutterError.onError, PlatformDispatcher.instance.onError);
|
||||
final errors = await installAppErrors(config);
|
||||
expect(errors.config.mark, 'package:todo/');
|
||||
FlutterError.onError = saved.$1;
|
||||
PlatformDispatcher.instance.onError = saved.$2;
|
||||
AppErrors.instance = null;
|
||||
});
|
||||
|
||||
test('config mark uses the package name, else the app', () {
|
||||
// ignore: prefer_const_constructors -- a runtime instance for coverage
|
||||
final named = AppErrorsConfig(app: 'a-b', repo: 'o/a', package: 'pkg');
|
||||
expect(named.mark, 'package:pkg/');
|
||||
// ignore: prefer_const_constructors
|
||||
expect(AppErrorsConfig(app: 'a-b', repo: 'o/a').mark, 'package:a_b/');
|
||||
});
|
||||
|
||||
test('route observer follows pop and replace', () {
|
||||
final errors = AppErrors.forTest(config, queue);
|
||||
final observer = AppErrorsRouteObserver(errors);
|
||||
Route<void> named(String name) => MaterialPageRoute<void>(
|
||||
builder: (_) => const SizedBox(),
|
||||
settings: RouteSettings(name: name),
|
||||
);
|
||||
observer.didPop(named('/b'), named('/a'));
|
||||
expect(errors.reporter.route, '/a');
|
||||
observer.didReplace(newRoute: named('/c'));
|
||||
expect(errors.reporter.route, '/c');
|
||||
observer.didPop(named('/c'), null);
|
||||
expect(errors.reporter.route, '/c', reason: 'no name keeps the last');
|
||||
});
|
||||
|
||||
testWidgets('WaitWatch built at runtime', (tester) async {
|
||||
// ignore: prefer_const_constructors
|
||||
await tester.pumpWidget(WaitWatch.centered('x'));
|
||||
// ignore: prefer_const_constructors
|
||||
await tester.pumpWidget(WaitWatch(operation: 'y', child: SizedBox()));
|
||||
expect(find.byType(SizedBox), findsOneWidget);
|
||||
});
|
||||
|
||||
test('redactForReport masks secrets', () {
|
||||
expect(
|
||||
redactForReport(
|
||||
'GET https://u:p@x.io/a?key=1 Bearer abc eyJa.eyJb.c '
|
||||
'password: hunter2 /home/kuhy/file',
|
||||
),
|
||||
'GET https://<redacted>@x.io/a?<redacted> Bearer <redacted> <jwt> '
|
||||
'password: <redacted> ~/file',
|
||||
);
|
||||
});
|
||||
|
||||
test('ErrorEntry round-trips through JSON', () {
|
||||
final e = ErrorEntry(
|
||||
at: DateTime.utc(2026),
|
||||
kind: perfSlowKind,
|
||||
error: 'x',
|
||||
stack: const ['a'],
|
||||
route: '/r',
|
||||
operation: 'op',
|
||||
durationMs: 5,
|
||||
waitId: 'w',
|
||||
still: true,
|
||||
);
|
||||
final back = ErrorEntry.fromJson(e.toJson());
|
||||
expect(back.toJson(), e.toJson());
|
||||
expect(ErrorEntry.tryFromJson('nope'), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
class _Throws {
|
||||
@override
|
||||
String toString() => throw StateError('no');
|
||||
}
|
||||
@ -10,7 +10,7 @@ environment:
|
||||
sdk: ^3.12.2
|
||||
|
||||
dependencies:
|
||||
file_picker: 13.4.0
|
||||
file_picker: 13.3.3
|
||||
file_selector: 1.1.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
@ -13,7 +13,7 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
material_ui: 1.11.1
|
||||
material_ui: 1.11.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@ -8,7 +8,7 @@ version = "0.10.0"
|
||||
description = "Time-boxed focus projects: replace chosen gates, pay a daily-minutes gate"
|
||||
requires-python = ">=3.14"
|
||||
# Stdlib only on purpose: guards import it from the system python.
|
||||
dependencies = ["earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.22.0#subdirectory=earned_time"]
|
||||
dependencies = ["earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.21.0#subdirectory=earned_time"]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["focus_project*"]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# floor is satisfied by anything newer, so it tells a checker nothing
|
||||
# about whether this repo is actually current.
|
||||
bandit[toml]==1.9.4
|
||||
earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.22.0#subdirectory=earned_time
|
||||
earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.21.0#subdirectory=earned_time
|
||||
mypy==2.4.1
|
||||
pre-commit==4.7.0
|
||||
pylint==4.1.4
|
||||
|
||||
@ -125,24 +125,6 @@ lower ranks keep queueing), waits windowless, and re-arms fully once nothing
|
||||
outranks it. `scripts/verify_all_lockers.py` checks this with five real
|
||||
processes on a private Xvfb.
|
||||
|
||||
## Error and slow-wait reporting
|
||||
|
||||
`gatelock.error_report` is the Python reporter of the shared app-errors pipeline
|
||||
(utils `DOCS-app-errors.md`). Call it once at start-up, then watch the Tk loop:
|
||||
|
||||
```python
|
||||
from gatelock import error_report
|
||||
|
||||
rep = error_report.install("leetcode-guard", "kuhyx/leetcode-guard")
|
||||
error_report.watch_stalls(root, rep) # a frozen loop over 1 s -> perf.slow
|
||||
with rep.wait("coach.load"): # or rep.begin(...).end() across callbacks
|
||||
...
|
||||
```
|
||||
|
||||
Uncaught, thread and Tk callback errors and waits over 1 s go to
|
||||
`~/.local/state/app-errors-spool/<app>.jsonl`. The `app-errors` ingest timer
|
||||
turns them into board tickets. Nothing shows on screen.
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
|
||||
@ -1,312 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""Report every error and every wait over 1 s of a Tk (or any Python) app.
|
||||
|
||||
The Python reporter of kuhy's shared app-errors pipeline (utils
|
||||
``DOCS-app-errors.md``; the Dart one is crdt_sync_flutter's, generalised from
|
||||
kartka). ``install`` once at start-up hooks ``sys.excepthook``,
|
||||
``threading.excepthook`` and Tk callback errors (``Misc._report_exception``,
|
||||
which every root, ``GateRoot`` included, goes through), each chained to the
|
||||
hook it replaces. ``Reporter.begin``/``wait`` time a user-visible wait, and
|
||||
``watch_stalls`` reports a frozen Tk loop with no call-site work.
|
||||
|
||||
A report is one JSON line in ``$XDG_STATE_HOME/app-errors-spool/<app>.jsonl``.
|
||||
The PC's ``app-errors`` ingest (utils ``app_errors/``) reads it, groups it by
|
||||
signature and hands it to the board, which files a ticket. Reporting shows
|
||||
nothing on screen, never raises and never reports from inside a report.
|
||||
Identical errors within ``WINDOW`` seconds are dropped and at most
|
||||
``MAX_PER_MINUTE`` are written per minute (an error loop cannot fill the disk).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import contextmanager
|
||||
from dataclasses import dataclass, field
|
||||
import datetime as dt
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import tkinter as tk
|
||||
import traceback
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable, Iterator
|
||||
from types import TracebackType
|
||||
|
||||
#: The kind the board files as "bring this wait under 1 s".
|
||||
SLOW_KIND = "perf.slow"
|
||||
#: How often the stall watch ticks, milliseconds.
|
||||
STALL_TICK_MS = 100
|
||||
|
||||
_TK_DOOR = "_report_exception"
|
||||
|
||||
_installed: Reporter | None = None
|
||||
|
||||
|
||||
def _default_spool() -> Path:
|
||||
base = os.environ.get("XDG_STATE_HOME") or str(Path.home() / ".local" / "state")
|
||||
return Path(base) / "app-errors-spool"
|
||||
|
||||
|
||||
def _short(path: str, mark: str) -> str:
|
||||
"""Return ``path`` from the package that holds it: no home directory in a report."""
|
||||
for anchor in ("site-packages/", "dist-packages/"):
|
||||
if anchor in path:
|
||||
return path.rsplit(anchor, 1)[1]
|
||||
if mark in path:
|
||||
return mark + path.rsplit(mark, 1)[1]
|
||||
return Path(path).name
|
||||
|
||||
|
||||
@dataclass
|
||||
class Reporter:
|
||||
"""Writes one app's error and slow-wait reports to the spool."""
|
||||
|
||||
#: Seconds an identical error stays suppressed.
|
||||
WINDOW = 30.0
|
||||
#: Most error reports written per minute.
|
||||
MAX_PER_MINUTE = 20
|
||||
#: Most slow-wait reports written per minute.
|
||||
MAX_SLOW_PER_MINUTE = 30
|
||||
|
||||
app: str
|
||||
repo: str
|
||||
mark: str = ""
|
||||
spool: Path = field(default_factory=_default_spool)
|
||||
build: int = 0
|
||||
version: str | None = None
|
||||
threshold: float = 1.0
|
||||
still_after: float = 5.0
|
||||
clock: Callable[[], float] = time.time
|
||||
_seen: dict[str, float] = field(default_factory=dict)
|
||||
_minutes: dict[str, tuple[float, int]] = field(default_factory=dict)
|
||||
_busy: bool = False
|
||||
_serial: int = 0
|
||||
_lock: threading.Lock = field(default_factory=threading.Lock)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""Default the frame mark to the app's module directory."""
|
||||
self.mark = self.mark or self.app.replace("-", "_") + "/"
|
||||
|
||||
def _allowed(self, bucket: str, cap: int) -> bool:
|
||||
now = self.clock()
|
||||
start, count = self._minutes.get(bucket, (now, 0))
|
||||
if now - start >= 60: # noqa: PLR2004 -- one minute
|
||||
start, count = now, 0
|
||||
if count >= cap:
|
||||
return False
|
||||
self._minutes[bucket] = (start, count + 1)
|
||||
return True
|
||||
|
||||
def _write(self, entry: dict[str, object]) -> None:
|
||||
at = dt.datetime.fromtimestamp(self.clock(), dt.UTC)
|
||||
entry |= {
|
||||
"at": at.strftime("%Y-%m-%dT%H:%M:%S.") + f"{at.microsecond // 1000:03d}Z",
|
||||
"repo": self.repo,
|
||||
"mark": self.mark,
|
||||
"build": self.build,
|
||||
}
|
||||
if self.version:
|
||||
entry["version"] = self.version
|
||||
line = json.dumps(entry, sort_keys=True) + "\n"
|
||||
with self._lock:
|
||||
self.spool.mkdir(parents=True, exist_ok=True)
|
||||
with (self.spool / f"{self.app}.jsonl").open("a", encoding="utf-8") as f:
|
||||
f.write(line)
|
||||
|
||||
def report(self, kind: str, error: object, tb: TracebackType | None = None) -> None:
|
||||
"""Record ``error`` (exception or message) as ``kind``, unless suppressed."""
|
||||
if self._busy:
|
||||
return
|
||||
self._busy = True
|
||||
try:
|
||||
text = (
|
||||
f"{type(error).__name__}: {error}"
|
||||
if isinstance(error, BaseException)
|
||||
else str(error)
|
||||
)
|
||||
now = self.clock()
|
||||
key = f"{kind}|{text}"
|
||||
self._seen = {k: t for k, t in self._seen.items() if now - t < self.WINDOW}
|
||||
if key in self._seen or not self._allowed("error", self.MAX_PER_MINUTE):
|
||||
return
|
||||
self._seen[key] = now
|
||||
frames = traceback.extract_tb(tb) if tb is not None else []
|
||||
stack = [
|
||||
f"{_short(f.filename, self.mark)}:{f.lineno} in {f.name}"
|
||||
for f in reversed(frames)
|
||||
]
|
||||
self._write({"kind": kind, "error": text, "stack": stack})
|
||||
except Exception: # noqa: BLE001, S110 -- never raise into the app it watches
|
||||
pass
|
||||
finally:
|
||||
self._busy = False
|
||||
|
||||
def slow(
|
||||
self,
|
||||
operation: str,
|
||||
ms: int,
|
||||
*,
|
||||
wait_id: str,
|
||||
route: str | None = None,
|
||||
still: bool = False,
|
||||
) -> None:
|
||||
"""Record one wait of ``ms`` milliseconds on ``operation``."""
|
||||
try:
|
||||
if not self._allowed("slow", self.MAX_SLOW_PER_MINUTE):
|
||||
return
|
||||
entry: dict[str, object] = {
|
||||
"kind": SLOW_KIND,
|
||||
"error": f"{operation} waited {ms} ms",
|
||||
"operation": operation,
|
||||
"durationMs": ms,
|
||||
"waitId": wait_id,
|
||||
"still": still,
|
||||
}
|
||||
if route:
|
||||
entry["route"] = route
|
||||
self._write(entry)
|
||||
except Exception: # noqa: BLE001, S110 -- never raise into the app
|
||||
pass
|
||||
|
||||
def begin(self, operation: str, *, route: str | None = None) -> SlowWait:
|
||||
"""Start timing a wait on ``operation`` (``coach.load``); ``end`` it after."""
|
||||
self._serial += 1
|
||||
return SlowWait(
|
||||
self,
|
||||
operation,
|
||||
route,
|
||||
self.clock(),
|
||||
f"{int(self.clock() * 1000):x}-{self._serial}",
|
||||
)
|
||||
|
||||
@contextmanager
|
||||
def wait(self, operation: str, *, route: str | None = None) -> Iterator[SlowWait]:
|
||||
"""Time the ``with`` block as a wait on ``operation``."""
|
||||
handle = self.begin(operation, route=route)
|
||||
try:
|
||||
yield handle
|
||||
finally:
|
||||
handle.end()
|
||||
|
||||
|
||||
@dataclass
|
||||
class SlowWait:
|
||||
"""One timed wait: reported when it ends after the threshold, or is still going."""
|
||||
|
||||
reporter: Reporter
|
||||
operation: str
|
||||
route: str | None
|
||||
started: float
|
||||
id: str
|
||||
_ended: bool = False
|
||||
_reported_still: bool = False
|
||||
_timer: threading.Timer = field(init=False)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""Arm the still-waiting report (a hung load never ends)."""
|
||||
self._timer = threading.Timer(self.reporter.still_after, self._still)
|
||||
self._timer.daemon = True
|
||||
self._timer.start()
|
||||
|
||||
def _ms(self) -> int:
|
||||
return round((self.reporter.clock() - self.started) * 1000)
|
||||
|
||||
def _still(self) -> None:
|
||||
if self._ended:
|
||||
return
|
||||
self._reported_still = True
|
||||
self.reporter.slow(
|
||||
self.operation, self._ms(), wait_id=self.id, route=self.route, still=True
|
||||
)
|
||||
|
||||
def end(self) -> None:
|
||||
"""End the wait; write it if it outlasted the threshold; repeats do nothing."""
|
||||
if self._ended:
|
||||
return
|
||||
self._ended = True
|
||||
self._timer.cancel()
|
||||
ms = self._ms()
|
||||
if self._reported_still or ms > self.reporter.threshold * 1000:
|
||||
self.reporter.slow(self.operation, ms, wait_id=self.id, route=self.route)
|
||||
|
||||
|
||||
def watch_stalls(root: tk.Misc, reporter: Reporter) -> None:
|
||||
"""Report each time ``root``'s event loop froze past the threshold.
|
||||
|
||||
The operation is ``tk.mainloop``: a blocking call on the Tk thread.
|
||||
"""
|
||||
last = [reporter.clock()]
|
||||
|
||||
def tick() -> None:
|
||||
now = reporter.clock()
|
||||
late = round((now - last[0]) * 1000) - STALL_TICK_MS
|
||||
last[0] = now
|
||||
if late > reporter.threshold * 1000:
|
||||
reporter.slow("tk.mainloop", late, wait_id=f"stall-{int(now * 1000):x}")
|
||||
try:
|
||||
root.after(STALL_TICK_MS, tick)
|
||||
except tk.TclError:
|
||||
return # the window is gone
|
||||
|
||||
root.after(STALL_TICK_MS, tick)
|
||||
|
||||
|
||||
def install(
|
||||
app: str,
|
||||
repo: str,
|
||||
*,
|
||||
mark: str = "",
|
||||
build: int = 0,
|
||||
version: str | None = None,
|
||||
) -> Reporter:
|
||||
"""Hook uncaught, thread and Tk callback errors once; return the reporter.
|
||||
|
||||
The spool is ``$XDG_STATE_HOME/app-errors-spool``; tests build a
|
||||
``Reporter`` with their own ``spool`` instead.
|
||||
"""
|
||||
global _installed # noqa: PLW0603 -- one set of process-wide hooks
|
||||
if _installed is not None:
|
||||
return _installed
|
||||
rep = Reporter(
|
||||
app=app,
|
||||
repo=repo,
|
||||
mark=mark,
|
||||
build=build,
|
||||
version=version,
|
||||
)
|
||||
prior_sys = sys.excepthook
|
||||
|
||||
def sys_hook(
|
||||
kind: type[BaseException], value: BaseException, tb: TracebackType | None
|
||||
) -> None:
|
||||
rep.report("uncaught.python", value, tb)
|
||||
prior_sys(kind, value, tb)
|
||||
|
||||
prior_thread = threading.excepthook
|
||||
|
||||
def thread_hook(args: threading.ExceptHookArgs) -> None:
|
||||
value: object = args.exc_value
|
||||
if value is None:
|
||||
value = args.exc_type.__name__
|
||||
rep.report("uncaught.thread", value, args.exc_traceback)
|
||||
prior_thread(args)
|
||||
|
||||
# Misc._report_exception is the one door every Tk callback error passes,
|
||||
# whatever root subclass overrides report_callback_exception.
|
||||
prior_tk: Callable[[tk.Misc], None] = getattr(tk.Misc, _TK_DOOR)
|
||||
|
||||
def tk_hook(widget: tk.Misc) -> None:
|
||||
_, value, tb = sys.exc_info()
|
||||
if value is not None:
|
||||
rep.report("uncaught.tk", value, tb)
|
||||
prior_tk(widget)
|
||||
|
||||
sys.excepthook = sys_hook
|
||||
threading.excepthook = thread_hook
|
||||
setattr(tk.Misc, _TK_DOOR, tk_hook)
|
||||
_installed = rep
|
||||
return rep
|
||||
@ -1,290 +0,0 @@
|
||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
||||
"""The Tk app error and slow-wait reporter: hooks, dedup, spool lines, stalls."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
import threading
|
||||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from gatelock import error_report
|
||||
from gatelock.error_report import Reporter
|
||||
|
||||
DOOR = "_report_exception"
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class Clock:
|
||||
"""A settable wall + monotonic clock."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.t = 1_800_000_000.0
|
||||
|
||||
def __call__(self) -> float:
|
||||
return self.t
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def clock() -> Clock:
|
||||
return Clock()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def reporter(tmp_path: Path, clock: Clock) -> Reporter:
|
||||
return Reporter(
|
||||
app="leetcode-guard",
|
||||
repo="kuhyx/leetcode-guard",
|
||||
spool=tmp_path,
|
||||
build=5,
|
||||
version="0.3.0",
|
||||
clock=clock,
|
||||
)
|
||||
|
||||
|
||||
def _lines(tmp_path: Path, app: str = "leetcode-guard") -> list[dict[str, object]]:
|
||||
path = tmp_path / f"{app}.jsonl"
|
||||
if not path.exists():
|
||||
return []
|
||||
return [json.loads(line) for line in path.read_text().splitlines()]
|
||||
|
||||
|
||||
def _raise() -> BaseException:
|
||||
try:
|
||||
raise ValueError("bad 12") # noqa: EM101, TRY003, TRY301 -- a real traceback for the test
|
||||
except ValueError as e:
|
||||
return e
|
||||
|
||||
|
||||
def test_report_writes_one_entry(reporter: Reporter, tmp_path: Path) -> None:
|
||||
exc = _raise()
|
||||
reporter.report("uncaught.python", exc, exc.__traceback__)
|
||||
(entry,) = _lines(tmp_path)
|
||||
assert entry["kind"] == "uncaught.python"
|
||||
assert entry["error"] == "ValueError: bad 12"
|
||||
assert entry["repo"] == "kuhyx/leetcode-guard"
|
||||
assert entry["mark"] == "leetcode_guard/"
|
||||
assert entry["build"] == 5
|
||||
assert entry["version"] == "0.3.0"
|
||||
assert entry["at"] == "2027-01-15T08:00:00.000Z"
|
||||
stack = entry["stack"]
|
||||
assert isinstance(stack, list)
|
||||
assert "test_error_report.py" in stack[0]
|
||||
assert " in _raise" in stack[0]
|
||||
|
||||
|
||||
def test_identical_errors_within_window_are_dropped(
|
||||
reporter: Reporter, tmp_path: Path, clock: Clock
|
||||
) -> None:
|
||||
for _ in range(5):
|
||||
reporter.report("k", "same")
|
||||
assert len(_lines(tmp_path)) == 1
|
||||
clock.t += Reporter.WINDOW + 1
|
||||
reporter.report("k", "same")
|
||||
assert len(_lines(tmp_path)) == 2
|
||||
|
||||
|
||||
def test_rate_cap_per_minute(reporter: Reporter, tmp_path: Path, clock: Clock) -> None:
|
||||
for i in range(Reporter.MAX_PER_MINUTE + 5):
|
||||
reporter.report("k", f"e{i}")
|
||||
assert len(_lines(tmp_path)) == Reporter.MAX_PER_MINUTE
|
||||
clock.t += 61
|
||||
reporter.report("k", "later")
|
||||
assert len(_lines(tmp_path)) == Reporter.MAX_PER_MINUTE + 1
|
||||
|
||||
|
||||
def test_report_never_raises(reporter: Reporter, tmp_path: Path) -> None:
|
||||
class Bad:
|
||||
def __str__(self) -> str:
|
||||
raise RuntimeError
|
||||
|
||||
reporter.report("k", Bad())
|
||||
(tmp_path / "leetcode-guard.jsonl").mkdir() # an unwritable spool file
|
||||
reporter.report("k", "other")
|
||||
assert True
|
||||
|
||||
|
||||
def test_report_inside_report_is_ignored(reporter: Reporter, tmp_path: Path) -> None:
|
||||
reporter._busy = True
|
||||
reporter.report("k", "x")
|
||||
assert _lines(tmp_path) == []
|
||||
|
||||
|
||||
def test_slow_wait_over_threshold_is_written(
|
||||
reporter: Reporter, tmp_path: Path, clock: Clock
|
||||
) -> None:
|
||||
wait = reporter.begin("coach.load", route="coach")
|
||||
clock.t += 2.0
|
||||
wait.end()
|
||||
wait.end() # repeat ends do nothing
|
||||
(entry,) = _lines(tmp_path)
|
||||
assert entry["kind"] == "perf.slow"
|
||||
assert entry["operation"] == "coach.load"
|
||||
assert entry["durationMs"] == 2000
|
||||
assert entry["route"] == "coach"
|
||||
assert entry["still"] is False
|
||||
assert entry["error"] == "coach.load waited 2000 ms"
|
||||
|
||||
|
||||
def test_fast_wait_writes_nothing(
|
||||
reporter: Reporter, tmp_path: Path, clock: Clock
|
||||
) -> None:
|
||||
with reporter.wait("quick"):
|
||||
clock.t += 0.5
|
||||
assert _lines(tmp_path) == []
|
||||
|
||||
|
||||
def test_still_waiting_is_written_then_the_end(
|
||||
reporter: Reporter, tmp_path: Path, clock: Clock
|
||||
) -> None:
|
||||
wait = reporter.begin("hung")
|
||||
clock.t += 6
|
||||
wait._still()
|
||||
clock.t += 1
|
||||
wait.end()
|
||||
still, end = _lines(tmp_path)
|
||||
assert still["still"] is True
|
||||
assert end["still"] is False
|
||||
assert still["waitId"] == end["waitId"]
|
||||
|
||||
|
||||
def test_slow_rate_cap(reporter: Reporter, tmp_path: Path, clock: Clock) -> None:
|
||||
for _ in range(Reporter.MAX_SLOW_PER_MINUTE + 3):
|
||||
w = reporter.begin("op")
|
||||
clock.t += 1.5
|
||||
w.end()
|
||||
assert len(_lines(tmp_path)) == Reporter.MAX_SLOW_PER_MINUTE
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def hooks() -> Iterator[None]:
|
||||
saved = (sys.excepthook, threading.excepthook, getattr(tk.Misc, DOOR))
|
||||
yield
|
||||
sys.excepthook, threading.excepthook = saved[:2]
|
||||
setattr(tk.Misc, DOOR, saved[2])
|
||||
error_report._installed = None
|
||||
|
||||
|
||||
def _install(spool: Path) -> Reporter:
|
||||
rep = error_report.install("tk-app", "kuhyx/tk-app")
|
||||
rep.spool = spool
|
||||
return rep
|
||||
|
||||
|
||||
def test_install_chains_sys_and_thread_hooks(hooks: None, tmp_path: Path) -> None:
|
||||
prior = MagicMock()
|
||||
sys.excepthook = prior
|
||||
prior_thread = MagicMock()
|
||||
threading.excepthook = prior_thread
|
||||
rep = _install(tmp_path)
|
||||
assert _install(tmp_path) is rep # idempotent
|
||||
exc = _raise()
|
||||
sys.excepthook(ValueError, exc, exc.__traceback__)
|
||||
prior.assert_called_once()
|
||||
args = MagicMock(
|
||||
exc_type=RuntimeError, exc_value=RuntimeError("thread boom"), exc_traceback=None
|
||||
)
|
||||
threading.excepthook(args)
|
||||
prior_thread.assert_called_once_with(args)
|
||||
kinds = [e["kind"] for e in _lines(tmp_path, "tk-app")]
|
||||
assert kinds == ["uncaught.python", "uncaught.thread"]
|
||||
|
||||
|
||||
def test_thread_hook_without_value(hooks: None, tmp_path: Path) -> None:
|
||||
threading.excepthook = MagicMock()
|
||||
_install(tmp_path)
|
||||
threading.excepthook(
|
||||
MagicMock(exc_type=SystemExit, exc_value=None, exc_traceback=None)
|
||||
)
|
||||
assert _lines(tmp_path, "tk-app")[0]["error"] == "SystemExit"
|
||||
|
||||
|
||||
def test_install_reports_tk_callback_errors(hooks: None, tmp_path: Path) -> None:
|
||||
prior = MagicMock()
|
||||
setattr(tk.Misc, DOOR, prior)
|
||||
_install(tmp_path)
|
||||
widget = MagicMock()
|
||||
try:
|
||||
raise KeyError("cb") # noqa: EM101, TRY301
|
||||
except KeyError:
|
||||
getattr(tk.Misc, DOOR)(widget)
|
||||
prior.assert_called_once_with(widget)
|
||||
(entry,) = _lines(tmp_path, "tk-app")
|
||||
assert entry["kind"] == "uncaught.tk"
|
||||
assert entry["error"] == "KeyError: 'cb'"
|
||||
|
||||
|
||||
def test_tk_hook_without_active_exception(hooks: None, tmp_path: Path) -> None:
|
||||
setattr(tk.Misc, DOOR, MagicMock())
|
||||
_install(tmp_path)
|
||||
getattr(tk.Misc, DOOR)(MagicMock())
|
||||
assert _lines(tmp_path, "tk-app") == []
|
||||
|
||||
|
||||
def test_default_spool_and_mark(
|
||||
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
||||
) -> None:
|
||||
monkeypatch.setenv("XDG_STATE_HOME", str(tmp_path))
|
||||
rep = Reporter(app="diet-guard", repo="kuhyx/diet-guard")
|
||||
assert rep.spool == tmp_path / "app-errors-spool"
|
||||
assert rep.mark == "diet_guard/"
|
||||
monkeypatch.delenv("XDG_STATE_HOME")
|
||||
assert Reporter(app="a", repo="kuhyx/a").spool.name == "app-errors-spool"
|
||||
|
||||
|
||||
def test_stall_watch_reports_a_frozen_loop(
|
||||
reporter: Reporter, tmp_path: Path, clock: Clock
|
||||
) -> None:
|
||||
root = MagicMock()
|
||||
error_report.watch_stalls(root, reporter)
|
||||
tick = root.after.call_args.args[1]
|
||||
clock.t += 0.1
|
||||
tick() # on time: nothing
|
||||
clock.t += 2.5 # the loop was blocked 2.5 s
|
||||
tick()
|
||||
(entry,) = _lines(tmp_path)
|
||||
assert entry["operation"] == "tk.mainloop"
|
||||
assert entry["durationMs"] == 2500 - error_report.STALL_TICK_MS
|
||||
|
||||
|
||||
def test_stall_watch_stops_with_the_window(reporter: Reporter, clock: Clock) -> None:
|
||||
root = MagicMock()
|
||||
error_report.watch_stalls(root, reporter)
|
||||
tick = root.after.call_args.args[1]
|
||||
root.after.side_effect = tk.TclError("destroyed")
|
||||
tick() # must not raise
|
||||
assert root.after.call_count == 2
|
||||
|
||||
|
||||
def test_frame_paths(reporter: Reporter) -> None:
|
||||
assert (
|
||||
error_report._short("/x/lib/python3.15/site-packages/gatelock/a.py", "m/")
|
||||
== "gatelock/a.py"
|
||||
)
|
||||
assert error_report._short(
|
||||
"/home/u/src/leetcode-guard/leetcode_guard/ui.py", "leetcode_guard/"
|
||||
) == ("leetcode_guard/ui.py")
|
||||
assert error_report._short("/somewhere/else.py", "m/") == "else.py"
|
||||
|
||||
|
||||
def test_slow_never_raises(reporter: Reporter, tmp_path: Path) -> None:
|
||||
(tmp_path / "leetcode-guard.jsonl").mkdir()
|
||||
reporter.slow("op", 2000, wait_id="w")
|
||||
assert True
|
||||
|
||||
|
||||
def test_still_after_end_does_nothing(
|
||||
reporter: Reporter, tmp_path: Path, clock: Clock
|
||||
) -> None:
|
||||
wait = reporter.begin("op")
|
||||
wait.end()
|
||||
clock.t += 9
|
||||
wait._still()
|
||||
assert _lines(tmp_path) == []
|
||||
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "gatelock"
|
||||
version = "0.15.0"
|
||||
version = "0.14.0"
|
||||
description = "Shared per-output lock-window + HMAC log-integrity backend for blocking-overlay apps"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [] # pure stdlib — tkinter is bundled with Python
|
||||
|
||||
@ -153,10 +153,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: material_ui
|
||||
sha256: a6b19012df437a356cbc01f8ea22a105e07194c47c9a6009da0032a0ce35c4ab
|
||||
sha256: "474c135fd46b56ff1d35ca982155e8863d28fbc6464d1192acf4ee53a738680e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
version: "1.11.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -4,7 +4,7 @@ description: >-
|
||||
modal that drives it. Extracted from four apps that each carried a copy,
|
||||
two of them byte-identical.
|
||||
publish_to: 'none'
|
||||
version: 0.5.1
|
||||
version: 0.5.0
|
||||
|
||||
environment:
|
||||
sdk: ^3.13.0
|
||||
@ -13,7 +13,7 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
http: 1.6.0
|
||||
material_ui: 1.11.1
|
||||
material_ui: 1.11.0
|
||||
url_launcher: 6.3.3
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
@ -37,7 +37,7 @@ the tag (shallow), then link or copy `godot_dev_tools/addons/dev_tools` to
|
||||
`res://addons/dev_tools` and gitignore that path:
|
||||
|
||||
```bash
|
||||
git clone --depth 1 --branch godot-dev-tools-v0.2.0 https://github.com/kuhyx/utils "$cache"
|
||||
git clone --depth 1 --branch godot-dev-tools-v0.1.1 https://github.com/kuhyx/utils "$cache"
|
||||
ln -sfn "$cache/godot_dev_tools/addons/dev_tools" addons/dev_tools # CI: cp -a instead
|
||||
```
|
||||
|
||||
@ -56,28 +56,6 @@ if options.dev and ResourceLoader.exists(ADDON):
|
||||
Exclude `addons/dev_tools/*` from every export preset, and keep the host glue
|
||||
out of exports too.
|
||||
|
||||
## Error and slow-wait reporting (`addons/app_errors/`)
|
||||
|
||||
The Godot reporter of kuhy's shared app-errors pipeline (utils
|
||||
`DOCS-app-errors.md`), released under the same tag. Unlike dev_tools, mount it
|
||||
in **every** build and keep it in exports: player errors are the point.
|
||||
|
||||
```gdscript
|
||||
const ERRORS := "res://addons/app_errors/error_reporter.gd"
|
||||
|
||||
if ResourceLoader.exists(ERRORS):
|
||||
var rep: Node = (load(ERRORS) as GDScript).new()
|
||||
rep.setup("car-rental-sim", "kuhyx/car-rental-sim")
|
||||
add_child(rep)
|
||||
# rep.report_wait("level.load", msec), or begin_wait / end_wait
|
||||
```
|
||||
|
||||
Script errors and `push_error` arrive through an `OS.add_logger` logger. Any
|
||||
frame over 1 s becomes the wait `godot.frame`. Reports go to
|
||||
`~/.local/state/app-errors-spool/<app>.jsonl` on desktop Linux, and nothing is
|
||||
written on web. The `app-errors` ingest timer turns them into board tickets.
|
||||
Nothing shows on screen.
|
||||
|
||||
## The host interface
|
||||
|
||||
`setup(host)` takes ONE object of the game's own: any Object, no base class,
|
||||
|
||||
@ -1,202 +0,0 @@
|
||||
extends Node
|
||||
## Reports every error and every wait over 1 s of a Godot game to kuhy's shared
|
||||
## app-errors pipeline (utils DOCS-app-errors.md). Mount it like dev_tools, but
|
||||
## in every build, not only --dev runs: player errors are the point.
|
||||
##
|
||||
## var rep: Node = (load("res://addons/app_errors/error_reporter.gd") as GDScript).new()
|
||||
## rep.setup("car-rental-sim", "kuhyx/car-rental-sim")
|
||||
## add_child(rep)
|
||||
## rep.report_wait("level.load", msec) # or begin_wait / end_wait
|
||||
##
|
||||
## Script errors and push_error arrive through an OS logger; a frame over 1 s is
|
||||
## reported as the wait `godot.frame`. Each report is one JSON line in
|
||||
## $XDG_STATE_HOME/app-errors-spool/<app>.jsonl, which the PC's app-errors
|
||||
## ingest turns into a board ticket. Desktop only (a web build has no spool),
|
||||
## shows nothing on screen, and never reports from inside a report. Identical
|
||||
## errors within WINDOW_SEC are dropped; at most MAX_PER_MINUTE are written.
|
||||
## No class_name (the addon stays out of the global class cache).
|
||||
|
||||
const ReporterLogger = preload("res://addons/app_errors/reporter_logger.gd")
|
||||
const SLOW_KIND := "perf.slow"
|
||||
const MARK := "res://"
|
||||
const WINDOW_SEC := 30.0
|
||||
const MAX_PER_MINUTE := 20
|
||||
const MAX_SLOW_PER_MINUTE := 30
|
||||
const THRESHOLD_MS := 1000
|
||||
const KINDS := {
|
||||
Logger.ERROR_TYPE_ERROR: "godot.error",
|
||||
Logger.ERROR_TYPE_SCRIPT: "uncaught.gdscript",
|
||||
Logger.ERROR_TYPE_SHADER: "godot.shader",
|
||||
}
|
||||
|
||||
## Seconds since the epoch (tests replace it).
|
||||
var clock: Callable = Time.get_unix_time_from_system
|
||||
## Folder of the spool; empty writes nothing (a web build).
|
||||
var spool_dir := default_spool_dir()
|
||||
var logger: Logger
|
||||
|
||||
var _app := ""
|
||||
var _repo := ""
|
||||
var _build := 0
|
||||
var _version := ""
|
||||
var _mutex := Mutex.new()
|
||||
var _busy := false
|
||||
var _seen := {}
|
||||
var _minutes := {}
|
||||
var _serial := 0
|
||||
var _frames := 0
|
||||
|
||||
|
||||
## The spool folder: $XDG_STATE_HOME (else ~/.local/state)/app-errors-spool;
|
||||
## empty off desktop Linux.
|
||||
static func default_spool_dir() -> String:
|
||||
if not OS.has_feature("linuxbsd"):
|
||||
return ""
|
||||
var base := OS.get_environment("XDG_STATE_HOME")
|
||||
if base == "":
|
||||
base = OS.get_environment("HOME").path_join(".local/state")
|
||||
return base.path_join("app-errors-spool")
|
||||
|
||||
|
||||
## Names the game: `app` as the board shows it, `repo` as owner/name, and the
|
||||
## build number when the game knows one.
|
||||
func setup(app: String, repo: String, build := 0, version := "") -> void:
|
||||
_app = app
|
||||
_repo = repo
|
||||
_build = build
|
||||
_version = version
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
logger = ReporterLogger.new(_on_error)
|
||||
OS.add_logger(logger)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
OS.remove_logger(logger)
|
||||
logger = null
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_check_frame(delta)
|
||||
|
||||
|
||||
## A frame that took over a second is a wait the player saw (the first frame
|
||||
## is the boot, before the window shows anything).
|
||||
func _check_frame(delta: float) -> void:
|
||||
_frames += 1
|
||||
if _frames > 1 and delta * 1000.0 > THRESHOLD_MS:
|
||||
_slow("godot.frame", roundi(delta * 1000.0), "frame-%d" % _frames)
|
||||
|
||||
|
||||
## Reports a finished wait of `msec` on `operation` when it took over 1 s.
|
||||
func report_wait(operation: String, msec: int) -> void:
|
||||
if msec > THRESHOLD_MS:
|
||||
_serial += 1
|
||||
_slow(operation, msec, "%s-%d" % [operation, _serial])
|
||||
|
||||
|
||||
## Starts timing a wait on `operation`; pass the result to end_wait.
|
||||
func begin_wait(operation: String) -> Dictionary:
|
||||
return {"operation": operation, "started": clock.call(), "ended": false}
|
||||
|
||||
|
||||
## Ends a wait from begin_wait; repeat calls do nothing.
|
||||
func end_wait(wait: Dictionary) -> void:
|
||||
if wait.ended:
|
||||
return
|
||||
wait.ended = true
|
||||
report_wait(wait.operation, roundi((clock.call() - wait.started) * 1000.0))
|
||||
|
||||
|
||||
func _on_error(
|
||||
function: String,
|
||||
file: String,
|
||||
line: int,
|
||||
code: String,
|
||||
rationale: String,
|
||||
error_type: int,
|
||||
backtraces: Array[ScriptBacktrace]
|
||||
) -> void:
|
||||
if not KINDS.has(error_type):
|
||||
return
|
||||
var stack: Array[String] = []
|
||||
for bt in backtraces:
|
||||
for i in bt.get_frame_count():
|
||||
stack.append(
|
||||
(
|
||||
"%s:%d in %s"
|
||||
% [bt.get_frame_file(i), bt.get_frame_line(i), bt.get_frame_function(i)]
|
||||
)
|
||||
)
|
||||
if stack.is_empty() and file.begins_with(MARK):
|
||||
stack.append("%s:%d in %s" % [file, line, function])
|
||||
var message := rationale if rationale != "" else code
|
||||
_report(KINDS[error_type], message, stack)
|
||||
|
||||
|
||||
func _report(kind: String, message: String, stack: Array[String]) -> void:
|
||||
_mutex.lock()
|
||||
if _busy:
|
||||
_mutex.unlock()
|
||||
return
|
||||
_busy = true
|
||||
var now: float = clock.call()
|
||||
var key := "%s|%s" % [kind, message]
|
||||
for seen_key in _seen.keys():
|
||||
if now - _seen[seen_key] >= WINDOW_SEC:
|
||||
_seen.erase(seen_key)
|
||||
if not _seen.has(key) and _allowed("error", MAX_PER_MINUTE, now):
|
||||
_seen[key] = now
|
||||
_write({"kind": kind, "error": message, "stack": stack}, now)
|
||||
_busy = false
|
||||
_mutex.unlock()
|
||||
|
||||
|
||||
func _slow(operation: String, msec: int, wait_id: String) -> void:
|
||||
_mutex.lock()
|
||||
var now: float = clock.call()
|
||||
if _allowed("slow", MAX_SLOW_PER_MINUTE, now):
|
||||
var entry := {
|
||||
"kind": SLOW_KIND,
|
||||
"error": "%s waited %d ms" % [operation, msec],
|
||||
"operation": operation,
|
||||
"durationMs": msec,
|
||||
"waitId": wait_id,
|
||||
"still": false,
|
||||
}
|
||||
_write(entry, now)
|
||||
_mutex.unlock()
|
||||
|
||||
|
||||
func _allowed(bucket: String, cap: int, now: float) -> bool:
|
||||
var minute: Array = _minutes.get(bucket, [now, 0])
|
||||
if now - minute[0] >= 60.0:
|
||||
minute = [now, 0]
|
||||
if minute[1] >= cap:
|
||||
return false
|
||||
_minutes[bucket] = [minute[0], minute[1] + 1]
|
||||
return true
|
||||
|
||||
|
||||
## Appends one entry; a missing spool folder is made, a failure drops it.
|
||||
func _write(entry: Dictionary, now: float) -> void:
|
||||
if spool_dir == "":
|
||||
return
|
||||
var ms := int(fmod(now, 1.0) * 1000.0)
|
||||
entry.at = "%s.%03dZ" % [Time.get_datetime_string_from_unix_time(int(now)), ms]
|
||||
entry.repo = _repo
|
||||
entry.mark = MARK
|
||||
entry.build = _build
|
||||
if _version != "":
|
||||
entry.version = _version
|
||||
DirAccess.make_dir_recursive_absolute(spool_dir)
|
||||
var path := spool_dir.path_join("%s.jsonl" % _app)
|
||||
var file := FileAccess.open(path, FileAccess.READ_WRITE)
|
||||
if file == null:
|
||||
file = FileAccess.open(path, FileAccess.WRITE)
|
||||
if file == null:
|
||||
return
|
||||
file.seek_end()
|
||||
file.store_line(JSON.stringify(entry, "", true))
|
||||
file.close()
|
||||
@ -1 +0,0 @@
|
||||
uid://8royr22sfg7a
|
||||
@ -1,27 +0,0 @@
|
||||
extends Logger
|
||||
## Forwards engine and script errors to the error reporter. The engine may call
|
||||
## a logger from any thread, so it only hands over; the reporter locks.
|
||||
## No class_name (the addon stays out of the global class cache).
|
||||
|
||||
var _sink: Callable
|
||||
|
||||
|
||||
func _init(sink: Callable) -> void:
|
||||
_sink = sink
|
||||
|
||||
|
||||
func _log_error(
|
||||
function: String,
|
||||
file: String,
|
||||
line: int,
|
||||
code: String,
|
||||
rationale: String,
|
||||
_editor_notify: bool,
|
||||
error_type: int,
|
||||
script_backtraces: Array[ScriptBacktrace]
|
||||
) -> void:
|
||||
_sink.call(function, file, line, code, rationale, error_type, script_backtraces)
|
||||
|
||||
|
||||
func _log_message(_message: String, _error: bool) -> void:
|
||||
pass
|
||||
@ -1 +0,0 @@
|
||||
uid://ck74fh55cpf8f
|
||||
@ -1,4 +1,4 @@
|
||||
; Release of the dev_tools addon. The git tag is godot-dev-tools-v<version>.
|
||||
[addon]
|
||||
|
||||
version = "0.2.0"
|
||||
version = "0.1.1"
|
||||
|
||||
@ -19,7 +19,7 @@ main() {
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
mapfile -t files < <(find "$HERE/addons/dev_tools" "$HERE/addons/app_errors" "$HERE/tests" -name '*.gd' -type f | sort)
|
||||
mapfile -t files < <(find "$HERE/addons/dev_tools" "$HERE/tests" -name '*.gd' -type f | sort)
|
||||
# One process per tool, not xargs -P: parallel gdtoolkit processes race to
|
||||
# create their grammar cache dir (os.makedirs EEXIST) on a cold cache and
|
||||
# report a file as unopenable.
|
||||
|
||||
@ -1,180 +0,0 @@
|
||||
extends GutTest
|
||||
## The app_errors addon: engine and script errors and slow waits become spool
|
||||
## lines in the shape utils app_errors ingests (app_errors/README.md "Entry").
|
||||
|
||||
const Reporter = preload("res://addons/app_errors/error_reporter.gd")
|
||||
const TmpDir = preload("res://tests/tmp_dir.gd")
|
||||
|
||||
var _dir := TmpDir.path("app_errors")
|
||||
var _rep: Node
|
||||
|
||||
|
||||
func before_each() -> void:
|
||||
_rep = Reporter.new()
|
||||
_rep.spool_dir = ProjectSettings.globalize_path(_dir)
|
||||
_rep.setup("car-rental-sim", "kuhyx/car-rental-sim", 12, "0.4.0")
|
||||
_rep.clock = func() -> float: return 1800000000.0
|
||||
add_child_autofree(_rep)
|
||||
|
||||
|
||||
func after_each() -> void:
|
||||
TmpDir.remove_tree(_dir)
|
||||
|
||||
|
||||
func _lines() -> Array:
|
||||
var path := _dir.path_join("car-rental-sim.jsonl")
|
||||
if not FileAccess.file_exists(path):
|
||||
return []
|
||||
var out := []
|
||||
for line in FileAccess.get_file_as_string(path).split("\n", false):
|
||||
out.append(JSON.parse_string(line))
|
||||
return out
|
||||
|
||||
|
||||
func _none() -> Array[ScriptBacktrace]:
|
||||
var out: Array[ScriptBacktrace] = []
|
||||
return out
|
||||
|
||||
|
||||
func _script_error(message: String) -> void:
|
||||
_rep.logger._log_error(
|
||||
"_ready", "res://scripts/car.gd", 77, message, "", false, Logger.ERROR_TYPE_SCRIPT, _none()
|
||||
)
|
||||
|
||||
|
||||
func test_script_error_is_one_entry() -> void:
|
||||
_script_error("Invalid access to property 'x'")
|
||||
var lines := _lines()
|
||||
assert_eq(lines.size(), 1)
|
||||
var entry: Dictionary = lines[0]
|
||||
assert_eq(entry.kind, "uncaught.gdscript")
|
||||
assert_eq(entry.error, "Invalid access to property 'x'")
|
||||
assert_eq(entry.repo, "kuhyx/car-rental-sim")
|
||||
assert_eq(entry.mark, "res://")
|
||||
assert_eq(int(entry.build), 12)
|
||||
assert_eq(entry.version, "0.4.0")
|
||||
assert_eq(entry.at, "2027-01-15T08:00:00.000Z")
|
||||
assert_eq(entry.stack, ["res://scripts/car.gd:77 in _ready"])
|
||||
|
||||
|
||||
func test_push_error_uses_the_script_backtrace() -> void:
|
||||
var bts := _none()
|
||||
bts.append(ScriptBacktrace.new())
|
||||
_rep.logger._log_error(
|
||||
"push_error",
|
||||
"core/variant/variant_utility.cpp",
|
||||
1023,
|
||||
"deliberate",
|
||||
"",
|
||||
false,
|
||||
Logger.ERROR_TYPE_ERROR,
|
||||
bts
|
||||
)
|
||||
var entry: Dictionary = _lines()[0]
|
||||
assert_eq(entry.kind, "godot.error")
|
||||
assert_eq(entry.error, "deliberate")
|
||||
assert_eq(entry.stack, [], "an empty backtrace and a C++ file give no frames")
|
||||
|
||||
|
||||
func test_rationale_wins_over_code() -> void:
|
||||
_rep.logger._log_error(
|
||||
"f",
|
||||
"res://a.gd",
|
||||
1,
|
||||
"p_index < 0",
|
||||
"Index out of range",
|
||||
false,
|
||||
Logger.ERROR_TYPE_ERROR,
|
||||
_none()
|
||||
)
|
||||
assert_eq(_lines()[0].error, "Index out of range")
|
||||
|
||||
|
||||
func test_warnings_are_ignored() -> void:
|
||||
_rep.logger._log_error("f", "res://a.gd", 1, "w", "", false, Logger.ERROR_TYPE_WARNING, _none())
|
||||
_rep.logger._log_message("hello", false)
|
||||
assert_eq(_lines(), [])
|
||||
|
||||
|
||||
func test_identical_errors_are_deduplicated() -> void:
|
||||
for i in 5:
|
||||
_script_error("same")
|
||||
assert_eq(_lines().size(), 1)
|
||||
|
||||
|
||||
func test_rate_cap_per_minute() -> void:
|
||||
for i in Reporter.MAX_PER_MINUTE + 4:
|
||||
_script_error("e%d" % i)
|
||||
assert_eq(_lines().size(), Reporter.MAX_PER_MINUTE)
|
||||
|
||||
|
||||
func test_report_wait_over_threshold() -> void:
|
||||
_rep.report_wait("level.load", 2000)
|
||||
_rep.report_wait("level.load", 400)
|
||||
var lines := _lines()
|
||||
assert_eq(lines.size(), 1, "a wait under 1 s writes nothing")
|
||||
var entry: Dictionary = lines[0]
|
||||
assert_eq(entry.kind, "perf.slow")
|
||||
assert_eq(entry.operation, "level.load")
|
||||
assert_eq(int(entry.durationMs), 2000)
|
||||
assert_eq(entry.error, "level.load waited 2000 ms")
|
||||
|
||||
|
||||
func test_begin_and_end_wait() -> void:
|
||||
var t := [1800000000.0]
|
||||
_rep.clock = func() -> float: return t[0]
|
||||
var wait: Dictionary = _rep.begin_wait("shop.open")
|
||||
t[0] += 1.5
|
||||
_rep.end_wait(wait)
|
||||
_rep.end_wait(wait)
|
||||
assert_eq(_lines().size(), 1)
|
||||
assert_eq(int(_lines()[0].durationMs), 1500)
|
||||
|
||||
|
||||
func test_long_frame_is_a_stall() -> void:
|
||||
_rep._check_frame(0.016)
|
||||
_rep._check_frame(2.5)
|
||||
var lines := _lines()
|
||||
assert_eq(lines.size(), 1)
|
||||
assert_eq(lines[0].operation, "godot.frame")
|
||||
assert_eq(int(lines[0].durationMs), 2500)
|
||||
|
||||
|
||||
func test_no_spool_dir_writes_nothing() -> void:
|
||||
_rep.spool_dir = ""
|
||||
_script_error("x")
|
||||
assert_eq(_lines(), [])
|
||||
|
||||
|
||||
func test_logger_is_removed_on_exit() -> void:
|
||||
var rep: Node = Reporter.new()
|
||||
rep.spool_dir = ProjectSettings.globalize_path(_dir)
|
||||
rep.setup("x", "kuhyx/x")
|
||||
add_child(rep)
|
||||
var logger: Logger = rep.logger
|
||||
assert_not_null(logger)
|
||||
remove_child(rep)
|
||||
assert_null(rep.logger)
|
||||
rep.free()
|
||||
|
||||
|
||||
func test_default_spool_dir_follows_xdg() -> void:
|
||||
var saved := OS.get_environment("XDG_STATE_HOME")
|
||||
OS.set_environment("XDG_STATE_HOME", "/tmp/xdg-state")
|
||||
assert_eq(Reporter.default_spool_dir(), "/tmp/xdg-state/app-errors-spool")
|
||||
OS.unset_environment("XDG_STATE_HOME")
|
||||
assert_eq(
|
||||
Reporter.default_spool_dir(),
|
||||
OS.get_environment("HOME").path_join(".local/state/app-errors-spool")
|
||||
)
|
||||
if saved != "":
|
||||
OS.set_environment("XDG_STATE_HOME", saved)
|
||||
|
||||
|
||||
func test_real_push_error_reaches_the_spool() -> void:
|
||||
push_error("deliberate test error")
|
||||
assert_push_error("deliberate test error")
|
||||
var errors := []
|
||||
for entry in _lines():
|
||||
errors.append(entry.error)
|
||||
assert_has(errors, "deliberate test error")
|
||||
@ -1 +0,0 @@
|
||||
uid://brlqp63lcn6c3
|
||||
@ -7,9 +7,7 @@
|
||||
# 1. every released library's tag for its current version is on origin
|
||||
# (sickdays, sync_settings_ui: the apps' pins resolve to the code on main);
|
||||
# 2. the sickdays CLI + launcher run the checkout's code, via
|
||||
# sickdays/install.sh (its venv installs sickdays editable from here);
|
||||
# 3. the app-errors ingest timer is active and runs this checkout's code,
|
||||
# via app_errors/install.sh.
|
||||
# sickdays/install.sh (its venv installs sickdays editable from here).
|
||||
#
|
||||
# Run it from the live checkout (~/src/utils), never from a worktree: install.sh
|
||||
# installs editable from its own directory, and a worktree path would point the
|
||||
@ -82,29 +80,12 @@ check_sickdays() {
|
||||
fi
|
||||
}
|
||||
|
||||
# The ingest timer must be active and its venv must import this checkout.
|
||||
check_app_errors() {
|
||||
local module
|
||||
if ! systemctl --user is-active --quiet app-errors-ingest.timer; then
|
||||
bad "app-errors-ingest.timer is not active"
|
||||
return
|
||||
fi
|
||||
module="$("$HOME/.local/share/app-errors/venv/bin/python" -I -c 'import app_errors; print(app_errors.__file__)' 2>/dev/null || true)"
|
||||
if [[ "$module" != "$UTILS_DIR/app_errors/"* ]]; then
|
||||
bad "the app-errors venv imports ${module:-nothing}, not $UTILS_DIR/app_errors"
|
||||
else
|
||||
log "ok: app-errors ingest runs $module"
|
||||
fi
|
||||
}
|
||||
|
||||
verify() {
|
||||
check_tag sickdays sickdays
|
||||
check_tag sync_settings_ui sync_settings_ui
|
||||
check_tag game-recording game_recording
|
||||
check_tag godot-dev-tools godot_dev_tools
|
||||
check_tag app-errors app_errors
|
||||
check_sickdays
|
||||
check_app_errors
|
||||
if [[ "$FAILED" -ne 0 ]]; then
|
||||
log "health check FAILED"
|
||||
exit 1
|
||||
@ -116,8 +97,6 @@ main() {
|
||||
if [[ "$VERIFY_ONLY" -eq 0 ]]; then
|
||||
log "installing sickdays from $UTILS_DIR/sickdays"
|
||||
"$UTILS_DIR/sickdays/install.sh"
|
||||
log "installing the app-errors ingest from $UTILS_DIR/app_errors"
|
||||
"$UTILS_DIR/app_errors/install.sh"
|
||||
fi
|
||||
verify
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ description: >-
|
||||
injected closures -- no keystore or platform plugin access lives in this
|
||||
package itself.
|
||||
publish_to: 'none'
|
||||
version: 0.8.3
|
||||
version: 0.8.2
|
||||
|
||||
environment:
|
||||
sdk: ^3.13.0
|
||||
@ -23,7 +23,7 @@ dependencies:
|
||||
path: data_transfer_flutter
|
||||
flutter:
|
||||
sdk: flutter
|
||||
material_ui: 1.11.1
|
||||
material_ui: 1.11.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@ -39,25 +39,25 @@
|
||||
"coverage": "vitest run --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint-react/eslint-plugin": "5.30.3",
|
||||
"@eslint-react/eslint-plugin": "5.30.2",
|
||||
"@eslint/js": "10.0.1",
|
||||
"@vitest/eslint-plugin": "1.6.28",
|
||||
"eslint-import-resolver-typescript": "4.4.5",
|
||||
"eslint-plugin-boundaries": "7.4.4",
|
||||
"eslint-plugin-boundaries": "7.4.3",
|
||||
"eslint-plugin-jsx-a11y": "6.10.2",
|
||||
"eslint-plugin-perfectionist": "5.14.0",
|
||||
"eslint-plugin-perfectionist": "5.13.0",
|
||||
"eslint-plugin-playwright": "2.12.2",
|
||||
"eslint-plugin-react-hooks": "7.1.1",
|
||||
"eslint-plugin-react-refresh": "0.5.8",
|
||||
"eslint-plugin-react-you-might-not-need-an-effect": "1.2.0",
|
||||
"eslint-plugin-sonarjs": "4.2.2",
|
||||
"eslint-plugin-unicorn": "80.0.0",
|
||||
"eslint-plugin-unicorn": "79.0.0",
|
||||
"globals": "17.14.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "10.15.0",
|
||||
"typescript": ">=6",
|
||||
"typescript-eslint": "8.73.0"
|
||||
"typescript-eslint": "8.72.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "1.65.1",
|
||||
@ -66,7 +66,7 @@
|
||||
"eslint": "10.15.0",
|
||||
"react": "19.3.1",
|
||||
"typescript": "6.0.3",
|
||||
"typescript-eslint": "8.73.0",
|
||||
"typescript-eslint": "8.72.2",
|
||||
"vitest": "5.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@
|
||||
"@vitest/coverage-v8": "5.1.0",
|
||||
"eslint": "10.15.0",
|
||||
"typescript": "6.0.3",
|
||||
"typescript-eslint": "8.73.0",
|
||||
"typescript-eslint": "8.72.2",
|
||||
"vitest": "5.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,8 +194,8 @@ importers:
|
||||
specifier: 6.0.3
|
||||
version: 6.0.3
|
||||
typescript-eslint:
|
||||
specifier: 8.73.0
|
||||
version: 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
specifier: 8.72.2
|
||||
version: 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
vitest:
|
||||
specifier: 5.1.0
|
||||
version: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(vite@8.2.1(@types/node@26.6.6))
|
||||
@ -424,67 +424,63 @@ packages:
|
||||
'@types/node@26.6.6':
|
||||
resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.73.0':
|
||||
resolution: {integrity: sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==}
|
||||
'@typescript-eslint/eslint-plugin@8.72.2':
|
||||
resolution: {integrity: sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': ^8.73.0
|
||||
'@typescript-eslint/parser': ^8.72.2
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/parser@8.73.0':
|
||||
resolution: {integrity: sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==}
|
||||
'@typescript-eslint/parser@8.72.2':
|
||||
resolution: {integrity: sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/project-service@8.73.0':
|
||||
resolution: {integrity: sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==}
|
||||
'@typescript-eslint/project-service@8.72.2':
|
||||
resolution: {integrity: sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/scope-manager@8.73.0':
|
||||
resolution: {integrity: sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==}
|
||||
'@typescript-eslint/scope-manager@8.72.2':
|
||||
resolution: {integrity: sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.73.0':
|
||||
resolution: {integrity: sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==}
|
||||
'@typescript-eslint/tsconfig-utils@8.72.2':
|
||||
resolution: {integrity: sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/type-utils@8.73.0':
|
||||
resolution: {integrity: sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==}
|
||||
'@typescript-eslint/type-utils@8.72.2':
|
||||
resolution: {integrity: sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/types@8.73.0':
|
||||
resolution: {integrity: sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==}
|
||||
'@typescript-eslint/types@8.72.2':
|
||||
resolution: {integrity: sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.73.0':
|
||||
resolution: {integrity: sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==}
|
||||
'@typescript-eslint/typescript-estree@8.72.2':
|
||||
resolution: {integrity: sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript/native': npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
peerDependenciesMeta:
|
||||
'@typescript/native':
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/utils@8.73.0':
|
||||
resolution: {integrity: sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==}
|
||||
'@typescript-eslint/utils@8.72.2':
|
||||
resolution: {integrity: sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.73.0':
|
||||
resolution: {integrity: sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==}
|
||||
'@typescript-eslint/visitor-keys@8.72.2':
|
||||
resolution: {integrity: sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@vitest/coverage-v8@5.1.0':
|
||||
@ -546,6 +542,10 @@ packages:
|
||||
resolution: {integrity: sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
brace-expansion@5.0.9:
|
||||
resolution: {integrity: sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
cacheable@2.5.0:
|
||||
resolution: {integrity: sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==}
|
||||
|
||||
@ -806,6 +806,10 @@ packages:
|
||||
magicast@0.5.5:
|
||||
resolution: {integrity: sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==}
|
||||
|
||||
minimatch@10.2.6:
|
||||
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
minimatch@11.0.8:
|
||||
resolution: {integrity: sha512-nFQuYSTVrGvysVBps5Ih+0BdnYFN/Cj3C816r6+p7yK+FHrVLGE4O4N9AFwykrlNlvM2HYt+Rad1Uiro6h88Ig==}
|
||||
engines: {node: 20 || >=22}
|
||||
@ -923,8 +927,8 @@ packages:
|
||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
typescript-eslint@8.73.0:
|
||||
resolution: {integrity: sha512-+EnKy9rkYPun4l+kG2bDuYWQ6y1tGVgdR/tY1U9AC6h21CjEwOoc7gsjwe0FXB8uWFzk4QiCFbuRWgX758PiAg==}
|
||||
typescript-eslint@8.72.2:
|
||||
resolution: {integrity: sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
@ -1204,77 +1208,74 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 8.9.0
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.73.0(@typescript-eslint/parser@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/eslint-plugin@8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.12.2
|
||||
'@typescript-eslint/parser': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/type-utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/parser': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.72.2
|
||||
'@typescript-eslint/type-utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
ignore: 7.0.6
|
||||
natural-compare: 1.4.0
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/parser@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/parser@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/scope-manager': 8.72.2
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/project-service@8.73.0(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/project-service@8.72.2(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.73.0(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.73.0':
|
||||
'@typescript-eslint/scope-manager@8.72.2':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.73.0(typescript@6.0.3)':
|
||||
'@typescript-eslint/tsconfig-utils@8.72.2(typescript@6.0.3)':
|
||||
dependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@typescript-eslint/type-utils@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/type-utils@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/types@8.73.0': {}
|
||||
'@typescript-eslint/types@8.72.2': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.73.0(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/typescript-estree@8.72.2(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/project-service': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.73.0(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/project-service': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
minimatch: 11.0.8
|
||||
minimatch: 10.2.6
|
||||
semver: 7.8.5
|
||||
tinyglobby: 0.2.17
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
@ -1282,21 +1283,20 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/utils@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.10.1(eslint@10.15.0(supports-color@7.2.0))
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.72.2
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.73.0':
|
||||
'@typescript-eslint/visitor-keys@8.72.2':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
'@vitest/coverage-v8@5.1.0(vitest@5.1.0)':
|
||||
@ -1355,6 +1355,10 @@ snapshots:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
brace-expansion@5.0.9:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
cacheable@2.5.0:
|
||||
dependencies:
|
||||
'@cacheable/memory': 2.2.0
|
||||
@ -1592,6 +1596,10 @@ snapshots:
|
||||
'@babel/types': 7.29.8
|
||||
source-map-js: 1.2.1
|
||||
|
||||
minimatch@10.2.6:
|
||||
dependencies:
|
||||
brace-expansion: 5.0.9
|
||||
|
||||
minimatch@11.0.8:
|
||||
dependencies:
|
||||
'@isaacs/nonrecursive-glob-match': 1.1.0
|
||||
@ -1700,16 +1708,15 @@ snapshots:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
|
||||
typescript-eslint@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3):
|
||||
typescript-eslint@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 8.73.0(@typescript-eslint/parser@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/parser': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/eslint-plugin': 8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/parser': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
typescript@6.0.3: {}
|
||||
|
||||
@ -42,14 +42,14 @@
|
||||
"@kuhyx/ts-config": "link:../ts_config",
|
||||
"@testing-library/dom": "10.4.2",
|
||||
"@testing-library/jest-dom": "7.0.1",
|
||||
"@testing-library/user-event": "14.6.12",
|
||||
"@testing-library/user-event": "14.6.10",
|
||||
"@types/node": "26.6.6",
|
||||
"@vitest/coverage-v8": "5.1.0",
|
||||
"astro": "7.4.12",
|
||||
"eslint": "10.15.0",
|
||||
"jsdom": "31.0.1",
|
||||
"typescript": "6.0.3",
|
||||
"typescript-eslint": "8.73.0",
|
||||
"typescript-eslint": "8.72.2",
|
||||
"vitest": "5.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,8 +194,8 @@ importers:
|
||||
specifier: 7.0.1
|
||||
version: 7.0.1(@testing-library/dom@10.4.2)(vitest@5.1.0)
|
||||
'@testing-library/user-event':
|
||||
specifier: 14.6.12
|
||||
version: 14.6.12(@testing-library/dom@10.4.2)
|
||||
specifier: 14.6.10
|
||||
version: 14.6.10(@testing-library/dom@10.4.2)
|
||||
'@types/node':
|
||||
specifier: 26.6.6
|
||||
version: 26.6.6
|
||||
@ -215,8 +215,8 @@ importers:
|
||||
specifier: 6.0.3
|
||||
version: 6.0.3
|
||||
typescript-eslint:
|
||||
specifier: 8.73.0
|
||||
version: 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
specifier: 8.72.2
|
||||
version: 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
vitest:
|
||||
specifier: 5.1.0
|
||||
version: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(jsdom@31.0.1)(vite@8.3.8(@types/node@26.6.6)(yaml@2.9.1))
|
||||
@ -1022,8 +1022,8 @@ packages:
|
||||
vitest:
|
||||
optional: true
|
||||
|
||||
'@testing-library/user-event@14.6.12':
|
||||
resolution: {integrity: sha512-8yQV8v+eToBhsUO4oYrZY7fzhpTEMZx4IDx0/iuER/x0Xuy0NdqQOhsaaUNlvXE03N7vQ+4RCXUieKC0NJty9w==}
|
||||
'@testing-library/user-event@14.6.10':
|
||||
resolution: {integrity: sha512-tA4stGNp3mLGOGO+lh87UA56Tz4c8NVGBSkyIF58O+W/bs2Re9BCI9xihnL70+DsThncFznE0skS88SM1D2hyg==}
|
||||
engines: {node: '>=12', npm: '>=6'}
|
||||
peerDependencies:
|
||||
'@testing-library/dom': '>=7.21.4'
|
||||
@ -1067,67 +1067,63 @@ packages:
|
||||
'@types/unist@3.0.3':
|
||||
resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.73.0':
|
||||
resolution: {integrity: sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==}
|
||||
'@typescript-eslint/eslint-plugin@8.72.2':
|
||||
resolution: {integrity: sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': ^8.73.0
|
||||
'@typescript-eslint/parser': ^8.72.2
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/parser@8.73.0':
|
||||
resolution: {integrity: sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==}
|
||||
'@typescript-eslint/parser@8.72.2':
|
||||
resolution: {integrity: sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/project-service@8.73.0':
|
||||
resolution: {integrity: sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==}
|
||||
'@typescript-eslint/project-service@8.72.2':
|
||||
resolution: {integrity: sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/scope-manager@8.73.0':
|
||||
resolution: {integrity: sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==}
|
||||
'@typescript-eslint/scope-manager@8.72.2':
|
||||
resolution: {integrity: sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.73.0':
|
||||
resolution: {integrity: sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==}
|
||||
'@typescript-eslint/tsconfig-utils@8.72.2':
|
||||
resolution: {integrity: sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/type-utils@8.73.0':
|
||||
resolution: {integrity: sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==}
|
||||
'@typescript-eslint/type-utils@8.72.2':
|
||||
resolution: {integrity: sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/types@8.73.0':
|
||||
resolution: {integrity: sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==}
|
||||
'@typescript-eslint/types@8.72.2':
|
||||
resolution: {integrity: sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.73.0':
|
||||
resolution: {integrity: sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==}
|
||||
'@typescript-eslint/typescript-estree@8.72.2':
|
||||
resolution: {integrity: sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript/native': npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
peerDependenciesMeta:
|
||||
'@typescript/native':
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/utils@8.73.0':
|
||||
resolution: {integrity: sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==}
|
||||
'@typescript-eslint/utils@8.72.2':
|
||||
resolution: {integrity: sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.73.0':
|
||||
resolution: {integrity: sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==}
|
||||
'@typescript-eslint/visitor-keys@8.72.2':
|
||||
resolution: {integrity: sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@ungap/structured-clone@1.4.0':
|
||||
@ -1306,6 +1302,10 @@ packages:
|
||||
resolution: {integrity: sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
brace-expansion@5.0.9:
|
||||
resolution: {integrity: sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
cacheable@2.5.0:
|
||||
resolution: {integrity: sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==}
|
||||
|
||||
@ -1864,6 +1864,10 @@ packages:
|
||||
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
minimatch@10.2.6:
|
||||
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
minimatch@11.0.8:
|
||||
resolution: {integrity: sha512-nFQuYSTVrGvysVBps5Ih+0BdnYFN/Cj3C816r6+p7yK+FHrVLGE4O4N9AFwykrlNlvM2HYt+Rad1Uiro6h88Ig==}
|
||||
engines: {node: 20 || >=22}
|
||||
@ -2210,8 +2214,8 @@ packages:
|
||||
typescript-auto-import-cache@0.3.6:
|
||||
resolution: {integrity: sha512-RpuHXrknHdVdK7wv/8ug3Fr0WNsNi5l5aB8MYYuXhq2UH5lnEB1htJ1smhtD5VeCsGr2p8mUDtd83LCQDFVgjQ==}
|
||||
|
||||
typescript-eslint@8.73.0:
|
||||
resolution: {integrity: sha512-+EnKy9rkYPun4l+kG2bDuYWQ6y1tGVgdR/tY1U9AC6h21CjEwOoc7gsjwe0FXB8uWFzk4QiCFbuRWgX758PiAg==}
|
||||
typescript-eslint@8.72.2:
|
||||
resolution: {integrity: sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
@ -3295,7 +3299,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
vitest: 5.1.0(@types/node@26.6.6)(@vitest/coverage-v8@5.1.0)(jsdom@31.0.1)(vite@8.3.8(@types/node@26.6.6)(yaml@2.9.1))
|
||||
|
||||
'@testing-library/user-event@14.6.12(@testing-library/dom@10.4.2)':
|
||||
'@testing-library/user-event@14.6.10(@testing-library/dom@10.4.2)':
|
||||
dependencies:
|
||||
'@testing-library/dom': 10.4.2
|
||||
|
||||
@ -3340,77 +3344,74 @@ snapshots:
|
||||
|
||||
'@types/unist@3.0.3': {}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.73.0(@typescript-eslint/parser@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/eslint-plugin@8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.12.2
|
||||
'@typescript-eslint/parser': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/type-utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/parser': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.72.2
|
||||
'@typescript-eslint/type-utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
ignore: 7.0.6
|
||||
natural-compare: 1.4.0
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/parser@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/parser@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/scope-manager': 8.72.2
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/project-service@8.73.0(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/project-service@8.72.2(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.73.0(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.73.0':
|
||||
'@typescript-eslint/scope-manager@8.72.2':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.73.0(typescript@6.0.3)':
|
||||
'@typescript-eslint/tsconfig-utils@8.72.2(typescript@6.0.3)':
|
||||
dependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@typescript-eslint/type-utils@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/type-utils@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/types@8.73.0': {}
|
||||
'@typescript-eslint/types@8.72.2': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.73.0(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/typescript-estree@8.72.2(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/project-service': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.73.0(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
'@typescript-eslint/project-service': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/visitor-keys': 8.72.2
|
||||
debug: 4.4.3(supports-color@7.2.0)
|
||||
minimatch: 11.0.8
|
||||
minimatch: 10.2.6
|
||||
semver: 7.8.5
|
||||
tinyglobby: 0.2.17
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
@ -3418,21 +3419,20 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
'@typescript-eslint/utils@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.10.1(eslint@10.15.0(supports-color@7.2.0))
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.72.2
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.73.0':
|
||||
'@typescript-eslint/visitor-keys@8.72.2':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/types': 8.72.2
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
'@ungap/structured-clone@1.4.0': {}
|
||||
@ -3691,6 +3691,10 @@ snapshots:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
brace-expansion@5.0.9:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
cacheable@2.5.0:
|
||||
dependencies:
|
||||
'@cacheable/memory': 2.2.0
|
||||
@ -4223,6 +4227,10 @@ snapshots:
|
||||
|
||||
min-indent@1.0.1: {}
|
||||
|
||||
minimatch@10.2.6:
|
||||
dependencies:
|
||||
brace-expansion: 5.0.9
|
||||
|
||||
minimatch@11.0.8:
|
||||
dependencies:
|
||||
'@isaacs/nonrecursive-glob-match': 1.1.0
|
||||
@ -4603,16 +4611,15 @@ snapshots:
|
||||
dependencies:
|
||||
semver: 7.8.5
|
||||
|
||||
typescript-eslint@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3):
|
||||
typescript-eslint@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 8.73.0(@typescript-eslint/parser@8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/parser': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/eslint-plugin': 8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/parser': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/typescript-estree': 8.72.2(supports-color@7.2.0)(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.72.2(eslint@10.15.0(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)
|
||||
eslint: 10.15.0(supports-color@7.2.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
typescript@6.0.3: {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user