You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- use fuzz to generate random payloads
- verify openai => universal => openai works
- snapshot fuzz cases, and keep the fuzz generator ignored
---------
Co-authored-by: Matt Perpick <matt@braintrustdata.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Run `make -C crates/lingua/tests/fuzz run` to get a minimal failing case. Show the issue to the user, validate it with a real request, and fix with TDD.
Copy file name to clipboardExpand all lines: AGENTS.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,13 @@ Lingua is a universal message format that compiles to provider-specific formats
13
13
-**Type safety**: Full TypeScript and Rust type generation with bidirectional validation
14
14
-**No network calls**: This is a message format library, not an API client
15
15
-**Explicit error handling**: All errors must be properly handled, never silently swallowed
16
+
-**No hidden marker fields**: Do not encode provider semantics via internal marker keys (for example in `provider_options`) to fake lossless roundtrips.
17
+
-**Ask when non-lossy mapping is unclear**: If the universal type cannot represent a provider feature non-lossily, stop and ask for clarification on the intended canonical representation before implementing a workaround.
18
+
-**No unapproved fallback logic**: Do not add ad-hoc fallback parsing/translation paths (for example `fallback_*` helpers) without checking with the programmer first.
19
+
-**Typed boundaries only**: At provider boundaries, parse into well-defined typed structs/enums. Do not add lenient raw-JSON parsing that guesses defaults for required fields (for example defaulting missing `role` to `user`, lowercasing unknown roles, or inventing empty `content`).
20
+
-**Fix via types or explicit errors**: If fuzzing finds unsupported/ambiguous shapes, either model them explicitly in types/converters or return a clear error. Do not silently coerce invalid input into a "best effort" shape.
21
+
-**Typed-boundary CI gate**: CI enforces `make typed-boundary-check-branch BASE=origin/<base-branch>` on pull requests. Running `make typed-boundary-check` locally is recommended for faster feedback, but not required as a pre-commit hook.
22
+
-**Typed extras views over raw map access**: If provider extras must be read, deserialize extras into a typed view struct first; do not pluck fields ad-hoc with `map.get(...)`.
16
23
17
24
## Documentation style guide
18
25
@@ -428,4 +435,4 @@ Update README.md:
428
435
-**Document differences**: Note any provider-specific quirks or limitations
429
436
-**Consider streaming**: Many providers support streaming responses
430
437
431
-
This process ensures consistent provider integration while maintaining type safety and zero-runtime overhead.
438
+
This process ensures consistent provider integration while maintaining type safety and zero-runtime overhead.
typed-boundary-check-branch: ## Fail if committed branch diff adds direct Value field access (usage: make typed-boundary-check-branch BASE=fuzz-test-anthropic)
79
+
@if [ -z"$(BASE)" ];then\
80
+
echo"Usage: make typed-boundary-check-branch BASE=<comparison-branch>";\
81
+
exit 1;\
82
+
fi;\
83
+
echo"Checking typed boundary regressions in committed diff against $(BASE)...";\
0 commit comments