Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- CI and local test orchestration no longer requires the full 116-step deploy suite on every push. `check:prepush` runs core plus lightweight contracts for the files changed and falls back to the full suite for unknown or transversal changes; measured runs finished documentation in 46.8 s and a map change in 73.9 s, versus 1455 s for the previous full hook. `check:fast` and `check:deploy` now expand `tools/eval/suites.mjs`, with all original 338 and 116 steps preserved token-for-token and order-checked, plus `eval:portalembed` from staging. The CI keeps its complete independent lists.
- Invariants now run in source, VM, bots, characters/materials and four map shards. `INVARIANTES_FAMILIA` and map-check selectors reject unknown IDs before starting simulations, preserve each `freshReport` producer with its consumers and keep bots, mount and recoil execution in one shard. Equipment and Sertão are split by existing command/check IDs, with no duplicated scenario and no quality split.
- Every runner execution writes a timing JSON artifact with per-step status, duration and final exit. `--jobs=2` is available only for the core suite as an explicit opt-in; the pre-push stays sequential after local CPU-contention measurements.
- Edge traffic count (`src/lib/server-traffic.mjs`) now names in-app browsers: TikTok (`musical_ly`/`BytedanceWebview`/`TikTok`), Instagram, Facebook (`FBAN`/`FBAV`/`FB_IAB`), LinkedIn (`LinkedInApp`) and X (`TwitterAndroid`/`Twitter for iPhone`) stay `kind: browser` (they are people) with `agent: app/<name>`; open browsers keep the empty agent. Reason: the 08/11 TikTok paid campaign sent 517 visits in one hour, 72% loaded the game and 85% left in under a minute without entering, and the admin had no way to tell them from Chrome. `server-traffic-check.mjs` gains the five UA cases plus the open-Chrome and `facebookexternalhit` counter-cases, and is finally wired as `eval:servertraffic` inside `check:fast` (it had no script since #988).

### Fixed
- Multiplayer character voices belong to the character again (owner, 09/11: Saci and other absent characters shouting in a Lampião room). `Sfx.characterVoice` now resolves take of the event → another in-game take of the SAME character (kill/radio/round) → faction pool only for characters without structured in-game voice; the legacy string form (select-only) keeps the pool. The live pack stored every Mítico as that string with all 56 kill takes mixed in `voice.M`, so any Mítico kill picked any Mítico: `tools/audio/miticos-character-voice-apply.mjs` + `miticos-voice-map.json` (pool M identified offline by transcription + voice pitch band) restructure the 9 Míticos as `{select, kill}` with captions, zero new bytes, pool untouched — the owner applies it to the private manifest. Pinned by `eval:mp-voz-personagem` (VOZ1–6, mutant `pool-da-faccao`).
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,9 @@
"//eval:retratohero": "Retrato hero só para ids com arquivo (ops-diag #1231). Mutantes: hero-fantasma, helper-cego e consumidor-cru.",
"eval:retratohero": "node tools/eval/retrato-hero-check.mjs && node tools/eval/retrato-hero-check.mjs --mutante=hero-fantasma && node tools/eval/retrato-hero-check.mjs --mutante=helper-cego && node tools/eval/retrato-hero-check.mjs --mutante=consumidor-cru",
"//eval:xpixel": "Código-base do pixel do X insere o <script> do uwt.js (ops-diag #1231: insertBefore recebia a função twq). Mutante: insere-funcao.",
"eval:xpixel": "node tools/eval/x-pixel-snippet-check.mjs && node tools/eval/x-pixel-snippet-check.mjs --mutante=insere-funcao"
"eval:xpixel": "node tools/eval/x-pixel-snippet-check.mjs && node tools/eval/x-pixel-snippet-check.mjs --mutante=insere-funcao",
"//eval:servertraffic": "Classificação de user-agent da contagem de borda (src/lib/server-traffic.mjs): bots de busca/IA/preview/automação fora, navegador interno de app (app/tiktok, app/instagram…) nomeado e continuando como browser. Nunca esteve em script desde a #988.",
"eval:servertraffic": "node --test tools/eval/server-traffic-check.mjs"
},
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions src/lib/server-traffic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,22 @@ const AGENTS = [
[/facebookexternalhit|twitterbot|linkedinbot|slackbot|discordbot|whatsapp/i, 'social-preview', 'social/preview'],
];

/* Navegador interno de app: segue `kind: 'browser'` (é gente) com agente nomeado, porque se
comporta diferente (08/11: 85% das visitas do TikTok saíram em menos de 1 min). Régua: eval:servertraffic. */
const APPS = [
[/musical_ly|bytedancewebview|tiktok/i, 'app/tiktok'],
[/instagram/i, 'app/instagram'],
[/\bFBAN\b|\bFBAV\b|FB_IAB/, 'app/facebook'],
[/linkedinapp/i, 'app/linkedin'],
[/twitterandroid|twitter for iphone/i, 'app/x'],
];

