mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
fix(javascript): keep exact empty values in graph identities
#839 displayed empty artifact-local keys and source-map original names as `""` inside node identities, so `fetch("")` and `fetch('""')` (or `sources: ["", "\"\""]`) produced the same node ID and merged two distinct facts. Function nodes likewise exposed only a display label, so `['']()` and `['""']()` were indistinguishable. Admit the exact empty string in `artifact-local-key.key` and `source-map-original.original_source`, keep the `""` substitution for labels only, and record each function node's exact `name` in its properties. Regenerate the catalog digests for the relaxed output schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -370,14 +370,24 @@ it("keeps exact empty environment keys distinct from dynamic keys", () => {
|
||||
|
||||
it("labels exact empty method names without inventing computed names", () => {
|
||||
const graph = graphFor(`
|
||||
const target = { ['']() { return 42; }, [key]() { return 1; } };
|
||||
const target = {
|
||||
['']() { return 42; },
|
||||
['""']() { return 2; },
|
||||
[key]() { return 1; },
|
||||
};
|
||||
`);
|
||||
const labels = graph.nodes
|
||||
const functions = graph.nodes
|
||||
.filter(({ kind }) => kind === "function")
|
||||
.map(({ label }) => label);
|
||||
expect(labels).toContain('""');
|
||||
.map(({ label, properties }) => ({ label, name: properties.name }));
|
||||
// Both exact names display as `""`; only `properties.name` tells them apart.
|
||||
expect(functions).toEqual(
|
||||
expect.arrayContaining([
|
||||
{ label: '""', name: "" },
|
||||
{ label: '""', name: '""' },
|
||||
]),
|
||||
);
|
||||
expect(
|
||||
labels.filter((label) => label?.startsWith("[computed@")),
|
||||
functions.filter(({ label }) => label?.startsWith("[computed@")),
|
||||
).toHaveLength(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user