Skip to content

Commit a8d3dfc

Browse files
chore: remove a scratch probe that git add -A swept into the 2.5.3 commit
vis-probe.mjs was a throwaway CDP script written to the repo root to diagnose the screenshot regression: it read document.visibilityState on every live TradingView page, and its output is what proved the guard was firing on a working chart. The command that was supposed to delete it was killed mid-run for memory, and the next `git add -A` put it in the release commit. SCOPE, MEASURED RATHER THAN ASSUMED in the v2.5.3 commit and tag YES in the published npm tarball NO - the package.json files whitelist has no root-level *.mjs entry, verified against an installed copy of 2.5.3 So no user received it. It is a public-repo tidiness problem, not a shipped one. The tag is left alone: history that has been published stays published. WHY THE ROOT IS THE ONE PLACE THIS HIDES Not under src/ or tests/ where anyone would look, and not caught by the packaging whitelist that would otherwise have flagged it. `git add -A` sees it, `npm pack` does not, so the only signal was reading git status carefully, and I did not. Two guards, because one of them is the one I would also forget: - .gitignore now covers the scratch-probe shapes, so `git add -A` cannot pick one up in the first place. - tests/integration.test.js fails on ANY unexpected .mjs/.cjs in the repo root, whitelisting only eslint.config.mjs. That catches the next scratch file whatever it is called, including one written before the ignore rule matches. Mutation-tested: putting the probe back turns it red. 938/938, lint clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NoRK4Aam9jKA5jVqx655R9
1 parent 8520020 commit a8d3dfc

5 files changed

Lines changed: 31 additions & 18 deletions

File tree

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,10 @@ scripts/*.pine
2424
# npm pack output
2525
*.tgz
2626
WHERE-THINGS-ARE.md
27+
28+
# Scratch probes. A killed cleanup step once let one of these reach a release
29+
# commit via `git add -A`; tests/integration.test.js also fails on them.
30+
/*-probe.mjs
31+
/probe.mjs
32+
/vis*.mjs
33+
/front.mjs

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TVControl turns your TradingView Desktop into something you can talk to. You typ
1212

1313
It works because every Chromium app, TradingView Desktop included, ships with a built-in debugging interface (the same one Chrome uses to debug itself). TVControl speaks that interface on your behalf, exposing **113 chart-control and diagnostic tools** to any agent that speaks the Model Context Protocol. It is client-neutral: anything that can launch an MCP server over stdio works, and it is in daily use across several. Pair-program in Pine Script. Optimize parameter grids. Snapshot and restore whole chart setups. Drive 4-pane layouts. Step through replay. Scan a watchlist. All by speech-to-action.
1414

15-
**113 MCP tools · 937 deterministic offline tests · 10 verify scripts · 9 prompt-library workflows · no TVControl cloud backend.** Everything in this repo is real, tested, and used daily.
15+
**113 MCP tools · 938 deterministic offline tests · 10 verify scripts · 9 prompt-library workflows · no TVControl cloud backend.** Everything in this repo is real, tested, and used daily.
1616

1717
## What is new in 2.5
1818

@@ -76,7 +76,7 @@ The full prompt library (every workflow above plus chart analysis, watchlist and
7676

7777
This isn't a demo. It ships with a test battery.
7878

79-
- **937 offline tests**: Pine analyzer, sanitization, replay, pane and indicator boundaries, watchlist, alerts, state snapshots, sweep planning, vision wrapper, telemetry, capability gating, privacy-safe bundles, chaos cleanup, soak bounds, golden workflows, native watchdog services, startup resilience, embedding contract, CLI/MCP guard parity, update safety, tool registration, and CLI routing. Live Pine-service checks are isolated in `tests/pine_api.test.js`.
79+
- **938 offline tests**: Pine analyzer, sanitization, replay, pane and indicator boundaries, watchlist, alerts, state snapshots, sweep planning, vision wrapper, telemetry, capability gating, privacy-safe bundles, chaos cleanup, soak bounds, golden workflows, native watchdog services, startup resilience, embedding contract, CLI/MCP guard parity, update safety, tool registration, and CLI routing. Live Pine-service checks are isolated in `tests/pine_api.test.js`.
8080
- **Mutation-tested, not just green.** A test that cannot fail is worse than no test, because it turns an unknown into false confidence. Fixes in this project are checked by reintroducing the bug and confirming the suite goes red. Where behaviour lives in page-side JavaScript, the tests execute that generated code against a stub DOM rather than describing it in a mock.
8181
- **The suite has a floor.** A run that reports fewer tests than expected fails, so tests cannot silently disappear from a green run.
8282
- **10 end-to-end verify scripts** under [`examples/verify/`](./examples/verify/) that drive the same MCP tools through the `tv` CLI against a live TradingView. Run `examples/verify/run-all.sh` and it auto-skips when TV isn't up.

‎scripts/run_offline_tests.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ args.push(...tests);
4141
// looking like success.
4242
//
4343
// RAISE THIS when you add tests. It is meant to be edited.
44-
const EXPECTED_MIN_TESTS = 937;
44+
const EXPECTED_MIN_TESTS = 938;
4545

4646
// HERMETIC. Any core function that reaches the real browser instead of its
4747
// injected _deps now throws and fails the test that did it. Before this flag,

‎tests/integration.test.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,27 @@ describe('MCP tool registration — integration', () => {
184184
`Found ${offenders.length} raw throw new Error sites in src/core/ — convert to ClassifiedError:\n${offenders.join('\n')}`);
185185
});
186186

187+
it('the repository root holds no stray scratch files', async () => {
188+
// MEASURED 2026-09-08: a throwaway CDP probe, `vis-probe.mjs`, was written
189+
// to the repo root to diagnose the screenshot regression. The command that
190+
// was supposed to delete it was killed mid-run, and the next `git add -A`
191+
// swept it into the v2.5.3 release commit. The npm `files` whitelist kept it
192+
// out of the published package, so no user got it, but it is in the public
193+
// repo and in a release tag.
194+
//
195+
// The root is the one directory where a scratch file is invisible: it is not
196+
// under src/ or tests/ where anyone would look, and it is not caught by the
197+
// packaging whitelist that would otherwise have flagged it.
198+
const { readdirSync } = await import('node:fs');
199+
const root = new URL('../', import.meta.url);
200+
const ALLOWED = new Set(['eslint.config.mjs']);
201+
const stray = readdirSync(root)
202+
.filter((f) => /\.(mjs|cjs)$/.test(f) && !ALLOWED.has(f));
203+
assert.deepEqual(stray, [],
204+
`Stray script(s) in the repo root: ${stray.join(', ')}. `
205+
+ 'Scratch files belong in the scratchpad directory, not next to package.json.');
206+
});
207+
187208
it('every tool name is unique (no collisions)', () => {
188209
const server = mockServer();
189210
registerHealthTools(server);

‎vis-probe.mjs‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)