Skip to content

[go-CAN-02] No J1939 test vector exercises the Data-Page bit, so the pgn.go bit-placement bug is untested #74

Description

@SoundMatt

Location: j1939/pgn_test.go:24-61 (TestDecodeEncodeRoundTrip, TestIsPeerToPeer)

Finding: The only PGN test cases in this file are 0x0FECA, 0x00E800, and 0x0FF00 — all DP=0. No test constructs or checks a DP=1 PGN. Worse, the sole encode/decode test is a pure round-trip (EncodeID output fed straight into DecodeID), so a shared, symmetric bug in both directions — exactly what the DP-bit-placement issue is — passes cleanly even though the externally-visible PGN value is wrong. There's no test that asserts a fixed, independently-known-correct 29-bit CAN ID against a hand-computed golden value for a given (priority, PGN, src) tuple.

Recommendation: Add golden-value test vectors — including at least one DP=1 PGN — that check EncodeID against a hand-computed 29-bit ID and DecodeID against a hand-computed PGN, independent of each other, so the two directions can't mask a shared defect.

Filed from the 2026-07-29 ecosystem audit register; independently re-verified against current HEAD before filing.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions