feat(ffi): surface auth connect errors in language wrappers#1692
Conversation
The moq-ffi MoqError gained Unauthorized (HTTP 401) and Forbidden (HTTP 403) variants so callers can tell an auth rejection from a retryable transport failure, but the language wrappers didn't expose an ergonomic way to act on them. Add parity helpers next to the existing isShutdown: - swift: MoqError.isAuth - kotlin: MoqException.isAuth - go: moq.IsAuthError (errors.Is over the generated sentinels) - python: re-export MoqError from the moq package Document the auth-error path in each wrapper's guide plus the C library doc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b7cd320 to
49640b2
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughThis PR adds authentication/authorization error handling guidance and helpers across the Moq SDK ecosystem. Implementations in Go, Kotlin, and Swift each provide an 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" 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 |
|
@Qizot do you need this? |
|
@kixelated yes, please |
Follow-up to #1649, which added
Unauthorized(HTTP 401) andForbidden(HTTP 403) variants to the moq-ffiMoqErrorso callers can distinguish an auth rejection from a retryable transport failure. That PR landed the Rust side but left the language wrappers without an ergonomic way to act on the new variants (the Cross-Package Sync row forrs/moq-ffi). This closes that gap.Summary
Parity helpers next to the existing
isShutdown:MoqError.isAuth(true for.Unauthorized/.Forbidden)MoqException.isAuthmoq.IsAuthError(err), usingerrors.Isover the generatedErrMoqErrorUnauthorized/ErrMoqErrorForbiddensentinelsMoqErrorfrom themoqpackage so callers canexcept moq.MoqError.Unauthorizedwithout reaching intomoq_ffiPlus an auth-error note in each wrapper's guide (
doc/lib/{swift,kt,go,py}) and the C library doc (doc/lib/c), which documents the distinct return codes +moq_error()strings since libmoq has no named C constants for them.The variants themselves are already emitted by every binding (flat UniFFI error), so this is purely the ergonomic + documentation surface.
Test plan
just cirunsjust {py,kt,go} checkon the Linux runner (these wrappers were skipped for fix(native): surface terminal auth connect errors #1649 since it didn't touch them); Go compilesIsAuthErroragainst freshly-regenerated bindings that now includeErrMoqErrorForbidden.swift checkis macOS-only and skips on the Linux runner; theisAuthhelper mirrors the existingisShutdownexactly.gofmtclean; Python isort/__all__ordering consistent with existing style.(Written by Claude)