Skip to content

fix: give StateMachine, Client and Manager one protocol policy - #148

Merged
gomaja merged 1 commit into
mainfrom
feat/i143-converge-core-options
Oct 16, 2026
Merged

gomaja merged 1 commit into
mainfrom
feat/i143-converge-core-options

Conversation

@gomaja

@gomaja gomaja commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Since the three front ends moved onto the shared protocol core, fifteen
Manager-only core options and two Manager adapter remaps kept Manager's
older error and correlation policies where StateMachine and Client did
something else. Twelve options and both remaps are gone, so
each input now gets one disposition in every front end. The three
options that remain decide who closes the connection after a message
error: the core for natively admitted StateMachine and Client
connections, the reader for Manager and externally admitted ones. The
core's own phase and timers follow from that choice: one decision marks
the connection terminal and selects whether a required reply closes it
once written, and the write's completion then terminates it. The core
options are now documented that way.

Behaviour changes, by the front end whose users see them:

  • StateMachine and Client answer a repeated CER that carries a fatal
    decoding error, such as an invalid AVP length, with an error CEA
    before they close, as Manager did, so the peer learns why the
    connection ends (RFC 6733 section 7). Settings.OnCEA runs for that
    error CEA. A repeated CER without a fatal decoding error is still
    ignored.
  • StateMachine and Client keep a fatal decoder error fatal when a base
    header error decides the Result-Code: they send the answer a request
    requires, report Closing and close, as for every other fatal message
    error.
  • StateMachine and Client report a fatal error received during Closing
    as fatal; Closing timers, replies and the connection are unchanged.
  • StateMachine and Client check a DWA's Origin-Host and Origin-Realm
    before its Result-Code, as DPA matching does, so an unsuccessful DWA
    from the wrong peer is reported as invalid, not as a rejected probe.
  • StateMachine, Client and Manager report a well-formed DWA that answers
    no outstanding DWR as an unexpected message with Result-Code 0 and the
    correlation detail (RFC 6733 section 3). StateMachine and Client log
    it as "sm: DWA identifiers mismatch; answer discarded" and no longer
    call the invalid-answer watchdog hook for it.
  • Client and dialed Manager discard a CEA whose identifiers do not match
    the pending CER as an unexpected message (RFC 6733 section 3). Manager
    no longer fails the handshake with a CEA rejection for it. If the CEA
    also carries a fatal decoding error, the connection still ends:
    Client's core fails the handshake and closes, Manager's reader closes,
    and both report Closing. Without a fatal error the pending CER keeps
    its deadline.
  • Dialed Manager discards a CEA that arrives after the handshake by
    ownership, silently for an exact duplicate, instead of validating it.
  • Manager reports a DPA that answers no outstanding DPR during Closing
    as an unexpected message rather than InvalidDPA, as StateMachine and
    Client do.
  • Manager derives the header Result-Code for a decoded first message
    that is not a CER, and keeps the decoder's code for a reported
    decoding error.
  • Manager classifies an invalid-header request during Closing as
    InvalidHeader rather than MalformedMessage.
  • Manager resets Tw when it receives a message with a valid header and a
    fatal body error, without watchdog credit (RFC 3539 section 3.4.1).
  • Manager.Close rejects a Disconnect-Cause outside 0-2 (RFC 6733 section
    5.4.3) before any shutdown step, also on a Manager that is already
    closed, with the error StateMachine.Disconnect returns.
  • StateMachine and Client keep the standard fmt wrapper around a failed
    error-answer build in the error they record.

New TCP parity tests cover each change through StateMachine (accepted
and Client) and Manager (accepted and dialed). A run of 6,100 shared
scenarios against main differs only where listed above, and bytes and
allocations per exchange are at or below main.

Closes #143.


Summary by cubic

Consolidates the error and correlation policy across StateMachine, Client, and Manager by removing fifteen Manager-only core options and two adapter remaps; each input now gets one disposition in every frontend. Only the ownership of connection closure after a message error still differs: the core for natively admitted StateMachine and Client connections, the reader for Manager and externally admitted ones.

