A re-read of the seat events that fails partway keeps nothing it read (issue 1966)
mesh/delivery ready: it is merged on the Approve
mesh/check pass ecad0c688b48 on fc21f2d1bd56 | carried from mesh-catalog 7630e3cc9d1e | unit 500 run, 1003 kept | integration 499 run, 1070 kept | com…
mesh/delivery ready: it is merged on the Approve
mesh/check pass ecad0c688b48 on fc21f2d1bd56 | carried from mesh-catalog 7630e3cc9d1e | unit 500 run, 1003 kept | integration 499 run, 1070 kept | com…
A created whose dropped lay past the failure was kept again. When the stream cannot be read whole, only the error is written to bindings-again. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -3236,7 +3236,15 @@ func TestGrants(t *testing.T) {
|
||||
if got := readAgain("mod-z"); !strings.Contains(got, "holds no created or recreated of mod-z") || !strings.Contains(got, "seat mesh-broker's list") {
|
||||
t.Errorf("a module whose created the stream no longer holds: %s", got)
|
||||
}
|
||||
if len(acts) != 3 || !strings.HasPrefix(acts[0], "grants_bindings_again mod-x: ") {
|
||||
// A re-read that fails partway applies nothing it read: the created whose dropped lay past the failure is not kept.
|
||||
p.History = failingHistory{saidHistory{event("created", "mod-x", "late", "mod-x_late")}}
|
||||
if got := readAgain("mod-x"); !strings.Contains(got, "could not be read, so nothing was kept") || !strings.Contains(got, `"read":0`) {
|
||||
t.Errorf("a failed re-read: %s", got)
|
||||
}
|
||||
if got := bindingsOn("a.mod-x"); len(got) != 1 || got[0].Bucket != "mod-x_windows" {
|
||||
t.Errorf("a failed re-read kept what it read before the failure: %+v", got)
|
||||
}
|
||||
if len(acts) != 4 || !strings.HasPrefix(acts[0], "grants_bindings_again mod-x: ") {
|
||||
t.Errorf("hand acts %v", acts)
|
||||
}
|
||||
})
|
||||
@@ -4680,3 +4688,10 @@ func oldStateReaders(path string, src []byte) ([]string, error) {
|
||||
type saidHistory []grants.SaidEvent
|
||||
|
||||
func (h saidHistory) Said() ([]grants.SaidEvent, error) { return h, nil }
|
||||
|
||||
// failingHistory is a re-read that fails partway: the events read so far, and the error.
|
||||
type failingHistory struct{ read saidHistory }
|
||||
|
||||
func (h failingHistory) Said() ([]grants.SaidEvent, error) {
|
||||
return h.read, errors.New("$JS.API.STREAM.MSG.GET.EVENTS at sequence 2: context deadline exceeded")
|
||||
}
|
||||
|
||||
@@ -307,7 +307,9 @@ func (p *Part) bindingsAgain(res *Result, module, by string) {
|
||||
out := BindingsAgain{V: 1, Module: module, By: by, At: p.now(), Kept: []string{}, Already: []string{}, Dropped: []string{}}
|
||||
events, err := p.History.Said()
|
||||
if err != nil {
|
||||
out.Error = "the shared events stream could not be read: " + err.Error()
|
||||
// A read that failed partway applies nothing: a created whose dropped lies past the failure would be kept again.
|
||||
out.Error = "the shared events stream could not be read, so nothing was kept: " + err.Error()
|
||||
events = nil
|
||||
}
|
||||
heardCreate := false
|
||||
for _, e := range events {
|
||||
|
||||
Reference in New Issue
Block a user