wireforge 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. wireforge/__init__.py +3 -0
  2. wireforge/_data/cmake/WireForgeConfig.cmake +29 -0
  3. wireforge/_data/cmake/WireForgeConfigVersion.cmake +15 -0
  4. wireforge/_data/cmake/WireForgeGenerate.cmake +64 -0
  5. wireforge/_data/runtime/LICENSE +21 -0
  6. wireforge/_data/runtime/include/wireforge/array_access.hpp +35 -0
  7. wireforge/_data/runtime/include/wireforge/bit_utils.hpp +226 -0
  8. wireforge/_data/runtime/include/wireforge/byte_io.hpp +387 -0
  9. wireforge/_data/runtime/include/wireforge/checksum.hpp +201 -0
  10. wireforge/_data/runtime/include/wireforge/codec_support.hpp +412 -0
  11. wireforge/_data/runtime/include/wireforge/config.hpp +41 -0
  12. wireforge/_data/runtime/include/wireforge/delegate.hpp +101 -0
  13. wireforge/_data/runtime/include/wireforge/dispatcher.hpp +339 -0
  14. wireforge/_data/runtime/include/wireforge/expr_support.hpp +38 -0
  15. wireforge/_data/runtime/include/wireforge/frame_decoder.hpp +262 -0
  16. wireforge/_data/runtime/include/wireforge/frame_layout.hpp +20 -0
  17. wireforge/_data/runtime/include/wireforge/link.hpp +223 -0
  18. wireforge/_data/runtime/include/wireforge/lock.hpp +146 -0
  19. wireforge/_data/runtime/include/wireforge/ring_buffer.hpp +226 -0
  20. wireforge/_data/runtime/include/wireforge/span.hpp +116 -0
  21. wireforge/_data/runtime/include/wireforge/static_vector.hpp +264 -0
  22. wireforge/_data/runtime/include/wireforge/status.hpp +75 -0
  23. wireforge/_data/runtime/include/wireforge/transport.hpp +95 -0
  24. wireforge/_data/runtime/include/wireforge/validation.hpp +153 -0
  25. wireforge/_data/runtime/include/wireforge/version.hpp +22 -0
  26. wireforge/_data/runtime/requirements.yaml +438 -0
  27. wireforge/_data/schema/deviations.schema.json +47 -0
  28. wireforge/_data/schema/fragment.schema.json +79 -0
  29. wireforge/_data/schema/llr_ids.schema.json +25 -0
  30. wireforge/_data/schema/project.schema.json +1240 -0
  31. wireforge/_data/schema/runtime_requirements.schema.json +34 -0
  32. wireforge/_data/ui/assets/index-6Pomu6U4.js +44 -0
  33. wireforge/_data/ui/assets/index-GVdDyUAG.css +1 -0
  34. wireforge/_data/ui/index.html +13 -0
  35. wireforge/bundle.py +177 -0
  36. wireforge/ci_check.py +155 -0
  37. wireforge/cli.py +617 -0
  38. wireforge/codec.py +897 -0
  39. wireforge/compat.py +536 -0
  40. wireforge/coverage_points.py +64 -0
  41. wireforge/cpp.py +273 -0
  42. wireforge/cpp_codec.py +440 -0
  43. wireforge/cpp_interface.py +874 -0
  44. wireforge/cpp_tests.py +1993 -0
  45. wireforge/differential.py +586 -0
  46. wireforge/docs_markdown.py +72 -0
  47. wireforge/expr.py +598 -0
  48. wireforge/findings.py +187 -0
  49. wireforge/fmt.py +351 -0
  50. wireforge/generate.py +644 -0
  51. wireforge/golden.py +253 -0
  52. wireforge/hlr_import.py +112 -0
  53. wireforge/impact.py +249 -0
  54. wireforge/importers.py +402 -0
  55. wireforge/issues.py +27 -0
  56. wireforge/layout.py +681 -0
  57. wireforge/lifecycle.py +1266 -0
  58. wireforge/lifecycle_results.py +205 -0
  59. wireforge/lifecycle_rules.py +78 -0
  60. wireforge/lifecycle_runtime.py +375 -0
  61. wireforge/llr.py +693 -0
  62. wireforge/llr_ids.py +104 -0
  63. wireforge/loader.py +422 -0
  64. wireforge/mcp_server.py +357 -0
  65. wireforge/model.py +322 -0
  66. wireforge/plain.py +15 -0
  67. wireforge/py.typed +0 -0
  68. wireforge/reqif.py +289 -0
  69. wireforge/resources.py +43 -0
  70. wireforge/results.py +377 -0
  71. wireforge/runtime_reqs.py +147 -0
  72. wireforge/schema.py +151 -0
  73. wireforge/server/__init__.py +1 -0
  74. wireforge/server/app.py +619 -0
  75. wireforge/server/oidc.py +99 -0
  76. wireforge/server/storage.py +146 -0
  77. wireforge/service.py +1354 -0
  78. wireforge/templates/command/project.yaml +38 -0
  79. wireforge/templates/raw/project.yaml +28 -0
  80. wireforge/templates/telemetry/project.yaml +51 -0
  81. wireforge/test_cases.py +475 -0
  82. wireforge/test_project.py +478 -0
  83. wireforge/trace.py +442 -0
  84. wireforge/validate.py +1241 -0
  85. wireforge/vcs.py +44 -0
  86. wireforge/vectors.py +222 -0
  87. wireforge/versioning.py +137 -0
  88. wireforge/wireshark.py +792 -0
  89. wireforge/wireshark_runtime.lua +725 -0
  90. wireforge-0.1.0.dist-info/METADATA +91 -0
  91. wireforge-0.1.0.dist-info/RECORD +96 -0
  92. wireforge-0.1.0.dist-info/WHEEL +5 -0
  93. wireforge-0.1.0.dist-info/entry_points.txt +2 -0
  94. wireforge-0.1.0.dist-info/licenses/LICENSE +98 -0
  95. wireforge-0.1.0.dist-info/licenses/runtime/LICENSE +21 -0
  96. wireforge-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @file validation.hpp
