Repository navigation
Add optional feedback email and increase interface sound volume - #89
Conversation
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: ASSERTIVE
- Plan: Team
- Run ID:
b4015895-6695-4e1b-9aca-dd94ada02506
📒 Files selected for processing: 8
docs/sound-effects.mdtauri-app/scripts/test-feedback-email.mjstauri-app/sound-lab/index.htmltauri-app/src-tauri/src/commands.rstauri-app/src/app/components/stories/FeedbackDialog.stories.tsxtauri-app/src/components/settings/settings/FeedbackDialog.tsxtauri-app/src/lib/sound-effects.tstauri-app/src/lib/tauri.ts
Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.
| await page.route('**/src/lib/tauri.ts*', async route => { | ||
| const response = await route.fetch(); | ||
| const source = await response.text(); | ||
| const marker = 'export const submitFeedback = (input) => {'; | ||
| assert.ok(source.includes(marker), 'Intercept only the desktop transport boundary'); | ||
| await route.fulfill({ response, body: source.replace(marker, `${marker} return window.__feedbackSend(input);`) }); | ||
| }); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,125p' tauri-app/scripts/test-feedback-email.mjs
sed -n '245,265p' tauri-app/src/lib/tauri.tsRepository: SupaStellar/Cleanmeter
Length of output: 7158
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- package/config references ---'
rg -n -F --glob 'tauri-app/package.json' -e '"playwright"' -e '"vite"' -e '"scripts"' -e 'test-feedback-email' tauri-app/package.json || test "$?" -eq 1
rg -n -F --glob 'tauri-app/*' -e 'vite.config' -e 'server:' -e 'esbuild' -e 'minify' -e 'test-feedback-email' tauri-app || test "$?" -eq 1
printf '%s\n' '--- exact relevant source with line numbers ---'
nl -ba tauri-app/scripts/test-feedback-email.mjs | sed -n '20,42p'
nl -ba tauri-app/src/lib/tauri.ts | sed -n '248,265p'Repository: SupaStellar/Cleanmeter
Length of output: 10802
🌐 Web query:
official Playwright documentation page.route handler throws exception request behavior
💡 Result:
<source_evidence>
<source kind="search">
<title>BrowserContext | Playwright</title>
<location>https://playwright.dev/docs/api/class-browsercontext</location>
<excerpt>citeturn1search4 [wordlim: 200] Crawled: last week; Routing provides the capability to modify network requests that are made by any page in the browser context. ... * `handler` function(Route, Request):Promise<Object> | Object# ... * `'ignoreErrors'` - do not wait for current handler calls (if any) to finish, all errors thrown by the handlers after unrouting are silently caught ... Emitted when exception is unhandled in any of the pages in this context.
Returns
* Promise<void>#
* * *
### route
Added before v1.9 browserContext.route
Routing provides the capability to modify network requests that are made by any page in the browser context. Once route is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
note
browserContext.route() will not intercept requests intercepted by Service Worker. See this issue. We recommend disabling Service Workers when using request interception by setting serviceWorkers to `'block'`.
Usage
An example of a naive handler that aborts all image requests:
`
const context = await browser.newContext();
await context.route('**/*.{png,jpg,jpeg}', route => route.abort());
const page = await context.newPage();
await page.goto('https://example.com');
await browser.close();
`
or the same snippet using a regex pattern instead:
</excerpt>
</source>
<source kind="search">
<title>playwright/docs/src/api/class-route.md at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/docs/src/api/class-route.md</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: 2 days ago; Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked. ... An error will be thrown if the number is exceeded. ... Fulfills route's request with given response.
# class: Route
* since: v1.8
Whenever a network route is set up with [`method: Page.route`] or [`method: BrowserContext.route`], the `Route` object allows to handle the route.
Learn more about networking.
## async method: Route.abort
* since: v1.8
Aborts the route's request.
### param: Route.abort.errorCode
* since: v1.8
* `errorCode` ?<[string]>
Optional error code. Defaults to `failed`, could be one of the following:
* `'aborted'` - An operation was aborted (due to user action)
* `'accessdenied'` - Permission to access a resource, other than the network, was denied
* `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.
* `'blockedbyclient'` - The client chose to block the request.
* `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).
* `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.
headers.Remove("origin");
await route.ContinueAsync(new() { Headers = headers });
});
Details
The [`option: headers`] option applies to both the routed request and any redirects it initiates. However, [`option: url`], [`option: method`], and [`option: postData`] only apply to the original request and are not carried over to redirected requests.
[`method: Route.continue`] will immediately send the request to the network, other matching handlers won't be invoked. Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked.
:::warning Some request headers are forbidden and cannot be overridden (for example, `Cookie`, `Host`, `Content-Length` and others, see this MDN page for full list). If an override is provided for a forbidden header, it will be ignored and the original request header will be used.
To set custom cookies, use [`method: BrowserContext.addCookies`]. :::
### option: Route.continue.url
* since: v1.8
* `url` <[string]>
If set changes the request URL. New URL must have same protocol as original one.
### option: Route.continue.method
* since: v1.8
* `method` <[string]>
If set changes the request method (e.g. GET or POST).
### option: Route.continue.postData
* since: v1.8
* langs: js, python
* `postData` <[string]|[Buffer]|[Serializable]>
If set changes the post data of request.
### option: Route.continue.postData
* since: v1.8
* langs: java
* `postData` <[string]|[Buffer]>
If set changes the post data of request.
### option: Route.continue.postData
* since: v1.8
* langs: csharp
* `postData` <[Buffer]>
If set changes the post data of request.
### option: Route.continue.headers
* since: v1.8
* `headers` <[Object]<[string], [string]>>
If set changes the request HTTP headers. Header values will be converted to a string.
## method: Route.request
* since: v1.8
* returns: <[Request]>
A request to be routed.</excerpt>
</source>
<source kind="search">
<title>Route | Playwright</title>
<location>https://playwright.dev/docs/api/class-route</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: last week; One can also modify request while falling back to the subsequent handler, that way intermediate route handler can modify url, method, headers and postData of the request. ... If the signal is aborted, the operation will be aborted and throw an error. ... APIResponse to fulfill route's request with.
# Route
Whenever a network route is set up with page.route() or browserContext.route(), the `Route` object allows to handle the route.
Learn more about networking.
## Methods
### abort
Added before v1.9 route.abort
Aborts the route's request.
Usage
`
await route.abort();
await route.abort(errorCode);
`
Arguments
* `errorCode` string (optional)#
Optional error code. Defaults to `failed`, could be one of the following:
* `'aborted'` - An operation was aborted (due to user action)
* `'accessdenied'` - Permission to access a resource, other than the network, was denied
* `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.
* `'blockedbyclient'` - The client chose to block the request.
* `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).
Defaults to `20`. Pass `0` to not follow redirects.
* `maxRetries` number (optional) Added in: v1.46#
Maximum number of times network errors should be retried. Currently only `ECONNRESET` error is retried. Does not retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to `0` - no retries.
* `method` string (optional)#
If set changes the request method (e.g. GET or POST).
* `postData` string | Buffer | Serializable (optional)#
Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type` header will be set to `application/octet-stream` if not explicitly set.
* `signal` AbortSignal (optional) Added in: v1.62#
</excerpt>
</source>
<source kind="search">
<title>playwright/docs/src/api/class-page.md at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md?plain=1</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: last week; using var playwright = await Playwright.CreateAsync(); ... page.on('pageerror', exception => { ... await page.goto('data:text/html,<script>throw new Error("Test")</script>'); ... If you would like to route/listen to this network request, use [`method: BrowserContext.route`] and [`event: BrowserContext.request`] respectively instead of similar methods on the [Page]. ... Emitted when a request finishes successfully after downloading the response body.
with page.expect_event("popup") as page_info:
page.get_by_text("open the popup").click()
popup = page_info.value
print(popup.evaluate("location.href"))
```
```csharp
var popup = await page.RunAndWaitForPopupAsync(async () =>
{
await page.GetByText("open the popup").ClickAsync();
});
Console.WriteLine(await popup.EvaluateAsync<string>("location.href"));
```
:::note
Use [`method: Page.waitForLoadState`] to wait until the page gets to a particular state (you should not need it in most
cases).
:::
## event: Page.request
* since: v1.8
- argument: <[Request]>
Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see
[`method: Page.route`] or [`method: BrowserContext.route`].
## event: Page.requestFailed
* since: v1.9
- argument: <[Request]>
Emitted when a request fails, for example by timing out.
```js
page.on('requestfailed', request => {
console.log(request.url() + ' ' + request.failure().errorText);
});
```
```java
page.onRequestFailed(request -> {
</excerpt>
</source>
<source kind="search">
<title>playwright/packages/playwright-core/src/client/browserContext.ts at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/browserContext.ts</location>
<excerpt>citeturn0search3 [wordlim: 200] Crawled: 3 weeks ago; routeHandler.matches(route.request().url())) ... throw new Error('Route from har is not supported in thin clients');
const { responseEndTiming } = params;
const request = network.Request.from(params.request);
const response = network.Response.fromNullable(params.response);
const page = Page.fromNullable(params.page);
request._setResponseEndTiming(responseEndTiming);
this.emit(Events.BrowserContext.RequestFinished, request);
if (page)
page.emit(Events.Page.RequestFinished, request);
if (response)
response._finishedPromise.resolve(null);
}
async _onRoute(route: network.Route) {
route._context = this;
const page = route.request()._safePage();
const routeHandlers = this._routes.slice();
for (const routeHandler of routeHandlers) {
// If the page or the context was closed we stall all requests right away.
if (page?._closeWasCalled || this.isClosed())
return;
if (!routeHandler.matches(route.request().url()))
continue;
const index = this._routes.indexOf(routeHandler);
if (index === -1)
continue;
if (routeHandler.willExpire())
this._routes.splice(index, 1);
const handled = await routeHandler.handle(route);
if (!this._routes.length)
this._updateInterceptionPatterns({ internal: true }).catch(() => {});
if (handled)
return;
}
// If the page is closed or unrouteAll() was called without waiting and interception disabled,
// the method will throw an error - silence it.
this._bindings.set(name, binding);
return DisposableObject.from(result.disposable);
}
async route(url: URLMatch, handler: network.RouteHandlerCallback, options: { times?: number } = {}): Promise<DisposableStub> {
this._routes.unshift(new network.RouteHandler(this._options.baseURL, url, handler, options.times));
await this._updateInterceptionPatterns({ title: 'Route requests' });
return new DisposableStub(() => this.unroute(url, handler));
}
async routeWebSocket(url: URLMatch, handler: network.WebSocketRouteHandlerCallback): Promise<void> {
this._webSocketRoutes.unshift(new network.WebSocketRouteHandler(this._options.baseURL, url, handler));
await this._updateWebSocketInterceptionPatterns({ title: 'Route WebSockets' });
}
async routeFromHAR(har: string, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, updateContent?: 'attach' | 'embed', updateMode?: 'minimal' | 'full' } = {}): Promise<void> {
const localUtils = this._connection.localUtils();
if (!localUtils)
throw new Error('Route from har is not supported in thin clients');
</excerpt>
</source>
<omitted_sources count="22">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>
Citations:
- 1: https://playwright.dev/docs/api/class-browsercontext?utm_source=openai
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- package/config ---'
sed -n '1,180p' tauri-app/package.json
for f in tauri-app/vite.config.* tauri-app/*vite*.config.*; do
if test -f "$f"; then printf '%s\n' "--- $f"; nl -ba "$f"; fi
done
printf '%s\n' '--- relevant lines ---'
nl -ba tauri-app/scripts/test-feedback-email.mjs | sed -n '27,38p'
nl -ba tauri-app/src/lib/tauri.ts | sed -n '252,264p'Repository: SupaStellar/Cleanmeter
Length of output: 10869
🌐 Web query:
site:playwright.dev/docs/api/class-page page.route handler throws exception abort request
💡 Result:
<source_evidence>
<source kind="search">
<title>Page | Playwright</title>
<location>https://playwright.dev/docs/api/class-page</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: last week; The Page class emits various events (described below) which can be handled using any of Node's native `EventEmitter` methods, such as `on`, `once` or `removeListener`. ... When overlay is visible, Playwright calls the handler first, and then proceeds with the action/assertion. ... * `'commit'` - consider operation to be finished when network response is received and the document started loading. ... The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not Found" and 500 "Internal Server Error". ... await page.route('/api/**', async route => { ... * If set to 'abort' any request not found in the HAR file will be aborted. ... page.on('pageerror', exception => {
When set to `"ai"`, returns a snapshot optimized for AI consumption: including element references like `[ref=e2]` and snapshots of `<iframe>`s. Defaults to `"default"`.
* `signal` AbortSignal (optional) Added in: v1.62#
Allows to cancel the operation using an `AbortSignal`. If the signal is aborted, the operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout, which can be changed using browserContext.setDefaultTimeout() or page.setDefaultTimeout(); pass `timeout: 0` to disable the timeout entirely.
* `timeout` number (optional)#
Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the browserContext.setDefaultTimeout() or page.setDefaultTimeout() methods.
Returns
* Promise<Serializable>#
If the signal is aborted, the operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout, which can be changed using browserContext.setDefaultTimeout() or page.setDefaultTimeout(); pass `timeout: 0` to disable the timeout entirely.
* `timeout` number (optional)#
Maximum operation time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `navigationTimeout` option in the config, or by using the browserContext.setDefaultNavigationTimeout(), browserContext.setDefaultTimeout(), page.setDefaultNavigationTimeout() or page.setDefaultTimeout() methods.
* `waitUntil` "load" | "domcontentloaded" | "networkidle" | "commit" (optional)#
When to consider operation succeeded, defaults to `load`. Events can be either:
* `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* `options` Object (optional)
* `referer` string (optional)#
Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders().
* `signal` AbortSignal (optional) Added in: v1.62#
Allows to cancel the operation using an `AbortSignal`. If the signal is aborted, the operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout, which can be changed using browserContext.setDefaultTimeout() or page.setDefaultTimeout(); pass `timeout: 0` to disable the timeout entirely.
* `timeout` number (optional)#
Maximum operation time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `navigationTimeout` option in the config, or by using the browserContext.setDefaultNavigationTimeout(), browserContext.setDefaultTimeout(), page.setDefaultNavigationTimeout() or page.setDefaultTimeout() methods.
* `waitUntil` "load" | "domcontentloaded" | "networkidle" | "commit" (optional)#
When to consider operation succeeded, defaults to `load`. Events can be either:
* `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` eve…[truncated]</excerpt>
</source>
<source kind="search">
<title>Route | Playwright</title>
<location>https://playwright.dev/docs/api/class-route</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: last week; await route.abort(errorCode); ... One can also modify request while falling back to the subsequent handler, that way intermediate route handler can modify url, method, headers and postData of the request. ... await page.route('https://dog.ceo/api/breeds/list/all', async route => { ... If the signal is aborted, the operation will be aborted and throw an error.
# Route
Whenever a network route is set up with page.route() or browserContext.route(), the `Route` object allows to handle the route.
Learn more about networking.
## Methods
### abort
Added before v1.9 route.abort
Aborts the route's request.
Usage
`
await route.abort();
await route.abort(errorCode);
`
Arguments
* `errorCode` string (optional)#
Optional error code. Defaults to `failed`, could be one of the following:
* `'aborted'` - An operation was aborted (due to user action)
* `'accessdenied'` - Permission to access a resource, other than the network, was denied
* `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.
* `'blockedbyclient'` - The client chose to block the request.
* `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).
Allows to cancel the operation using an `AbortSignal`. If the signal is aborted, the operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout, which can be changed using browserContext.setDefaultTimeout() or page.setDefaultTimeout(); pass `timeout: 0` to disable the timeout entirely.
* `timeout` number (optional) Added in: v1.33#
Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
* `url` string (optional)#
If set changes the request URL. New URL must have same protocol as original one.
Returns
* Promise<APIResponse>#
Details
Note that headers option will apply to the fetched request as well as any redirects initiated by it. If you want to only apply headers to the original request, but not to redirects, look into route.continue() instead.
</excerpt>
</source>
<source kind="search">
<title>Playwright Test | Playwright</title>
<location>https://playwright.dev/docs/api/class-test</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: last week; This is useful from inside a fixture or a route handler when you have detected an unrecoverable misuse and want to fail the test right away. ... import { test, expect } from '@playwright/test'; ... await page.route('**/publish', route => { ... return route.abort();
</excerpt>
</source>
<source kind="search">
<title>BrowserContext | Playwright</title>
<location>https://playwright.dev/docs/api/class-browsercontext</location>
<excerpt>citeturn0search3 [wordlim: 200] Crawled: last week; await context.route('**/*.{png,jpg,jpeg}', route => route.abort()); ... await context.route('/api/**', async route => { ... Page routes (set up with page.route()) take precedence over browser context routes when request matches both handlers. ... * `handler` function(Route, Request):Promise<Object> | Object#
</excerpt>
</source>
<source kind="search">
<title>Page | Playwright</title>
<location>https://playwright.dev/docs/next/api/class-page</location>
<excerpt>citeturn0search4 [wordlim: 200] Crawled: last month; page.route() will not intercept the first request of a popup page. ... An example of a naive handler that aborts all image requests: ... await page.route('**/*.{png,jpg,jpeg}', route => route.abort());
</excerpt>
</source>
<omitted_sources count="7">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>
Citations:
- 1: https://playwright.dev/docs/api/class-page?utm_source=openai
🌐 Web query:
Playwright RouteHandler.handle _ignoreException thrown route handler implementation page.route exception abort request
💡 Result:
<source_evidence>
<source kind="find_in_page">
<title>playwright/packages/playwright-core/src/client/network.ts at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/network.ts</location>
<excerpt>citeturn5view2 [wordlim: 200] Crawled: today; Content type: text/html; Source: find({"ref_id":"turn4view0","pattern":"async abort"}); Total lines: 3755
L2649: this._fallbackOverrides.postDataBuffer = Buffer.from(JSON.stringify(overrides.postData), 'utf-8');
L2650:
L2651: }
L2652:
L2653: _fallbackOverridesForContinue() {
L2654:
L2655: return this._fallbackOverrides;
L2670: _context!: BrowserContext;
L2671:
L2672: _didThrow: boolean = false;
L2673:
L2674: static from(route: channels.RouteChannel): Route {
L2675:
L2676: return (route as any)._object;
L2677:
L2678: }
L2679:
L2680: constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.RouteInitializer) {
L2681:
L2682: super(parent, type, guid, initializer);
L2683:
L2684: }
L2685:
L2686: request(): Request {
L2687:
L2688: return Request.from(this._initializer.request);
L2689:
L2690: }
L2691:
L2692: private async _raceWithTargetClose(promise: Promise<any>): Promise<void> {
L2693: // When page closes or crashes, we catch any potential rejects from this Route.
L2694:
L2695: // Note that page could be missing when routing popup's initial request that
L2696:
L2697: // does not have a Page initialized just yet.
L2698:
L2699: return await this.request()._targetClosedScope().safeRace(promise);
L2700:
L2701: }
L2702:
L2703: async _startHandling(): Promise<boolean> {
L2704:
L2705: this._handlingPromise = new ManualPromise();
L2706:
L2707: return await this._handlingPromise;
L2708:
L2709: }
L2710:
L2711: async fallback(options: FallbackOverrides = {}) {
L2712:
L2713: this._checkNotHandled();
L2714: this.request()._applyFallbackOverrides(options);
L2715:
L2716: this._reportHandled(false);
L2717:
L2718: }
L2719:
L2720: async abort(errorCode?: string) {
L2721:
L2722: await this._handleRoute(async () => {
L2723:
L2724: await this._raceWithTargetClose(this._channel.abort({ errorCode }, kNoTimeout));
L2725:
L2726: });
L2727:
L2728: }
L2729:
L2730: async _redirectNavigationRequest(url: string) {
L2731:
L2732: await this._handleRoute(async () => {
L2733:
L2734: await this._raceWithTargetClose(this._channel.redirectNavigationRequest({ url }, kNoTimeout));
L2735:
L2736: });
L2737:
L2738: }
L2739:
L2740: @apiCall()
L2741: async fetch(options: FallbackOverrides & { maxRedirects?: number, maxRetries?: number, timeout?: number, signal?: AbortSignal } = {}): Promise<APIResponse> {
L2742:
L2743: return await this._context.request._innerFetch({ request: this.request(), data: options.postData, ...options });
L2744:
L2745: }
L2746:
L2747: async fulfill(options: { response?: api.APIResponse, status?: number, headers?: Headers, contentType?: string, body?: string | Buffer, json?: any, path?: string } = {}) {
L2748:
L2749: await this._handleRoute(async () => {
L2750: await this._innerFulfill(options);
L2751:
L2752: });
L2753:
L2754: }
L2755:
L2756: private async _handleRoute(callback: () => Promise<void>) {
L2757:
L2758: this._checkNotHandled();
L2759:
L2760: try {
L2761:
L2762: await callback();
L2763:
L2764: this._reportHandled(true);
L2765:
L2766: } catch (e) {
L2767:
L2768: this._didThrow = true;
L2769:
L2770: throw e;
L2771:
L2772: }
L2773:
L2774: }
L2775:
L2776: private async _innerFulfill(options: { response?: api.APIResponse, status?: number, headers?: Headers, contentType?: string, body?: string | Buffer, json?: any, path?: string } = {}): Promise<void> {
L2777:
L2778: let fetchResponseUid;
L2779: let { status: statusOption, headers: headersOption, body } = options;
L2780:
L2781: if (options.json !== undefined) {
L2782:
L2783: assert(options.body === undefined, 'Can specify either body or json parameters');
L2784:
L2785: body = JSON.stringify(options.json);
L2786:
L2787: }
L2788:
L2789: if (options.response instanceof APIResponse) {
L2790:
L2791: statusOption ??= options.response.status();
L2…[truncated]</excerpt>
</source>
<source kind="open_page">
<title></title>
<location>https://raw.githubusercontent.com/microsoft/playwright-python/main/playwright/_impl/_helper.py</location>
<excerpt>citeturn2view1 [wordlim: 200] Crawled: today; Content type: text/plain; Source: open({"ref_id":"https://raw.githubusercontent.com/microsoft/playwright-python/main/playwright/_impl/_helper.py","lineno":null}); Total lines: 40
L0: # Copyright (c) Microsoft Corporation.
L1: #
L2: # Licensed under the Apache License, Version 2.0 (the "License");
L3: # you may not use this file except in compliance with the License.
L4: # You may obtain a copy of the License at
L5: #
L6: # http://www.apache.org/licenses/LICENSE-2.0
L7: #
L8: # Unless required by applicable law or agreed to in writing, software
L9: # distributed under the License is distributed on an "AS IS" BASIS,
L10: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
L11: # See the License for the specific language governing permissions and
L12: # limitations under the License.
L13: """Python only: helpers of the generated API (playwright/{async,sync}_api/_generated.py)."""
L14:
L15: import datetime
L16: from typing import Optional, Union, overload
L17:
L18:
L19: @overload
L20: def to_milliseconds(value: Union[float, datetime.timedelta]) -> float: ...
L21:
L22:
L23: @overload
L24: def to_milliseconds(value: None) -> None: ...
L25:
L26:
L27: @overload
L28: def to_milliseconds(
L29: value: Union[float, datetime.timedelta, None],
L30: ) -> Optional[float]: ...
L31:
L32: def to_milliseconds(
L33: value: Union[float, datetime.timedelta, None],
L34: ) -> Optional[float]:
L35: if value is None:
L36: return None
L37: if isinstance(value, datetime.timedelta):
L38: return value / datetime.timedelta(milliseconds=1)
L39: return value
</excerpt>
</source>
<source kind="open_page">
<title>playwright/packages/playwright-core/src/client/network.ts at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/network.ts</location>
<excerpt>citeturn4view0 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({"ref_id":"https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/network.ts","lineno":null}); Total lines: 3755
L0: 【0†Skip to content】
L1: ## Navigation Menu
L2:
L3: 【1†Sign in】
L4:
L5: Appearance settings
L6:
L7: * Platform
L8:
L9: * AI CODE CREATION
L10: * 【2†GitHub CopilotWrite better code with AI】
L11: * 【3†GitHub Copilot appDirect agents from issue to merge】
L12: * 【4†MCP RegistryIntegrate external tools】
L13:
L14: * DEVELOPER WORKFLOWS
L15: * 【5†ActionsAutomate any workflow】
L16: * 【6†CodespacesInstant dev environments】
L17: * 【7†IssuesPlan and track work】
L18: * 【8†Code ReviewManage code changes】
L19: * 【9†Code QualityEnforce quality at merge】
L20: * APPLICATION SECURITY
L21: * 【10†GitHub Advanced SecurityFind and fix vulnerabilities】
L22: * 【11†Code securitySecure your code as you build】
L23: * 【12†Secret protectionStop leaks before they start】
L24:
L25: * EXPLORE
L26: * 【13†Why GitHub】
L27: * 【14†Documentation†docs.github.com】
L28: * 【15†Blog†github.blog】
L29: * 【16†Changelog†github.blog】
L30: * 【17†Marketplace】
L31:
L32: 【18†View all features】
L33:
L34: * Solutions
L35: * BY COMPANY SIZE
L36: * 【19†Enterprises】
L37: * 【20†Small and medium teams】
L38: * 【21†Startups】
L39: * 【22†Nonprofits】
L40:
L41: * BY USE CASE
L42: * 【23†App Modernization】
L43: * 【24†DevSecOps】
L44: * 【25†DevOps】
L45: * 【26†CI/CD】
L46: * 【27†View all use cases】
L47:
L48: * BY INDUSTRY
L49: * 【28†Healthcare】
L50: * 【29†Financial services】
L51: * 【30†Manufacturing】
L52: * 【31†Government】
L53: * 【32†View all industries】
L54:
L55: 【33†View all solutions】
L56:
L57: * Resources
L58: * EXPLORE BY TOPIC
L59: * 【34†AI】
L60: * 【35†Software Development】
L61: * 【36†DevOps】
L62: * 【37†Security】
L63: * 【38†View all topics】
L64:
L65: * EXPLORE BY TYPE
L66: * 【39†Customer stories】
L67: * 【40†Events & webinars】
L68: * 【41†Ebooks & reports】
L69: * 【42†Business insights】
L70: * 【43†GitHub Skills†skills.github.com】
L71: * SUPPORT & SERVICES
</excerpt>
</source>
<source kind="open_page">
<title>playwright/packages/playwright-core/src/client/browserContext.ts at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/browserContext.ts</location>
<excerpt>citeturn4view1 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({"ref_id":"turn0search2","lineno":null}); Total lines: 2500
L1858: if (response)
L1859:
L1860: response._finishedPromise.resolve(null);
L1861:
L1862: }
L1863:
L1864: async _onRoute(route: network.Route) {
L1865:
L1866: route._context = this;
L1867:
L1868: const page = route.request()._safePage();
L1869:
L1870: const routeHandlers = this._routes.slice();
L1871:
L1872: for (const routeHandler of routeHandlers) {
L1873:
L1874: // If the page or the context was closed we stall all requests right away.
L1875:
L1876: if (page?._closeWasCalled || this.isClosed())
L1877:
L1878: return;
L1879:
L1880: if (!routeHandler.matches(route.request().url()))
L1881:
L1882: continue;
L1883:
L1884: const index = this._routes.indexOf(routeHandler);
L1885: if (index === -1)
L1886:
L1887: continue;
L1888:
L1889: if (routeHandler.willExpire())
L1890:
L1891: this._routes.splice(index, 1);
L1892:
L1893: const handled = await routeHandler.handle(route);
L1894:
L1895: if (!this._routes.length)
L1896:
L1897: this._disableInterception().catch(() => {});
L1898:
L1899: if (handled)
L1900:
L1901: return;
L1902:
L1903: }
L1904:
L1905: // If the page is closed or unrouteAll() was called without waiting and interception disabled,
L1906:
L1907: // the method will throw an error - silence it.
L1908:
L1909: await route._innerContinue(true /* isFallback */).catch(() => {});
L1910:
L1911: }
L1912: async _onWebSocketRoute(webSocketRoute: network.WebSocketRoute) {
L1913:
L1914: const routeHandler = this._webSocketRoutes.find(route => route.matches(webSocketRoute.url()));
L1915:
L1916: if (routeHandler)
L1917:
L1918: await routeHandler.handle(webSocketRoute);
L1919:
L1920: else
L1921:
L1922: webSocketRoute.connectToServer();
L1923:
L1924: }
L1925:
L1926: async _onBinding(bindingCall: BindingCall) {
L1927:
L1928: const func = this._bindings.get(bindingCall._initializer.name);
L1929:
L1930: if (!func)
L1931:
L1932: return;
L1933:
L1934: await bindingCall.call(func);
L1935:
L1936: }
L1937:
L1938: private _serviceWorkerScope(serviceWorker: Worker) {
L1939:
L1940: try {
L1941: let url = new URL('.', serviceWorker.url()).href;
L1942:
L1943: if (!url.endsWith('/'))
L1944:
L1945: url += '/';
L1946:
L1947: return url;
L1948:
L1949: } catch {
L1950:
L1951: return null;
L1952:
L1953: }
L1954:
L1955: }
L1956:
L1957: setDefaultNavigationTimeout(timeout: number | undefined) {
L1958:
L1959: this._timeoutSettings.setDefaultNavigationTimeout(timeout);
L1960:
L1961: }
L1962:
L1963: setDefaultTimeout(timeout: number | undefined) {
L1964:
L1965: this._timeoutSettings.setDefaultTimeout(timeout);
L1966:
L1967: }
L1968:
L1969: browser(): Browser | null {
L1970:
L1971: return this._browser;
L1972:
L1973: }
L1974:
L1975: pages(): Page[] {
L1976:
L1977: return [...this._pages];
L1978:
L1979: }
L1980:
L1981: isClosed(): boolean {
L2009: async addCookies(cookies: network.SetNetworkCookieParam[]): Promise<void> {
L2010:
L2011: await this._channel.addCookies({ cookies }, kNoTimeout);
L2012:
L2013: }
L2014:
L2015: async clearCookies(options: network.ClearNetworkCookieOptions = {}): Promise<void> {
L2016:
L2017: await this._channel.clearCookies(network.toClearCookiesParams(options), kNoTimeout);
L2018:
L2019: }
L2020:
L2021: async grantPermissions(permissions: string[], options?: { origin?: string }): Promise<void> {
L2022:
L2023: await this._channel.grantPermissions({ permissions, ...options }, kNoTimeout);
L2024:
L2025: }
L2026: async clearPermissions(): Promise<void> {
L2027:
L2028: await this._channel.clearPermissions({}, kNoTimeout);
L2029:
L2030: }
L2031:
L2032: async setGeolocation(geolocation: { longitude: number, latitude: number, accuracy?: number } | null): Promise<void> {
L2033:
L2034: await this._channel.setGeolocation({ geolocati…[truncated]</excerpt>
</source>
<source kind="open_page">
<title>playwright/docs/src/api/class-route.md at main · microsoft/playwright · GitHub</title>
<location>https://github.com/microsoft/playwright/blob/main/docs/src/api/class-route.md</location>
<excerpt>citeturn4view2 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({"ref_id":"turn0search0","lineno":null}); Total lines: 851
L284: Details
L285:
L286: The [`option: headers`] option applies to both the routed request and any redirects it initiates. However, [`option: url`], [`option: method`], and [`option: postData`] only apply to the original request and are not carried over to redirected requests.
L287:
L288: [`method: Route.continue`] will immediately send the request to the network, other matching handlers won't be invoked. Use [`method: Route.fallback`] If you want next matching handler in the chain to be invoked.
L289: :::warning Some request headers are forbidden and cannot be overridden (for example, `Cookie`, `Host`, `Content-Length` and others, see 【74†this MDN page†developer.mozilla.org】 for full list). If an override is provided for a forbidden header, it will be ignored and the original request header will be used.
L290:
L291: To set custom cookies, use [`method: BrowserContext.addCookies`]. :::
L292: ### option: Route.continue.url
L293:
L294: * since: v1.8
L295:
L296: * `url` <[string]>
L297:
L298: If set changes the request URL. New URL must have same protocol as original one.
L299:
L300: ### option: Route.continue.method
L301:
L302: * since: v1.8
L303:
L304: * `method` <[string]>
L305:
L306: If set changes the request method (e.g. GET or POST).
L307:
L308: ### option: Route.continue.postData
L309:
L310: * since: v1.8
L311: * langs: js, python
L312:
L313: * `postData` <[string]|[Buffer]|[Serializable]>
L314:
L315: If set changes the post data of request.
L316: ### option: Route.continue.postData
L317:
L318: * since: v1.8
L319: * langs: java
L320:
L321: * `postData` <[string]|[Buffer]>
L322:
L323: If set changes the post data of request.
L324:
L325: ### option: Route.continue.postData
L326:
L327: * since: v1.8
L328: * langs: csharp
L329:
L330: * `postData` <[Buffer]>
L331:
L332: If set changes the post data of request.
L333:
L334: ### option: Route.continue.headers
L335:
L336: * since: v1.8
L337:
L338: * `headers` <[Object]<[string], [string]>>
L339:
L340: If set changes the request HTTP headers. Header values will be converted to a string.
L341: ## async method: Route.fallback
L342:
L343: * since: v1.23
L344:
L345: Continues route's request with optional overrides. The method is similar to [`method: Route.continue`] with the difference that other matching handlers will be invoked before sending the request.
L346:
L347: Usage
L348: When several routes match the given pattern, they run in the order opposite to their registration. That way the last registered route can always override all the previous ones. In the example below, request will be handled by the bottom-most handler first, then it'll fall back to the previous one and in the end will be aborted by the first registered route.
L349:
L350: await page.route('**/*', async route => {
L351: // Runs last.
L352: await route.abort();
L353: });
L354: await page.route('**/*', async route => {
L355: // Runs second.
L356: await route.fallback();
L357: });
L358: await page.route('**/*', async route => {
L359: // Runs first.
L360: await route.fallback();
L361: });
L362:
L363: page.route("**/*", route -> {
L364: // Runs last.
L365: route.abort();
L366: });
L367:
L368: page.route("**/*", route -> {
L369: // Runs second.
L370: route.fallback();
L371: });
L372:
L373: page.route("**/*", route -> {
L374: // Runs first.
L375: route.fallback();
L376: });
L377: await page.route("**/*", lambda route: route.abort()) # Runs last.
L378: await page.route("**/*", lambda route: route.fallb…[truncated]</excerpt>
</source>
<omitted_sources count="36">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>
Citations:
- 1: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/network.ts
- 2: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/browserContext.ts
- 3: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/network.ts
Abort the intercepted request when the marker assertion fails.
The Vite transform removes the TypeScript return annotation, so the current marker matches the emitted function prefix. If formatting changes, the assertion runs before route.fulfill. A rejected route handler does not call a terminal route method, so the request can remain pending and make the awaited page.goto time out instead of reporting the assertion directly.
Suggested fix
--- "a/tauri-app/scripts/test-feedback-email.mjs"
+++ "b/tauri-app/scripts/test-feedback-email.mjs"
@@ -26,13 +26,21 @@
assert.equal(response.status(), 201, await response.text());
}
});
- await page.route('**/src/lib/tauri.ts*', async route => {
- const response = await route.fetch();
- const source = await response.text();
- const marker = 'export const submitFeedback = (input) => {';
- assert.ok(source.includes(marker), 'Intercept only the desktop transport boundary');
- await route.fulfill({ response, body: source.replace(marker, `${marker} return window.__feedbackSend(input);`) });
+ await page.route('**/src/lib/tauri.ts*', async route => {
+ try {
+ const response = await route.fetch();
+ const source = await response.text();
+ const marker = /export\s+const\s+submitFeedback\s*=\s*\(\s*input\s*\)\s*=>\s*\{/;
+ assert.match(source, marker, 'Intercept only the desktop transport boundary');
+ await route.fulfill({
+ response,
+ body: source.replace(marker, match => `${match} return window.__feedbackSend(input);`),
+ });
+ } catch (error) {
+ await route.abort().catch(() => {});
+ throw error;
+ }
});
await page.goto(process.env.APP_URL ?? 'http://127.0.0.1:1433/');
const open = async () => {
await page.getByRole('tab', { name: 'Help', exact: true }).click();| </style></head><body><main> | ||
| <h1>Sound lab</h1><p>Listen, compare, and choose your favourites. These controls only affect this playground.</p> | ||
| <div class="controls"><label>Volume <span id="volume-label">35%</span><input id="volume" type="range" min="0" max="100" value="35" aria-label="Preview volume"></label><button id="mute" aria-pressed="false">Mute</button><label class="inline"><input id="ready" type="checkbox" checked>Keep audio ready while testing</label></div> | ||
| <div class="controls"><label>Volume <span id="volume-label">70%</span><input id="volume" type="range" min="0" max="100" value="70" aria-label="Preview volume"></label><button id="mute" aria-pressed="false">Mute</button><label class="inline"><input id="ready" type="checkbox" checked>Keep audio ready while testing</label></div> |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,85p' tauri-app/sound-lab/index.html
rg -n 'sound-lab/index.html|<form|id="mute"' tauri-app/sound-lab tauri-app/src docs/sound-effects.mdRepository: SupaStellar/Cleanmeter
Length of output: 3440
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- references ---'
rg -n -F --hidden --glob '!node_modules/**' --glob '!target/**' --glob '!dist/**' -e 'tauri-app/sound-lab' -e 'sound-lab' -e '<iframe' -e 'iframe' . || test "$?" -eq 1
printf '%s\n' '--- instruction/config candidates ---'
rg --files -g 'AGENTS.md' -g 'CONTRIBUTING*' -g '*STYLE*' -g '*GUIDELINE*' -g '.htmlhintrc*' -g 'package.json' -g 'README*' . | sort
printf '%s\n' '--- relevant instruction text ---'
for f in $(rg --files -g 'AGENTS.md' -g 'CONTRIBUTING*' -g '*STYLE*' -g '*GUIDELINE*' -g '.htmlhintrc*' | sort); do
printf '\n### %s\n' "$f"
sed -n '1,220p' "$f"
doneRepository: SupaStellar/Cleanmeter
Length of output: 2478
Add type="button" to #mute.
The sound lab is currently used as a standalone page, so form submission is not a present runtime concern. However, .htmlhintrc enables button-type-require, and this button violates that project requirement.
Proposed fix
-<button id="mute" aria-pressed="false">Mute</button>
+<button type="button" id="mute" aria-pressed="false">Mute</button>🧰 Tools
🪛 HTMLHint (1.9.2)
[warning] 6-6: The type attribute must be present on elements.
(button-type-require)
[warning] 6-6: No matching [ label ] tag found.
(input-requires-label)
[warning] 6-6: No matching [ label ] tag found.
(input-requires-label)
Adds an optional email field to feedback so the team can reply while anonymous submissions remain supported. The form validates email, preserves drafts after failed submissions, and uses consistent Name/Email field sizing without helper text. Interface sound gain increases from 35% to 70% in the app and sound lab.
Validation:
Rollout: deploy the companion feedback portal change before releasing this app build; the current portal ignores email. Railway has paused deployments, so production verification is pending. Native installed-app submission and hardware-specific checks remain manual.
Companion portal PR: https://github.com/SupaStellar/cleanmeter-feedback-portal/pull/7