Skip to content

Countable envelopes are never assigned event_seq #55

@nficano

Description

@nficano

The protocol and docs describe session-scoped event sequencing, but the typed wire structs have no event_seq field and the runtime never stamps one onto outbound envelopes. src/envelope.rs:56 and src/envelope.rs:185 define Envelope and RawEnvelope metadata without event_seq; src/runtime/server.rs:310 increments an internal emitted counter for ack flow control but sends the original envelope unchanged; and src/runtime/job.rs:200 exposes bump_event_seq even though the writer never calls it. As a result, clients cannot know what value to send in session.ack, JobSubscribedPayload.subscribed_from stays at zero for active jobs, history and from_event_seq cannot be implemented correctly, and README snippets that read env.event_seq do not match the API.

Fix prompt: Add an optional event_seq: u64 metadata field to both Envelope and RawEnvelope with serde defaults matching the other optional envelope fields. In the runtime writer, assign a strictly increasing session-scoped sequence to every MessageType::is_countable_event() envelope before persisting, publishing, and sending it, and update JobRegistry::bump_event_seq for job-scoped events so session.list_jobs and job.subscribed report the actual high-water mark. Add integration tests that assert countable events carry monotonic event_seq, non-countable session control messages do not, session.ack can use the observed value, and job subscription acknowledgements reflect the last emitted job event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:highHigh severity issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions