Skip to content

pyOSut (osut 0.9.0) dependency bugs worked around by _compat.py — report upstream to rd2/pyOSut #1

Description

@phylroy

While porting TBD to Python, three bugs were found in the pyOSut dependency
(osut 0.9.0, https://github.com/rd2/pyOSut). Each deviates from the canonical
Ruby osut behaviour that py-tbd must mirror, so all three are worked around by a
version/behaviour-guarded runtime shim (src/tbd/_compat.py) that no-ops once the
dependency ships a fix. They should be reported/fixed upstream in rd2/pyOSut.

See UPSTREAM.md → Dependency bugs for the authoritative record.

D1 — insulatingLayer raises NameError on massless layers 🔴

osut.py:579, massless branch:

res["r"] = m.thermalResistance()   # `m` is undefined; loop var is `l`

Any construction whose insulating layer is a MasslessOpaqueMaterial (very common)
raises NameError: name 'm' is not defined. Fix: ml.

D2 — insulatingLayer uses hardcoded thresholds instead of RMIN/DMIN/KMAX 🔴

osut.py qualifies a layer with 0.001 / 0.003 / 3.0 where Ruby osut uses
the constants RMIN (0.005), DMIN (0.01), KMAX (2.0). Consequence: a different
layer is selected as "insulating" than in the Ruby gem — e.g. a ~0.15 m
normalweight-concrete floor (k≈2.31) is excluded by Ruby (k > KMAX) but kept
by pyOSut (k > 3.0), changing every downstream derating result for that surface.
Fix: use the RMIN/DMIN/KMAX constants.

D3 — rsi accumulates an Optional instead of a resistance 🔴

osut.py:536, massless branch:

rsi += m.to_MasslessOpaqueMaterial()   # missing .get().thermalResistance()

rsi raises TypeError: unsupported operand type(s) for +=: 'float' and 'OptionalMasslessOpaqueMaterial' for any construction containing a massless layer.
Fix: rsi += m.to_MasslessOpaqueMaterial().get().thermalResistance().


Workaround in py-tbd: src/tbd/_compat.py installs _insulating_layer_fixed
(D1+D2) and _rsi_fixed (D3), matching Ruby osut 0.9.1, only when the buggy
behaviour is detected. This issue tracks removing the shim once pyOSut releases a
fix and py-tbd's dependency pin is bumped.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesPertains to a dependency packageupstreamTracks an upstream fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions