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
9 changes: 9 additions & 0 deletions lib/adversarial-paths.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ test('adversarial-review: nearby same-titled findings merge into the more severe
assert.equal(run.reportValue.verdict, 'Block')
})

test('adversarial-review: titles in a non-Latin script still tokenise, so nearby Cyrillic duplicates merge', async () => {
const a = '\u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0446\u0438\u043a\u043b\u0430 \u0441\u0434\u0432\u0438\u0433'
const run = await runEngine('adversarial-review', {
script: script({ correctness: { findings: [F(a, 'src/a.rs', 10, 'medium')] }, security: { findings: [F(`${a} \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430`, 'src/a.rs', 12, 'high')] } },
{ scout: scout({ lenses: ['correctness', 'security'] }) }),
})
assert.ok(run.logs.includes('Review: 2 raw findings -> 1 after mechanical dedup'), run.logs.join('\n'))
})

test('adversarial-review: the verdict ladder, and an escalated finding that lost its deciding vote', async () => {
/** @param {Record<string, unknown>} lenses */
const verdictOf = async lenses => (await runEngine('adversarial-review', { script: script(lenses) })).reportValue.verdict
Expand Down
6 changes: 3 additions & 3 deletions lib/engine-harness.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ test('rust-audit: a nested review that DIED (null report) is NOT RUN with a logg
// verdict. Folding the review axis into dispatchDim resolves report==null to null BEFORE
// reviewResult, so a dead nested review now lands in NOT RUN exactly like an agent death.
//
// Discriminator (Фальсификация поимённо): `security` is scripted LIVE while the nested review is
// Discriminator (falsify per element): `security` is scripted LIVE while the nested review is
// scripted dead (`workflow: null`), so the NOT-RUN membership and the death log track the DEATH and
// could not fire for a dimension that ran to a result.
const run = await runEngine('rust-audit', {
Expand Down Expand Up @@ -402,7 +402,7 @@ test('rust-audit: a nested review that RAN to an unreadable verdict is a Warning
// report is still a Warning; a fix that instead nulled on `verdictLine == null` would sweep this
// legitimate run into NOT RUN, and this test is what refutes that over-correction.
//
// Discriminator (Фальсификация поимённо): every AGENT axis dies here (`'*': null`), so `notRun` is
// Discriminator (falsify per element): every AGENT axis dies here (`'*': null`), so `notRun` is
// non-empty and their death log fires — proving the review axis's ABSENCE from both is a real
// discrimination, not a vacuously empty set.
const run = await runEngine('rust-audit', {
Expand Down Expand Up @@ -437,7 +437,7 @@ test('rust-audit: a dead or thrown contract dimension is NOT RUN under its Unico
//
// So: script a touched edge (a changed crate on one end), kill the contract agent both ways it can
// die, and assert that the death is LOGGED and the axis lands in `notRun` — both under the Unicode
// key, never the ASCII label. Discriminator (Фальсификация поимённо): `security` is scripted LIVE, so
// key, never the ASCII label. Discriminator (falsify per element): `security` is scripted LIVE, so
// a death log / notRun membership that tracks the contract axis cannot also fire for one that ran.
const scout = {
hasDiff: true, hasUnsafe: false, baseRef: 'main', repoRoot: '/ws', notes: 'x',
Expand Down
2 changes: 1 addition & 1 deletion lib/lens-scope.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ test('lens-scope: git octal escapes are decoded back into the real name', () =>
// per UTF-8 byte. Handling only `\\` and `\"` left the literal twelve characters
// `caf\\303\\251.rs`, which matches no file — the name was silently absent from its slice.
assert.equal(decodeGitPath('"caf\\303\\251.rs"'), 'café.rs')
assert.equal(decodeGitPath('"\\320\\277\\321\\203\\321\\202\\321\\214.rs"'), 'путь.rs')
assert.equal(decodeGitPath('"\\320\\277\\321\\203\\321\\202\\321\\214.rs"'), '\u043f\u0443\u0442\u044c.rs')
assert.equal(decodeGitPath('"tab\\there.rs"'), 'tab\there.rs')
assert.equal(decodeGitPath('"nl\\nhere.rs"'), 'nl\nhere.rs')
// An escape git does not emit keeps BOTH characters. Swallowing the backslash produced a valid
Expand Down
2 changes: 1 addition & 1 deletion lib/memory-record-id.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sha256Hex, memoryRecordId } from './memory-record-id.mjs'
const STRINGS = [
'', 'a', 'abc', 'decision\nunwrap in parser is fine\nsrc/parse.rs',
'a'.repeat(55), 'a'.repeat(56), 'a'.repeat(63), 'a'.repeat(64), 'a'.repeat(65), 'x'.repeat(1000),
'ошибка в разборе', 'naïve café — “quoted”', '日本語のタイトル', 'emoji 🦀 crab and 𝄞 clef', 'mixed\ttabs\r\nand lines',
'\u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0440\u0430\u0437\u0431\u043e\u0440\u0435', 'naïve café — “quoted”', '日本語のタイトル', 'emoji 🦀 crab and 𝄞 clef', 'mixed\ttabs\r\nand lines',
'lone \ud800 surrogate',
]

Expand Down
2 changes: 1 addition & 1 deletion src/adversarial-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -2152,7 +2152,7 @@ const { deadLenses, all } = await runFinderLenses(plan.lenses)
// AND similar titles — proximity alone never merges, so two distinct issues in one window
// survive as two findings. Under-merge costs one cheap verify agent; over-merge silently
// loses a finding — stay conservative.
const normTokens = (/** @type {unknown} */ t) => new Set(String(t || '').toLowerCase().replace(/[^a-z0-9а-яё]+/gi, ' ').split(' ').filter(w => w.length > 2))
const normTokens = (/** @type {unknown} */ t) => new Set(String(t || '').toLowerCase().replace(/[^a-z0-9\u0430-\u044f\u0451]+/gi, ' ').split(' ').filter(w => w.length > 2))
/** @param {unknown} a @param {unknown} b */
function titleSimilar(a, b) {
const tokensA = normTokens(a), B = normTokens(b)
Expand Down
2 changes: 1 addition & 1 deletion workflows/adversarial-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ async function runFinderLenses(lenses) {
phase('Review')
const { deadLenses, all } = await runFinderLenses(plan.lenses)

const normTokens = (/** @type {unknown} */ t) => new Set(String(t || '').toLowerCase().replace(/[^a-z0-9а-яё]+/gi, ' ').split(' ').filter(w => w.length > 2))
const normTokens = (/** @type {unknown} */ t) => new Set(String(t || '').toLowerCase().replace(/[^a-z0-9\u0430-\u044f\u0451]+/gi, ' ').split(' ').filter(w => w.length > 2))
/** @param {unknown} a @param {unknown} b */
function titleSimilar(a, b) {
const tokensA = normTokens(a), B = normTokens(b)
Expand Down
Loading