Skip to content

fix(endpoint): preserve empty input request envelopes - #666

Draft
allenflux wants to merge 1 commit into
runpod:mainfrom
allenflux:fix/preserve-empty-endpoint-input
Draft

allenflux wants to merge 1 commit into
runpod:mainfrom
allenflux:fix/preserve-empty-endpoint-input

Conversation

@allenflux

Copy link
Copy Markdown

Endpoint.run and run_sync wrap an already formed request again when its input is an empty object. For example, {"input": {}, "webhook": "...", "policy": {...}} becomes nested under a second input, so the handler receives the envelope and the request loses its top-level controls.

Check for the presence of the input key when deciding whether to wrap raw handler data. This preserves empty input envelopes as well as existing nonempty envelopes; bare input dictionaries still wrap once. The two methods' docstrings now describe this existing dual input contract. The async endpoint API is unchanged.

The send-requests documentation describes input and top-level webhook/policy. Current CLI tests already accept an empty object as handler input.

Validation on macOS arm64 / Python 3.10.22:

  • Same eight public Endpoint regressions: two failures and six passing controls on main, then all pass. They inspect prepared request JSON without sending it, including raw/empty input and caller input immutability.
  • Complete stock suite: baseline 2,181 tests plus six subtests; final branch 2,189 tests plus six subtests, no failures or skips. Coverage is 93.66%, retaining the original 90% gate.
  • Independent fresh sources: 25 related cases pass, covering request controls, authentication headers, timeouts, return values and error propagation.
  • Wheel/sdist build, Twine and diff checks pass. Black passes for the new test and modified source lines. Whole-file Black on runner.py still fails on both unchanged main and this branch due to existing formatting; this is not a claim of a clean whole-file format check.

The stock remote E2E exclusion was preserved. Full local tests used fake credentials and a test-process guard rejecting unexpected non-loopback connections. No live Runpod service, GPU, worker deployment or cluster was used. Python 3.11–3.14 and the Linux CI platform were not run locally.

AI assistance was used for implementation, regression testing and independent automated local review.

This branch has not been deployed

No deployments
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