Skip to content

Number the occurrences of non-idempotent method calls - #91

Merged
bolehan merged 1 commit into
masterfrom
bolekhan/method-call-occurrence-numbers
Aug 25, 2026
Merged

bolehan merged 1 commit into
masterfrom
bolekhan/method-call-occurrence-numbers

Conversation

@bolehan

@bolehan bolehan commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Identical method calls in a template share a single definition and a single value, which is wrong for a method whose repeated calls have to be evaluated separately.

A template factory now takes the names of such methods. Every call of one gets an OccurrenceNumber, its 1-based number among the identical calls registered on the same value, and that number is a part of the call identity, so such calls no longer share a definition. Calls of any other method are untouched and their OccurrenceNumber stays null.

A number belongs to a call site rather than to an evaluation: both arms of a condition get their own number and both have to be provided, a call in a loop body has a single number shared by all iterations, and two loops over one collection share a single definition for a call on the collection element.

Model validation now reports a model that provides more than one value for a call the template requires, instead of failing on a duplicate dictionary key.

Bumps the package version to 8.6.0.

Identical method calls in a template share a single definition and a single
value, which is wrong for a method whose repeated calls have to be evaluated
separately.

A template factory now takes the names of such methods. Every call of one gets an
OccurrenceNumber, its 1-based number among the identical calls registered on the
same value, and that number is a part of the call identity, so such calls no
longer share a definition. Calls of any other method are untouched and their
OccurrenceNumber stays null.

A number belongs to a call site rather than to an evaluation: both arms of a
condition get their own number and both have to be provided, a call in a loop
body has a single number shared by all iterations, and two loops over one
collection share a single definition for a call on the collection element.

Model validation now reports a model that provides more than one value for a call
the template requires, instead of failing on a duplicate dictionary key.

Bumps the package version to 8.6.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bolehan bolehan self-assigned this Aug 24, 2026
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Mindbox.Quokka.Abstractions 91% 88% 108
Mindbox.Quokka 84% 79% 2265
Summary 84% (5012 / 5982) 79% (988 / 1245) 2373

{
internal class AnalysisContext
{
private readonly HashSet<string> nonIdempotentMethodNames;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

А это правила либы, что без _ приваты?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Да, везде без подчёркиваний

@bolehan
bolehan merged commit 566bcdf into master Aug 25, 2026
1 check passed
@bolehan
bolehan deleted the bolekhan/method-call-occurrence-numbers branch August 25, 2026 08:48
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.

2 participants