Skip to content

docs: fix watcher field-registration pattern across all docs#102

Merged
zeevdr merged 1 commit into
mainfrom
fix/docs-watcher-lifecycle
May 25, 2026
Merged

docs: fix watcher field-registration pattern across all docs#102
zeevdr merged 1 commit into
mainfrom
fix/docs-watcher-lifecycle

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 25, 2026

Summary

  • All three watcher docs showed field() called inside the context manager block, which raises RuntimeError at runtime — the implementation enforces registration before start() / __enter__.
  • Unified on the canonical two-step pattern: create watcher, register fields, then enter the context manager.
  • Removed the contradictory "Or equivalently" block and confusing "Wait —" note from watching.md, and fixed the Multiple watchers example.

Test plan

  • Read sdk/docs/quickstart.md — watcher example registers fields before with watcher:
  • Read sdk/docs/watching.md — Basic usage, Lifecycle, and Multiple watchers all use correct pattern; no contradictory note
  • Read sdk/docs/async.md — both examples register fields before async with watcher:
  • Verify against watcher.py:146field() raises RuntimeError if _thread is not None

Closes #65

All three docs (quickstart, watching, async) showed watcher.field() called
inside the context manager block, which raises RuntimeError at runtime. The
implementation enforces field registration before start() / __enter__. Unified
on the canonical two-step pattern: create watcher, register fields, then enter
the context manager. Also removed the contradictory "Or equivalently" block and
confusing "Wait —" note from watching.md Lifecycle section, and fixed the
Multiple watchers example which had the same error.

Closes #65

Co-Authored-By: Claude <noreply@anthropic.com>
@zeevdr zeevdr added this to the Beta Readiness milestone May 25, 2026
@zeevdr zeevdr added size: S Quick win — a few hours or less priority: P2 Nice-to-have labels May 25, 2026
@zeevdr zeevdr merged commit 3955ffa into main May 25, 2026
11 checks passed
@zeevdr zeevdr deleted the fix/docs-watcher-lifecycle branch May 25, 2026 09:50
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

priority: P2 Nice-to-have size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: reconcile conflicting watching.md and quickstart.md patterns

1 participant