fix(domain): preserve derived byte counts and uncertain identity

This commit is contained in:
morluto
2026-10-13 13:12:06 +08:00
parent 8b181716ac
commit 7a2cd1ea0a
4 changed files with 59 additions and 13 deletions
@@ -22,6 +22,26 @@ const exampleMethod = () => {
};
describe("managed decompiler reconstruction import", () => {
it("reports UTF-8 byte totals while preserving UTF-16 text lengths", () => {
const text = 'return "é"; // 😀';
const method = exampleMethod();
const result = importManagedReconstructionEvidence({
...MANAGED_RECONSTRUCTION_IMPORT_EXAMPLE,
methods: [
{
...method,
reconstruction: { ...method.reconstruction, text },
},
],
});
if (!result.ok) throw result.error;
expect(result.value.normalized_result).toMatchObject({
summary: { total_text_bytes: 20 },
methods: [{ reconstruction: { text, text_length: 17 } }],
});
});
it("rejects reconstruction text hash drift", () => {
expect(() =>
importManagedReconstruction({