function classify(agent) {
const ua = agent || '';
for (const [pattern, kind, name] of AGENTS) if (pattern.test(ua)) return { kind, agent: name };
if (/bot|crawler|spider|ahrefs|semrush/i.test(ua)) return { kind: 'other-bot', agent: 'other/unknown-bot' };
if (/curl|python-requests|wget|httpclient|axios|node-fetch/i.test(ua) || !ua) return { kind: 'automation', agent: 'automation/tool' };
for (const [pattern, name] of APPS) if (pattern.test(ua)) return { kind: 'browser', agent: name };
return { kind: 'browser', agent: '' };
}

Expand Down
5 changes: 3 additions & 2 deletions tests/eval-suites.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const BASELINE = {
fast: { quantidade: 338, sha256: '05c5d2027a8229f379a4556ee991daf1bc0e9f45b04ee3515d4e458259d6bfdf' },
deploy: { quantidade: 116, sha256: '3aea0f68ace2a6954de58bd2ae028e7ab17cd879ca9057ac002c80f92955859d' },
};
const NOVOS = { fast: new Set(['eval:portalembed', 'eval:lixo', 'eval:envruntime']), deploy: new Set() };
const NOVOS = { fast: new Set(['eval:portalembed', 'eval:lixo', 'eval:envruntime', 'eval:servertraffic']), deploy: new Set() };
const assinatura = (passos) => createHash('sha256').update(passos.join('\n')).digest('hex');

for (const [nome, baseline] of Object.entries(BASELINE)) {
Expand All @@ -35,10 +35,11 @@ for (const [nome, baseline] of Object.entries(BASELINE)) {
});
}

test('staging adiciona portalembed, lixo e envruntime sem apagar os passos migrados', () => {
test('staging adiciona portalembed, lixo, envruntime e servertraffic sem apagar os passos migrados', () => {
assert.ok(SUITES.fast.includes('eval:portalembed'));
assert.ok(SUITES.fast.includes('eval:lixo'));
assert.ok(SUITES.fast.includes('eval:envruntime'));
assert.ok(SUITES.fast.includes('eval:servertraffic'));
});

test('suites temáticas só reutilizam passos existentes, sem duplicar execução', () => {
Expand Down
13 changes: 13 additions & 0 deletions tools/eval/server-traffic-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ describe('entradas HTML contadas no servidor', () => {
assert.equal(trafficEntry(req('curl/8.0'))?.kind, 'automation');
});

it('navegador interno de app é browser (gente), com o app nomeado e referrer/UTM preservados', () => {
const req = (agent) => new Request('https://www.corosolto.com.br/?utm_source=tiktok', { headers: { accept: 'text/html', referer: 'https://www.tiktok.com/', 'user-agent': agent } });
const tiktok = 'Mozilla/5.0 (Linux; Android 14; SM-A155M Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.6723.107 Mobile Safari/537.36 musical_ly_2024.12 JsSdk/1.0 NetType/WIFI Channel/googleplay AppName/musical_ly app_version/38.2.5 ByteLocale/pt-BR ByteFullLocale/pt-BR Region/BR BytedanceWebview/d8a21c6';
assert.deepEqual(trafficEntry(req(tiktok)), { landing: '/', referrer: 'www.tiktok.com', utmSource: 'tiktok', kind: 'browser', agent: 'app/tiktok' });
assert.equal(trafficEntry(req('Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21F90 Instagram 334.0.4.32.98 (iPhone15,2; iOS 17_5; pt_BR; pt; scale=3.00; 1179x2556; 606166883)'))?.agent, 'app/instagram');
assert.equal(trafficEntry(req('Mozilla/5.0 (Linux; Android 13; SM-G991B Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/129.0.0.0 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/480.0.0.42.75;]'))?.agent, 'app/facebook');
assert.equal(trafficEntry(req('Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36 LinkedInApp'))?.agent, 'app/linkedin');
// Chrome comum continua sem agente: o campo vazio é o que separa navegador aberto de app.
assert.deepEqual(trafficEntry(req('Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36')), { landing: '/', referrer: 'www.tiktok.com', utmSource: 'tiktok', kind: 'browser', agent: '' });
// O preview do Facebook (facebookexternalhit) é bot de preview, nunca app.
assert.equal(trafficEntry(req('facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'))?.kind, 'social-preview');
});

it('não conta recursos, API, HEAD ou hosts de preview', () => {
const entry = (url, method = 'GET', accept = 'text/html') => trafficEntry(new Request(url, { method, headers: { accept } }));
assert.equal(entry('https://www.corosolto.com.br/api/health'), null);
Expand Down
Loading
Loading