You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,50 @@ Uses `.clang-format` with LLVM base style:
147
147
- Tab indentation (4-space tabs)
148
148
- K&R inspired style
149
149
150
+
## Test Integrity
151
+
Never modify, delete, skip, or weaken tests to make them pass.
152
+
Never fabricate, adjust, or derive expected values from the code under test just to force a pass; fixed expected values are acceptable when they come from an independent oracle, such as committed test vectors or other externally verified results.
153
+
A passing test suite achieved by changing the tests (not the implementation) is not a passing result.
154
+
Fix the code. If the code cannot be fixed within scope, escalate.
155
+
156
+
Do not use the code under test as its only oracle where an independent oracle is required, especially for crypto, KDFs, canonical encodings, and other security-sensitive transformations. In those cases, tests should use known external test vectors, cross-validation against an independent implementation, or bit-exact comparison against a trusted reference path. For example, a test that only encrypts with function A and decrypts with function A is insufficient to validate the correctness of the cryptographic primitive.
157
+
158
+
Roundtrip/property tests are still acceptable where they match the behavior being validated, such as encode/decode or serialize/parse flows already used elsewhere in this repository, but they should not be the sole oracle when stronger independent validation is needed.
159
+
160
+
## No Fabrication
161
+
Never report status, results, or completion that does not reflect work actually performed.
162
+
If you are uncertain whether a step succeeded, say so explicitly. Do not paper over uncertainty with confident-sounding output.
163
+
164
+
## Exit Code Discipline
165
+
Every shell command's exit code must be checked.
166
+
Never proceed after a silent failure.
167
+
A command that failed and was ignored is not a completed step.
168
+
169
+
## MQTT Specification Discipline
170
+
Wire format and protocol behavior are governed by the published MQTT specifications. Treat the spec as the source of truth, not the code.
171
+
172
+
Relevant specifications:
173
+
- MQTT v3.1.1 — OASIS Standard (`mqtt-v3.1.1-os`)
174
+
- MQTT v5.0 — OASIS Standard (`mqtt-v5.0`)
175
+
- MQTT-SN v1.2 — OASIS
176
+
177
+
When implementing or testing a normative requirement, cite it in a comment so reviewers can verify against the spec:
- When a rule has no bracketed identifier, reference the section number, e.g. `MQTT 5.0 section 3.15.2`.
180
+
- MQTT-SN v1.2: `MQTT-SN 1.2 section X.Y`.
181
+
182
+
Match the version scope of the change. MQTT v5.0 adds packets and fields (AUTH, Reason Codes, Properties) that do not exist in v3.1.1; do not apply a v5-only rule to v3.1.1 code paths or vice versa. Guard v5-only logic with `WOLFMQTT_V5` and v3.1.1-only logic accordingly.
183
+
184
+
## Test Oracle Discipline
185
+
Do not use the code under test as its own oracle for wire-format behavior. For encoder or decoder tests, use one of:
186
+
- A hand-constructed byte sequence that matches the spec wire format, built by reading the relevant section (not captured from encoder output). Comment the byte layout so the fixture is auditable.
187
+
- Values from the spec's worked examples or conformance annex.
188
+
- A cross-check against an independent implementation (e.g. mosquitto) captured once and committed as a fixed byte array.
189
+
190
+
Roundtrip tests (encode then decode, or vice versa) are acceptable for regression and structural coverage, but they cannot be the sole oracle for a wire-format rule — a bug present in both encoder and decoder will still roundtrip. Pair roundtrip coverage with at least one independent fixture per rule.
191
+
192
+
Tests must be fully offline and must not fetch vectors from the network at runtime.
0 commit comments