best-practices: Server-side robustness (deps, event loop, load_sibling) - #10
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
topkoa
force-pushed
the
docs/best-practices-integration
branch
from
July 6, 2026 04:30
e96f451 to
f74c4c1
Compare
Add server-side robustness rules found in the completeness sweep, ground-truthed against the loader. Rules (34-37): - Declare Python deps in requirements.txt (no manifest field): installs are hash-keyed and persistent, but sequential and slow — they delay later plugins, so keep them minimal and pinned. A failed install is non-fatal (Host still loads routes), so guard heavy/optional imports and degrade if missing. - Don't block the event loop: setup() runs on the loop thread and is killed at a ~60s timeout — wire only, defer heavy work. A blocking async def handler freezes the whole server; use non-blocking I/O or a plain def (threadpool). - Split routes.py with context["load_sibling"], not bare imports — two plugins shipping a top-level util.py collide in sys.modules (first wins). load_sibling namespaces per plugin and enables relative imports; don't mix the two. - Log through context["log"], never print(); namespace routes under /api/plugins/<id>/. Renumber Shipping to 38-42 and add a checklist block. Docs only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: K. O. A. <topkoa@gmail.com>
topkoa
force-pushed
the
docs/best-practices-server-robustness
branch
from
July 6, 2026 04:32
6999ed5 to
b11d019
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second of four gap-closing PRs. Adds a "Server-side robustness" section for
routes-shipping plugins — the server-side concerns that let one plugin stall the whole server or delay others. Ground-truthed against the loader.Rules (34–37)
requirements.txt, keep them light. There's no manifest field; the Hostpip installs them to a persistent, hash-keyed location. Installs are sequential and slow — they delay later plugins (yours shows "installing…"), so keep them minimal and pinned. A failed install is non-fatal (the Host still tries your routes), so guard heavy/optional imports and degrade if missing.setup()fast.setup()runs on the event-loop thread and is killed at a ~60s timeout — wire only, defer heavy work. A blockingasync defhandler freezes the whole server for every request; use non-blocking I/O or a plaindef(the Host runs sync handlers in a threadpool).routes.pywithcontext["load_sibling"], not bare imports. The Host puts each plugin dir onsys.path, so two plugins shipping a top-levelutil.pycollide insys.modules(first wins).load_siblingnamespaces per plugin and enables relative imports; don't mix bareimportandload_siblingfor the same file.context["log"], neverprint()(correlation + rotation); plus a route-namespacing reminder (silent + permanent collisions, rules 6/7).Added a "Server-side robustness" checklist block; Shipping renumbered to 38–42 (contiguous 1–42).
Scope & stacking
Docs only. Stacked on #9. Full stack: … → #8 → #9 → #10 (two more coming: styling, diagnostics).
mkdocs build --strict+check_versions.pypass.🤖 Generated with Claude Code