milestone 24: persist and surface the unsupported-line count
This commit is contained in:
@@ -61,6 +61,7 @@ pub const StatusView = struct {
|
||||
wildcards: u32,
|
||||
exceptions: u32,
|
||||
skipped_regex: u32,
|
||||
skipped_unsupported: u32,
|
||||
|
||||
pub fn from(status: *const manager_mod.SourceStatus) StatusView {
|
||||
return .{
|
||||
@@ -75,6 +76,7 @@ pub const StatusView = struct {
|
||||
.wildcards = status.counts.wildcards,
|
||||
.exceptions = status.counts.exceptions,
|
||||
.skipped_regex = status.counts.skipped_regex,
|
||||
.skipped_unsupported = status.counts.skipped_unsupported,
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -321,6 +323,7 @@ test "editing a blocklist keeps the counters the refresh wrote" {
|
||||
.wildcard_count = 3,
|
||||
.exception_count = 2,
|
||||
.skipped_regex_count = 1,
|
||||
.skipped_unsupported_count = 8,
|
||||
.checksum = "abc",
|
||||
});
|
||||
|
||||
@@ -335,6 +338,8 @@ test "editing a blocklist keeps the counters the refresh wrote" {
|
||||
try testing.expectEqualStrings("renamed", row.name);
|
||||
try testing.expect(!row.enabled);
|
||||
try testing.expectEqual(@as(i64, 42), row.domain_count);
|
||||
try testing.expectEqual(@as(i64, 1), row.skipped_regex_count);
|
||||
try testing.expectEqual(@as(i64, 8), row.skipped_unsupported_count);
|
||||
try testing.expectEqual(@as(usize, 2), bench.reloads);
|
||||
}
|
||||
|
||||
@@ -383,7 +388,13 @@ test "a status becomes the flat shape the API answers with" {
|
||||
const message = "connection refused";
|
||||
@memcpy(status.last_error[0..message.len], message);
|
||||
status.last_error_len = message.len;
|
||||
status.counts = .{ .domains = 10, .wildcards = 2, .exceptions = 4, .skipped_regex = 1 };
|
||||
status.counts = .{
|
||||
.domains = 10,
|
||||
.wildcards = 2,
|
||||
.exceptions = 4,
|
||||
.skipped_regex = 1,
|
||||
.skipped_unsupported = 6,
|
||||
};
|
||||
|
||||
const view: StatusView = .from(&status);
|
||||
try testing.expectEqual(@as(i64, 7), view.id);
|
||||
@@ -393,4 +404,6 @@ test "a status becomes the flat shape the API answers with" {
|
||||
try testing.expectEqualStrings(message, view.last_error);
|
||||
try testing.expectEqual(@as(u32, 10), view.domains);
|
||||
try testing.expectEqual(@as(u32, 4), view.exceptions);
|
||||
try testing.expectEqual(@as(u32, 1), view.skipped_regex);
|
||||
try testing.expectEqual(@as(u32, 6), view.skipped_unsupported);
|
||||
}
|
||||
|
||||
@@ -1876,7 +1876,7 @@ components:
|
||||
|
||||
Blocklist:
|
||||
type: object
|
||||
required: [id, url, name, enabled, is_suggested, last_updated, domain_count, wildcard_count, exception_count, skipped_regex_count, checksum]
|
||||
required: [id, url, name, enabled, is_suggested, last_updated, domain_count, wildcard_count, exception_count, skipped_regex_count, skipped_unsupported_count, checksum]
|
||||
properties:
|
||||
id: { type: integer }
|
||||
url: { type: string }
|
||||
@@ -1890,6 +1890,7 @@ components:
|
||||
wildcard_count: { type: integer }
|
||||
exception_count: { type: integer }
|
||||
skipped_regex_count: { type: integer }
|
||||
skipped_unsupported_count: { type: integer }
|
||||
checksum:
|
||||
type: string
|
||||
nullable: true
|
||||
@@ -1919,7 +1920,7 @@ components:
|
||||
|
||||
SourceStatus:
|
||||
type: object
|
||||
required: [id, state, loaded, last_attempt, last_success, url, last_error, domains, wildcards, exceptions, skipped_regex]
|
||||
required: [id, state, loaded, last_attempt, last_success, url, last_error, domains, wildcards, exceptions, skipped_regex, skipped_unsupported]
|
||||
properties:
|
||||
id: { type: integer }
|
||||
state:
|
||||
@@ -1936,6 +1937,7 @@ components:
|
||||
wildcards: { type: integer }
|
||||
exceptions: { type: integer }
|
||||
skipped_regex: { type: integer }
|
||||
skipped_unsupported: { type: integer }
|
||||
|
||||
Rule:
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user