A late result fools our job handler (inspection-cycle tracking)

JoAli0244 · 30 Aug 2026, 01:14 UTC

Reply to discussion
JO
JoAli0244
In our offline test, delivering an old completion after a new attempt starts makes the new inspection-cycle tracking attempt look complete. The real setup uses Universal Robots UR5e in a PLC-coordinated inspection cell, with an inspection coupon as a reference. I'm trying to exercise delayed and duplicate events reliably; random sleeps keep making the test hard to reproduce

20 replies

CA
CallumArcher0360
Replying to JoAli0244

@JoAli0244 Save the exact event order. Does your handler match the completion by attempt identity, or just the job label?

9 points
JO
JoAli0244
Replying to CallumArcher0360

Our handler matches only the job label. The saved sequence reliably shows the earlier completion arriving after a new attempt begins and being attached to that new attempt

22 points
CA
CallumArcher0360
Replying to JoAli0244

Replay that sequence with explicit attempt matching. Give the harness a clock you advance deliberately; repeatable ordering should cover the race.

24 points
MI
MinaBennett0772
Replying to CallumArcher0360

@CallumArcher0360 It covers that order, not every race. A duplicate or a timeout followed by a late acknowledgement is a different sequence.

-3 points
CA
CallumArcher0360
Replying to MinaBennett0772

@MinaBennett0772 Fair. I meant this reproduced wrong match, not the whole class. Keep it as one named schedule and add duplicates and timeout-then-acknowledgement separately.

16 points
JO
JoAli0244
Replying to CallumArcher0360

For a duplicate, should our history keep both observations even if the completed count only changes once?

11 points
CA
CallumArcher0360
Replying to JoAli0244

Yes. Record the second observation as a duplicate without applying completion again. You want repeat delivery to leave the accepted result unchanged.

20 points
JU
JuliaBennett0761
Replying to CallumArcher0360

Is idempotent just another word for ignoring the second message? i'm not sure how that fits with retaining it in the history.

25 points
CA
CallumArcher0360
Replying to JuliaBennett0761

Same effect when applied again. You can observe and log the duplicate without repeating its business effect; those are different actions.

6 points
BE
BethBrooks0846
Replying to CallumArcher0360

@CallumArcher0360 On my setup, checking the final count alone let a repeated notification slip through. The stored number was correct even though another visible effect happened twice.

2 points
JO
JoAli0244
Replying to BethBrooks0846

I'll include our emitted notifications in the expected result, not just the count. A correct number with a doubled message would still be confusing

8 points
MI
MinaBennett0772
Replying to JoAli0244

And the timeout case? Waiting too long doesn't tell you whether the remote job completed.

5 points
JO
JoAli0244
Replying to MinaBennett0772

Unknown until matching evidence settles it. I don't want our harness teaching the application that timeout means safe to retry

18 points
CA
CallumArcher0360
Replying to JoAli0244

@JoAli0244 Then make that explicit in the schedule: advance past the timeout, assert unknown, deliver the queued acknowledgement, and apply only the transition it actually supports.

21 points
JU
JuliaBennett0761
Replying to CallumArcher0360

Should that delayed acknowledgement only establish acceptance? i think i've been reading acknowledgement as if it necessarily means completion.

23 points
CA
CallumArcher0360
Replying to JuliaBennett0761

@JuliaBennett0761 Follow your interface's definitions. If it acknowledges acceptance, it says nothing by itself about completion. Name those events differently in the test.

20 points
JO
JoAli0244
Replying to CallumArcher0360

I'll keep acceptance and completion separate in our fixtures. Our expected-state names need to be as clear as the incoming events

15 points
BE
BethBrooks0846
Replying to CallumArcher0360

@CallumArcher0360 My own supposedly deterministic harness still depended on a real timer in one component. Removing that dependency was necessary to make repeated schedules behave consistently.

13 points
JO
JoAli0244
Replying to BethBrooks0846

The job-only match explains our reproduced failure. I've got a deterministic starting case, but haven't established the wider delayed-event behaviour

21 points
CA
CallumArcher0360
Replying to JoAli0244

@JoAli0244 The saved wrong-match case is useful progress. It makes sense to keep the broader event handling open.

12 points

Add to the discussion

Welcome to Application Robot

Everyone can read the forum. Sign in or create an account to start a discussion, reply, or upload photos.

Forgot your password?

By creating an account, you agree to our Terms and Conditions and community guidelines. Read our Privacy Policy for how your information is handled.