Conversation
Lock scope for ok-array length + negative numeric error codes. Findings 1/2/5 deferred as taste.
Finding #3: require flags.len() == sent.len() so a short all-true ok array cannot pass as a valid envelope. Finding #4: parse code/status/error_code as i64 (then u64, then string) so numeric negatives like "code": -1 are treated as error envelopes. Do not fold i64 into u64 (drops signed codes). Findings 1/2/5 deferred as taste.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Automated GLM review — human review still required. Scope: 1. should-fix — 2. nit — 3. nit — 4. nit — Checked and clean: Findings: 0 blockers, 1 should-fix, 3 nits. |
Follow-up on merged #23 (boss review findings 3+4). Findings 1/2/5 deferred as taste.
Finding #3
parse_translate_responseaccepted a per-stringokarray shorter thansent. An all-true short array (e.g.ok:[true]for three texts) passed and the missing flags silently covered unsent fields.Fix: require
flags.len() == sent.len(); mismatch is a malformed envelope (bail!). Same-length all-true still passes.Finding #4
Numeric negative error codes (
"code": -1) were skipped:as_u64()isNoneon signed JSON numbers andas_str()isNoneon numbers.Fix: parse as
i64(as_i64first, thenas_u64→i64, then string). Negative codes are error envelopes. 0 and 200 stay success. Do not fold i64→u64 (try_fromwould drop negatives again).Deferred (taste)
Defaultimpl forOpenRouterClientfieldsparam onparse_translate_responseTRANSLATE_URLTests
ok_array_shorter_than_sent_is_malformednumeric_negative_error_code_is_a_hard_failurecargo test --bin zola -- ok_array_shorter_than_sent numeric_negative_error_code ok_false ok_array_with_a_false mirrored_error_code_1003 ok_all_true→ 7 passed.