Skip to content

test(studio): every bound method is recorded in an allowlist file, and the entry must agree with the code - #751

Merged
pbertsch merged 8 commits into
mainfrom
test/bound-guard
Nov 17, 2026
Merged

pbertsch merged 8 commits into
mainfrom
test/bound-guard

Conversation

@pbertsch

Copy link
Copy Markdown
Member

Summary

Test-only plus one data file. Every exported App method is callable from the window and, in the headless build, from a page script with the bridge token, so adding one is a decision. The decision table already existed in the test as a Go map with a category; it is now studio/bound_methods.json, the one place decisions are written, with one entry per method:

  • category, does (one sentence), callers (window, bridge, automation), touches (files, devices, network, keychain) and confirm (none, asks, answers, native-dialog).

bound_methods_test.go reads the file (the other tests use the same data) and fails:

  • for a new method with no entry, and the message prints the entry to add;
  • for an entry whose method no longer exists;
  • when an entry contradicts the code: callers against the headless bridge's block list and the automation endpoint's method set, a secret that touches no keychain, a pure method that touches something, a run (RunFile*) that does not ask, a window-only preference that is not native-dialog, unknown values, a duplicate entry.

Mutants

Run against the real code and file: a new method with no entry, an entry removed, a stale entry, a secret whose touches were emptied, a run whose confirm was set to none: all killed. A second test runs the check on 12 deliberately wrong inputs (including the message naming the method and the entry to add).

Writing the 67 entries meant stating what each touches, and one was wrong in my first pass (CheckReplaceLine reads nothing from disk), which the check caught. No production code changes.

Test plan

  • go test -race ./studio (whole package)
  • mutants as above
  • disclosure scan

🤖 Generated with Claude Code

https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF

…d the entry must agree with the code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
@pbertsch
pbertsch requested a review from a team as a code owner November 17, 2026 04:12
@pbertsch
pbertsch merged commit 59e58d4 into main Nov 17, 2026
10 of 11 checks passed
jay23606 added a commit to jay23606/flutter-probe that referenced this pull request Nov 17, 2026
…d the entry must agree with the code (AlphaWaveSystems#751)

## Summary
Test-only plus one data file. Every exported `App` method is callable from the window and, in the headless build, from a page script with the bridge token, so adding one is a decision. The decision table already existed in the test as a Go map with a category; it is now `studio/bound_methods.json`, the one place decisions are written, with one entry per method:

- `category`, `does` (one sentence), `callers` (window, bridge, automation), `touches` (files, devices, network, keychain) and `confirm` (none, asks, answers, native-dialog).

`bound_methods_test.go` reads the file (the other tests use the same data) and fails:
- for a new method with no entry, and the message prints the entry to add;
- for an entry whose method no longer exists;
- when an entry contradicts the code: `callers` against the headless bridge's block list and the automation endpoint's method set, a secret that touches no keychain, a pure method that touches something, a run (`RunFile*`) that does not ask, a window-only preference that is not native-dialog, unknown values, a duplicate entry.

## Mutants
Run against the real code and file: a new method with no entry, an entry removed, a stale entry, a secret whose touches were emptied, a run whose confirm was set to none: all killed. A second test runs the check on 12 deliberately wrong inputs (including the message naming the method and the entry to add).

Writing the 67 entries meant stating what each touches, and one was wrong in my first pass (`CheckReplaceLine` reads nothing from disk), which the check caught. No production code changes.

## Test plan
- [x] `go test -race ./studio` (whole package)
- [x] mutants as above
- [x] disclosure scan
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.

1 participant