fix(steps): three things the real repos caught

Validating the reading against four real servers turned up three defects, all
in the walk and all visible in both readings:

- **A hop's span is only a hop's span when the call is the one we asked for.**
  An inline Express handler's edges carry the ROUTE's line — where the only
  call is `router.post('/users/login', async (req, res) => {` — so the read
  span covered the whole registration and every call in the handler counted as
  written inside it, and so as running first. express-realworld's login drew
  its 200 before the `login()` that produces it. A read that does not find the
  call it was asked for is now a bare position: no span, no `inside`.

- **A name-match the call as written disproves.** `crypto.createHash('sha256')
  .update(…)` in a Nest service kept only `update` in the index and matched it
  to the caller's own `AuthService.update` — and the login endpoint then read
  as though it updated the user, four extra replies and a session delete
  included. In this family a method of your own class is written `this.x(…)`,
  so a receiver that is not `this` proves the guess wrong; the call leaves the
  index instead. The endpoint goes from 15 steps to 6, all of them real.

- **A value with no calls of its own is lent the file's.** The gate counted any
  edge, and `const signIn = validatedAction(schema, async (data) => { … })`
  holds one plain `references` edge to its schema — so the whole server action
  went unlent and its picture had one call out of nine. Only edges the walk
  follows as behaviour count now, and next-saas-starter's `signIn` reads whole:
  the lookup, two early returns, `Promise.all` of session and activity log, and
  the redirect to /dashboard or the checkout session.

Also: an `elif` whose body raises does not mean the arm it is written in always
raises — FastAPI's `if not user: raise … elif not user.is_active: raise …` was
ending its own arm.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01REFyW9hmNrxhwN5wxRoAkC
This commit is contained in:
Colby McHenry
2026-08-29 13:46:01 -05:00
co-authored by Claude Opus 5
parent 7b6704a70d
commit 676030314a
3 changed files with 58 additions and 7 deletions
+14
View File
@@ -296,6 +296,20 @@ export async function save() {
expect(one[0]!.branch).not.toBe(two[0]!.branch);
});
it('does not call an arm an exit because a later elif raises', async () => {
const src = `
def handler(user):
if not user:
raise HTTPException(400)
elif not user.is_active:
raise HTTPException(400)
go(user)
`;
// The `elif` arm raises; the arm it is written in runs on to `go(user)`.
const after = await guardsInSource(src, 'python', lineOf(src, 'go(user)'), 4);
expect(after.map((g) => g.armExit ?? null)).toEqual(after.map(() => null));
});
it('reads a Swift guard as an exit', async () => {
const src = `
func load() {