Skip to content

Fix README inaccuracies and document confirmed-but-missing API surface - #48

Open
dan-distributive wants to merge 3 commits into
mainfrom
docs/readme-accuracy-pass
Open

Fix README inaccuracies and document confirmed-but-missing API surface#48
dan-distributive wants to merge 3 commits into
mainfrom
docs/readme-accuracy-pass

Conversation

@dan-distributive

Copy link
Copy Markdown

Summary

Verified every claim in the README against the actual dcp/api/*.py source and the test suite (which turned out to be the most reliable ground-truth for what's actually implemented).

Fixed inaccuracies:

  • job.on('readystatechange', ...) never fires -- Job.on() is a thin passthrough to the real JS EventEmitter (job.py:180-196), which requires the exact camelCase 'readyStateChange'.
  • job.exec() was documented as returning None; it actually returns the deployed job's ID (traced through _exec()/blockify).
  • paymentAccountKeystore=wallet.get() was shown as a literal parameter default -- it isn't one; wallet.get() is a runtime fallback deep in the underlying JS method, not a signature default.
  • dcp.wallet.get()'s documented return type had a typo (Keystre) and undersold the actual default return type (BankAccountKeystore, not the generic base Keystore).
  • job.public's documented keys included "public" instead of "name", contradicting the very next example line.
  • Removed the @dcp.distribute(...) decorator claim -- zero occurrences anywhere in source, tests, or examples.
  • Fixed four job.fs.add()/chdir() examples using curly quotes, which are invalid Python string delimiters.
  • Fixed a mismatched-quote syntax error in the addSlices() example.
  • Fixed dcp.JobFs() -> dcp.JobFS() (wrong case; would AttributeError).
  • Fixed my_job.exec -> my_job.exec() (missing call, so the example was a no-op).
  • fetchResults()'s range_object type referenced dcp.compute.RangeObject, which compute.js imports but never re-exports -- swapped for the plain-dict shape the JS side actually accepts.
  • Noted that dcp.compute_do (distinct from the working dcp.compute.do) is currently broken: compute_do.py:20 references the undefined name computedo_js instead of compute_do_js.

Documented previously-missing, confirmed-real API surface (per test_job.py / test_misc_api_existence.py): job.setPaymentAccountKeystore, setSlicePaymentOffer, requires, cancel, resume, localExec, plus the status/work/collateResults/requirements/serializers attributes, and -- the largest gap -- the universal .aio async namespace that class_manager.py's make_new_class() attaches to every wrapped module and object.

Test plan

  • Docs-only change; no code touched. Confirmed each claim against source rather than running the suite, since pytest requires a full DCP scheduler/worker environment this session doesn't have.

dan-distributive and others added 3 commits July 29, 2026 10:12
Verified every claim against the actual dcp/api/*.py source and the
test suite:

- job.on('readystatechange', ...) never fires; Job.on() is a thin
  passthrough to the real JS EventEmitter (job.py:180-196), which
  requires the exact camelCase 'readyStateChange'.
- job.exec() is documented as returning None; it actually returns the
  deployed job's ID (traced through _exec()/blockify).
- paymentAccountKeystore=wallet.get() was shown as a literal parameter
  default; it isn't one -- wallet.get() is a runtime fallback deep in
  the underlying JS method, not a signature default.
- dcp.wallet.get()'s documented return type had a typo (Keystre) and
  undersold the actual default return type (BankAccountKeystore, not
  the generic base Keystore).
- job.public's documented keys included "public" instead of "name",
  contradicting the very next example line.
- Removed the @dcp.distribute(...) decorator claim -- zero occurrences
  anywhere in source, tests, or examples.
- Fixed four job.fs.add()/chdir() examples using curly quotes, which
  are invalid Python string delimiters.
- Fixed a mismatched-quote syntax error in the addSlices() example.
- Fixed dcp.JobFs() -> dcp.JobFS() (wrong case; would AttributeError).
- Fixed my_job.exec -> my_job.exec() (missing call, so the example was
  a no-op).
- fetchResults()'s range_object type referenced dcp.compute.RangeObject,
  which compute.js imports but never re-exports -- swapped for the
  plain-dict shape the JS side actually accepts.
- Noted that dcp.compute_do (distinct from the working dcp.compute.do)
  is currently broken: compute_do.py:20 references the undefined name
  computedo_js instead of compute_do_js.

Also documented confirmed-real API surface that test_job.py and
test_misc_api_existence.py exercise but the README never mentioned:
job.setPaymentAccountKeystore, setSlicePaymentOffer, requires, cancel,
resume, localExec, plus the status/work/collateResults/requirements/
serializers attributes, and -- the largest gap -- the universal .aio
async namespace that class_manager.py's make_new_class() attaches to
every wrapped module and object.
setPaymentAccountKeystore is the only newly-documented method actually
invoked by a test (test_setting_payment_ks); setSlicePaymentOffer,
requires, cancel, resume, and localExec are only confirmed present via
hasattr() checks in test_misc_api_existence.py, whose own docstring
says outright it "does not test functionality." localExec in
particular is suspected not to work for Pyodide work functions.
Flagged all of these as unverified rather than presenting them with
the same confidence as the tested method.
Traced Job's underlying EventEmitter (dcp/common/dcp-events in the
dcp monorepo) and confirmed it's deliberately case-insensitive:
sanitizeEventName() lowercases every event name on both .on() and
.emit(), per an explicit caseSensitiveEventNames=false default (DOM
Level 2 compliant). Since bifrost2's Job.on() is a thin passthrough to
that same EventEmitter, 'readystatechange' and 'readyStateChange' were
always equivalent -- the earlier camelCase fix wasn't wrong, just
unnecessary. Reverting to the original lowercase form.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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