Skip to content

A14-19: .CharLengthCache key omits the tree -> cross-tree contamination of ExpectedLength()/rhi #87

Description

@ms609

R/Consistency.R:151-152key <- paste(c(nRelabel, x), collapse = ",") uses only the replicate count and the state-count tabulation x, never a tree-derived quantity. Two different trees scored against the same dataset with the same nRelabel collide on the same cache entry.

Reproduced verbatim by the opus verifier: on a 16-tip dataset, ExpectedLength(dat, PectinateTree(16), 500) returns 4 (the balanced tree's median) instead of the correct 5, once BalancedTree(16) was scored first in the same R session. Fresh session gives the correct 5.

This feeds Consistency(..., nRelabel > 0)'s rhi — a headline published statistic — with a plausible-looking wrong number, and independently defeats set.seed() reproducibility for any workflow scoring more than one tree per session.

Fix: include a tree-derived quantity (e.g. a hash of the tree topology, or at minimum NTip(tree) is insufficient — needs actual topology) in the cache key.

Filed by /red-team area 14 (opus finder, 2026-08-05), confirmed by opus verifier with live repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:14Red-team focus area 14in-progressBeing fixed; claiming comment names the branchred-teamFiled by the /red-team rotationsev:highP1: wrong user-visible result / crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions