test(threads): a function is not its own caller, and a caller is not reachability #645

Merged
coilyco-ops merged 1 commit from qa/callers-not-reachability into main 2026-08-13 17:52:21 +00:00
Member

Lands a hardening commit that never had a pull request. My first description of this was wrong and I am correcting it here rather than editing it away.

What I claimed, and why it was wrong

I wrote that PR #641 "merged c11df60 while the branch tip was e472df8", and called it a stale merge in the shape of #506. The timestamps say otherwise:

17:43:41Z   PR #641 merged.  merge commit a7ac90f, second parent c11df60
17:45:41Z   e472df8 committed

The hardening was committed two minutes after the merge. The merge took the only commit that existed at the time and was entirely correct. The PR's head.sha reads e472df8 today only because I pushed to that branch afterwards, which moved the recorded head of an already-merged pull request.

So nothing was dropped. I pushed a follow-up to a branch whose PR had closed, and assumed it would be carried. That is my error, not the platform's, and the evidence was in git log the whole time.

What this PR actually does

The same change, on current main, with a pull request behind it.

productionCallers counted every non-test reference outside the declaration line, including a recursive call. A self-recursive function would have read as used by production with no production caller at all.

What it deliberately does not fix

IsGrantDenial     external production callers = 0
asGrantDenial     external production callers = 1   <- the caller is IsGrantDenial

asGrantDenial has a caller. That caller has none. The chain is dead at the root and a single-level count cannot see it.

The comment says so and names that pair, because the rule I wrote on #618a delegate is live if something outside it calls itpasses here and is still wrong. A helper that looks authoritative and cannot see reachability is worse than one that admits it.

No behaviour change to the guard. BindJobToThread does not reference itself.

Test-only.

Refs #618, #620

Lands a hardening commit that never had a pull request. **My first description of this was wrong and I am correcting it here rather than editing it away.** ## What I claimed, and why it was wrong I wrote that PR #641 "merged `c11df60` while the branch tip was `e472df8`", and called it a stale merge in the shape of https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/506. The timestamps say otherwise: ``` 17:43:41Z PR #641 merged. merge commit a7ac90f, second parent c11df60 17:45:41Z e472df8 committed ``` **The hardening was committed two minutes after the merge.** The merge took the only commit that existed at the time and was entirely correct. The PR's `head.sha` reads `e472df8` today only because I pushed to that branch afterwards, which moved the recorded head of an already-merged pull request. So nothing was dropped. I pushed a follow-up to a branch whose PR had closed, and assumed it would be carried. That is my error, not the platform's, and the evidence was in `git log` the whole time. ## What this PR actually does The same change, on current `main`, with a pull request behind it. `productionCallers` counted every non-test reference outside the declaration line, **including a recursive call**. A self-recursive function would have read as used by production with no production caller at all. ## What it deliberately does not fix ``` IsGrantDenial external production callers = 0 asGrantDenial external production callers = 1 <- the caller is IsGrantDenial ``` `asGrantDenial` has a caller. That caller has none. **The chain is dead at the root and a single-level count cannot see it.** The comment says so and names that pair, because the rule I wrote on https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/618 — *a delegate is live if something outside it calls it* — **passes here and is still wrong**. A helper that looks authoritative and cannot see reachability is worse than one that admits it. No behaviour change to the guard. `BindJobToThread` does not reference itself. Test-only. Refs https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/618, https://forgejo.coilysiren.me/coilyco-gaming/sirens-echo/issues/620
test(threads): a function's own body is not one of its callers
All checks were successful
ci / image-build (pull_request) Successful in 23s
ci / test (pull_request) Successful in 41s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
aa1e49b78e
Re-lands a commit that was on the branch and not in the merge. PR #641 merged
c11df60 while e472df8 was the tip, so the hardening never reached main. Same
shape as sirens-echo#506, where a force-push meant the reviewed branch and the
merged branch were different commits.

The helper counted every non-test reference outside the declaration line, which
includes a recursive call. A self-recursive function would have read as used by
production with no production caller at all.

Excluding its own body does not address the harder case, which is transitive.
asGrantDenial has one caller and that caller is IsGrantDenial, which has none,
so the chain is dead at the root and a single-level count cannot see it. The
comment says so and names that pair, because the rule I first wrote on
sirens-echo#618 - a delegate is live if something outside it calls it - passes
here and is still wrong.

No behaviour change to the guard. BindJobToThread does not reference itself.

Refs sirens-echo#618, sirens-echo#620

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/sirens-echo!645
No description provided.