main (the TypeScript refactor) fixes a crash that the latest published version — 2.2.7 (Feb 2025) — still ships:
- In
trend.js, THRESHOLDS_RATIO.sort(ascendingNumbers).find(t => Math.abs(ratio) < t.pascal) returns undefined when Math.abs(ratio) is not < any threshold (i.e. ratio is NaN/Infinity, which happens with degenerate pressure history — samples with equal/invalid timestamps making difference / from blow up). The next line reads threshold.trend.key unguarded → TypeError: Cannot read properties of undefined (reading 'trend'). (ascendingNumbers also compares the threshold objects by subtraction, so the sort is a no-op NaN comparator.)
- One level up,
getPredictions() reads pressureTrend.tendency when getTrend() returned null → Cannot read properties of null (reading 'tendency').
Both are already handled on main:
src/trend.ts — .sort((a, b) => a.pascal - b.pascal) and if (!threshold) return null;
index.ts — if (pressureTrend === null) return null;
The problem is only that these fixes aren't released: npm latest is still 2.2.7, which predates the refactor. So a fresh npm install of signalk-barometer-trend pulls the crashing build — it throws on essentially every pressure sample and repeatedly takes the SignalK server down (reported downstream at oyve/signalk-barometer-trend#24, where the user's workaround was to disable the plugin).
Would it be possible to cut a new release from main so downstream can depend on the fixed version? Thanks for maintaining this.
main(the TypeScript refactor) fixes a crash that the latest published version —2.2.7(Feb 2025) — still ships:trend.js,THRESHOLDS_RATIO.sort(ascendingNumbers).find(t => Math.abs(ratio) < t.pascal)returnsundefinedwhenMath.abs(ratio)is not<any threshold (i.e.ratioisNaN/Infinity, which happens with degenerate pressure history — samples with equal/invalid timestamps makingdifference / fromblow up). The next line readsthreshold.trend.keyunguarded →TypeError: Cannot read properties of undefined (reading 'trend'). (ascendingNumbersalso compares the threshold objects by subtraction, so the sort is a no-opNaNcomparator.)getPredictions()readspressureTrend.tendencywhengetTrend()returnednull→Cannot read properties of null (reading 'tendency').Both are already handled on
main:src/trend.ts—.sort((a, b) => a.pascal - b.pascal)andif (!threshold) return null;index.ts—if (pressureTrend === null) return null;The problem is only that these fixes aren't released: npm
latestis still2.2.7, which predates the refactor. So a freshnpm installofsignalk-barometer-trendpulls the crashing build — it throws on essentially every pressure sample and repeatedly takes the SignalK server down (reported downstream at oyve/signalk-barometer-trend#24, where the user's workaround was to disable the plugin).Would it be possible to cut a new release from
mainso downstream can depend on the fixed version? Thanks for maintaining this.