bug fixes for #388 - #391
Conversation
refactor into ScenarioId class
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude code-review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude pr-review |
|
Claude finished @leekahung's task in 5m 39s —— View job Code Review
The tree is unchanged since the 2026-09-09 review — @leekahung's
|
| # | Where | Finding |
|---|---|---|
| 3 | test_langchain_tools.py:118, graph.py:84 |
Nothing exercises the tool's schema conversion. test_tool_schema_matches_function_signature still covers only retrieve_city_state_laws; every deadline test goes through .invoke(), which validates the Pydantic model and never builds a JSON schema. date/time/Optional[time]/StrEnum are the corners of Gemini's OpenAPI subset most likely to be rejected, and the tool is bound to the live model at graph.py:219/:233, so a converter failure 400s every conversation that reaches it while CI stays green. Still the highest-value open item. |
| 4 | langchain_tools.py:329-334 |
service_date's ge/le are enforced at validation but Pydantic v2 doesn't render date constraints into JSON Schema, so the model sees format: "date" with no range to correct against. Cheapest fix: state the range in the field description. The model_json_schema() assertion in #3 settles it either way. |
| 5 | langchain_tools.py:656-671 |
The tenant block asserts a bare DEADLINE: with none of its premises — period_value, period_unit, service_date, service_method are all above the marker, and the prompt forbids restating them. One premise line below the marker makes it self-checking. |
| 6 | langchain_tools.py:653, system_prompt.md:22, test_langchain_tools.py:763 |
The relay marker is still a triplicated literal with no test tying tool to prompt; a prompt-side edit drifts silently and the likely failure is relaying the AGENT NOTES header. |
| 7 | test_langchain_tools.py:875, :960 |
assert basis in result is a substring check, so "ORS 90.160(1)" also passes against "ORS 90.160(1) and ORS 90.155(2)" — the ten no-extension rows can't independently detect a spurious extension. assert f"Legal basis: {basis}." in result anchors both ends. |
| 8 | langchain_tools.py:402 |
_parse_service_time still misses "2:30 p.m." and "2:30:00 PM". Recoverable ValidationError, so minor. |
| 9 | langsmith_dataset.py:1290, :1293 vs :1665 |
Two sentinels for one concept: the comment says -1 so that scenario_id=0 isn't "unknown", while both readers default to 0. Dead today only because every key is populated. |
| 10 | langsmith_dataset.py:253-256, :301-304 |
dict(inputs_schema) is shallow, but the comment claims the SDK gets "a dict it owns"; _load_schema_properties' own docstring is honest that the shallowness leaves nested dicts aliased to the lru_cache. Overstated comment, or use copy.deepcopy. |
| 11 | langsmith_dataset.py:338-342 |
cmd_dataset_pull's decorate-sort buys nothing — it caches the key to avoid recomputation, then re-reads the same metadata via is_unlabeled on the next line. sorted(..., key=ScenarioId.sort_key), as cmd_example_list:816 now does, is the same work in one line. |
| 12 | langchain_tools.py:649; ScenarioId.partition:496 |
Minor, both unchanged: the UNIT CHECK reads "1 HOURS, NOT 1 DAYS" at period_value == 1; and partition's "silently keeps the last" docstring is now unreachable from push/validate but still live via cmd_dataset_diff:684, which partitions never-validated remote examples — worth naming diff as the remaining exposure. |
Two smaller notes on this round's new files: test_period_value_bounds.py now covers service_date bounds too, but its name and module docstring still say period_value only — and the five tests would sit naturally in test_langchain_tools.py beside the rest of the tool's suite. And cmd_example_adopt's new collision check (langsmith_dataset.py:906-915) compares --start-id only against remote ids; a local JSONL record not yet pushed could still collide, which the newly-fatal duplicate check would then surface at the next push. Probably the right scope, since pull overwrites local anyway — just worth knowing the check isn't total.
The ScenarioId refactor itself reads well: parse's bool/whole-float/IntEnum handling is right, __new__ correctly rejects the subclass so parse stays the only untrusted entry point, and the bool-vs-1 remote-lookup test (test_langsmith_dataset.py:1235) pins the bug the old == comparison had. The duplicate-id line-number reporting and the _adopt_metadata unknown-key preservation are both clean fixes.
Not verified: uv and pytest aren't on this runner and executing python isn't permitted here, so nothing above was run — it's static reading plus the statute text in the repo's own corpus. Finding #4's claim about Pydantic's date-constraint schema output remains reasoning, not observation. To have the suite run as part of the review, the job needs Bash(uv run pytest:*) in --allowedTools.
· branch more-evals
| import pytest | ||
| from flask import Flask | ||
|
|
||
| import evaluate.langsmith_dataset # noqa: F401 |
|
Non-blocking follow-up: the CodeQL unused-import alert at #391 (comment) is still open — |
refactor into ScenarioId class
What type of PR is this? (check all applicable)
Description
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Please replace this line with instructions on how to test your changes, a note on the devices and browsers this has been tested on, as well as any relevant images for UI changes.
Added/updated tests?
Documentation
Architecture.mdhas been updated[optional] Are there any post deployment tasks we need to perform?