Build direct-onchain admin dashboard - #37
Conversation
|
@codex review @copilot review @coderabbitai review |
There was a problem hiding this comment.
Pull request overview
This PR updates the Calibration Worker to serve a public, read-only “FOC Platform Admin” dashboard as the default HTML surface, backed by direct FocPlatformRegistry count/list/detail reads and new /api/admin/* endpoints, while preserving the existing evidence endpoints and clarifying the demo’s source-of-truth boundaries in docs.
Changes:
- Switch the Worker’s primary HTML route (
/,/demo,/admin) to the admin dashboard UI and add dashboard JSON endpoints under/api/admin/*. - Add Node tests that exercise the new dashboard endpoints via an injected adapter/fixture model.
- Update docs/README to describe the new dashboard routes, pagination model, and the “pre-pagination ABI” caveat for the currently deployed Calibration registry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/calibration-worker.test.mjs | Adds dashboard route/API tests and a fixture adapter to validate injected direct-read pages. |
| src/worker/calibration-demo.mjs | Implements /api/admin/* routes and replaces the demo HTML with the admin dashboard UI + client-side fetch/paging. |
| src/registry/read-model.mjs | Switches registry artifact loading to an ESM JSON import for runtime/bundle compatibility. |
| README.md | Documents the dashboard-first Worker behavior and the new admin API endpoints. |
| docs/calibration-worker-demo.md | Updates demo docs with dashboard endpoints, pagination semantics, and evidence caveats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review @copilot review @coderabbitai review |
Code Review Overall the dashboard implementation is clean and well-structured. One bug was identified and already fixed in commit Bug fixed — - rows.filter((row) => !coordinator || row.coordinator === coordinator),
+ rows.filter((row) => !coordinator || String(row.coordinator ?? "").toLowerCase() === coordinator),A test covering the case-insensitive coordinator filter was added alongside the fix. Other observations (no changes needed):
|
|
To use Codex here, create a Codex account and connect to github. |
Code Review — current HEAD ( CI passes and all 13
No new issues identified. The implementation is clean:
|
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 222e303791
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review @copilot review @coderabbitai review |
Code Review — current HEAD ( CI passes and all 13 New in
The client-side No issues identified. |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce5beaff72
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review @copilot review @coderabbitai review |
Code Review — current HEAD ( CI passes and all 13 New in
All section titles ( The empty-state guard ( No issues identified. |
|
To use Codex here, create a Codex account and connect to github. |
|
Code Review — current HEAD ( All 13 New in
The regression test passes a bare-hex env value ( No issues identified. |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da4ac1cff8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Code Review — current HEAD ( All 13 New in Stale response suppression: Warnings unavailable guard: The previous check ( Both the No issues identified. |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee6d632a28
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Code Review — current HEAD ( All 13 New in
The fix is correctly applied at the The regression test sends No issues identified. Implementation is ready for merge. |
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cb17e96ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Code Review — current HEAD ( All 13 New in
Previously, changing
The regression test asserts both No issues identified. Implementation is ready for merge. |
|
To use Codex here, create a Codex account and connect to github. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Linked Issues
Closes #32.
Refs #27, #29, #30, #31, #33, #5.
Dependency Position
This is D3 in the direct-onchain dashboard stack:
#29, #30, and #31 are merged on
main. #33 remains responsible for publishing updated Calibration/demo evidence against a registry that supports the new pagination ABI.Start-Phase UI/Data Contract
The Worker dashboard is public/read-only and treats
FocPlatformRegistrydirect views as the current-state source when the configured registry runtime hash matches the current pagination-capable artifact hash:/api/admin/overview: bounded count reads for objects, accounts, datasets, coordinators, and relayers./api/admin/files: cursor-paginated object list/detail reads./api/admin/accounts: offset-paginated account usage reads./api/admin/datasets: offset-paginated dataset record reads./api/admin/coordinators: offset-paginated coordinator/relayer reads./api/admin/reconciliation: cursor-paginated, page-scoped object reconciliation checks. Account-usage, dataset-record, and coordinator-policy check families are declared as omitted instead of scanning the whole registry from one Worker request.The first screen at
/,/demo, and/adminis now the FOC Platform admin console rather than a static evidence page. Existing evidence endpoints remain available. For the committed pre-pagination Calibration registry, dashboard APIs default to skipped read-only payloads instead of live-reading missing count/list methods;?live=trueremains available for an upgraded registry. Skipped dashboard responses render as an unavailable state instead of an empty table.Data Source Mapping
objectCount,accountCount,datasetRecordCount,coordinatorCount, andrelayerCount.listObjects,getStorageObject,getCopyReceipts, andreceiptPayer.listAccountIds,listAccountObjects, andgetAccountUsage.listDatasetKeysandgetDatasetRecord.listCoordinators,coordinatorPolicies,listRelayers, andisRelayer.The file table intentionally exposes raw object/copy receipt fields only. Reconciliation-derived warnings stay in
/api/admin/reconciliationso page-local file reads do not claim false dependency errors from partial data.The coordinator dashboard renders coordinator policies and relayer rows as separate sections, so relayer-only pages do not collapse into the generic empty state. The coordinator tab pager combines coordinator and relayer pagination so relayer-only next pages remain reachable.
Current Test Evidence
Post-filter-pagination local validation on
96e1dc1:node --test test/calibration-worker.test.mjs-> 13 tests passed.pnpm lint-> workspace scaffold checks passed.git diff --check-> clean.pnpm test-> 118 Node tests and 29 Foundry tests passed.pnpm ops:validate-> secret scan findings: 0.pnpm ops:smoke -- --iterations 3-> 3 mocked API/coordinator iterations passed.pnpm worker:dry-run-> Wrangler 4.106.0, upload 834.13 KiB / gzip 167.30 KiB.Earlier local evidence on this PR also included
pnpm build:artifacts, clean artifact diff checks, direct regression coverage for mixed-case coordinator filtering, relayer global search filtering, shared-filter pagination reset, default skipped dashboard read gate, bare-hex runtime hash matching, relayer-only rendering, relayer pagination, page-scoped reconciliation, skipped warning metrics rendering asn/a, and stale dashboard response suppression.Screenshot / Browser Verification
Fresh local Worker checks after the relayer pagination fix:
pnpm worker:dev -- --port 8795served athttp://localhost:8787./api/admin/coordinatorswith empty coordinator pagination and relayerhasNextPage: true; verified the Next button was enabled, advanced tooffset=20, and rendered the second relayer./tmp/foc-platform-admin-issue32-relayer-pagination.png.Fresh local Worker checks after the relayer render fix:
pnpm worker:dev -- --port 8794served athttp://localhost:8787./api/admin/coordinatorspayload and verified the coordinator tab renders aRelayerssection plus0x0000000000000000000000000000000000004000, without theNo rows on this pageempty state./tmp/foc-platform-admin-issue32-relayer-only.png.Earlier local Worker checks after the default-live gate:
pnpm worker:dev -- --port 8793served athttp://localhost:8787./tmp/foc-platform-admin-issue32-default-gated-desktop.png./tmp/foc-platform-admin-issue32-default-gated-mobile.png./: title and H1 areFOC Platform Admin, 5 nav buttons, body-level horizontal overflow0on desktop and mobile./api/admin/overviewreturnedsource: "skipped",dashboardLiveDefault: false, expected runtime hash0x2c49443e7a9ebf3337453240e706df249d29f4f217ec948d6c10e9502a199d1f, and current configured registry runtime hash0xed478a27e255a1b27989ffa4f2fcbf38f1a9ec61a84c8d3e20aceb4e26f72040.Pre-gate screenshots from the direct dashboard fixture path remain available at
/tmp/foc-platform-admin-issue32-rebased-*.png.Worker / Wrangler Evidence
The dashboard dry-run bundles through Wrangler and exposes only public read env vars from the existing demo configuration. The current deployed demo registry predates the pagination ABI; live public evidence for the new direct-list dashboard is intentionally deferred to #33. The dashboard now avoids opening the deployed pre-pagination config in a live-read error state and renders skipped responses explicitly as unavailable.
Secret-Surface Assessment
pnpm ops:validatereportedsecretScan.findings: 0across tracked files.GETonly and read-only.?live=trueis explicit and should be used only with an upgraded pagination-capable registry.AI Review Status
Copilot reviewed
c92d9adand raised two issues; both were fixed in222e303:buildAdminSurfacesimport;Codex reviewed
222e303and raised a P2 default-live-read issue for the committed pre-pagination registry. Fixed ince5beafby gating default dashboard live reads on runtime hash match and documenting the #33 boundary.Codex reviewed
ce5beafand raised a P2 relayer-only rendering issue. Fixed in4588fcfby rendering coordinator policies and relayers as separate dashboard sections.Codex reviewed
4588fcfand raised a P2 relayer-pagination issue. Fixed in9d0d677by combining coordinator and relayer pagination for the coordinator tab pager.Codex reviewed
9d0d677and raised a P2 reconciliation fanout issue. Fixed ince1221fby making/api/admin/reconciliationpage-scoped and cursor-paginated; the thread was replied to and resolved.Codex reviewed
ce1221fand raised a P2 skipped-response rendering issue. Fixed inc8e6838by renderingsource: "skipped"dashboard payloads as unavailable before table rendering; the thread was replied to and resolved.Codex reviewed
c8e6838and raised a P2 runtime-hash normalization issue. Fixed inda4ac1cby stripping an optional0xprefix before comparing runtime hashes; the thread was replied to and resolved.Codex reviewed
da4ac1cand raised two P2 dashboard state issues. Fixed inee6d632by rendering skipped warning/mismatch counts as unavailable and by discarding stale dashboard fetch responses after view/filter changes; both threads were replied to and resolved.Codex reviewed
ee6d632and raised a P3 relayer-search issue. Fixed in8cb17e9by filtering relayer rows through the same globalqpath as coordinator rows; the thread was replied to and resolved.Codex reviewed
8cb17e9and raised a P2 shared-filter pagination reset issue. Fixed in96e1dc1by resetting every view cursor/offset when shared filters change; the thread was replied to and resolved. Copilot reviewed96e1dc1cleanly, Codex reported no major issues on96e1dc1, latest-head CI passed, and all review threads are resolved.