Skip to content

State protocols: diagnostics on protocol tokens use IDisposable wording ("used after it is disposed") #393

Description

@PhysShell

Описание

The verdict codes on state-protocol tokens are correct, but the message text is the core's generic disposable wording. Real output from TB-MVP-01 (samples/OrderBackend/corpus/negative/C8_stale_draft.cs.txt):

OrderBackend/C8_stale_draft.cs:18: error: [OWN002] IDisposable local 'draft' is used after it is disposed [resource: disposable]

draft is a DraftOrder state token, not an IDisposable. "Disposed" here means "spent by the Submit transition". The line points to the region entry (OrderProtocol.WithDraft(...)), not to the line where the stale use happened.

Each code has the same wording problem:

code actual meaning needed wording
OWN002 use after a transition e.g. "state token 'draft' is used after a transition spent it (Submit, line N)"
OWN005 a copy is a move the token was copied, and the source is dead
OWN013 raw entity inside a region the entity is touched while a state of it is open
OWN001 a bound token never spent an open state never transitioned (see the affine-tokens issue)

The line should point to the offending use, not to the region entry.

Мотивация / сценарий

This is the main UX debt of the TB-MVP-01 typed EF workflow. The compiler errors are perfect: 'DraftOrder' does not contain a definition for 'Approve'. The Own.NET errors read as if the developer had a Dispose bug, so a user unfamiliar with the analyzer internals will not understand them. samples/OrderBackend/README.md currently has to explain the wording away in a separate paragraph.

Acceptance:

  • the protocol-token findings carry their own resource kind or wording, with a kind tag such as [resource: protocol-token], and the line of the actual violating use;
  • the codes do not change;
  • Python and Rust CLI output stays byte-identical, and the renders and ledgers are regenerated with their own writers;
  • messages for ordinary disposables do not change.

Альтернативы

  • Leave the core untouched and post-process the text in the CLI front. That is a hack, and it breaks the parity contract.
  • Introduce a separate TYP0xx family (P-010 open question 6). That is a bigger decision; this issue only needs the wording and the line.

Область

diagnostics (OWN-коды)

Refs: TB-MVP-01 (#391), docs/notes/tb-mvp-01-report.md section "What the slice does not claim".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions