docs(code-runtime-python): sync README with the shipped backend

The package README (both languages) still described this layer as
protocol-only with the PythonCodeRuntime implementation deferred to a
later PR, contradicting the shipped code. Rewrite the intro to describe
the registered runtime, add a Configuration section for every Config cap,
and drop the "implementation not in this layer" limitation. Also pin the
residual-detach fixture's size invariant: the byteLength assertion only
holds above Node's Buffer pool threshold.
This commit is contained in:
Chinesezjc
2026-08-31 14:20:00 +08:00
committed by Tianyi Cui
parent e576ceb913
commit 538ad4d3dc
4 changed files with 48 additions and 205 deletions
@@ -5,6 +5,12 @@ describe('detachResidual — fd-3 residual detachment', () => {
it('returns a copy that does NOT share the source frame allocation', () => {
// Simulate the data handler's state: one large joined frame from
// Buffer.concat, sliced past its newline to leave a small residual VIEW.
// The fixture MUST stay larger than Node's Buffer pool threshold
// (`Buffer.poolSize / 2`, 4 KiB): above it `Buffer.from` allocates a
// dedicated backing store whose `byteLength` equals the copy's length,
// which is what the byteLength assertion below pins. A smaller residual
// would be pooled into an 8 KiB shared ArrayBuffer, making `byteLength`
// report 8192 and the assertion false-fail even though the fix is intact.
const joined = Buffer.alloc(1024 * 1024, 0x61) // 1 MiB backing allocation
joined[512] = 0x0a // a newline partway through
const residual = joined.subarray(513) // a view onto `joined`'s backing store
@@ -17,10 +23,13 @@ describe('detachResidual — fd-3 residual detachment', () => {
expect(carried).toBeDefined()
expect(carried!.length).toBe(residual.length)
expect(carried!.equals(residual)).toBe(true)
// The copy's backing store is its own, sized to its content — not the 1 MiB
// frame. A subarray view would report the source's full byteLength here.
expect(carried!.buffer.byteLength).toBe(carried!.length)
// The core invariant: the copy does NOT share the source frame's backing
// store, so retaining it cannot pin the 1 MiB allocation.
expect(carried!.buffer).not.toBe(joined.buffer)
// And the copy's own backing store is sized to its content — not the whole
// frame. Holds because the fixture exceeds the pool threshold (see above);
// a subarray view would report the source's full byteLength here.
expect(carried!.buffer.byteLength).toBe(carried!.length)
})
it('carries nothing forward for an empty residual', () => {