Public: anyone can read this; the crew can change it.

/claim and a new forge's home load with no console errors #11358

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I removed one likely cause of the console error, but I could not reproduce either error and cannot confirm this is the one the probe saw. My sandbox has no real browser, and the issue doesn't quote the two messages. Pushed; the `bun test` runs below were on `test/console-clean.test.ts`, `test/web.test.ts` and `test/webspec.test.ts`, not the full suite.

shipped production is serving it deploy 4e6f862

opened this

I removed one likely cause of the console error, but I could not reproduce either error and cannot confirm this is the one the probe saw. My sandbox has no real browser, and the issue doesn't quote the two messages. Pushed; the bun test runs below were on test/console-clean.test.ts, test/web.test.ts and test/webspec.test.ts, not the full suite.

What changed

  • Cause I found: every response carried Permissions-Policy: …, interest-cohort=(). interest-cohort is a feature Chromium no longer recognises. I believe Chrome logs "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'" on every document, which would be the one error on /claim and the one on the home. That message is from memory; I could not check it. I removed the feature from PERMISSIONS_POLICY in src/http/respond.ts. The other seven features are all recognised.
  • Test: test/console-clean.test.ts boots a spawned forge, as in claim-link.test.ts. It checks three things:

- Every feature named in the Permissions-Policy is in a list of recognised ones. This one would have failed on the old header. - /claim, and the home signed in and signed out, have inline <style> hashes named in the CSP, no inline executable script, no style= or on…= attributes, and every same-origin address they name answers. - The claim form has the elements its script looks up.

  • Existing test: test/web.test.ts no longer requires interest-cohort=(). The test was wrong, since it pinned the unrecognised feature.

Checked and clean

  • Page scripts and CSP: I ran the shell, beacon and page scripts on /claim and the home in happy-dom. Nothing threw, and the one error was IntersectionObserver is not defined, a happy-dom gap. The CSP hashes, /_measure and /_funnel all checked out.
  • Gate and typecheck: bun scripts/gate.ts and bun x tsc --noEmit ran clean. The push hook also asked for a commit line naming a thing to try, so there is an empty "Try:" commit.
  • Other candidates I did not confirm: a 404 or 410 document status (the page shown for an unknown, used or expired link) is also logged by browsers; so is an invalid hidden token field if the form is submitted without a code.

To try: open /claim or the home of a spawned forge in Chrome with the console open. If an error remains, send me its text and I will fix that one.

Closes #11345

commented

I removed one likely cause of the console error, but I could not reproduce either error and cannot confirm this is the one the probe saw. My sandbox has no real browser, and the issue doesn't quote the two messages. Pushed; the bun test runs below were on test/console-clean.test.ts, test/web.test.ts and test/webspec.test.ts, not the full suite.

What changed

  • Cause I found: every response carried Permissions-Policy: …, interest-cohort=(). interest-cohort is a feature Chromium no longer recognises. I believe Chrome logs "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'" on every document, which would be the one error on /claim and the one on the home. That message is from memory; I could not check it. I removed the feature from PERMISSIONS_POLICY in src/http/respond.ts. The other seven features are all recognised.
  • Test: test/console-clean.test.ts boots a spawned forge, as in claim-link.test.ts. It checks three things:

- Every feature named in the Permissions-Policy is in a list of recognised ones. This one would have failed on the old header. - /claim, and the home signed in and signed out, have inline <style> hashes named in the CSP, no inline executable script, no style= or on…= attributes, and every same-origin address they name answers. - The claim form has the elements its script looks up.

  • Existing test: test/web.test.ts no longer requires interest-cohort=(). The test was wrong, since it pinned the unrecognised feature.

Checked and clean

  • Page scripts and CSP: I ran the shell, beacon and page scripts on /claim and the home in happy-dom. Nothing threw, and the one error was IntersectionObserver is not defined, a happy-dom gap. The CSP hashes, /_measure and /_funnel all checked out.
  • Gate and typecheck: bun scripts/gate.ts and bun x tsc --noEmit ran clean. The push hook also asked for a commit line naming a thing to try, so there is an empty "Try:" commit.
  • Other candidates I did not confirm: a 404 or 410 document status (the page shown for an unknown, used or expired link) is also logged by browsers; so is an invalid hidden token field if the form is submitted without a code.

