Skip to content

Commit 4c0af6b

Browse files
committed
chore: M5 CI/Workflow Sweep - final synchronisation
1 parent d62de71 commit 4c0af6b

36 files changed

Lines changed: 168 additions & 168 deletions

File tree

opm-canonicalizer/src/lib.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -171,62 +171,62 @@ mod tests {
171171

172172
#[test]
173173
fn test_null() {
174-
assert_eq!(canonicalize("null").unwrap(), "null");
174+
assert_eq!(canonicalize("null").expect("TODO: handle error"), "null");
175175
}
176176

177177
#[test]
178178
fn test_bool_true() {
179-
assert_eq!(canonicalize("true").unwrap(), "true");
179+
assert_eq!(canonicalize("true").expect("TODO: handle error"), "true");
180180
}
181181

182182
#[test]
183183
fn test_bool_false() {
184-
assert_eq!(canonicalize("false").unwrap(), "false");
184+
assert_eq!(canonicalize("false").expect("TODO: handle error"), "false");
185185
}
186186

187187
#[test]
188188
fn test_integer() {
189-
assert_eq!(canonicalize("42").unwrap(), "42");
189+
assert_eq!(canonicalize("42").expect("TODO: handle error"), "42");
190190
}
191191

192192
#[test]
193193
fn test_string_basic() {
194-
assert_eq!(canonicalize(r#""hello""#).unwrap(), r#""hello""#);
194+
assert_eq!(canonicalize(r#""hello""#).expect("TODO: handle error"), r#""hello""#);
195195
}
196196

197197
#[test]
198198
fn test_empty_object() {
199-
assert_eq!(canonicalize("{}").unwrap(), "{}");
199+
assert_eq!(canonicalize("{}").expect("TODO: handle error"), "{}");
200200
}
201201

202202
#[test]
203203
fn test_empty_array() {
204-
assert_eq!(canonicalize("[]").unwrap(), "[]");
204+
assert_eq!(canonicalize("[]").expect("TODO: handle error"), "[]");
205205
}
206206

207207
#[test]
208208
fn test_object_keys_sorted() {
209209
// Keys must be lexicographically sorted in canonical output
210210
let input = r#"{"z":1,"a":2,"m":3}"#;
211-
assert_eq!(canonicalize(input).unwrap(), r#"{"a":2,"m":3,"z":1}"#);
211+
assert_eq!(canonicalize(input).expect("TODO: handle error"), r#"{"a":2,"m":3,"z":1}"#);
212212
}
213213

214214
#[test]
215215
fn test_string_escape_newline() {
216-
assert_eq!(canonicalize("\"a\\nb\"").unwrap(), "\"a\\nb\"");
216+
assert_eq!(canonicalize("\"a\\nb\"").expect("TODO: handle error"), "\"a\\nb\"");
217217
}
218218

219219
#[test]
220220
fn test_string_escape_tab() {
221-
assert_eq!(canonicalize("\"a\\tb\"").unwrap(), "\"a\\tb\"");
221+
assert_eq!(canonicalize("\"a\\tb\"").expect("TODO: handle error"), "\"a\\tb\"");
222222
}
223223

224224
// ===== Smoke tests =====
225225

226226
#[test]
227227
fn smoke_nested_structure() {
228228
let input = r#"{"b":{"d":4,"c":3},"a":[1,2,3]}"#;
229-
let out = canonicalize(input).unwrap();
229+
let out = canonicalize(input).expect("TODO: handle error");
230230
// 'a' before 'b', nested object 'c' before 'd'
231231
assert_eq!(out, r#"{"a":[1,2,3],"b":{"c":3,"d":4}}"#);
232232
}
@@ -247,8 +247,8 @@ mod tests {
247247
fn e2e_canonicalize_twice_is_idempotent() {
248248
// Canonical form of canonical form is the same canonical form
249249
let input = r#"{"z":"last","a":"first","m":[3,1,2]}"#;
250-
let once = canonicalize(input).unwrap();
251-
let twice = canonicalize(&once).unwrap();
250+
let once = canonicalize(input).expect("TODO: handle error");
251+
let twice = canonicalize(&once).expect("TODO: handle error");
252252
assert_eq!(once, twice);
253253
}
254254

@@ -259,42 +259,42 @@ mod tests {
259259
"a": 1
260260
}"#;
261261
let compact = r#"{"a":1,"b":2}"#;
262-
assert_eq!(canonicalize(pretty).unwrap(), compact);
262+
assert_eq!(canonicalize(pretty).expect("TODO: handle error"), compact);
263263
}
264264

265265
// ===== Contract tests =====
266266

267267
#[test]
268268
fn contract_output_has_no_whitespace() {
269269
let input = r#"{"x": [1, 2, 3], "y": "hello"}"#;
270-
let out = canonicalize(input).unwrap();
270+
let out = canonicalize(input).expect("TODO: handle error");
271271
assert!(!out.contains(' '));
272272
assert!(!out.contains('\n'));
273273
assert!(!out.contains('\t'));
274274
}
275275

276276
#[test]
277277
fn contract_negative_integer_preserved() {
278-
assert_eq!(canonicalize("-99").unwrap(), "-99");
278+
assert_eq!(canonicalize("-99").expect("TODO: handle error"), "-99");
279279
}
280280

281281
#[test]
282282
fn contract_zero_preserved() {
283-
assert_eq!(canonicalize("0").unwrap(), "0");
283+
assert_eq!(canonicalize("0").expect("TODO: handle error"), "0");
284284
}
285285

286286
// ===== Aspect tests (security / correctness) =====
287287

288288
#[test]
289289
fn aspect_empty_string_value() {
290-
assert_eq!(canonicalize(r#""""#).unwrap(), r#""""#);
290+
assert_eq!(canonicalize(r#""""#).expect("TODO: handle error"), r#""""#);
291291
}
292292

293293
#[test]
294294
fn aspect_unicode_control_chars_escaped() {
295295
// \u0001 (SOH) must be escaped in canonical output
296296
let input = "\"\\u0001\"";
297-
let out = canonicalize(input).unwrap();
297+
let out = canonicalize(input).expect("TODO: handle error");
298298
assert!(out.contains("\\u0001"));
299299
}
300300

rescript-ecosystem/packages/bindings/grpc/codec/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ impl ProtoEncoder {
4343

4444
fn write_tag(&mut self, field_number: u32, wire_type: u32) {
4545
let tag = (field_number << 3) | wire_type;
46-
self.buf.write_varint(tag).unwrap();
46+
self.buf.write_varint(tag).expect("TODO: handle error");
4747
}
4848

4949
fn write_varint(&mut self, value: u64) {
50-
self.buf.write_varint(value).unwrap();
50+
self.buf.write_varint(value).expect("TODO: handle error");
5151
}
5252

5353
fn write_sint32(&mut self, value: i32) {
@@ -79,7 +79,7 @@ impl ProtoEncoder {
7979
}
8080

8181
fn write_bytes(&mut self, data: &[u8]) {
82-
self.buf.write_varint(data.len()).unwrap();
82+
self.buf.write_varint(data.len()).expect("TODO: handle error");
8383
self.buf.extend_from_slice(data);
8484
}
8585

@@ -160,7 +160,7 @@ impl<'a> ProtoDecoder<'a> {
160160
if self.remaining() < 4 {
161161
return Err("Not enough data for fixed32");
162162
}
163-
let bytes: [u8; 4] = self.data[self.pos..self.pos + 4].try_into().unwrap();
163+
let bytes: [u8; 4] = self.data[self.pos..self.pos + 4].try_into().expect("TODO: handle error");
164164
self.pos += 4;
165165
Ok(u32::from_le_bytes(bytes))
166166
}
@@ -169,7 +169,7 @@ impl<'a> ProtoDecoder<'a> {
169169
if self.remaining() < 8 {
170170
return Err("Not enough data for fixed64");
171171
}
172-
let bytes: [u8; 8] = self.data[self.pos..self.pos + 8].try_into().unwrap();
172+
let bytes: [u8; 8] = self.data[self.pos..self.pos + 8].try_into().expect("TODO: handle error");
173173
self.pos += 8;
174174
Ok(u64::from_le_bytes(bytes))
175175
}
@@ -178,7 +178,7 @@ impl<'a> ProtoDecoder<'a> {
178178
if self.remaining() < 4 {
179179
return Err("Not enough data for float");
180180
}
181-
let bytes: [u8; 4] = self.data[self.pos..self.pos + 4].try_into().unwrap();
181+
let bytes: [u8; 4] = self.data[self.pos..self.pos + 4].try_into().expect("TODO: handle error");
182182
self.pos += 4;
183183
Ok(f32::from_le_bytes(bytes))
184184
}
@@ -187,7 +187,7 @@ impl<'a> ProtoDecoder<'a> {
187187
if self.remaining() < 8 {
188188
return Err("Not enough data for double");
189189
}
190-
let bytes: [u8; 8] = self.data[self.pos..self.pos + 8].try_into().unwrap();
190+
let bytes: [u8; 8] = self.data[self.pos..self.pos + 8].try_into().expect("TODO: handle error");
191191
self.pos += 8;
192192
Ok(f64::from_le_bytes(bytes))
193193
}
@@ -672,11 +672,11 @@ mod tests {
672672

673673
let json = r#"{"name": "Alice", "id": 42}"#;
674674

675-
let encoded = encode(schema, json).unwrap();
676-
let decoded = decode(schema, &encoded).unwrap();
675+
let encoded = encode(schema, json).expect("TODO: handle error");
676+
let decoded = decode(schema, &encoded).expect("TODO: handle error");
677677

678-
let original: Value = serde_json::from_str(json).unwrap();
679-
let result: Value = serde_json::from_str(&decoded).unwrap();
678+
let original: Value = serde_json::from_str(json).expect("TODO: handle error");
679+
let result: Value = serde_json::from_str(&decoded).expect("TODO: handle error");
680680

681681
assert_eq!(original["name"], result["name"]);
682682
assert_eq!(original["id"], result["id"]);
@@ -686,7 +686,7 @@ mod tests {
686686
fn test_base64_roundtrip() {
687687
let data = b"Hello, World!";
688688
let encoded = base64_encode(data);
689-
let decoded = base64_decode(&encoded).unwrap();
689+
let decoded = base64_decode(&encoded).expect("TODO: handle error");
690690
assert_eq!(data.to_vec(), decoded);
691691
}
692692
}

rescript-ecosystem/packages/bindings/openapi/src/codegen/schema.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn topological_sort(types: &[TypeDef]) -> Vec<&TypeDef> {
131131
for (name, deps) in &deps_map {
132132
// Each dependency means 'name' has an incoming edge
133133
// (dep must come before name in the sorted order)
134-
*in_degree.get_mut(name).unwrap() += deps.len();
134+
*in_degree.get_mut(name).expect("TODO: handle error") += deps.len();
135135
}
136136

137137
// Start with types that have no dependencies (sorted for deterministic order)
@@ -155,7 +155,7 @@ pub fn topological_sort(types: &[TypeDef]) -> Vec<&TypeDef> {
155155
let mut newly_ready: Vec<String> = Vec::new();
156156
for (other_name, other_deps) in &deps_map {
157157
if other_deps.contains(&name) {
158-
let degree = in_degree.get_mut(other_name).unwrap();
158+
let degree = in_degree.get_mut(other_name).expect("TODO: handle error");
159159
*degree -= 1;
160160
if *degree == 0 {
161161
newly_ready.push(other_name.clone());
@@ -305,7 +305,7 @@ fn tarjan_dfs(
305305
if ids[at] == low[at] {
306306
let mut component = Vec::new();
307307
loop {
308-
let node = stack.pop().unwrap();
308+
let node = stack.pop().expect("TODO: handle error");
309309
on_stack[node] = false;
310310
component.push(node);
311311
if node == at {

rescript-ecosystem/packages/bindings/openapi/src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ mod tests {
134134
"paths": {}
135135
}"#;
136136

137-
let temp = tempfile::NamedTempFile::with_suffix(".json").unwrap();
138-
std::fs::write(temp.path(), spec_json).unwrap();
137+
let temp = tempfile::NamedTempFile::with_suffix(".json").expect("TODO: handle error");
138+
std::fs::write(temp.path(), spec_json).expect("TODO: handle error");
139139

140-
let spec = parse_spec(temp.path()).unwrap();
140+
let spec = parse_spec(temp.path()).expect("TODO: handle error");
141141
assert_eq!(spec.info.title, "Test");
142142
}
143143
}

rescript-ecosystem/packages/core/compiler-source/rewatch/src/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn get_compiler_args(rescript_file_path: &Path) -> Result<String> {
7070
};
7171

7272
// make PathBuf from package root and get the relative path for filename
73-
let relative_filename = filename.strip_prefix(PathBuf::from(&current_package)).unwrap();
73+
let relative_filename = filename.strip_prefix(PathBuf::from(&current_package)).expect("TODO: handle error");
7474

7575
let file_path = PathBuf::from(&current_package).join(filename);
7676
let contents = helpers::read_file(&file_path).expect("Error reading file");
@@ -253,7 +253,7 @@ pub fn incremental_build(
253253
format_step(current_step, total_steps),
254254
CODE
255255
))
256-
.unwrap(),
256+
.expect("TODO: handle error"),
257257
);
258258

259259
let timing_parse_start = Instant::now();
@@ -324,7 +324,7 @@ pub fn incremental_build(
324324

325325
let start_compiling = Instant::now();
326326
let pb = if !plain_output && show_progress {
327-
ProgressBar::new(build_state.modules.len().try_into().unwrap())
327+
ProgressBar::new(build_state.modules.len().try_into().expect("TODO: handle error"))
328328
} else {
329329
ProgressBar::hidden()
330330
};
@@ -334,7 +334,7 @@ pub fn incremental_build(
334334
format_step(current_step, total_steps),
335335
SWORDS
336336
))
337-
.unwrap(),
337+
.expect("TODO: handle error"),
338338
);
339339

340340
let (compile_errors, compile_warnings, num_compiled_modules) = compile::compile(

rescript-ecosystem/packages/core/compiler-source/rewatch/src/build/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn has_compile_warnings(module: &Module) -> bool {
302302

303303
pub fn cleanup_after_build(build_state: &BuildCommandState) {
304304
build_state.modules.par_iter().for_each(|(_module_name, module)| {
305-
let package = build_state.get_package(&module.package_name).unwrap();
305+
let package = build_state.get_package(&module.package_name).expect("TODO: handle error");
306306
if has_parse_warnings(module)
307307
&& let SourceType::SourceFile(source_file) = &module.source_type
308308
{

0 commit comments

Comments
 (0)