test(perf): distinguish Codex tool context and token accounting (#2416)

Add optional owned Codex tool/usage capture and exact-name discovery experiments while preserving default ephemeral trials and all REA public APIs. Retain scoped managed and actual Android results, mixed outcomes, source identities and resource unknowns.

Six semantic Python tests, full checked pre-push, byte-identical own-file rebase verification, manual review and all 39 exact-head CI checks pass. Historical main fixture failures and their independent repair remain documented; measured source/runtime pins are unchanged.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Ysopwnable
2026-10-13 09:01:17 +08:00
committed by GitHub
co-authored by factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent 37b7550ecc
commit ee87111009
7 changed files with 582 additions and 28 deletions
@@ -52,6 +52,21 @@ def named_scope(value, names):
return {'conflicting_reported_scopes': selected}
def scope_with_verified_counts(value, expected_scope, returned_counts):
"""Validate explicit extra row counts; never erase unknown or conflicting facts."""
if not isinstance(value, dict):
return value, {}
scope = dict(value)
checks = {}
for name, expected in returned_counts.items():
if name in scope:
reported = scope[name]
checks[name] = type(reported) is int and reported == expected
if name not in expected_scope:
del scope[name]
return scope, checks
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--domain', choices=['wasm', 'evm', 'android', 'managed', 'managed-nonempty', 'firmware', 'inventory', 'javascript', 'native', 'browser'], required=True)
@@ -134,7 +149,13 @@ def main():
for key in ['module_refs', 'pinvoke_imports']:
check(key, answer.get('native_boundaries', {}).get(key), reference['boundaries'][key])
check('artifact_coverage', named_scope(answer.get('coverage'), ['artifact', 'managed_artifact', 'managed_metadata']), n['coverage'])
check('native_boundaries_coverage', named_scope(answer.get('coverage'), ['native_boundaries', 'native_boundary_declarations']), reference['boundaries']['coverage'])
boundary_scope, counts = scope_with_verified_counts(
named_scope(answer.get('coverage'), ['native_boundaries', 'native_boundary_declarations']),
reference['boundaries']['coverage'],
{'module_ref_count': len(reference['boundaries']['module_refs']),
'pinvoke_import_count': len(reference['boundaries']['pinvoke_imports'])})
check('native_boundaries_coverage', boundary_scope, reference['boundaries']['coverage'])
checks.update({'native_coverage_' + name: valid for name, valid in counts.items()})
elif domain == 'managed-nonempty':
n = reference['boundaries']
check('module_mvid', answer.get('module_mvid'), n['module']['mvid'])