3
+ * @brief Value checks used by generated `validate()` functions.
4
+ *
5
+ * Every check returns Status::Ok or the error code; first_error() combines several checks so that
6
+ * generated functions stay free of branches.
7
+ */
8
+ #ifndef WIREFORGE_VALIDATION_HPP
9
+ #define WIREFORGE_VALIDATION_HPP
10
+
11
+ #include "wireforge/status.hpp"
12
+
13
+ #include <cstddef>
14
+ #include <cstdint>
15
+ #include <type_traits>
16
+
17
+ namespace wireforge {
18
+
19
+ /**
20
+ * @brief `lhs < rhs` for any two arithmetic values, correct across signed and unsigned integers.
21
+ */
22
+ template <typename A, typename B> [[nodiscard]] constexpr bool less(A lhs, B rhs) noexcept {
23
+ static_assert(std::is_arithmetic_v<A> && std::is_arithmetic_v<B>, "arithmetic values only");
24
+ if constexpr (std::is_integral_v<A> && std::is_integral_v<B>) {
25
+ if constexpr (std::is_signed_v<A> == std::is_signed_v<B>) {
26
+ return lhs < rhs;
27
+ } else if constexpr (std::is_signed_v<A>) {
28
+ return lhs < 0 || static_cast<std::make_unsigned_t<A>>(lhs) < rhs;
29
+ } else {
30
+ return rhs >= 0 && lhs < static_cast<std::make_unsigned_t<B>>(rhs);
31
+ }
32
+ } else {
33
+ return static_cast<double>(lhs) < static_cast<double>(rhs);
34
+ }
35
+ }
36
+
37
+ /// @brief Status::OutOfRange when @p value is below @p low.
38
+ template <typename V, typename L>
39
+ [[nodiscard]] constexpr Status check_min(V value, L low) noexcept {
40
+ if constexpr (std::is_floating_point_v<V>) {
41
+ return value >= static_cast<V>(low) ? Status::Ok : Status::OutOfRange;
42
+ } else {
43
+ return less(value, low) ? Status::OutOfRange : Status::Ok;
44
+ }
45
+ }
46
+
47
+ /// @brief Status::OutOfRange when @p value is above @p high.
48
+ template <typename V, typename H>
49
+ [[nodiscard]] constexpr Status check_max(V value, H high) noexcept {
50
+ if constexpr (std::is_floating_point_v<V>) {
51
+ return value <= static_cast<V>(high) ? Status::Ok : Status::OutOfRange;
52
+ } else {
53
+ return less(high, value) ? Status::OutOfRange : Status::Ok;
54
+ }
55
+ }
56
+
57
+ /// @brief Status::OutOfRange unless @p low <= @p value <= @p high (NaN is out of range).
58
+ template <typename V, typename L, typename H>
59
+ [[nodiscard]] constexpr Status check_range(V value, L low, H high) noexcept {
60
+ return check_min(value, low) == Status::Ok ? check_max(value, high) : Status::OutOfRange;
61
+ }
62
+
63
+ /// @brief Status::OutOfRange unless @p value fits @p bits bits (unsigned or two's complement).
64
+ template <typename V> [[nodiscard]] constexpr Status check_bits(V value, unsigned bits) noexcept {
65
+ static_assert(std::is_integral_v<V>, "bit-fields are integers");
66
+ using Unsigned = std::make_unsigned_t<V>;
67
+ constexpr unsigned kWidth = sizeof(V) * 8U;
68
+ // The shift count is taken modulo 64, so it is never 64 (undefined) even in the branch that
69
+ // is not selected for a 64-bit value; MSVC reports such a shift as C4293.
70
+ constexpr std::uint64_t kMask =
71
+ kWidth >= 64U ? ~std::uint64_t{0U} : ((std::uint64_t{1U} << (kWidth % 64U)) - 1U);
72
+ const std::uint64_t raw = static_cast<std::uint64_t>(static_cast<Unsigned>(value)) & kMask;
73
+ if constexpr (std::is_signed_v<V>) {
74
+ // In range when every bit from the sign bit of the field upwards equals the sign.
75
+ const std::uint64_t upper = raw >> (bits - 1U);
76
+ return upper == 0U || upper == (kMask >> (bits - 1U)) ? Status::Ok : Status::OutOfRange;
77
+ } else {
78
+ return (raw >> bits) == 0U ? Status::Ok : Status::OutOfRange;
79
+ }
80
+ }
81
+
82
+ /// @brief Status::OutOfRange when @p valid is false (enum membership and similar checks).
83
+ [[nodiscard]] constexpr Status check_true(bool valid) noexcept {
84
+ return valid ? Status::Ok : Status::OutOfRange;
85
+ }
86
+
87
+ /// @brief Status::CountExceedsMax unless @p low <= @p count <= @p high.
88
+ [[nodiscard]] constexpr Status check_count(std::size_t count, std::size_t low,
89
+ std::size_t high) noexcept {
90
+ return count >= low && count <= high ? Status::Ok : Status::CountExceedsMax;
91
+ }
92
+
93
+ /// @brief Status::CountExceedsMax unless @p count equals @p expected.
94
+ [[nodiscard]] constexpr Status check_count_equals(std::size_t count,
95
+ std::int64_t expected) noexcept {
96
+ return expected >= 0 && count == static_cast<std::size_t>(expected) ? Status::Ok
97
+ : Status::CountExceedsMax;
98
+ }
99
+
100
+ /// @brief Status::Ok when @p holds, otherwise @p error.
101
+ [[nodiscard]] constexpr Status status_if(bool holds, Status error) noexcept {
102
+ return holds ? Status::Ok : error;
103
+ }
104
+
105
+ /// @brief @p size when @p status is Status::Ok, otherwise 0.
106
+ [[nodiscard]] constexpr std::size_t size_if_ok(Status status, std::size_t size) noexcept {
107
+ return status == Status::Ok ? size : 0U;
108
+ }
109
+
110
+ /// @brief The first of @p statuses that is not Status::Ok, or Status::Ok.
111
+ template <typename... Statuses>
112
+ [[nodiscard]] constexpr Status first_error(Statuses... statuses) noexcept {
113
+ static_assert((std::is_same_v<Statuses, Status> && ...), "arguments must be Status values");
114
+ Status result = Status::Ok;
115
+ static_cast<void>(((result = result == Status::Ok ? statuses : result), ...));
116
+ return result;
117
+ }
118
+
119
+ /// @brief Identifies a type in overloads of generated free functions (found through ADL).
120
+ template <typename T> struct TypeTag {};
121
+
122
+ /// @brief The TypeTag value of @p T, e.g. `max_wire_size(wireforge::type_tag<Msg>)`.
123
+ template <typename T> inline constexpr TypeTag<T> type_tag{};
124
+
125
+ /// @brief Calls the generated `validate(element)` on every element; returns the first error.
126
+ template <typename Container>
127
+ [[nodiscard]] constexpr Status validate_each(const Container& container) noexcept {
128
+ Status result = Status::Ok;
129
+ for (const auto& element : container) {
130
+ result = validate(element);
131
+ if (result != Status::Ok) {
132
+ break;
133
+ }
134
+ }
135
+ return result;
136
+ }
137
+
138
+ /// @brief Applies @p check to every element; returns the first error.
139
+ template <typename Container, typename Check>
140
+ [[nodiscard]] constexpr Status check_each(const Container& container, Check check) noexcept {
141
+ Status result = Status::Ok;
142
+ for (const auto& element : container) {
143
+ result = check(element);
144
+ if (result != Status::Ok) {
145
+ break;
146
+ }
147
+ }
148
+ return result;
149
+ }
150
+
151
+ } // namespace wireforge
152
+
153
+ #endif // WIREFORGE_VALIDATION_HPP
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @file version.hpp
3
+ * @brief Version of the WireForge runtime.
4
+ */
5
+ #ifndef WIREFORGE_VERSION_HPP
6
+ #define WIREFORGE_VERSION_HPP
7
+
8
+ #include <cstdint>
9
+
10
+ namespace wireforge {
11
+
12
+ inline constexpr std::uint32_t kVersionMajor = 0U; ///< Major version.
13
+ inline constexpr std::uint32_t kVersionMinor = 1U; ///< Minor version.
14
+ inline constexpr std::uint32_t kVersionPatch = 0U; ///< Patch version.
15
+
16
+ /// @brief Packed version number: major * 10000 + minor * 100 + patch.
17
+ inline constexpr std::uint32_t kVersionNumber =
18
+ (kVersionMajor * 10000U) + (kVersionMinor * 100U) + kVersionPatch;
19
+
20
+ } // namespace wireforge
21
+
22
+ #endif // WIREFORGE_VERSION_HPP
@@ -0,0 +1,438 @@
1
+ # Requirements of the WireForge runtime library (MIT, like the library).
2
+ #
3
+ # STATUS: draft. The requirements were written from the Doxygen comments of the headers and from what
4
+ # the unit tests check, so they describe the code and are not independent of it. They must be reviewed
5
+ # against the intended behaviour by a person; the pull request that changes this file records who did.
6
+ #
7
+ # Not covered yet: array_access.hpp, expr_support.hpp, frame_layout.hpp and config.hpp have no unit test
8
+ # of their own (generated code exercises them). IDs are never reused: a requirement that is dropped
9
+ # stays here with `retired: true`.
10
+ schema_version: 1
11
+ component: wireforge-runtime
12
+ requirements:
13
+ RTR-status-001:
14
+ header: status.hpp
15
+ code: [to_string]
16
+ text: Every status code shall have a name, and a value outside the enumeration shall be named "Unknown".
17
+ verification: test
18
+ RTR-version-001:
19
+ header: version.hpp
20
+ code: [kVersionNumber]
21
+ text: The packed version number shall equal major * 10000 + minor * 100 + patch.
22
+ verification: test
23
+
24
+ RTR-span-001:
25
+ header: span.hpp
26
+ code: [Span, subspan, first]
27
+ text: A span shall view a contiguous range without owning it; subspans and prefixes shall stay inside the range.
28
+ verification: test
29
+ RTR-span-002:
30
+ header: span.hpp
31
+ code: [Span, make_span]
32
+ text: A span of mutable elements shall convert to a span of const elements, and make_span shall build a span from arrays and containers.
33
+ verification: test
34
+ RTR-static_vector-001:
35
+ header: static_vector.hpp
36
+ code: [StaticVector, push_back, resize]
37
+ text: A static vector shall hold at most its capacity; adding or resizing beyond it shall fail with a status and leave the vector unchanged.
38
+ realizes: [COUNT]
39
+ verification: test
40
+ RTR-static_vector-002:
41
+ header: static_vector.hpp
42
+ code: [StaticVector]
43
+ text: A vector of capacity one shall represent an optional field (empty or one element).
44
+ verification: test
45
+ RTR-static_vector-003:
46
+ header: static_vector.hpp
47
+ code: [StaticVector]
48
+ text: Two static vectors shall compare equal when their used elements are equal, whatever is in the unused storage.
49
+ verification: test
50
+ RTR-static_vector-004:
51
+ header: static_vector.hpp
52
+ code: [FixedString, assign, resize, view]
53
+ text: A fixed string shall hold at most its capacity of characters, report an assignment or resize beyond it, and give a view of the used characters.
54
+ realizes: [CHARS]
55
+ verification: test
56
+
57
+ RTR-lock-001:
58
+ header: lock.hpp
59
+ code: [StdMutexLock, ScopedLock]
60
+ text: The standard mutex lock policy shall serialize the threads that use it. The claim covers the use of the library from several threads and is the integrator's to verify on the target.
61
+ verification: analysis
62
+ RTR-lock-002:
63
+ header: lock.hpp
64
+ code: [NullLock, ScopedLock]
65
+ text: The null lock policy shall cost nothing and accept the same guard syntax, for single-threaded use.
66
+ verification: test
67
+ RTR-lock-003:
68
+ header: lock.hpp
69
+ code: [RelaxedCounter]
70
+ text: A relaxed counter shall count increments from several threads without loss. The claim is the integrator's to verify on the target.
71
+ verification: analysis
72
+ RTR-lock-004:
73
+ header: lock.hpp
74
+ code: [DefaultLock]
75
+ text: The runtime shall build without the standard mutex (WIREFORGE_NO_STD_MUTEX), with the null lock as the default policy.
76
+ verification: test
77
+ RTR-static_vector-005:
78
+ header: static_vector.hpp
79
+ code: [StaticVector, FixedString]
80
+ text: The runtime shall not allocate heap memory.
81
+ verification: test
82
+
83
+ RTR-byte_io-001:
84
+ header: byte_io.hpp
85
+ code: [ByteWriter, ByteReader, write_unsigned, read_unsigned]
86
+ text: Unsigned integers of 1 to 8 bytes shall be written and read in big or little endian order as requested.
87
+ realizes: [LAYOUT]
88
+ verification: test
89
+ RTR-byte_io-002:
90
+ header: byte_io.hpp
91
+ code: [write_signed, read_signed]
92
+ text: Signed integers shall be written as two's complement and read back with the same value, including the extremes of each width.
93
+ realizes: [LAYOUT]
94
+ verification: test
95
+ RTR-byte_io-003:
96
+ header: byte_io.hpp
97
+ code: [write_unsigned, write_signed]
98
+ text: A value that does not fit the requested width shall be rejected with OutOfRange and shall not change the writer.
99
+ realizes: [BITS]
100
+ verification: test
101
+ RTR-byte_io-004:
102
+ header: byte_io.hpp
103
+ code: [ByteWriter]
104
+ text: A write beyond the buffer shall fail with BufferTooSmall and leave the writer unchanged.
105
+ realizes: [FRAME_ENCODE]
106
+ verification: test
107
+ RTR-byte_io-005:
108
+ header: byte_io.hpp
109
+ code: [ByteReader]
110
+ text: A read beyond the input shall fail with Truncated and leave the reader unchanged.
111
+ realizes: [TRUNCATED]
112
+ verification: test
113
+ RTR-byte_io-006:
114
+ header: byte_io.hpp
115
+ code: [ByteWriter, ByteReader]
116
+ text: Values shall be written and read at any byte offset without alignment requirements.
117
+ verification: test
118
+ RTR-byte_io-007:
119
+ header: byte_io.hpp
120
+ code: [write_unsigned_at, peek_unsigned_at]
121
+ text: A value inside the already written region shall be patched or peeked without moving the position.
122
+ verification: test
123
+ RTR-byte_io-008:
124
+ header: byte_io.hpp
125
+ code: [ByteWriter, ByteReader]
126
+ text: Floating-point values shall be written as their IEEE 754 bit patterns, special values included.
127
+ realizes: [LAYOUT]
128
+ verification: test
129
+ RTR-bit_utils-001:
130
+ header: bit_utils.hpp
131
+ code: [sign_extend, to_twos_complement, fits_signed, fits_unsigned]
132
+ text: Sign extension, two's complement conversion and width checks shall be correct for every width up to 64 bits.
133
+ realizes: [BITS]
134
+ verification: test
135
+ RTR-bit_utils-002:
136
+ header: bit_utils.hpp
137
+ code: [BitPacker, BitUnpacker, write_bits, read_bits]
138
+ text: Bit groups shall pack and unpack fields that straddle bytes, in most-significant-bit-first and least-significant-bit-first order and in both byte orders, up to 64 bits.
139
+ realizes: [LAYOUT]
140
+ verification: test
141
+ RTR-bit_utils-003:
142
+ header: bit_utils.hpp
143
+ code: [BitPacker, BitUnpacker]
144
+ text: Signed bit fields shall be sign-extended when read.
145
+ realizes: [LAYOUT]
146
+ verification: test
147
+ RTR-bit_utils-004:
148
+ header: bit_utils.hpp
149
+ code: [BitPacker, BitUnpacker]
150
+ text: A bit group of an invalid size, a field that does not fit it and a truncated group shall be reported with a status.
151
+ realizes: [BITS, TRUNCATED]
152
+ verification: test
153
+
154
+ RTR-ring_buffer-001:
155
+ header: ring_buffer.hpp
156
+ code: [SpscByteRing, StaticSpscByteRing]
157
+ text: A byte ring shall be usable to its full capacity.
158
+ verification: test
159
+ RTR-ring_buffer-002:
160
+ header: ring_buffer.hpp
161
+ code: [SpscByteRing]
162
+ text: A byte ring shall return bytes in the order they were written, also when the indices wrap around.
163
+ verification: test
164
+ RTR-ring_buffer-003:
165
+ header: ring_buffer.hpp
166
+ code: [SpscByteRing]
167
+ text: A byte ring shall allow peeking at an offset and consuming a number of bytes without copying.
168
+ verification: test
169
+ RTR-ring_buffer-004:
170
+ header: ring_buffer.hpp
171
+ code: [SpscByteRing]
172
+ text: A byte ring shall behave like a queue of bytes under any sequence of writes, reads, peeks and consumes.
173
+ verification: test
174
+ RTR-ring_buffer-005:
175
+ header: ring_buffer.hpp
176
+ code: [SpscByteRing]
177
+ text: A ring with one producer thread and one consumer thread shall lose and reorder no bytes. The claim is the integrator's to verify on the target.
178
+ verification: analysis
179
+ RTR-ring_buffer-006:
180
+ header: ring_buffer.hpp
181
+ code: [LockedByteRing]
182
+ text: A locked ring shall lose and reorder no bytes with several producers and consumers, and shall offer the interface of the single-producer ring. The claim for several threads is the integrator's to verify on the target.
183
+ verification: analysis
184
+
185
+ RTR-checksum-001:
186
+ header: checksum.hpp
187
+ code: [Crc, compute]
188
+ text: Parametric CRCs, with a table and without, shall produce the catalog check values.
189
+ realizes: [ALGORITHM, CHECKSUM]
190
+ verification: test
191
+ RTR-checksum-002:
192
+ header: checksum.hpp
193
+ code: [Crc]
194
+ text: The CRC aliases shall have the width, and the checksum size shall be the width in bytes.
195
+ realizes: [ALGORITHM]
196
+ verification: test
197
+ RTR-checksum-003:
198
+ header: checksum.hpp
199
+ code: [Crc, update, finalize]
200
+ text: A CRC computed in pieces shall equal the CRC computed at once, and the CRC of empty input shall be the initial value with the final xor applied.
201
+ realizes: [ALGORITHM]
202
+ verification: test
203
+ RTR-checksum-004:
204
+ header: checksum.hpp
205
+ code: [is_checksum, compute_checksum]
206
+ text: A user-defined checksum that provides init, update, finalize and a size shall be accepted wherever a CRC is.
207
+ realizes: [ALGORITHM]
208
+ verification: test
209
+
210
+ RTR-frame_decoder-001:
211
+ header: frame_decoder.hpp
212
+ code: [FrameFormat, FrameDecoder, valid]
213
+ text: A frame format shall be accepted only when its fields, sizes and length rule are consistent.
214
+ realizes: [FRAME_LENGTH]
215
+ verification: test
216
+ RTR-frame_decoder-002:
217
+ header: frame_decoder.hpp
218
+ code: [FrameDecoder, next]
219
+ text: The frame decoder shall deliver a complete frame, and the result shall not depend on how the bytes were split into chunks.
220
+ realizes: [FRAME_LENGTH]
221
+ verification: test
222
+ RTR-frame_decoder-003:
223
+ header: frame_decoder.hpp
224
+ code: [FrameDecoder, next]
225
+ text: The frame decoder shall skip bytes until the configured sync value and count them as skipped.
226
+ realizes: [FRAME_SYNC]
227
+ verification: test
228
+ RTR-frame_decoder-004:
229
+ header: frame_decoder.hpp
230
+ code: [FrameDecoder, next]
231
+ text: A frame with a wrong checksum shall be reported once as ChecksumMismatch and the decoder shall go on with the next frame.
232
+ realizes: [FRAME_RESYNC]
233
+ verification: test
234
+ RTR-frame_decoder-005:
235
+ header: frame_decoder.hpp
236
+ code: [FrameDecoder, next]
237
+ text: A length above the maximum frame size or above the ring capacity shall be reported as InvalidLength.
238
+ realizes: [FRAME_MAX]
239
+ verification: test
240
+ RTR-frame_decoder-006:
241
+ header: frame_decoder.hpp
242
+ code: [FrameDecoder, next]
243
+ text: Without resynchronization an error shall drop all buffered bytes.
244
+ realizes: [FRAME_RESYNC]
245
+ verification: test
246
+ RTR-frame_decoder-007:
247
+ header: frame_decoder.hpp
248
+ code: [FrameDecoder, next]
249
+ text: An output buffer that cannot hold the frame shall be reported as BufferTooSmall.
250
+ verification: test
251
+ RTR-frame_decoder-008:
252
+ header: frame_decoder.hpp
253
+ code: [FrameFormat, FrameDecoder]
254
+ text: Fixed-size framing with a sync value and a payload checksum shall be decoded.
255
+ realizes: [FRAME_LENGTH, FRAME_SYNC]
256
+ verification: test
257
+ RTR-frame_decoder-009:
258
+ header: frame_decoder.hpp
259
+ code: [FrameFormat, FrameDecoder]
260
+ text: A length field shall be interpreted as counting the payload, the payload and the trailer, or the whole frame, as configured.
261
+ realizes: [FRAME_LENGTH]
262
+ verification: test
263
+ RTR-frame_decoder-010:
264
+ header: frame_decoder.hpp
265
+ code: [FrameDecoder, counters]
266
+ text: The decoder shall work on a locked ring and shall reset its counters on request.
267
+ verification: test
268
+
269
+ RTR-delegate-001:
270
+ header: delegate.hpp
271
+ code: [Delegate]
272
+ text: A default-constructed delegate and a delegate made from a null function shall test false.
273
+ verification: test
274
+ RTR-delegate-002:
275
+ header: delegate.hpp
276
+ code: [Delegate, from_function, bind]
277
+ text: A delegate shall call a free function or a member function of an object.
278
+ verification: test
279
+ RTR-delegate-003:
280
+ header: delegate.hpp
281
+ code: [Delegate, from_callable]
282
+ text: A delegate shall refer to a callable object and not copy it.
283
+ verification: test
284
+ RTR-dispatcher-001:
285
+ header: dispatcher.hpp
286
+ code: [Dispatcher, dispatch, find]
287
+ text: The dispatcher shall deliver a message to the handler registered for its id, also with many ids.
288
+ realizes: [DISPATCH]
289
+ verification: test
290
+ RTR-dispatcher-002:
291
+ header: dispatcher.hpp
292
+ code: [Dispatcher, add, start]
293
+ text: Registration of an empty handler, of a duplicate id and after start, and a second start, shall be reported as InvalidState.
294
+ realizes: [DISPATCH]
295
+ verification: test
296
+ RTR-dispatcher-003:
297
+ header: dispatcher.hpp
298
+ code: [Dispatcher, dispatch]
299
+ text: A message with an unknown id shall go to the fallback handler when there is one, and shall be reported as UnknownMessageId otherwise.
300
+ realizes: [DISPATCH_UNKNOWN]
301
+ verification: test
302
+ RTR-dispatcher-004:
303
+ header: dispatcher.hpp
304
+ code: [Dispatcher, dispatch_frame, HeaderLayout]
305
+ text: A frame shall be dispatched by the id found with the header layout, passing the payload and the whole frame to the handler.
306
+ realizes: [DISPATCH]
307
+ verification: test
308
+ RTR-dispatcher-005:
309
+ header: dispatcher.hpp
310
+ code: [Dispatcher]
311
+ text: Dispatching after start shall be safe from several threads, and registration before start too. The claim for several threads is the integrator's to verify on the target.
312
+ verification: analysis
313
+ RTR-dispatcher-006:
314
+ header: dispatcher.hpp
315
+ code: [RawDispatcher, RawMessage]
316
+ text: The raw dispatcher shall give every frame to its single handler undecoded, with payload and frame, and report UnknownMessageId when there is no handler.
317
+ realizes: [RAW, DISPATCH_UNKNOWN]
318
+ verification: test
319
+
320
+ RTR-transport-001:
321
+ header: transport.hpp
322
+ code: [ITransport, is_transport]
323
+ text: A link shall work through the abstract transport interface as well as through a concrete transport type.
324
+ verification: test
325
+ RTR-link-001:
326
+ header: link.hpp
327
+ code: [Link, record]
328
+ text: A link shall send a frame to the transport and deliver a received frame to the dispatcher.
329
+ realizes: [FRAME_ENCODE, DISPATCH]
330
+ verification: test
331
+ RTR-link-002:
332
+ header: link.hpp
333
+ code: [Link, LinkCounters]
334
+ text: A link shall deliver frames in the order received and count bytes, frames and errors.
335
+ realizes: [DISPATCH]
336
+ verification: test
337
+ RTR-link-003:
338
+ header: link.hpp
339
+ code: [Link, PollResult]
340
+ text: A link shall report garbage and unknown message ids in the poll result without delivering them.
341
+ realizes: [DISPATCH_UNKNOWN, FRAME_SYNC]
342
+ verification: test
343
+ RTR-link-004:
344
+ header: link.hpp
345
+ code: [Link]
346
+ text: A link shall report an encoder error and a transport that cannot take the frame, and count the frame as not sent.
347
+ realizes: [FRAME_ENCODE]
348
+ verification: test
349
+ RTR-link-005:
350
+ header: link.hpp
351
+ code: [Link, Unframed]
352
+ text: A link without framing shall treat each transport read as one frame.
353
+ realizes: [FRAME_LENGTH]
354
+ verification: test
355
+ RTR-link-006:
356
+ header: link.hpp
357
+ code: [Link, Unframed]
358
+ text: A read longer than the maximum frame of an unframed link shall be rejected as InvalidLength.
359
+ realizes: [FRAME_MAX]
360
+ verification: test
361
+ RTR-link-007:
362
+ header: link.hpp
363
+ code: [Link]
364
+ text: One thread may send while another polls. The claim is the integrator's to verify on the target.
365
+ verification: analysis
366
+
367
+ RTR-codec_support-001:
368
+ header: codec_support.hpp
369
+ code: [Encoder, Decoder]
370
+ text: The encoder and decoder shall write and read every wire type of the model.
371
+ realizes: [LAYOUT, SIZE]
372
+ verification: test
373
+ RTR-codec_support-002:
374
+ header: codec_support.hpp
375
+ code: [Encoder, Decoder, status]
376
+ text: After the first error the encoder and decoder shall keep that status and refuse further work.
377
+ verification: test
378
+ RTR-codec_support-003:
379
+ header: codec_support.hpp
380
+ code: [Encoder, Decoder, fill_count]
381
+ text: Element counts and values shall be checked against their limits and reported as CountExceedsMax or OutOfRange.
382
+ realizes: [COUNT, RANGE]
383
+ verification: test
384
+ RTR-codec_support-004:
385
+ header: codec_support.hpp
386
+ code: [Encoder, Decoder]
387
+ text: A boolean on the wire shall be 0 or 1; any other value shall be reported as OutOfRange.
388
+ realizes: [RANGE]
389
+ verification: test
390
+ RTR-codec_support-005:
391
+ header: codec_support.hpp
392
+ code: [Encoder, Decoder, resize]
393
+ text: Text fields shall be zero padded on write and stripped of trailing zeros on read, and a payload-filling array shall take the rest of the payload.
394
+ realizes: [CHARS, COUNT]
395
+ verification: test
396
+ RTR-codec_support-006:
397
+ header: codec_support.hpp
398
+ code: [Encoder, Decoder]
399
+ text: Bit groups, constant fields (ConstMismatch) and checksums (ChecksumMismatch) shall be written and checked.
400
+ realizes: [CONST, CHECKSUM, LAYOUT]
401
+ verification: test
402
+ RTR-codec_support-007:
403
+ header: codec_support.hpp
404
+ code: [Decoder]
405
+ text: The decoder shall expect a given value and report bytes left after the last field as TrailingBytes.
406
+ realizes: [CONST, TRAILING]
407
+ verification: test
408
+ RTR-codec_support-008:
409
+ header: codec_support.hpp
410
+ code: [Encoder, Decoder]
411
+ text: Raw bytes shall be copied unchanged, and a buffer too small or input too short shall be reported as BufferTooSmall or Truncated.
412
+ realizes: [LAYOUT, TRUNCATED]
413
+ verification: test
414
+
415
+ RTR-validation-001:
416
+ header: validation.hpp
417
+ code: [check_range, check_min, check_max]
418
+ text: Range checks shall report OutOfRange for a value outside its limits, and NaN shall be outside every range.
419
+ realizes: [RANGE]
420
+ verification: test
421
+ RTR-validation-002:
422
+ header: validation.hpp
423
+ code: [check_true, status_if]
424
+ text: Width and membership checks shall report OutOfRange when the condition does not hold.
425
+ realizes: [ENUM, BITS]
426
+ verification: test
427
+ RTR-validation-003:
428
+ header: validation.hpp
429
+ code: [check_count, check_count_equals, first_error]
430
+ text: Count checks shall report CountExceedsMax, and several checks shall combine into the first error.
431
+ realizes: [COUNT]
432
+ verification: test
433
+ RTR-validation-004:
434
+ header: validation.hpp
435
+ code: [check_each, validate_each]
436
+ text: A check on every element of a sequence shall report the first element that fails.
437
+ realizes: [RANGE, COUNT]
438
+ verification: test
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "WireForge deviations (justifications for lines and rules that are not satisfied)",
4
+ "description": "Optional file `deviations.yaml` in the project directory. It is not part of the model and does not change the model hash.",
5
+ "type": "object",
6
+ "required": ["schema_version", "deviations"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "deviations": {
10
+ "type": "array",
11
+ "items": {
12
+ "oneOf": [
13
+ {
14
+ "type": "object",
15
+ "required": ["kind", "file", "function", "category", "rationale", "reviewer"],
16
+ "properties": {
17
+ "kind": { "const": "coverage" },
18
+ "file": { "type": "string", "minLength": 1, "description": "Runtime header relative to the include directory (wireforge/...), or <project>/... for generated code. `*` matches any characters." },
19
+ "function": { "type": "string", "minLength": 1, "description": "Demangled function name as gcov reports it; `*` matches any characters." },
20
+ "lines": { "type": "array", "items": { "type": "integer", "minimum": 1 }, "minItems": 1, "uniqueItems": true, "description": "Only these lines; absent: every uncovered line of the function." },
21
+ "category": { "enum": ["deactivated", "defensive", "unreachable-by-design"] },
22
+ "rationale": { "type": "string", "minLength": 1 },
23
+ "reviewer": { "type": "string", "minLength": 1 }
24
+ },
25
+ "additionalProperties": false
26
+ },
27
+ {
28
+ "type": "object",
29
+ "required": ["kind", "tool", "rule", "file", "category", "rationale", "reviewer"],
30
+ "properties": {
31
+ "kind": { "const": "rule" },
32
+ "tool": { "type": "string", "minLength": 1 },
33
+ "rule": { "type": "string", "minLength": 1 },
34
+ "file": { "type": "string", "minLength": 1 },
35
+ "function": { "type": "string", "minLength": 1 },
36
+ "category": { "enum": ["justified", "false-positive", "not-applicable"] },
37
+ "rationale": { "type": "string", "minLength": 1 },
38
+ "reviewer": { "type": "string", "minLength": 1 }
39
+ },
40
+ "additionalProperties": false
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ },
46
+ "additionalProperties": false
47
+ }