assert(bindBoard.includes("boardTarget=e.target.closest?.('.board-input-surface')")&&bindBoard.includes('!endpointTarget&&!gateTarget&&!boardTarget')&&bindBoard.indexOf('!endpointTarget&&!gateTarget&&!boardTarget')<bindBoard.indexOf('ensureBoardClaimForInput(b)'),'Board cells and existing lines cannot enter the claimed input path');
assert(claimPresentation.includes("own?'プレイ中'"),'Own board badge is not labelled プレイ中');
assert(!claimRequest.includes('toast(')&&!removeClaim.includes('toast('),'Board ownership still emits bottom notifications');
assert(functionSource('applyCloudEnvelope').includes('applyPlayerEconomyEnvelope(result)'),'Clear push response does not update the local gem wallet');
assert(functionSource('checkSolvedAndExpand').includes('data.states[b.id]=previous.state')&&functionSource('checkSolvedAndExpand').includes('for(let attempt=0;attempt<3&&!published;attempt++)'),'Unconfirmed clears can remain locally solved');
assert(functionSource('canExpandSharedBoard').includes('state.solvedById===currentPlayerId()'),'A non-solving player can generate transient expansion boards');
asyncfunctionready(){for(leti=0;i<120;i++){try{constresult=awaitrequest('/api/cloud/status');if(result.response.ok)returnresult.body}catch{}awaitsleep(30)}thrownewError(`Server did not start: ${stderr}`)}
for(constsessionofsessions)assert(normalStarterIds.has(session.starterLineColor),`Premium or unknown starter color returned: ${session.starterLineColor}`);
assert(newSet(sessions.map(session=>session.starterLineColor)).size>1,'Initial line color is not distributed across the normal color pool');
assert.equal(result.response.status,200,JSON.stringify(result.body));assert.equal(result.body.clearEvents.length,1,'Clear was not authoritatively accepted');assert(result.body.player.earnedScore>0,'Clear response did not include earned gems');assert.equal(result.body.player.availableScore,result.body.player.earnedScore);
constpolling=awaitrequest(`/api/realtime/poll?presenceId=${encodeURIComponent(presenceId)}&afterSequence=${connected.body.sequence||0}`,{headers:auth(alice)});assert.equal(polling.response.status,200);assert(polling.body.messages.some(message=>message.type==='claim-release'&&message.boardId==='B0'),'Clear did not release the プレイ中 claim');assert(polling.body.messages.some(message=>message.type==='world-revision'&&message.revision===clearRevision&&message.boardIds.includes('B0')),'Clear did not announce its world revision in realtime');
letpull=awaitrequest('/api/cloud/pull?since=0',{headers:auth(bob)});assert.equal(pull.body.page.states.B0.solved,true,'Other player did not receive the clear');
constplayerState=awaitrequest('/api/player/state',{headers:auth(alice)});assert.equal(playerState.body.player.earnedScore,reward,'Gem wallet did not persist the clear reward');
pull=awaitrequest('/api/cloud/pull?since=0',{headers:auth(bob)});assert.equal(pull.body.page.states.B0.solved,true,'A stale unfinished update reverted a cleared board');
pull=awaitrequest('/api/cloud/pull?since=0',{headers:auth(bob)});assert(pull.body.page.metas.B1&&pull.body.page.states.B1,'New shared board disappeared before the next pull');
pull=awaitrequest('/api/cloud/pull?since=0',{headers:auth(bob)});assert.equal(pull.body.page.states.B0.solved,true,'Cleared board reverted after server restart');assert(pull.body.page.metas.B1&&pull.body.page.states.B1,'New board disappeared after server restart');
consteconomyAfterRestart=awaitrequest('/api/player/state',{headers:auth(alice)});assert.equal(economyAfterRestart.body.player.earnedScore,reward,'Gem wallet disappeared after server restart');
console.log('LinkField v48.00 shared clear, claim release, expansion, and gem persistence smoke test passed');