Reading / writing values from / to frames is broken
The representation of a left value left(a): A + B is [0] * [?]^padL(A,B) * representation(a, A).
The representation of a right value right(b): A + B is [1] * [?]^padR(A,B) * representation(b, B).
Neither the read method nor the write method handle this.
I think this remained undetected because we never initialize the Bit Machine with input values, nor do we ever read output values from the final output frame.
To clarify, it's the read_value and write_value methods that are broken -- which indeed, are only used when providing programs with inputs or outputs.
I'm not terribly surprised these methods are broken. You're right that they've basically never been used and I guess there aren't very good tests since this predates all the ConstructNode/miniscript/text representation stuff. Sorry.