test: pin updates.tier="off" default in test settings

Source-level lint that fails fast if `updates.tier` in
src/tests/settings.json is reverted from "off" back to "notify"
(the implicit default). Addresses Qodo review note on #7800:

  "This PR changes test runtime behavior by setting updates.tier
  to off, but the PR diff does not include any regression test to
  ensure the version-badge cannot block chat-icon clicks if the
  setting is reverted."

The actual functional regression (badge blocking #chaticon) is
already covered by every chat.spec.ts click — they'd time out
again under "notify" once any new major drops on GitHub. This
new pin-test catches the regression at lint time instead, so we
don't need a downstream npm release to trigger it.

Same pattern as backend-tests-flake-mitigation.test.ts: cheap
source-level lint guarding a behavioural invariant that lives in
config.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
John McLear 2026-05-17 22:07:15 +01:00
parent 9e45cfcbd9
commit 55ba1c6788

View file

@ -0,0 +1,38 @@
'use strict';
// Source-level pin for src/tests/settings.json having `updates.tier: "off"`.
//
// Why this exists (#7800):
// v2.7.x introduced the pad version-badge — an absolutely-positioned banner
// at bottom-right (z-index 9999) that renders when /api/version-status
// reports the running core is at least one major behind the latest GitHub
// release. It intercepts pointer events on #chaticon (same corner,
// z-index 400). Every Playwright spec that clicks the chat icon then
// times out.
//
// With `updates.tier: "off"`, `expressCreateServer` in
// node/hooks/express/updateStatus.ts short-circuits and never registers
// /api/version-status — the client fetch 404s and the badge stays hidden.
//
// This setting is easy to silently revert during a settings reshuffle.
// The lint here is cheap insurance: keep the default at "off" so any
// downstream plugin that does `cp src/tests/settings.json settings.json`
// against this core gets the fix for free.
//
// If you genuinely need the updater on for a specific test scenario, set
// it in that test's local fixture — don't change the shared default.
import {readFileSync} from 'fs';
import {join} from 'path';
import {describe, it, expect} from 'vitest';
const repoRoot = join(__dirname, '..', '..', '..', '..');
const read = (rel: string) => readFileSync(join(repoRoot, rel), 'utf8');
describe('test-settings updater default (#7800)', () => {
it('src/tests/settings.json sets updates.tier="off"', () => {
const json = JSON.parse(read('src/tests/settings.json'));
expect(json.updates, 'updates block must be present').toBeDefined();
expect(json.updates.tier).toBe('off');
});
});