Add compose v5 compatibility, legacy-field warnings, UI error fixes#2094
Add compose v5 compatibility, legacy-field warnings, UI error fixes#2094SohamKukreti wants to merge 2 commits into
Conversation
…und error handling - docker-compose.yml: move the PID cap to deploy.resources.limits.pids (Compose v5 rejects pids_limit alongside a limits block; same behavior on v2.x). - entrypoint.sh: explain the loopback-only bind when no CRAWL4AI_API_TOKEN is set and how to fix it. - server.py: warn when the removed output_path (screenshot/pdf) or legacy hooks.code is sent - fields are ignored, never executed; hooks status reads "ignored" and /crawl/stream sends X-Hooks-Warning. Make "/" public so the /playground redirect works; data routes stay gated. - schemas.py: capture legacy hooks.code so it can be reported (never run). - playground: check response.ok on the streaming branch, surface server error details, hint at the token bar on 401. - tests: add deploy/docker/tests/test_legacy_compat.py (13 tests).
614593c to
12d138b
Compare
|
Nice work on the legacy-compat warnings. One interaction seems worth a look. The pre-existing gate in if crawl_request.hooks and not HOOKS_ENABLED:
raise HTTPException(403, "Hooks are disabled. Set CRAWL4AI_HOOKS_ENABLED=true to enable.")
Since Smallest version, no status codes change: keep firing on presence, but branch the error detail on what is actually inside, e.g.: if crawl_request.hooks and not HOOKS_ENABLED:
if crawl_request.hooks.code:
raise HTTPException(
403,
"Inline hook code (hooks.code) was removed in 0.9.0 and cannot be "
"enabled; it was not executed. Use declarative hook actions instead "
"(GET /hooks/info), which are additionally disabled on this server "
"(CRAWL4AI_HOOKS_ENABLED).",
)
raise HTTPException(403, "Hooks are disabled. Set CRAWL4AI_HOOKS_ENABLED=true to enable.")Probably worth hoisting into a small helper, since the gate appears in both Related question: did you consider rejecting |
Per review: enabling CRAWL4AI_HOOKS_ENABLED cannot run inline hook code (removed in 0.9.0), so code-carrying payloads now get a removal message instead of the misleading generic hint.
|
@SetagGnaw Good catch on the ordering. On a stock deployment ( I've adopted your suggested shape: keep firing on presence (the 403-when-disabled contract stays pinned by On your 400 vs. 200 + warning question: I considered rejecting
Thanks for the review! |
Summary
Companion to the self-hosting docs update; all changes verified against a built 0.9.2 image.
docker-compose.yml:
compose down. Identical behavior on Compose v2.x.entrypoint.sh:
server.py / schemas.py:
static/playground/index.html:
detailmessage instead of a generic "Request failed", and 401s hint at the token bar (distinguishing "no token set" from "token rejected").tests:
Fixes #2091
List of files changed and why
deploy/docker/entrypoint.shdeploy/docker/schemas.pydocker/server.pydocker/static/playground/index.htmldeploy/docker/tests/test_legacy_compat.pydocker-compose.ymlHow Has This Been Tested?
Ran old tests and also created a new test file to test the changes. Manually verified as well.
Checklist: