fix: register explorer dependency routes#6733
Conversation
|
CI note: the broad git diff --check
uv run --no-project --with pytest --with flask --with requests --with cryptography --with pynacl --with psutil python -m pytest node/tests/test_ergo_anchor_routes.py node/tests/test_explorer_api_routes.py tests/test_agent_jobs_query_validation.py -qResult: Manual route probe on the integrated app after the patch:
|
Asti1982
left a comment
There was a problem hiding this comment.
Reviewed the route-registration fix for #6693. The main happy path looks reasonable: the Agent Economy routes are registered on the integrated app, /anchors gives the explorer a stable navigation target, and /anchor/list now handles an empty anchor DB instead of 404/failing.
One non-blocking test gap below: the fallback branch is part of the behavior this PR is relying on for deployments where the optional anchor module cannot import, but the current integrated-app test does not force that branch. Adding a small import-failure/monkeypatch test would make this safer to merge.
Routing this as a substantive line-level review for rustchain-bounties #73; no RTC has been received for this review yet.
| print(f"[ANCHOR] Failed to register Ergo anchor endpoints: {e}") | ||
|
|
||
|
|
||
| if not _ANCHOR_ROUTES_REGISTERED: |
There was a problem hiding this comment.
This fallback branch is now part of the explorer's availability guarantee, but the added integrated-app test only exercises it if rustchain_ergo_anchor happens not to import in the test environment. Since the module normally imports, the fallback query parsing/table-creation path can regress without failing CI. Consider adding a focused test that forces the optional anchor import/registration to fail and then asserts /anchor/list still returns 200 with the empty payload plus the expected 400 responses for invalid limit/offset.
| try: | ||
| conn.row_factory = sqlite3.Row | ||
| cursor = conn.cursor() | ||
| _ensure_anchor_table(cursor) |
There was a problem hiding this comment.
Good extraction here: using _ensure_anchor_table(cursor) before the list query keeps /anchor/list aligned with get_last_anchor() on empty deployments. That matters for the explorer fix because a fresh DB should render an empty anchor list instead of surfacing a route-level error to first-time users.
BCOS Checklist (Required For Non-Doc PRs)
Summary
/agent/statsand/agent/jobsno longer 404 for the explorer dashboard./anchor/listfallback plus/anchorsredirect so navigation does not land on 404.ergo_anchorstable on empty DBs and returns an empty list instead of failing.Fixes the application-route 404s reported in #6693. The raw-IP certificate mismatch is deployment/certificate configuration, not something this repo patch can correct by itself.
RTC wallet for any merged-PR reward:
RTC1410e82d545ce0b3ffd21ca83e2465a8f2c3a64eTesting
Result:
34 passed in 0.24s.Manual route probe after the fix: