Calls to makeClientMarshaller share static mutable state: the results of 1 call to makeTranslationTable(...).
To Reproduce
This test fails:
test('calls to makeClientMarshaller do not share static mutable state', () => {
const m1 = makeClientMarshaller();
const m2 = makeClientMarshaller();
const capData = { body: '#"$0.Brand"', slots: ['board0123'] };
// b1 is a fresh synthetic remotable object
const b1 = m1.fromCapData(capData);
// unless m2 somehow has access to state from m1, m2 can't access b1.
const b2 = m2.fromCapData(capData);
expect(b1).not.toBe(b2);
});
Expected behavior
The call to makeTranslationTable(...) should be inside makeClientMarshaller.
Exported function such as makeClientMarshaller should not close over static mutable state.
This follows from anything globally accessible is immutable data in OCap Discipline.
Platform Environment
what OS are you using? what version of Node.js?
v18.17.1
Describe the bug
Calls to
makeClientMarshaller
share static mutable state: the results of 1 call tomakeTranslationTable(...)
.To Reproduce
This test fails:
Expected behavior
The call to
makeTranslationTable(...)
should be insidemakeClientMarshaller
.Exported function such as
makeClientMarshaller
should not close over static mutable state. This follows from anything globally accessible is immutable data in OCap Discipline.Platform Environment