Skip to content

fix: uptime monitors.test() deprecation window and bundle include (W0-13) - #162

Merged
caballeto merged 3 commits into
mainfrom
fix/test-uptime-alias
Oct 26, 2026
Merged

caballeto merged 3 commits into
mainfrom
fix/test-uptime-alias

Conversation

@caballeto

@caballeto caballeto commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Two follow-ups to #160:

  1. R16 deprecation window. On an uptime monitor, monitors.test(id) keeps returning the probe result until 2027-01-31, as 1.12 did, with a one-time DeprecationWarning pointing to monitors.probe(id). From that date it raises ValidationError USE_PROBE. This matches the amended doc 42 R16 and sdk-js.
  2. include (W0-13). Explicit include paths (files nothing imports, such as fixtures/order.json) are sent as CreateBundleRequest.include on a JSON upload, or as the include query parameter on a zip upload. The server then keeps them in the closure.

The spec is generated from mono #1436 (feat/bundle-include, head 9405da4), including its docs/contracts/bundle-vectors.json. It will be identical once #1436 merges.

What's covered (doc 42 map)

  • §2 R16. test() returns MonitorTestOutcome = RunDto | MonitorTestResultDto. devhelm.is_run() is a TypeGuard[RunDto] that narrows it, mirroring sdk-js isRun.
    • Only a 200 is treated as a probe result. Any other status that isn't 202 is refused.
    • From 2027-01-31, USE_PROBE carries details.passed, as in sdk-js.
  • §5.3 / D-12, W0-13.
    • include adds files to the default set and names them to the server.
    • In-memory {entrypoint, files, include} is supported.
    • An include path that names no file is refused with MONITOR_PACKAGE_PATH_INVALID, field include[i], as the server does.
  • §5.5.2. All 12 conformance vectors are checked:
    • the upload digest, and the closure digest over the server's file list;
    • the in-memory form carries the include list;
    • the refusal code and field for the symlink and include-missing vectors;
    • the import-outside-set vector is checked only for its code, because the include-set client never parses imports.
  • Async. AsyncDevhelm gets both changes; it is generated from the same source.

Tests

  • Unit: 1137 passed, 10 skipped (live tests skip without a stack). mypy --strict, ruff check/format and the unasync --check freshness check are clean.
  • New tests:
    • sync and async probe-with-warning, and USE_PROBE after the date (clock patched);
    • is_run narrowing;
    • an unexpected status is refused;
    • fixtures/order.json ships from disk and appears in include;
    • zip uploads send repeated ?include= parameters;
    • no include is sent when none is given.
  • Real-API matrix: not re-run on this branch, because the shared test API on :8081 was down. The last matrix run (Wave 0 stack, before the include change) gave 9 passed, 1 skipped. See "Not in this PR".

Self-review

Sonnet reviewer on the final diff: 2 P0s, both fixed.

  • typing_extensions was imported but not declared as a dependency. It is now declared, and TypeGuard/NotRequired come from typing.
  • Any non-202 status was being treated as a probe result. Now only 200 is.

P1s also fixed:

  • the removal date has a single source;
  • the refusal field is asserted on every vector;
  • async tests cover the deprecation path;
  • zip include is tested;
  • TypeAlias is annotated.

Review follow-ups:

  • P1: add @overloads on test() that narrow to RunDto when code= is given.
  • P1: the stacklevel of the deprecation warning points one frame off under asyncio.
  • P2: details.passed on USE_PROBE is undocumented beyond sdk-js parity.

Deviations from doc 42

Not in this PR

  • Real-API re-run of the matrix with run admissions opened (mono #1435 open-synthetics-admissions): the shared test API on :8081 was down. To rerun:
    DEVHELM_E2E_API_URL=http://localhost:8081 DEVHELM_API_TOKEN=devhelm-dev-token DEVHELM_ORG_ID=<seed> DEVHELM_WORKSPACE_ID=<seed> uv run pytest tests/test_synthetics_live.py
    
  • Live check of include-kept against the server: this needs a stack running #1436.
  • Release: left to the user.

How to verify locally

uv sync
make lint && make typecheck && make test

🤖 Generated with Claude Code

caballeto and others added 3 commits October 25, 2026 21:53
…l 2027-01-31

Doc 42 R16 (amended) and sdk-js: monitors.test(id) on an uptime monitor
returns the probe result with a one-time deprecation warning pointing to
monitors.probe(id) until 2027-01-31, and raises ValidationError USE_PROBE
after. The result is MonitorTestOutcome (RunDto | MonitorTestResultDto);
devhelm.is_run narrows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Regenerated from mono #1436 (W0-13), which adds CreateBundleRequest.include
and three bundle vectors (include-kept, include-set-with-include,
include-missing-refused). Explicit include paths from either code form are
sent with the upload (JSON field or zip query parameter); an in-memory
include that names no file is refused as include[i], as the server does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- monitors.test() treats only 200 as a probe result and refuses other
  non-202 statuses; the removal date has one source.
- typing.TypeGuard / NotRequired from the standard library, and
  typing_extensions declared for TypeAliasType.
- Tests: async deprecation and USE_PROBE paths, include as repeated query
  parameters on zip uploads, no include when none is given, and the
  refusal field of every conformance vector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@caballeto caballeto changed the title fix: keep monitors.test() returning the probe on uptime monitors until 2027-01-31 fix: uptime monitors.test() deprecation window and bundle include (W0-13) Oct 25, 2026
@caballeto
caballeto merged commit f5ad98e into main Oct 26, 2026
4 checks passed
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.

1 participant