feat: Collect and report unknown METAR elements in test summary

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-14 16:16:00 -07:00
parent 3e2d6ef4d3
commit 0e19ee7903
+34 -1
View File
@@ -550,6 +550,13 @@
let failed = 0;
let withUnknowns = 0;
const originalConsoleLog = console.log;
const unknowns = {
airports: new Set(),
weatherChunks: new Set(),
cloudInfos: new Set(),
cloudTypesInRemark: new Set(),
otherRemarks: new Set(),
};
metars.forEach(metarString => {
const tempLogs = [];
@@ -567,7 +574,25 @@
if (hasUnknowns) {
withUnknowns++;
originalConsoleLog(`METAR with decoding issues: ${metarString}`);
tempLogs.forEach(msg => originalConsoleLog(` -> ${msg}`));
tempLogs.forEach(msg => {
originalConsoleLog(` -> ${msg}`);
if (msg.startsWith('Unknown Airport code:')) {
const code = msg.split(' ')[3];
unknowns.airports.add(code);
} else if (msg.startsWith('Unknown weather chunk:')) {
const chunk = msg.split(' ')[3];
unknowns.weatherChunks.add(chunk);
} else if (msg.startsWith('Unknown cloud information:')) {
const code = msg.split(' ')[3];
unknowns.cloudInfos.add(code);
} else if (msg.startsWith('Unknown cloud type in remark:')) {
const code = msg.split(' ')[5];
unknowns.cloudTypesInRemark.add(code);
} else if (msg.startsWith('Other remark:')) {
const remark = msg.split(' ')[2];
unknowns.otherRemarks.add(remark);
}
});
}
} catch (e) {
@@ -585,6 +610,14 @@
console.log(`Clean decodes: ${clean} (${(clean/total*100).toFixed(1)}%)`);
console.log(`Decodes with issues: ${withUnknowns} (${(withUnknowns/total*100).toFixed(1)}%)`);
console.log(`Failed to parse: ${failed} (${(failed/total*100).toFixed(1)}%)`);
console.log(`\n--- Unknowns encountered ---`);
for (const key in unknowns) {
if (unknowns[key].size > 0) {
console.log(`${key}:`);
console.log([...unknowns[key]].sort());
}
}
}
testAllBtn.addEventListener('click', testAllMetars);