epic-4/story-5: Deliver Advanced Documentation and Migration Guides - #42
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive set of advanced documentation guides under docs/ covering initialization, evaluation, tracking, queue control, debugging, extending, support workflows, and migrations. It also adds a shared sample configuration and a robust drift-protection test suite in tests/test_docs_samples.py to ensure that code snippets in the documentation remain valid and executable against the current public API. Feedback on the changes includes removing an unused helper function in the test suite, refining the __exit__ method signature in the extension guide's code sample, and using a more precise type hint for a helper function in the sample configuration.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| def _all_python_fences(text: str) -> list[str]: | ||
| """Return the bodies of EVERY fenced python block (executable or not).""" | ||
| pattern = re.compile(r"```python[^\n]*\n(.*?)```", re.DOTALL) | ||
| return [m.group(1) for m in pattern.finditer(text)] | ||
|
|
There was a problem hiding this comment.
The function _all_python_fences is defined but never used anywhere in the test suite. To maintain a clean and maintainable codebase, it is recommended to remove this unused function.
References
- PEP 8 recommends removing dead or unused code to keep the codebase clean and maintainable. (link)
| def __exit__(self, *exc): | ||
| self.close() | ||
| return False |
There was a problem hiding this comment.
The __exit__ method of a context manager should ideally follow the standard signature __exit__(self, exc_type, exc_val, exc_tb) instead of using *exc. This ensures better compatibility with static analysis tools, IDEs, and type checkers.
| def __exit__(self, *exc): | |
| self.close() | |
| return False | |
| def __exit__(self, exc_type, exc_val, exc_tb): | |
| self.close() | |
| return False |
References
- Standard Python context managers should implement the
__exit__method with the explicit(self, exc_type, exc_val, exc_tb)signature for clarity and tool compatibility. (link)
| from typing import Any, Dict | ||
|
|
||
|
|
||
| def _rule_country(value: str) -> dict: |
There was a problem hiding this comment.
The type hint dict is imprecise. Since Dict and Any are already imported from typing, using Dict[str, Any] provides better type safety and consistency with the rest of the file (e.g., SAMPLE_CONFIG: Dict[str, Any]).
| def _rule_country(value: str) -> dict: | |
| def _rule_country(value: str) -> Dict[str, Any]: |
References
- PEP 484 and PEP 8 encourage precise type hinting to improve code readability and static analysis. (link)
ec7ed31 to
1338c8c
Compare
65e82a8 to
16fccf1
Compare
1338c8c to
31b611a
Compare
Beads: ai-driven-product-dev-2tks Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
index, initialization, evaluation, tracking, queue-control guides with executable doctest-run samples bound to the current public API. Beads: ai-driven-product-dev-2tks Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Beads: ai-driven-product-dev-o7au Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ation (GREEN) debugging (diagnose_* surface, closed DiagnosticReason, redaction-safe log seam), extending (runtime_checkable Transport/DataStore/EventBus seams, keyword-only transport injection, data_store field, no logger Protocol), support-workflows. Beads: ai-driven-product-dev-o7au Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Beads: ai-driven-product-dev-x758 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…entation (GREEN) migration-from-rest (endpoint mapping + batching/dedup/lifecycle/redaction callouts, runnable SDK-side flow), migration-from-javascript (concept map, deliberate Pythonic differences, parity evidence), README Documentation section linking docs/index.md + all guides. Beads: ai-driven-product-dev-x758 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16fccf1 to
cc3c404
Compare
F-066 propagation (rebase onto remediated 3-3)Rebased onto the remediated stack. Does not modify
|
|
Superseded — all commits already in main (bc76b64). Closing without merge as part of post-sprint cleanup. |
Story 4.5 — Deliver Advanced Documentation and Migration Guides
Part of sprint
sprint/2026-04-06-convert-python-sdk. Stacked on epic-4/story-4 (#41 → #40 → #39 → #38 → epic-3 chain).What was built
Ten topic/migration guides under
docs/(built as a genuine docs-heavy story against the repodocs/tree — the story file's stale "moved to wiki / docs removed" Codex narrative was verified false against the live branch and ignored):index.md,initialization.md,evaluation.md,tracking.md,queue-control.md(AC#1)debugging.md(deferred into this story from 4-3 — documents the partial cross-SDK diagnostic surface:reason/environment/bucket_value/variation_key+ hashedvisitor,DiagnosticReasonenum)extending.md(deferred into this story from 4-4 — documents the hybrid injection contract:Core(config, *, transport=…), storage viaconfig.data_store,@runtime_checkableports/adapters)support-workflows.mdmigration-from-rest.md(AC#2),migration-from-javascript.md(AC#3)Anti-drift coverage
New
tests/test_docs_samples.py+tests/docs_sample_config.pyexecute every code sample in every guide against the current public API (# doctest: runextraction harness), so docs cannot drift. The existing Story-1.6tests/test_examples.pydrift guard was left untouched.Quality
__enter__/__exit__, lifecycle(payload, error=None), offlineflush()needs injected transport).Scope notes
ai-driven-product-dev-nlwo; tasks-2tks,-o7au,-x758— closed.🤖 Generated with Claude Code