Skip to content

feat: count exclusive candidates dropped for invalid route shape - #445

Merged
tamaralipows merged 2 commits into
mainfrom
tnl/exclusive-route-rejection-metric
Aug 20, 2026
Merged

feat: count exclusive candidates dropped for invalid route shape#445
tamaralipows merged 2 commits into
mainfrom
tnl/exclusive-route-rejection-metric

Conversation

@tamaralipows

@tamaralipows tamaralipows commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

An exclusive leg that does not reach the route's output token makes the candidate unusable, so no commitment is made and the order falls back to public liquidity. That happened silently.

exclusive_route_invalid_shape_total counts it:

if !reaches_output {
    counter!("exclusive_route_invalid_shape_total").increment(1);
    return false;
}

It counts only the wrong-position case, not routes that carry no exclusive leg at all — those are pools routing around the exclusive components, not rejections, and they would swamp the series.

The counter fires per exclusive-scope candidate, not per order. An order served by several exclusive-scope pools contributes several increments.

🤖 Generated with Claude Code

@tamaralipows

Copy link
Copy Markdown
Contributor Author

Reopening. The shape rule is still on main, so this is the number that sizes whether removing it is worth doing.

#446 sketched the removal and was closed on cost: the conversion is a bisection over route replays, and a vm:* pool downstream of the exclusive leg makes those replays expensive against the 1000 ms router budget. non_terminal_exclusive_leg here says how often that case actually arises, which decides whether the cheaper version is worth building.

@tamaralipows
tamaralipows marked this pull request as ready for review August 20, 2026 19:20
@tamaralipows
tamaralipows force-pushed the tnl/exclusive-route-rejection-metric branch from 2d9a575 to 76f8f4f Compare August 20, 2026 19:35
@github-actions

Copy link
Copy Markdown

Breaking API Changes Detected

This PR introduces breaking API changes, but the PR title does not declare them.
Either fix the breaking changes, or declare them:

  • Append ! to the PR title type (e.g. feat!: ...) and make sure a !-marked commit
    lands on main — release-plz bumps the minor version for breaking changes on 0.x.x.
semver-checks output
error: failed to load rustdoc from file at `"target/doc/fynd_core.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/fynd_core.json
    (supported formats are v55, v56, v57)
error: failed to load rustdoc from file at `"target/doc/fynd_test_fixtures.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/fynd_test_fixtures.json
    (supported formats are v55, v56, v57)
error: failed to load rustdoc from file at `"target/doc/fynd_rpc.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/fynd_rpc.json
    (supported formats are v55, v56, v57)
error: failed to load rustdoc from file at `"target/doc/fynd_rpc_types.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/fynd_rpc_types.json
    (supported formats are v55, v56, v57)
error: failed to load rustdoc from file at `"target/doc/fynd_client.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/fynd_client.json
    (supported formats are v55, v56, v57)
error: failed to load rustdoc from file at `"target/doc/fynd_tools_common.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/fynd_tools_common.json
    (supported formats are v55, v56, v57)
error: failed to load rustdoc from file at `"target/doc/erc20_overrides.json"`

Caused by:
    unsupported rustdoc format v60 for file: target/doc/erc20_overrides.json
    (supported formats are v55, v56, v57)

An exclusive leg that does not reach the route's output token makes the
candidate unusable, so no commitment is made and the order falls back to
public liquidity. That happened silently.

`exclusive_route_invalid_shape_total` counts it, which sizes how much
exclusive liquidity the shape rule turns away.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tamaralipows tamaralipows changed the title feat: count why exclusive candidates fail the route shape check feat: count exclusive candidates dropped for invalid route shape Aug 20, 2026
@tamaralipows
tamaralipows force-pushed the tnl/exclusive-route-rejection-metric branch from 76f8f4f to dd16584 Compare August 20, 2026 19:41
@tamaralipows
tamaralipows enabled auto-merge August 20, 2026 19:44
@tamaralipows
tamaralipows merged commit 41a3dd9 into main Aug 20, 2026
17 of 18 checks passed
@tamaralipows
tamaralipows deleted the tnl/exclusive-route-rejection-metric branch August 20, 2026 19: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