position_of() not-found sentinel changed None -> -1, breaking router's `is None` guard
Tier 1 easy python · cross-file · authored, execution-grounded case
Ground-truth defects
The diff changes position_of()'s not-found sentinel from None to -1 (a plausible convention). The unchanged consumer router.route_for() still guards with `if idx is None`, so an unknown name no longer hits the default — it falls through to handlers[-1] and is silently routed to the LAST handler. No exception is raised; the break is only visible through the unchanged consumer router.py.
The change under review
diff
@@ -1,6 +1,6 @@ def position_of(items, target): - """Return the index of target in items, or None if it is not present.""" + """Return the index of target in items, or -1 if it is not present.""" for i, item in enumerate(items): if item == target: return i - return None + return -1
Leaderboard for this case
easy · 9 of 9 bots fully caught it (100% solve rate) · 100% avg coverage.
| # | Bot | Result | Caught | Coverage | Findings | False alarms |
|---|---|---|---|---|---|---|
| 1 | Claude Code (Opus 5.5) | solved | 1/1 | 100.0% | 2 | 0 |
| 2 | Cubic | solved | 1/1 | 100.0% | 1 | 0 |
| 3 | cursor | solved | 1/1 | 100.0% | 1 | 0 |
| 4 | Drape (Deep Review) | solved | 1/1 | 100.0% | 1 | 0 |
| 5 | Drape (Review) | solved | 1/1 | 100.0% | 1 | 0 |
| 6 | greptile | solved | 1/1 | 100.0% | 1 | 0 |
| 7 | Mjolnir (Opus 5.5) | solved | 1/1 | 100.0% | 2 | 0 |
| 8 | Mjolnir (Sonnet 5.5) | solved | 1/1 | 100.0% | 2 | 0 |
| 9 | qodo | solved | 1/1 | 100.0% | 1 | 0 |
Bot results
Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
The change switched the not-found sentinel from None to -1. router.py still checks `if idx is None`, so an unknown name now falls through to handlers[-1] and silently returns the last handler instead of "default". [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
position_of now returns -1 instead of None when the name isn't found, but route_for still checks `idx is None`. That check is never true any more, so an unknown route name skips the 'default' branch and returns handlers[-1]. That is the last registered handler, so requests for unknown routes silently go to the wrong handler (or raise IndexError if handlers is empty). Either update the caller to check `idx == -1` (or `idx < 0`), or keep returning None.
Using -1 as the 'not found' value is risky in Python because -1 is a valid index (the last element). Any caller that indexes with the result without checking it first gets the last element instead of an error, which is exactly the bug in router.py. None fails loudly when used as an index, so it is the safer value to return.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
raw comments (2)
<!-- cubic:v=144878ec-ed14-455d-b249-873003598aa4 -->
<!-- cubic:review-run=a23ff391-3b84-53e1-8b54-70e5122871af -->
<!-- metadata:{"confidence":10} -->
P1: When `target` is absent, `position_of` now returns `-1`, but `route_for` still checks for `None`; unknown routes therefore select `handlers[-1]` instead of the default handler. Update the caller's sentinel check (and any other callers) to handle `-1`, or preserve the existing `None` contract.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At lookup.py, line 6:
<comment>When `target` is absent, `position_of` now returns `-1`, but `route_for` still checks for `None`; unknown routes therefore select `handlers[-1]` instead of the default handler. Update the caller's sentinel check (and any other callers) to handle `-1`, or preserve the existing `None` contract.</comment>
<file context>
@@ -1,6 +1,6 @@
if item == target:
return i
- return None
+ return -1
</file context>
```
</details>
<!-- cubic:review-summary:start -->
**1 issue found** across 1 file
<!-- cubic:review-summary:end -->
<details>
<summary>Prompt for AI agents (unresolved issues)</summary>
```text
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lookup.py">
<violation number="1" location="lookup.py:6">
P1: When `target` is absent, `position_of` now returns `-1`, but `route_for` still checks for `None`; unknown routes therefore select `handlers[-1]` instead of the default handler. Update the caller's sentinel check (and any other callers) to handle `-1`, or preserve the existing `None` contract.</violation>
</file>
```
</details>
<sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/6/ai_pr_review_github_delivery_35926afe9d6ef75cb2c407bbe73ad94044f794fdcf80369fc14a375eac57c43a?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F6)</sub>
<!-- cubic:review-post:ai_pr_review_github_delivery_35926afe9d6ef75cb2c407bbe73ad94044f794fdcf80369fc14a375eac57c43a:d8ba70e1c8b5282527d2114bd0c657637d93c56e:a23ff391-3b84-53e1-8b54-70e5122871af -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
raw comments (2)
### Sentinel change breaks missing-route handling
**High Severity**
<!-- DESCRIPTION START -->
`position_of` now returns `-1` when the target is missing, but `route_for` still treats absence as `None`. Because `-1` is a valid Python index, unknown names skip the default path and resolve to the last handler instead of `"default"`.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: a0a993f5-af47-453b-a2e2-450a791aca9c -->
<!-- LOCATIONS START
lookup.py#L5-L6
lookup.py#L1-L2
LOCATIONS END -->
<details>
<summary>Additional Locations (1)</summary>
- [`lookup.py#L1-L2`](https://github.com/drape-io/crbench-cursor-2026-09/blob/43310488dcaf9538079e7227b1b71e43eb79185c/lookup.py#L1-L2)
</details>
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmYzN2M4MjRlLWQ1ODEtNGVlMi1iMzI2LWIxMjM3MWQyOWZjZSIsImVuY3J5cHRpb25LZXkiOiJCS2Y2WUFJVXFaZTJ0MGtzOFJsazN0cm1kSnZjX29oVnhyT2dvT3NfNmwwIiwiYnJhbmNoIjoidDEtcHktc2VudGluZWwtbm9uZS10by1taW51cy1vbmUiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmYzN2M4MjRlLWQ1ODEtNGVlMi1iMzI2LWIxMjM3MWQyOWZjZSIsImVuY3J5cHRpb25LZXkiOiJCS2Y2WUFJVXFaZTJ0MGtzOFJsazN0cm1kSnZjX29oVnhyT2dvT3NfNmwwIiwiYnJhbmNoIjoidDEtcHktc2VudGluZWwtbm9uZS10by1taW51cy1vbmUiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByTnVtYmVyIjo2LCJjb21taXRTaGEiOiI0MzMxMDQ4OGRjYWY5NTM4MDc5ZTcyMjdiMWI3MWU0M2ViNzkxODVjIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 43310488dcaf9538079e7227b1b71e43eb79185c. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_REVIEW -->
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
<!-- BUGBOT_FIX_ALL -->
<a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo4OTFkZjE1ZS04NTA1LTQ1Y2QtYjZiNS1kNTY4MjNhNWNkYTkiLCJlbmNyeXB0aW9uS2V5IjoiempMa25qSFpYTzZYODFQTVp1TnFNX3JCRXJSd1MwNXRaZ2pnYUxUMFJKSSIsImJyYW5jaCI6InQxLXB5LXNlbnRpbmVsLW5vbmUtdG8tbWludXMtb25lIiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
<!-- /BUGBOT_FIX_ALL -->
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
<sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 43310488dcaf9538079e7227b1b71e43eb79185c. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
raw comments (1)
**Unknown routes get the last handler, not default**
`route_for` still checks `idx is None`, so the new -1 return slips past it and `handlers[-1]` picks the last registered handler for any unknown name. Update `route_for` to check `idx == -1` (or keep returning None).
```
lookup.py:6 return -1
lookup.py:2 """Return the index of target in items, or -1 if it is not present."""
router.py:7 if idx is None:
router.py:8 return "default"
router.py:9 return handlers[idx]
```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
raw comments (1)
**Unknown routes no longer return default handler**
position_of now returns -1 when not found, but route_for still checks `idx is None`. The check never matches, so handlers[-1] (the last handler) is returned instead of "default". Change the check to `idx == -1` (or `idx < 0`).
```
lookup.py:1 def position_of(items, target):
lookup.py:2 """Return the index of target in items, or -1 if it is not present."""
lookup.py:3 for i, item in enumerate(items):
lookup.py:4 if item == target:
router.py:7 if idx is None:
router.py:8 return "default"
router.py:9 return handlers[idx]
```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
raw comments (2)
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Missing routes select last handler**
When `target` is absent, this now returns `-1`, but `route_for` still checks whether the result is `None`. The missing-route path therefore indexes `handlers[-1]` and returns the last registered handler instead of `"default"`. Update the caller to recognize the new sentinel as part of this change.
<h3>Greptile Summary</h3>
This PR changes `position_of` to return `-1` instead of `None` when the target is absent.
- Updates the helper's docstring to describe the new sentinel.
- Leaves its caller using the previous sentinel contract, causing missing routes to resolve to the final handler.
<h3>Confidence Score: 4/5</h3>
The PR is not safe to merge until the existing caller is updated to recognize the new not-found sentinel.
A missing route now produces `-1`, bypasses the caller's `None` check, and incorrectly selects the final handler through Python's negative indexing.
**Files Needing Attention:** lookup.py
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| lookup.py | Changes the not-found sentinel to `-1` without updating the existing caller that checks for `None`. |
</details>
<details open><summary><h3>Flowchart</h3></summary>
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Route name is absent] --> B[position_of returns -1]
B --> C{idx is None?}
C -->|No| D[Access handlers at index -1]
D --> E[Return last handler instead of default]
```
</details>
<!-- greptile_other_comments_section -->
<sub>Reviews (1): Last reviewed commit: ["Update lookup.py"](https://github.com/drape-io/crbench-greptile-2026-09/commit/b23d691cb435e5aa4788b2b4eb9feff02afd4f36) | [Re-trigger Greptile](https://app.greptile.com/api/retrigger?id=64284114)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
The change makes position_of return -1 instead of None when the target is missing. route_for in router.py still checks `if idx is None:`, so for an unknown name it now returns handlers[-1], the last handler, instead of "default". [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
[P1] Caller still checks for `None`, so unknown routes pick the last handler
`position_of` now returns `-1` instead of `None` when the target is missing, but `route_for` in `router.py:7-9` still checks `if idx is None`. Any unknown name now skips that check and reaches `handlers[-1]`. Python reads index `-1` as the last element, so unknown routes quietly get the last registered handler instead of `"default"`, and nothing raises an error. Either keep the `None` sentinel or change the caller to check `idx == -1` in the same change.
[P1] The caller still checks for `None`, so unknown routes return the last handler.
`position_of` now returns `-1` when the target is missing, but `route_for` in router.py:7 still tests `if idx is None:` to decide when to return `"default"`. For any name not in `routes`, that check is now false and the function returns `handlers[-1]`. That is the last registered handler, so an unknown route is silently sent to a real handler instead of the default, with no error raised. Either keep returning `None` here or update the caller to check `idx == -1` (or `idx ‹ 0`).
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
position_of now returns -1 on a miss. route_for in router.py still checks `if idx is None`, which can never be true now, so an unknown name falls through to handlers[-1]. That returns the last handler, or raises IndexError when handlers is empty. The change caused this by breaking the contract that this caller, which it did not modify, relies on. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
[P1] Caller still checks for `None`, so missing names now return the last handler
(change in lookup.py:1-6) `position_of` now returns `-1` when the target is absent, but its only caller, `route_for` in router.py, still tests `if idx is None:`. That check never fires. For any name not in `routes`, `handlers[-1]` is returned, which is the last handler (or an `IndexError` if `handlers` is empty). The correct "default" is never returned. The caller needs to be updated to test for `-1`, for example `idx == -1` or `idx ‹ 0`. The sentinel change is silent, so this regression would go unnoticed.
[P1] Caller still checks for None, so missing names now index handlers[-1]
(anchored to lookup.py:6) `position_of` now returns -1 instead of None when the target is absent, but `route_for` in router.py still does `if idx is None: return "default"`. That check can no longer be true, so for an unknown name `route_for` falls through to `handlers[-1]`. It returns the last handler instead of "default", or raises IndexError if `handlers` is empty. This happens for every lookup miss. `router.py` is the only caller of `position_of`, and the diff didn't update it (for example to `idx == -1` or `idx ‹ 0`).
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | high | ✓ | exact |
raw comments (3)
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
1\. Unknown routes select the last handler <code>🐞 Bug</code> <code>≡ Correctness</code>
<pre>
<b><i>route_for</i></b> still checks <b><i>idx is None</i></b> after <b><i>position_of</i></b> now returns <b><i>-1</i></b> for missing names. When
a route is unknown, Python uses <b><i>handlers[-1]</i></b> and dispatches the final handler instead of returning
the default; an empty handler list instead raises <b><i>IndexError</i></b>.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
`position_of` now returns `-1` when the target is absent, but `router.route_for` still checks for `None`. Unknown routes therefore select `handlers[-1]` or raise `IndexError` for an empty handler list instead of returning the default.
## Fix Focus Areas
- router.py[4-9]
- lookup.py[1-6]
## Recommended Fix
Change `route_for` to test `idx == -1` (or otherwise use the updated sentinel contract) before indexing `handlers`. Add tests covering an unknown route with multiple handlers and with an empty handler list, verifying that both return `"default"`.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<h3>Code Review by Qodo</h3>
<code>🐞 Bugs (1)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. Unknown routes select the last handler <code>🐞 Bug</code> <code>≡ Correctness</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>route_for</i></b> still checks <b><i>idx is None</i></b> after <b><i>position_of</i></b> now returns <b><i>-1</i></b> for missing names. When
>a route is unknown, Python uses <b><i>handlers[-1]</i></b> and dispatches the final handler instead of returning
>the default; an empty handler list instead raises <b><i>IndexError</i></b>.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[lookup.py[6]](https://github.com/drape-io/crbench-qodo-2026-09/pull/6/files#diff-3ac380b60e78aa4898f26168cc492158edb945c8294d135b685467cba67a1bcaR6-R6)</code>
>
>```diff
>+ return -1
>```
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>`position_of` now returns `-1` when the target is absent, but `router.route_for` still checks for `None`. Unknown routes therefore select `handlers[-1]` or raise `IndexError` for an empty handler list instead of returning the default.
>
>## Fix Focus Areas
>- router.py[4-9]
>- lookup.py[1-6]
>
>## Recommended Fix
>Change `route_for` to test `idx == -1` (or otherwise use the updated sentinel contract) before indexing `handlers`. Add tests covering an unknown route with multiple handlers and with an empty handler list, verifying that both return `"default"`.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-context:start -->
<details><summary><strong>Context sources</strong></summary>
<div>Review mode: <code>🚀 Fast</code>: This is a small, localized behavioral change to a single lookup function, with no security or broad compatibility-sensitive scope.</div>
<!-- qodo-context:end -->
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:start -->
<details>
<summary><strong>Tip of the day</strong></summary>
<br/>
<pre>💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper</pre>
<a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:end -->
<!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/c1a3f966b6047b3483a1b88b6e2f0520c314f778 -->
<a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>
<h3>PR Summary by Qodo</h3>
Return -1 when lookup targets are missing
<code>✨ Enhancement</code> <code>🕐 Less than 10 minutes</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<details>
<summary>AI Description</summary>
<dl>
<dd>
<br/>
><pre>
>• Changes the missing-target sentinel from <b><i>None</i></b> to <b><i>-1</i></b>.
>• Aligns <b><i>position_of</i></b> documentation with its new return contract.
></pre>
</dd>
</dl>
</details>
<details>
<summary>Diagram</summary>
<dl>
<dd>
<br/>
```mermaid
sequenceDiagram
participant R as Router
participant L as Lookup
participant H as Handlers
R->>L: Find route name
alt Target found
L-->>R: Return index
R->>H: Select indexed handler
H-->>R: Return handler
else Target missing
L-->>R: Return -1
R->>H: Select last handler
H-->>R: Return last handler
end
```
</dd>
</dl>
</details>
<details>
<summary>High-Level Assessment</summary>
<dl>
<dd>
<br/>
>The following are alternative approaches to this PR:
<details>
<summary><b>1. Coordinate caller migration</b></summary>
<dl>
<dd>
- ➕ Establishes the requested -1 contract safely
- ➕ Prevents missing values from becoming valid negative indexes
- ➖ Requires updating and testing every caller
</dd>
</dl>
</details>
<details>
<summary><b>2. Retain None sentinel</b></summary>
<dl>
<dd>
- ➕ Preserves compatibility with existing callers
- ➕ Clearly distinguishes absence from every valid integer index
- ➖ Does not provide the requested -1 behavior
- ➖ Requires callers to handle an optional return value
</dd>
</dl>
</details>
<details>
<summary><b>3. Raise an exception</b></summary>
<dl>
<dd>
- ➕ Makes missing-target handling explicit
- ➕ Eliminates ambiguous sentinel values
- ➖ Introduces a larger API behavior change
- ➖ Requires exception handling at every expected miss
</dd>
</dl>
</details>
>**Recommendation:** Use `-1` only as part of a coordinated migration: update callers such as `router.py` to test for `-1` before indexing and add found/missing-target tests. As submitted, the sentinel change is unsafe because Python interprets `handlers[-1]` as the final handler.
</dd>
</dl>
</details>
<details>
<summary> Files changed (1) <code> +2 / -2 </code> </summary>
<dl>
<dd>
<br/>
<details>
<summary>Enhancement (1) <code> +2 / -2 </code></summary>
<dl>
<dd>
<details>
<summary>lookup.py<code>Return -1 for missing targets</code> <code>+2/-2</code></summary>
<br/>
>Return -1 for missing targets
>
><pre>
>• Changes 'position_of' to return '-1' instead of 'None' when the target is absent. Updates the docstring to document the revised return contract.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/6/files#diff-3ac380b60e78aa4898f26168cc492158edb945c8294d135b685467cba67a1bca'>lookup.py</a>
</details>
</dd>
</dl>
</details>
</dd>
</dl>
</details>