Behavior changes users will see

  • StateMachine and Client answer a repeated CER carrying a fatal decoding error with an error CEA before closing, as Manager did, so the peer learns why the connection ends.
  • StateMachine and Client now report fatal errors received during Closing as fatal and preserve decoder fatality when a base header error sets the Result-Code.
  • A well-formed DWA or DPA that answers no outstanding request is now an unexpected message with Result-Code 0 in all frontends; StateMachine and Client no longer call the invalid-answer watchdog hook for it.
  • Client and dialed Manager discard a CEA whose identifiers do not match the pending CER as an unexpected message instead of failing the handshake; a fatal decoding error still ends the connection.
  • Manager.Close rejects a Disconnect-Cause outside 0–2 before any shutdown step, also on a Manager that is already closed.

New TCP parity tests cover each change; a run of 6,100 shared scenarios differs from main only in the listed behavior, at or below main's bytes and allocations per exchange.

Closes #143.

Written for commit 7160472. Summary will update on new commits.

View guided diff Turn on auto-fix

Since the three front ends moved onto the shared protocol core, fifteen
Manager-only core options and two Manager adapter remaps kept Manager's
older error and correlation policies where StateMachine and Client did
something else. Twelve options and both remaps are gone, so
each input now gets one disposition in every front end. The three
options that remain decide who closes the connection after a message
error: the core for natively admitted StateMachine and Client
connections, the reader for Manager and externally admitted ones. The
core's own phase and timers follow from that choice: one decision marks
the connection terminal and selects whether a required reply closes it
once written, and the write's completion then terminates it. The core
options are now documented that way.

Behaviour changes, by the front end whose users see them:

- StateMachine and Client answer a repeated CER that carries a fatal
  decoding error, such as an invalid AVP length, with an error CEA
  before they close, as Manager did, so the peer learns why the
  connection ends (RFC 6733 section 7). Settings.OnCEA runs for that
  error CEA. A repeated CER without a fatal decoding error is still
  ignored.
- StateMachine and Client keep a fatal decoder error fatal when a base
  header error decides the Result-Code: they send the answer a request
  requires, report Closing and close, as for every other fatal message
  error.
- StateMachine and Client report a fatal error received during Closing
  as fatal; Closing timers, replies and the connection are unchanged.
- StateMachine and Client check a DWA's Origin-Host and Origin-Realm
  before its Result-Code, as DPA matching does, so an unsuccessful DWA
  from the wrong peer is reported as invalid, not as a rejected probe.
- StateMachine, Client and Manager report a well-formed DWA that answers
  no outstanding DWR as an unexpected message with Result-Code 0 and the
  correlation detail (RFC 6733 section 3). StateMachine and Client log
  it as "sm: DWA identifiers mismatch; answer discarded" and no longer
  call the invalid-answer watchdog hook for it.
- Client and dialed Manager discard a CEA whose identifiers do not match
  the pending CER as an unexpected message (RFC 6733 section 3). Manager
  no longer fails the handshake with a CEA rejection for it. If the CEA
  also carries a fatal decoding error, the connection still ends:
  Client's core fails the handshake and closes, Manager's reader closes,
  and both report Closing. Without a fatal error the pending CER keeps
  its deadline.
- Dialed Manager discards a CEA that arrives after the handshake by
  ownership, silently for an exact duplicate, instead of validating it.
- Manager reports a DPA that answers no outstanding DPR during Closing
  as an unexpected message rather than InvalidDPA, as StateMachine and
  Client do.
- Manager derives the header Result-Code for a decoded first message
  that is not a CER, and keeps the decoder's code for a reported
  decoding error.
- Manager classifies an invalid-header request during Closing as
  InvalidHeader rather than MalformedMessage.
- Manager resets Tw when it receives a message with a valid header and a
  fatal body error, without watchdog credit (RFC 3539 section 3.4.1).
- Manager.Close rejects a Disconnect-Cause outside 0-2 (RFC 6733 section
  5.4.3) before any shutdown step, also on a Manager that is already
  closed, with the error StateMachine.Disconnect returns.
- StateMachine and Client keep the standard fmt wrapper around a failed
  error-answer build in the error they record.

New TCP parity tests cover each change through StateMachine (accepted
and Client) and Manager (accepted and dialed). A run of 6,100 shared
scenarios against main differs only where listed above, and bytes and
allocations per exchange are at or below main.

Closes #143.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 19:12
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-16T19:12:24.939892Z 7160472 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 891b57be-90ea-4992-9325-7523849ab614
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gomaja
gomaja merged commit c448174 into main Oct 16, 2026
2 checks passed
@gomaja
gomaja deleted the feat/i143-converge-core-options branch October 16, 2026 19:50
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.

core: converge the Manager-only protocol core options

2 participants