Skip to content

Fix README API drift against current Cleipnir.NET surface#7

Open
stidsborg wants to merge 1 commit intomainfrom
fix-readme-api-docs
Open

Fix README API drift against current Cleipnir.NET surface#7
stidsborg wants to merge 1 commit intomainfrom
fix-readme-api-docs

Conversation

@stidsborg
Copy link
Copy Markdown
Owner

Summary

README snippets had drifted from the actual API in Cleipnir/Flow.cs and Cleipnir.ResilientFunctions. Three of them would no longer compile, one had wrong semantics, and a few were structurally inconsistent with the working samples under Samples/ and Cleipnir.Tests/.

Concrete fixes:

  • Won't-compile fixes
    • new InitialEffect("TransactionId", transactionId)new InitialEffect(Id: 0, Value: transactionId, Alias: "TransactionId")InitialEffect's first parameter is int Id (Cleipnir.ResilientFunctions/.../InitialState.cs:16).
    • controlPanel.Restart(...)controlPanel.ScheduleRestart(...).Completion() — the method on ControlPanel<TReturn> is ScheduleRestart (ControlPanel.cs:304); matches the pattern used in every sample/test.
    • Effects.Remove("ShipProducts")Effects.Remove(shipProductsEffectId)Remove takes int/EffectId (ExistingEffects.cs:91); mirrors Samples/Cleipnir.Sample.Presentation.AspNet/Controllers/OrderController.cs:36.
  • Misleading example
    • Replaced await Message<FundsReserved>(waitFor: TimeSpan.FromMinutes(5)) in the "Messages" abstraction intro with await Message<FundsReserved>(). The waitFor overload returns a nullable timeout result, which the example then ignored — every other example in the doc and the samples uses the parameterless form.
  • Structural cleanups
    • The four public async Task ProcessOrder(Order order) methods in "Distributed system challenges" don't override Flow<TParam>.Run(TParam); renamed each to public override async Task Run(Order order) to match the rest of the doc.
    • Added the missing closing } on the second message-brokered OrderFlow example.

No code paths changed — README only.

Test plan

  • Render the README on GitHub and skim the changed snippets
  • Spot-check that updated snippets line up with current sample code (Samples/Cleipnir.Sample.Presentation.AspNet/Controllers/OrderController.cs, Samples/Cleipnir.Samples.Console/RestartFlow/Example.cs, Cleipnir.Tests/Flows/FunctionRegistrationTests.cs)

🤖 Generated with Claude Code

The README contained several snippets that no longer compile against
the actual API in Cleipnir/Flow.cs and Cleipnir.ResilientFunctions:

- InitialEffect's first parameter is int Id, not string — pass the
  effect name via the Alias parameter instead
- ControlPanel exposes ScheduleRestart(...).Completion(), not Restart()
- ExistingEffects.Remove takes int/EffectId, not a string name
- Flow<TParam> requires overriding Run(TParam), but the
  "Distributed system challenges" snippets defined a non-overriding
  ProcessOrder method
- Lead Messages-abstraction example used the timeout overload, which
  returns a nullable and contradicts every other example in the doc
- Closing class brace missing from the second message-brokered example

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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