test(code-runtime-python): pin send_done against rebinding write_encoded and _encode_json_plain

The rebinds-every-name fixture previously only rebound ProtocolChannel.send_sync,
which a bound method object ignores and the shipped send_done no longer calls —
so it did not actually guard the call-time-lookup shape. Rebind write_encoded
and _encode_json_plain too (the names send_done would resolve late if it looked
them up at call time) and state that in the settlement note's Testing section
(en + zh), re-recording the pairing.
This commit is contained in:
Chinesezjc
2026-08-31 14:33:31 +08:00
committed by Tianyi Cui
parent 093a6217ff
commit 7198234a82
4 changed files with 9 additions and 4 deletions
@@ -1412,7 +1412,12 @@ describe('PythonCodeRuntime — programs and bindings', () => {
'__main__._model_traceback = boom',
'__main__._UNRENDERABLE_DIAGNOSTIC = boom',
'__main__._LogStream.flush_line = boom',
// `send_done` writes via LOCALLY-BOUND `_encode_json_plain` +
// `ProtocolChannel.write_encoded`; rebinding these at call time must not
// redirect the done frame (a late lookup would be `boom` -> worker-exit).
'__main__.ProtocolChannel.send_sync = boom',
'__main__.ProtocolChannel.write_encoded = boom',
'__main__._encode_json_plain = boom',
'raise ValueError("real failure")',
].join('\n'),
bindings: [],