diff --git a/server/test/identity-platform-preserved.test.js b/server/test/identity-platform-preserved.test.js index 7406cad..f0dd063 100644 --- a/server/test/identity-platform-preserved.test.js +++ b/server/test/identity-platform-preserved.test.js @@ -48,8 +48,13 @@ test('the capability baseline survives that register — which is the whole poin const bsAfter = resolve({ client_type: 'player', client_version: '1.9.29', platform: 'brightsign', contract_version: 'v4' }, {}); const bsRow = { platform: bsAfter.platform, client_type: bsAfter.client_type, android_version: null }; assert.equal(caps.platformFamily(bsRow), 'brightsign'); - assert.equal(caps.supports(bsRow, 'system.reboot'), true, 'a BrightSign really can reboot'); - assert.equal(caps.supports(bsRow, 'remote.screenshot'), false, 'and really cannot screenshot'); + // Reboot needs the BrightScript host bridge, and an UNDECLARED unit is exactly the one we cannot + // know has it — a widget pointed at /player by someone else's tooling has no bridge at all. The + // point being preserved here is that the row still classifies as brightsign rather than decaying + // to `web`, which would have handed it the web baseline's screenshot and volume instead. + assert.equal(caps.supports(bsRow, 'system.reboot'), false, 'the baseline cannot assume a host bridge'); + assert.equal(caps.supports(bsRow, 'remote.screenshot'), false, 'and a canvas cannot read the video plane'); + assert.equal(caps.supports(bsRow, 'playback.video'), true, 'but it certainly plays video'); }); test('a register that DOES declare a platform still updates it', () => { diff --git a/server/test/player-parity-baselines.test.js b/server/test/player-parity-baselines.test.js index 7470490..80b90ac 100644 --- a/server/test/player-parity-baselines.test.js +++ b/server/test/player-parity-baselines.test.js @@ -25,20 +25,42 @@ const { test } = require('node:test'); const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); +const { execSync } = require('node:child_process'); const caps = require('../lib/player-capabilities'); const ROOT = path.join(__dirname, '..', '..'); const read = (p) => fs.readFileSync(path.join(ROOT, p), 'utf8'); +/* + * Baselines describe what an UN-UPDATED display can do, so they must be judged against the SHIPPED + * source, not the working tree. + * + * This distinction is not pedantic — it is the bug that made this file contradict itself. The + * baselines were justified against `git show v1.9.28:`, then read from the working tree, so + * the moment a player's payload bug was fixed the biconditional below demanded a baseline change for + * displays that cannot possibly have the fix yet. A baseline entry should move when a fix SHIPS, not + * when it is written. + * + * Falls back to the working tree when the tags are not available (a shallow CI clone), because a + * missing tag is a worse reason to fail a build than a slightly-early assertion. + */ +function readShipped(rel) { + try { + const tag = execSync("git tag --list 'v*' --sort=-v:refname | head -1", { cwd: ROOT, encoding: 'utf8' }).trim(); + if (tag) return execSync(`git show ${tag}:${rel}`, { cwd: ROOT, encoding: 'utf8', maxBuffer: 1 << 26 }); + } catch (e) { /* no tags, or the path did not exist in that release */ } + return read(rel); +} + const SRC = { - web: read('server/player/index.html'), + web: readShipped('server/player/index.html'), android: [ 'android/app/src/main/java/com/remotedisplay/player/MainActivity.kt', 'android/app/src/main/java/com/remotedisplay/player/service/WebSocketService.kt', 'android/app/src/main/java/com/remotedisplay/player/telemetry/PlayerCapabilities.kt', ].map(read).join('\n'), - tizen: ['tizen/js/app.js', 'tizen/js/device-control.js', 'tizen/js/capabilities.js'].map(read).join('\n'), - brightsign: ['brightsign/st-bridge.js', 'brightsign/autorun.brs'].map(read).join('\n'), + tizen: ['tizen/js/app.js', 'tizen/js/device-control.js', 'tizen/js/capabilities.js'].map(readShipped).join('\n'), + brightsign: ['brightsign/st-bridge.js', 'brightsign/autorun.brs'].map(readShipped).join('\n'), }; /*