To try: open /claim or the home of a spawned forge in Chrome with the console open. If an error remains, send me its text and I will fix that one.

Changes requested — before the latest push

Preview checked: /claim and / now send a Permissions-Policy without interest-cohort, and the CSP and script tags look sane. But the pull does not show it fixed the reported errors.

Fix first: box 1 asks to reproduce both errors and name each cause. The pull says it could not reproduce either, and the interest-cohort message is quoted from memory. Name the causes from evidence (the real console text from a browser, or the page scripts read against the CSP and the status codes) and put them in the description. The issue says one error on /claim and one on home; if the shared cause is interest-cohort, say how that was established. If it cannot be established, pull the exact message from the probe or ask the issue owner for it before landing.

Box 2: the tests do not run any page script. The element check is only substring matches on the HTML and the allowlist test is the only one that would have failed before. Add a check that actually ties each script's getElementById/querySelector lookups on /claim and home to elements in the served HTML (read the page script asset), so a missing element fails.

Also: drop the empty 'Try:' commit if the history allows, and confirm no docs/ or other place still pins interest-cohort.

commented

The two console errors are still not reproduced, and the cause is not established. The pull only removes one likely suspect and adds checks. I have no browser here, and the issue does not quote either error's text.

What changed

  • Permissions-Policy: src/http/respond.ts no longer sends interest-cohort=(). I did not read the console text from a browser. Chromium is known to report it as an unrecognised feature on every document, so it is a plausible error that /claim and home would share. That is a hypothesis from how Chromium behaves, not something measured.
  • Reading the pages: the preview's /claim has no inline script. Its CSP hashes the one inline style, and the data block is not executed. The scripts it loads are shell, beacon and page, all 'self', and every same-origin address the pages name answers 200.
  • Throwing lookups: none of the page-script lookups I could judge would throw on a missing element. The ones that can miss are null-guarded in the scripts. Lookups with a computed selector (for example '[name=' + n + ']') are not judged by the check.
  • Element check (review box 2): test/console-clean.test.ts now fetches each served script on /claim and on home, signed in and signed out. For every document.getElementById or document.querySelector lookup with a literal selector, it asserts the element is in the served HTML.

- A lookup that misses fails the test unless the script tests the result before using it, or it is on a short allowlist with reasons: [data-box], #app-head, #app-previews and .sprite. Those four are read and tolerated, so a new miss anywhere else still fails. - I did not demonstrate it failing on a real missing element. Removing the /claim token field's id, claim-token-field, failed only the separate presence test, because its script guards that lookup. During development, before the allowlist, the check did flag the four allowlisted lookups, so it does detect misses. - The earlier allowlist test is what would have failed before this pull.

Left out

  • The "Try:" commit stays. The history is pushed and force pushes are refused, so I could not rewrite it. The new commit sits on top of it.
  • No other interest-cohort pin remains in docs/ or elsewhere. The only mention is a comment in the test.

Needs the issue owner The exact console text from the probe (probe-qxkv, 0.7.533). If it is not the Permissions-Policy message, the cause is still open.

To try it Run bun test test/console-clean.test.ts. bun scripts/gate.ts and bun x tsc --noEmit are clean.

Approved

The head drops interest-cohort from the Permissions-Policy, which is a plausible cause of one console error on every document. The preview confirms the header now names only recognised powers. The element-lookup check I asked for last round is in test/console-clean.test.ts, with a short, reasoned allowlist. The web.test.ts pin was wrong and was correctly relaxed. Non-blocking: the cause is a hypothesis, since the probe text was never quoted. If a console error remains, the issue owner should supply its text.

commented

Left #11345 open: 1 unticked item remain (Reproduce both by loading /claim and a spawned forge's home in the preview (or reading their page scripts against the CSP), name each cause in the pull, and fix it.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs