From acccba9210fe252d3f8d7572305bb1b75e58bbe5 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sun, 30 Aug 2026 04:55:28 -0400 Subject: [PATCH] fix: remove duplicate useSSL key in polygon_node_list.yml (runtime crash) package:yaml (used by the app) throws 'Duplicate mapping key' on the two useSSL entries; PyYAML tolerated it so it slipped through. Adds a test that parses every bundled YAML asset with package:yaml to prevent regression. --- assets/polygon_node_list.yml | 1 - test/bundled_yaml_valid_test.dart | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 test/bundled_yaml_valid_test.dart diff --git a/assets/polygon_node_list.yml b/assets/polygon_node_list.yml index ecbff6b45..0332b5f5f 100644 --- a/assets/polygon_node_list.yml +++ b/assets/polygon_node_list.yml @@ -8,5 +8,4 @@ - uri: polygon.llamarpc.com useSSL: true - useSSL: true isEnabledForAutoSwitching: true \ No newline at end of file diff --git a/test/bundled_yaml_valid_test.dart b/test/bundled_yaml_valid_test.dart new file mode 100644 index 000000000..bf000d568 --- /dev/null +++ b/test/bundled_yaml_valid_test.dart @@ -0,0 +1,29 @@ +import 'dart:io'; +import 'package:yaml/yaml.dart'; +import 'package:flutter_test/flutter_test.dart'; + +// Guards against the 1.0.2-era crash: a duplicate mapping key in a bundled +// node list (polygon_node_list.yml had two `useSSL`). PyYAML tolerates it, +// but the app parses with package:yaml, which throws "Duplicate mapping key" +// at runtime. Every bundled *.yml the app can loadYaml() must parse cleanly. +void main() { + test('all bundled node-list YAML assets parse under package:yaml', () { + final dir = Directory('assets'); + final ymls = dir + .listSync(recursive: true) + .whereType() + .where((f) => f.path.endsWith('.yml') || f.path.endsWith('.yaml')) + .toList(); + expect(ymls, isNotEmpty, reason: 'no YAML assets found — wrong CWD?'); + + final failures = []; + for (final f in ymls) { + try { + loadYaml(f.readAsStringSync()); + } catch (e) { + failures.add('${f.path}: $e'); + } + } + expect(failures, isEmpty, reason: 'YAML assets rejected by package:yaml:\n${failures.join('\n')}'); + }); +}