Skip to content

feat(telemetry): ISO-8601 last_successful_submission on /api/v1/status - #32

Closed
erkancamli wants to merge 1 commit into
QuipNetwork:mainfrom
erkancamli:feat/status-last-submission-iso
Closed

erkancamli wants to merge 1 commit into
QuipNetwork:mainfrom
erkancamli:feat/status-last-submission-iso

Conversation

@erkancamli

Copy link
Copy Markdown

Closes #27

What

/api/v1/status now reports last_successful_submission as an ISO-8601 UTC timestamp (null before the first accepted submission), as requested in #27, and the field is documented.

The underlying tracking already existed: ValidatorPool stamps last_successful_submission = time.time() on every accepted submit and the controller snapshot carries it through. The endpoint just surfaced the raw float, and none of the liveness fields were in docs/rest-api.md.

Changes

  • substrate/telemetry_process.py
    • new _epoch_to_iso() helper: epoch seconds → datetime.fromtimestamp(ts, tz=timezone.utc).isoformat(); None, non-numeric, NaN or out-of-range values map to null so a corrupt snapshot value never breaks the whole status response.
    • last_successful_submission is now the ISO string.
    • the raw value is kept alongside as last_successful_submission_epoch for consumers that compute staleness arithmetically (I checked dashboard.quip.network, nodes.quip.network and check.quip.network; none of them read the field yet, so this is the moment to switch the format without breaking anyone).
  • docs/rest-api.md: documents is_mining, last_successful_submission, last_successful_submission_epoch, consecutive_submit_failures and runtime_incompatible with an example payload, so operators know how to read a "mining but not landing" node.
  • tests/test_telemetry_process.py
    • test_epoch_to_iso_renders_utc_or_none: helper edge cases.
    • test_telemetry_status_reports_last_successful_submission_as_iso: spins up the telemetry process against a snapshot file and checks ISO + epoch, then rewrites the snapshot without the field and checks both are null.

Example

{
  "is_mining": true,
  "last_successful_submission": "2026-09-07T18:42:11.503219+00:00",
  "last_successful_submission_epoch": 1788806531.503219,
  "consecutive_submit_failures": 0,
  "runtime_incompatible": null
}

Acceptance criteria from #27

  • ISO timestamp in the status response, null before the first accepted submission: yes.
  • Updated only on accepted submissions, not mined-but-unsubmitted solutions: unchanged, the stamp is set in ValidatorPool right after confirm_success() on the submit path only.

Testing

python -m pytest tests/test_telemetry_process.py (7 passed) and the full set of test files that touch the status endpoint or the pool (275 passed, 2 skipped). ruff check clean on the touched files.

…i/v1/status

Closes QuipNetwork#27

The controller snapshot already tracks the wall-clock time of the last
accepted submission (pool.py), but /api/v1/status surfaced it as a raw
time.time() float. QuipNetworkgh-27 asks for an ISO timestamp so operators can read
staleness at a glance.

- render the field as ISO-8601 UTC (null before the first accepted
  submission); invalid or missing snapshot values map to null instead of
  breaking the whole status response
- keep the raw value alongside as last_successful_submission_epoch for
  consumers that compute staleness arithmetically
- document is_mining, last_successful_submission(_epoch),
  consecutive_submit_failures and runtime_incompatible in docs/rest-api.md
- tests: helper edge cases, and an end-to-end telemetry process check that
  the endpoint returns ISO + epoch, and null for both before the first
  accepted submit
@erkancamli

Copy link
Copy Markdown
Author

Closing this: it patches files that no longer exist on main.

88d6814 ("chore(cutover): delete v0.2 Python monolith; miners+chain are Rust now") removed substrate/telemetry_process.py, tests/test_telemetry_process.py and docs/rest-api.md. Git reports all three as deleted-by-main rather than as a textual conflict, so there is nothing left to rebase onto and reworking this branch in place would not make sense.

The request behind it is still unmet in the Rust coordinator, so I have left the specifics on #27 rather than keeping a stale PR open here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add last_successful_submission timestamp to /api/v1/status

2 participants