Repository navigation
Conversation
Operation.ExpectedError reports whether an error that the source returned is a normal outcome, such as not found. For an accepted error the caller still gets the same error and nothing is cached, and the fallback timer still records, but DialCache records no fallback error event. The source deadline and panic errors never reach the predicate, and a nil, false or panicking predicate keeps today's behavior. Stale recovery and coalescing are unchanged. Go only for now; #287 tracks the other ports.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #288 +/- ##
==========================================
+ Coverage 94.79% 94.80% +0.01%
==========================================
Files 84 84
Lines 13199 13208 +9
Branches 805 805
==========================================
+ Hits 12512 12522 +10
+ Misses 621 620 -1
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolve the ledger conflicts with the Prometheus bucket option (#286): take main's source-audit.json and go-parity.json, apply the expected error mapping again, and refresh both in the catalog README's order.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Go source path records
error{error="fallback", in_fallback="true"}for every source error that a caller still waits for. Go code returns an error for normal outcomes such as not found, where TypeScript and Python sources usually returnnullorNone, which DialCache stores as a value. So in Go a normal "not found" shows as a fallback error, and real source failures hide among normal answers. The maintainer reported this while he added DialCache to a Go service whose source returns a "not found" error for a key that has no value yet. That service must not cache "not found", because the first write for such a key does not invalidate. Refs #287 for the Rust, TypeScript and Python ports.Change
Public API, Go only.
Operation[T]gets one field,ExpectedError func(error) bool.errors.Isanderrors.Asstill work. DialCache stores nothing in any layer, as today, and the fallback timer still records the duration. Only thefallbackerror event is skipped.FallbackTimeoutError(source deadline) andCallbackPanicError(source panic). DialCache returns both unwrapped, so a type check finds them. A source that returns another operation's error of these types unchanged also counts.falseor a panic in the predicate gives today's behavior. The predicate runs throughcallSafely, like the recovery predicate, and a panic logs a warning.fallbackerror, so C58's rule that a recovered failure still counts applies to the errors the predicate does not accept.GO-PARITY.mdand the Go note indocs/observability.mdsay so. Shadow validation is unchanged and still reportssource_errorfor any source error.CONTRACTS.mdtext. The maintainer chose a per-operation, Go-only option with no instance-level setting. The mutant rule fires, becauseformal/catalogs/mutations.jsonnamesgo/engine.go(no anchor touches the changed lines), so the tier is Mutations. Nodocs/upgrading.mdnote, because nothing changes for existing callers.go/README.md,docs/languages/go.mdwith an excerpt, a Go note under Error categories indocs/observability.md, andformal/guides/GO-PARITY.md. Each says that only Go has the option for now.formal/catalogs/README.md:source-audit.jsonfor the four edited pages;feature-coverage.jsonfor a new native case,B01.expected-source-errors, with the three new tests, listed under the api and observability features, and TypeScript not applicable (Expected source errors for the Rust, TypeScript and Python ports #287);go-parity.jsonfor the re-pinnedgo/api.goandgo/engine.gohashes, the newexpectedsymbol, the mapping rationale and the B01 binding adaptation.Ports
nullfor not found, which DialCache stores; #287Errfor normal outcomes, so the same problem applies; #287Nonefor not found; #287Validation
Head:
d662e80(merge ofmainat995c629into2c18aef)make check-go(go vet, gofmt and race tests with coverage) atd662e80: passed.make auditatd662e80: passed.corepack pnpm docs:checkandmake docsatd662e80: passed.d662e80: every check passed, includingtest,go,typescript,rust,python,wire,quint,differential (1)to(4),Build documentationandValidate PR title.formal-full.yamlinmutationsmode, run 44166353511, atd662e80: success (generate, symbolic, TypeScript, Go, Rust and Python parity, and the TypeScript, Go and Rust mutation campaigns).go -C go test -race -count=1 -run TestExpectedError ./at2c18aef: passed, 3 tests with 8 subtests: accepting, rejecting, nil and panicking predicates; deadline and panic errors; coalesced followers. The merge did not change the tested files;make check-goran them again atd662e80.source, removing the type check, or makingexpectedalways false each fails these tests.2c18aef: every check passed.formal-full.yamlinmutationsmode, run 44047562498, at2c18aef: success (generate, symbolic, TypeScript, Go, Rust and Python parity, and the TypeScript, Go and Rust mutation campaigns). The merge ofmainchanged Go source, so it does not coverd662e80.Not run: locally,
make integration-goandmake integration-wireneed Docker.check-ts,check-rustandcheck-pythonwere not run locally, because those ports are unchanged. CI ran all of them.Follow-ups