Skip to content

Please release main to npm — 2.2.7 still ships the pre-refactor crash (undefined threshold / null trend) #46

Description

@fakehec

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 nullCannot 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.tsif (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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions