Skip to content

Close a native Stream with its owner’s System Nexus command - #103

Closed
moetemp wants to merge 23 commits into
moe/jetty/v3/t14-no-auto-closefrom
moe/jetty/v3/t15-system-nexus-close
Closed

moetemp wants to merge 23 commits into
moe/jetty/v3/t14-no-auto-closefrom
moe/jetty/v3/t15-system-nexus-close

Conversation

@moetemp

@moetemp moetemp commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

This PR accepts a Workflow chain’s explicit close as a System Nexus command. The close takes effect after the Workflow Task commits, and the prototype records its terminal status.

This layer belongs to the frozen Jetty server prototype. The active Streams contract has no close operation and does not require a server change.

Current Streams design and project plan.

Reviewer's guide

Review this as a frozen prototype. The active Streams API uses a separate contract.

  1. Start with CloseFromRun in chasm/lib/stream/handler.go and its System Nexus route. Only the owning chain may close through a committed command.
  2. Read the failed-task and direct-close rejection cases in tests/stream_test.go. A failed Workflow Task must not close the Stream.

The server starts the operation only once the Workflow Task that issued it commits, so a failed
task closes nothing. The caller is the run in the operation's link, and the close goes in as its
Workflow Producer with no epoch.
A command's start always has the system callback and a direct call never has one. A direct call
waits for no Workflow Task to commit, so it gets stream_invalid and a pointer to the gRPC call.
A Local Activity writes before its Workflow Task commits, and a failed task can't take the close back. So only the close Activity or the System Nexus command closes.
The crate checks the owner first, so a caller that can't close gets stream_not_owner also after the close.
Outside a chain the Stream got the safety TTL with no chain check and no close. A Workflow create of a client Stream now changes the owner too, as the crate does.
A create has no task facts, so it withdrew a run's earlier tasks that a last read then hid. Its Superseded Record now has no epoch, as the crate's.
A page stopped after 10,000 entries of other Topics with no Record. A read with no wait took it for the end, and a parked read waited for a later append.
One append woke every parked read in one transaction and copied its batch into each. That could push the execution past the mutable state limit. Any other Workflow read now answers at once.
A wake whose create wait ended left the node abandoned, and every later create failed. A nested node has no execution of its own to replace.
The size cap dropped what a Workflow read from a client's Stream, and its replay then failed in a loop. An append that would drop a floor's range now fails, as on a Workflow Stream.
A wake outlived its run until the next write or its 7-day wait, so dead wakes filled stream.maxParkedReads.
The reset run carries the chain on, but the terminated run counted as the chain's end and closed the first run's Streams.
The active policy fails with NamespaceNotActive on a standby, and the queue retried the delete task with no end.
The namespace retention deleted the Activity and its Streams, though a closed Stream stays readable for its Retention. A closed host runs no Stream task, so the hold reads each Stream's expiry time.
A later run can't tell whether the first run has Streams, so every continue-as-new or retry chain end wrote the first run.
The server has its own copy of both rules, and nothing checked it against the crate's.
The stack already wrapped the chain-end code at 100. Two rows of upstream tables keep their gofmt alignment.
The helpers keep scan and ReadOrPark at or under their complexity before this round.
CHASM dropped the tasks of a Stream in a first run after continue-as-new or in a closed Activity. Its expiry, wake waits and readers check never ran, so the hold kept the host forever.
The fmt job runs go fix and fails on the loops it rewrites to slices.Backward and slices.Contains.
The replace points the module at api-go, so go mod tidy drops the upstream sums that Misc checks flags.
The golangci job failed on their complexity. The helpers keep the behavior.
@moetemp moetemp changed the title [Jetty] Closed a Workflow Stream from a System Nexus command of its chain. Close a native Stream with its owner’s System Nexus command Nov 27, 2026
@moetemp moetemp closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant