Commit 3b0b8160a3

3b0b8160a3de5a7bafe233e7cacfdc3f2744036d

parent: d413bbbb54

Unsigned

cmc <hello@cleberg.net> · 2026-10-26 19:53 UTC

Audit Inspect's recent searches, and fix what it found (!61)

The section renders only once a lookup has been run, so the empty-state suite
never had it in the tree. Its four findings were known only from driving one real
lookup by hand. `testSeededRecentSearches` covers it on purpose.

## It needs its own launch argument

Inspect renders either a result or the recent list, never both, so
`DOMAIN_DIG_SEED_FIXTURES` takes the branch and the section never appears. The
first attempt did exactly that and audited the batch screen instead — 35
findings, all already covered by `testSeededBatchResults`.

`DOMAIN_DIG_SEED_RECENT` seeds `recentSearches` alone. Assigning that property
does not persist: only `addRecentSearch` and `clearRecentSearches` write to
defaults, so it leaks no more than the other fixtures.

The test asserts "RECENT" is on screen before auditing. Without it the test
passes while measuring the wrong thing, which is how the first attempt looked
green until the finding list was read.

## Two of the eight findings were real

- **`hitRegion` on "Clear".** A `Button("Clear")` with a `.caption2` font and no
  padding is about 16pt tall, well under the WCAG 2.5.8 floor. Given
  `minWidth`/`minHeight` of `AppLayout.minimumTapTarget` and a `contentShape`.
- **`sufficientElementDescription` on each domain chip.** The label was the bare
  domain, which reads as neither a word nor an action. Given
  `accessibilityLabel("Look up <domain>")`; "Clear" likewise got "Clear recent
  searches".

Eight became three: two characterised noise entries and `dynamicType` on the
"RECENT" header, identical on both runtimes. `dynamicType` on "Clear" cleared as
a side effect of the 44pt frame, which fits those findings tracking geometry
rather than the element.

## Enforcement

The section gates on everything the project enforces except `.dynamicType`
(`enforcedAuditTypes.subtracting(.dynamicType)`). It is the only seeded screen
that gates at all.

Layout checked by capture: the header row reads normally with the taller Clear
target.

## Also

Closes the search for the store-pollution source, per the decision to archive
it. The remaining plan was to instrument a full-suite run and bisect which test
precedes contamination; the reset from `!51` makes the question unobservable
from the suite's results, so the answer would change nothing. Recorded in
`Docs/ACCESSIBILITY.txt` as closed rather than forgotten.

Verified: `./Scripts/audit-a11y.sh` passes on both tiers with no enforced
failures. 377/377 unit tests. Ratchet unchanged at 280.

Ref #21

Layout: unified · split

Docs/ACCESSIBILITY.txt +47 −15
@@ -435,20 +435,45 @@ naming the screen something other than what the Settings row that opens it
435435says. Left as reported. It is the one `textClipped` finding still open on
436436History & Network, and why that screen stays report-only.
437437
438## Recent searches are never audited
439
440The empty-state suite launches a fresh install, so Inspect's recent-searches
441section — which only appears once a lookup has been run — is never in the tree
442when the audit walks it. Driving one real lookup and re-auditing surfaced four
443findings in it on iOS 27.0:
444
445- `dynamicType` on the "RECENT" header and on the "Clear" button
446- `hitRegion` too small on "Clear"
447- `sufficientElementDescription`, "label not human-readable", on a domain chip
448
449These are latent rather than new: nothing in the section changed when Inspect
450moved to a `List`. They need a seeded recent-searches fixture to be audited
451properly, which the seed harness does not have.
438## Recent searches
439
440Inspect's recent-searches section appears only once a lookup has been run, so
441the empty-state suite never had it in the tree. Four findings in it were found
442by accident, by driving one real lookup; `testSeededRecentSearches` now covers
443it on purpose.
444
445**It needs its own launch argument.** `DOMAIN_DIG_SEED_FIXTURES` cannot be used:
446Inspect renders either a result or the recent list, never both, so seeding the
447batch results takes the branch and the section never appears. The first attempt
448did exactly that and audited the batch screen instead — 35 findings, all of them
449already covered by `testSeededBatchResults`. `DOMAIN_DIG_SEED_RECENT` seeds
450`recentSearches` alone. Assigning that property does not persist (only
451`addRecentSearch` and `clearRecentSearches` write to defaults), so it leaks no
452more than the other fixtures.
453
454The test asserts "RECENT" is on screen before auditing. Without that it passes
455while measuring the wrong thing, which is how the first attempt looked green
456until the finding list was read.
457
458Under audit, the section reported eight findings. Two kinds were real:
459
460- **`hitRegion` on "Clear".** A `Button("Clear")` with a `.caption2` font and no
461 padding is about 16pt tall, well under the WCAG 2.5.8 floor. Given
462 `minWidth`/`minHeight` of `AppLayout.minimumTapTarget` and a
463 `contentShape(Rectangle())`.
464- **`sufficientElementDescription` on each domain chip.** The button's label was
465 the bare domain, which reads as neither a word nor an action. Given
466 `accessibilityLabel("Look up <domain>")`; "Clear" likewise got "Clear recent
467 searches".
468
469Eight findings became three: two characterised noise entries, and `dynamicType`
470on the "RECENT" header. `dynamicType` on "Clear" cleared as a side effect of the
47144pt frame, which is consistent with those findings tracking geometry rather
472than the element.
473
474So the section gates on everything the project enforces except `.dynamicType` —
475`enforcedAuditTypes.subtracting(.dynamicType)`. It is the only seeded screen
476that gates at all.
452477
453478## The empty-state screens are cleared before each launch
454479
@@ -468,7 +493,14 @@ the live view model and `auditFixturesActive` blocks persistence precisely so
468493they cannot leak, and running the whole audit class against a cleared store
469494reproduces neither the failure nor the extra findings. Ruled out as well: the
470495unit target, which leaves `trackedDomains` as an empty array in the app's own
471defaults. The source of the rows was never isolated.
496defaults.
497
498**The source of the rows was never isolated, and the search is closed.** The
499remaining plan was to instrument a full-suite run, dump `trackedDomains` at each
500launch and bisect which test precedes contamination. That is not being done: the
501reset below makes the question unobservable from the suite's results, so the
502answer would change nothing. Reopen it only if a finding shows up that the reset
503does not explain.
472504
473505What fixed it is making the question moot. `AuditFixtures.resetStoreIfRequested`
474506clears the app's defaults domain and the history files when
DomainDig/AuditFixtures.swift +20
@@ -58,6 +58,26 @@ enum AuditFixtures {
5858 /// layout and traits, not string equality, so coverage wins.
5959 private static let now = Date()
6060
61 /// Inspect's recent-searches section renders only once a lookup has been
62 /// run, so a fresh-install audit never sees it. Assigning
63 /// `recentSearches` does not persist — only `addRecentSearch` and
64 /// `clearRecentSearches` write to defaults — so these stay in memory like
65 /// the rest of the fixtures.
66 ///
67 /// Its own argument rather than part of `DOMAIN_DIG_SEED_FIXTURES`,
68 /// because Inspect shows either a result or the recent list, never both:
69 /// seeding the batch results takes the branch and the section never
70 /// renders.
71 static var recentSearches: [String] {
72 ["healthy.example", "expiring.example", "broken.example"]
73 }
74
75 static let recentSearchesArgument = "DOMAIN_DIG_SEED_RECENT"
76
77 static var recentSearchesRequested: Bool {
78 ProcessInfo.processInfo.arguments.contains(recentSearchesArgument)
79 }
80
6181 static var trackedDomains: [TrackedDomain] {
6282 [
6383 TrackedDomain(
DomainDig/ContentView.swift +8
@@ -589,6 +589,11 @@ struct ContentView: View {
589589 }
590590 .font(appDensity.font(.caption2))
591591 .foregroundStyle(ThemeToken.textSecondary)
592 // `.caption2` text alone is around 16pt tall, well under the
593 // WCAG 2.5.8 floor, which is what the audit reports here.
594 .frame(minWidth: AppLayout.minimumTapTarget, minHeight: AppLayout.minimumTapTarget)
595 .contentShape(Rectangle())
596 .accessibilityLabel("Clear recent searches")
592597 }
593598
594599 ForEach(viewModel.recentSearches, id: \.self) { domain in
@@ -606,6 +611,9 @@ struct ContentView: View {
606611 .background(ThemeToken.surface)
607612 .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius))
608613 }
614 // A bare domain reads as neither a word nor an action; the
615 // button re-runs the lookup, so say that.
616 .accessibilityLabel("Look up \(domain)")
609617 }
610618 }
611619 .padding(.top, appDensity.metrics.cardSpacing)
DomainDig/DomainViewModel.swift +5
@@ -1793,6 +1793,11 @@ final class DomainViewModel {
17931793 private(set) var auditFixturesActive = false
17941794
17951795 func seedAuditFixturesIfRequested() {
1796 // Independent of the fixtures below: Inspect renders either a result or
1797 // the recent list, so the two cannot be seeded together.
1798 if AuditFixtures.recentSearchesRequested {
1799 recentSearches = AuditFixtures.recentSearches
1800 }
17961801 guard AuditFixtures.requested, !auditFixturesActive else { return }
17971802 auditFixturesActive = true
17981803 trackedDomains = AuditFixtures.trackedDomains
DomainDigUITests/AccessibilityAuditHarness.swift +13 −1
@@ -57,9 +57,18 @@ enum AccessibilityAuditHarness {
5757 /// row treatment went unmeasured.
5858 private static let seedFixturesArgument = "DOMAIN_DIG_SEED_FIXTURES"
5959
60 /// Matches `AuditFixtures.recentSearchesArgument`. Separate from the
61 /// fixtures above because Inspect shows either a result or the recent
62 /// list, never both.
63 private static let seedRecentSearchesArgument = "DOMAIN_DIG_SEED_RECENT"
64
6065 /// Launches the app with feature gating lifted, optionally at a specific
6166 /// content size category and with the audit fixtures seeded.
62 static func launch(contentSizeCategory: String? = nil, seeded: Bool = false) -> XCUIApplication {
67 static func launch(
68 contentSizeCategory: String? = nil,
69 seeded: Bool = false,
70 recentSearches: Bool = false
71 ) -> XCUIApplication {
6372 let app = XCUIApplication()
6473 // Every launch starts from a cleared store, so a screen the enforced
6574 // suite audits as empty is empty whatever ran before it.
@@ -67,6 +76,9 @@ enum AccessibilityAuditHarness {
6776 if seeded {
6877 app.launchArguments.append(seedFixturesArgument)
6978 }
79 if recentSearches {
80 app.launchArguments.append(seedRecentSearchesArgument)
81 }
7082 if let contentSizeCategory {
7183 app.launchArguments += ["-UIPreferredContentSizeCategoryName", contentSizeCategory]
7284 }
DomainDigUITests/AccessibilityAuditTests.swift +27
@@ -274,6 +274,33 @@ final class AccessibilityAuditTests: XCTestCase {
274274 /// One launch rather than ten: re-selecting the Settings tab pops it back
275275 /// to root, so each destination is reached from a known place, and the
276276 /// store reset means the launch state is the same for all of them.
277 /// Inspect with its recent-searches section present.
278 ///
279 /// The section renders only once a lookup has been run, so the empty-state
280 /// suite never has it in the tree. Four findings in it were found by
281 /// accident, by driving one real lookup; seeding `recentSearches` puts them
282 /// under the suite on purpose and keeps the launch deterministic.
283 ///
284 /// Gated on everything the project enforces except `.dynamicType`, which
285 /// still reports against the "RECENT" header. That one is the
286 /// position-dependent finding described in `Docs/ACCESSIBILITY.txt`, not a
287 /// property of the header — unlike the other seeded tests, nothing else
288 /// here needs to stay report-only.
289 func testSeededRecentSearches() throws {
290 let app = AccessibilityAuditHarness.launch(recentSearches: true)
291 app.selectRootTab("Inspect")
292 XCTAssertTrue(
293 app.staticTexts["RECENT"].waitForExistence(timeout: 10),
294 "The recent-searches section must render, or this audits nothing"
295 )
296 try AccessibilityAuditHarness.audit(
297 app,
298 screen: "recent-searches",
299 test: self,
300 enforcing: AccessibilityAuditHarness.enforcedAuditTypes.subtracting(.dynamicType)
301 )
302 }
303
277304 func testSettingsDestinations() throws {
278305 let destinations = [
279306 "Display",