Repository navigation
fix(bocha): accept validated date freshness filters - #352
Conversation
Eigenwise
left a comment
There was a problem hiding this comment.
Confirmed: on main the Literal accepts the placeholder "YYYY-MM-DD" strings and rejects real dates. The validator fixes that. Small cleanup:
- Move the new tests above the
if __name__ == "__main__":block. They currently come after it. - Import
ValidationErrorat the top of the test file instead of inside the test. exctoerrorin the validator.
I couldn't check this against the live BoCha API (no key here). If you've verified that a same-day range like 2026-11-07..2026-11-07 is accepted, a note in the description would help.
The freshness tests sat after the __main__ guard; they now come before it. ValidationError is imported at the top of the test file, and the validator's caught exception is named error. Also merges main. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Eigenwise
left a comment
There was a problem hiding this comment.
Thanks for this, the validator is the right fix and I'm merging it.
Since you hadn't had a chance to get back to it, I pushed one commit to your branch with the three cleanups from my last review: the freshness tests now sit above the __main__ guard, ValidationError is imported at the top of the test file, and the caught exception is named error. I also merged main in.
Checked on current main with your branch merged: the tool's 38 tests pass, and 8 of them fail on main's source.
It also fixes an older test along the way: test_bocha_search_tool_config_params_real_case_cn read its key from BOCHA_API_KEY even though it runs against a mocked session, so it failed on any machine without that variable. With your fixed fake key it passes everywhere.
One thing is still unverified: the validator accepts a same-day range such as 2026-11-07..2026-11-07, and I couldn't check that against the live BoCha API because I don't have a working key here. If you know how the API treats it, a comment here would be useful.
Covers what #348, #490, #341, #352 and #353 changed in documented behavior: one schema resolver shared by agents, tools, resources and prompts; nested schema classes in saved history; the scraper's streamed download cap; the YouTube tool's timestamp offset and client cleanup; the PDF reader's extraction_mode and include_links; BoCha freshness validation; datetime shifts by calendar days and elapsed time; the weather country filter; and that a persistent history backend should override delete_turn_id. Each statement was checked against the merged code on main. Co-authored-by: Kenny Vaneetvelde <kenny@eigenwise.io> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
The BoCha configuration treats
YYYY-MM-DDandYYYY-MM-DD..YYYY-MM-DDas literal enum values. As a result, real date filters fail validation while the format placeholders are accepted.Accept the existing time presets plus validated ISO calendar dates and ordered date ranges. Preserve valid filters unchanged in request payloads, reject invalid dates and placeholders, and document accepted values. The mocked configuration test now uses a dummy key instead of depending on BOCHA_API_KEY.
Validation:
No live BoCha requests or real API keys were used.