Skip to content

Commit

Permalink
Report aggregatable_debug_reporting issues as warnings (#1469)
Browse files Browse the repository at this point in the history
To match the specification, where they do not cause the entire
registration to be rejected.
  • Loading branch information
apasel422 authored Nov 16, 2024
1 parent 40ef03f commit 42667ed
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 115 deletions.
93 changes: 46 additions & 47 deletions ts/src/header-validator/source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ const testCases: TestCase[] = [
"destination": "https://a.test",
"aggregatable_debug_reporting": 1
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting'],
msg: 'must be an object',
Expand All @@ -1588,7 +1588,7 @@ const testCases: TestCase[] = [
"destination": "https://a.test",
"aggregatable_debug_reporting": {}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'budget'],
msg: 'required',
Expand All @@ -1608,7 +1608,7 @@ const testCases: TestCase[] = [
"key_piece": "0x1"
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'budget'],
msg: 'must be a number',
Expand All @@ -1624,7 +1624,7 @@ const testCases: TestCase[] = [
"key_piece": "0x1"
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'budget'],
msg: 'must be in the range [1, 65536]',
Expand All @@ -1640,7 +1640,7 @@ const testCases: TestCase[] = [
"key_piece": "0x1"
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'budget'],
msg: 'must be in the range [1, 65536]',
Expand All @@ -1656,7 +1656,7 @@ const testCases: TestCase[] = [
"key_piece": 1
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'key_piece'],
msg: 'must be a string',
Expand All @@ -1672,7 +1672,7 @@ const testCases: TestCase[] = [
"key_piece": "1"
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'key_piece'],
msg: 'must be a hex128 (must match /^0[xX][0-9A-Fa-f]{1,32}$/)',
Expand All @@ -1689,7 +1689,7 @@ const testCases: TestCase[] = [
"aggregation_coordinator_origin": 1
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: [
'aggregatable_debug_reporting',
Expand All @@ -1709,7 +1709,7 @@ const testCases: TestCase[] = [
"aggregation_coordinator_origin": "a.test"
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: [
'aggregatable_debug_reporting',
Expand All @@ -1729,7 +1729,7 @@ const testCases: TestCase[] = [
"aggregation_coordinator_origin": "http://a.test"
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: [
'aggregatable_debug_reporting',
Expand All @@ -1749,7 +1749,7 @@ const testCases: TestCase[] = [
"debug_data": {}
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data'],
msg: 'must be a list',
Expand All @@ -1766,7 +1766,7 @@ const testCases: TestCase[] = [
"debug_data": [1]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0],
msg: 'must be an object',
Expand All @@ -1783,7 +1783,7 @@ const testCases: TestCase[] = [
"debug_data": [{}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types'],
msg: 'required',
Expand Down Expand Up @@ -1812,7 +1812,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'key_piece'],
msg: 'must be a string',
Expand All @@ -1833,7 +1833,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'key_piece'],
msg: 'must be a hex128 (must match /^0[xX][0-9A-Fa-f]{1,32}$/)',
Expand All @@ -1854,7 +1854,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'value'],
msg: 'must be a number',
Expand All @@ -1871,11 +1871,11 @@ const testCases: TestCase[] = [
"debug_data": [{
"key_piece": "0x1",
"types": ["source-success"],
"value": 0
"value": 0
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'value'],
msg: 'must be in the range [1, 65536]',
Expand All @@ -1892,11 +1892,11 @@ const testCases: TestCase[] = [
"debug_data": [{
"key_piece": "0x1",
"types": ["source-success"],
"value": 65537
"value": 65537
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'value'],
msg: 'must be in the range [1, 65536]',
Expand All @@ -1917,7 +1917,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting'],
msg: 'data contains value greater than budget (789)',
Expand All @@ -1938,7 +1938,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types'],
msg: 'must be a list',
Expand All @@ -1959,7 +1959,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types'],
msg: 'length must be in the range [1, Infinity]',
Expand All @@ -1980,7 +1980,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 0],
msg: 'must be a string',
Expand All @@ -2001,12 +2001,6 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 1],
msg: 'duplicate value abc',
},
],
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 0],
Expand All @@ -2016,6 +2010,10 @@ const testCases: TestCase[] = [
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 1],
msg: 'unknown type',
},
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 1],
msg: 'duplicate value abc',
},
],
},
{
Expand All @@ -2025,23 +2023,20 @@ const testCases: TestCase[] = [
"aggregatable_debug_reporting": {
"budget": 123,
"key_piece": "0x1",
"debug_data": [{
"key_piece": "0x2",
"types": ["abc"],
"value": 123
}, {
"key_piece": "0x1",
"types": ["abc"],
"value": 456
}]
"debug_data": [
{
"key_piece": "0x2",
"types": ["abc"],
"value": 123
},
{
"key_piece": "0x1",
"types": ["abc"],
"value": 456
}
]
}
}`,
expectedErrors: [
{
path: ['aggregatable_debug_reporting', 'debug_data'],
msg: 'duplicate type: abc',
},
],
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 0],
Expand All @@ -2051,6 +2046,10 @@ const testCases: TestCase[] = [
path: ['aggregatable_debug_reporting', 'debug_data', 1, 'types', 0],
msg: 'unknown type',
},
{
path: ['aggregatable_debug_reporting', 'debug_data'],
msg: 'duplicate type: abc',
},
],
},
{
Expand All @@ -2067,7 +2066,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data', 0, 'types', 1],
msg: 'duplicate value source-success',
Expand All @@ -2092,7 +2091,7 @@ const testCases: TestCase[] = [
}]
}
}`,
expectedErrors: [
expectedWarnings: [
{
path: ['aggregatable_debug_reporting', 'debug_data'],
msg: 'duplicate type: unspecified',
Expand Down
Loading

0 comments on commit 42667ed

Please sign in to comment.