Per `.planning/audit-2026-05-03/tests-audit.md` section 5, five
`XCTAssertTrue(true)` placeholder tests were identified across the tree
that are mathematically incapable of failing. This commit fixes or
removes each, conservatively. Files touched and disposition:
- App/Tests/AppTests/MCPRuntimeWiringTests.swift:260
fixed: replaced trailing `XCTAssertTrue(true)` rubber-stamp at end of
CR-02 channel-drain test with a load-bearing assertion that the drain
task completed via `finish()`, not cancellation. The implicit `await
drainTask.value` is the real gate; the new assertion ensures regressions
that cancel-instead-of-finish surface.
- App/Tests/AppTests/WebviewBundleLoadTests.swift:60
deleted: `test_assetsDirectoryGitignored_documentedInSmokeScript`. Body
was `XCTAssertTrue(true)` with comment "intentionally has no assertion
— it exists to document the split of responsibility". Documentation,
not a test. Replaced with a top-level comment block documenting the
same split (smoke-test-hud.sh is the runtime gate).
- packages/AgentCore/Tests/AgentCoreTests/ToolChoiceTests.swift:38
fixed: removed trailing `XCTAssertTrue(true) // Test compiles → contract
holds.` from `testLLMProviderStreamRequiresToolChoice`. The closure
body itself is the contract — if the test compiles, the contract holds.
Comment updated to make the compile-time semantics explicit.
- packages/Shell/Tests/ShellTests/InputMonitoringDenialTests.swift:36
deleted: `test_localMonitorOnlyFallback`. Body was `XCTAssertTrue(true)`
documenting that the real fallback test lives in HotkeyBindingTests.
Replaced with a top-level comment pointing readers there.
- packages/Vision/Tests/VisionTests/PackageBoundaryTests.swift:14
deleted: `testVisionModuleCompilesStandalone`. Body was
`XCTAssertTrue(true)` with comment "compile is the assertion." VISION-03
isolation is enforced by `scripts/check-vision-isolation.sh` and the
Package.swift dependency graph, both of which are real gates. Folded
the documentation into the `testPublicAPISurface` doc-comment so the
explanation isn't lost.
HudStateEnumTests rubber-stamps (audit items #4–6 in section 5) were
left as-is. The voiceOverLabel literals are user-facing accessibility
text that VoiceOver actually speaks; they are load-bearing in the sense
the audit calls out as worth preserving ("replace with behavioral
assertions if the literal under test is load-bearing"). A regression
that breaks an a11y label IS a real regression. Conservative read; not
worth the blast radius of guessing wrong.
Pre-existing baseline issues unrelated to this batch:
- `packages/Shell/Tests/ShellTests/InputMonitoringDenialTests.swift`
fails to COMPILE on a clean tree (MockProbe missing
`isListenEventAccessGranted()`). Verified via `git stash` that the
failure is independent of this commit. Not addressed here per the
scope rules — flagged for follow-up.
Net test count: -3 tests (3 deleted, 0 added — the
MCPRuntimeWiringTests assertion replaces the tautology in-place).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
63 lines
3.2 KiB
Swift
63 lines
3.2 KiB
Swift
import XCTest
|
|
|
|
/// Plan 03-05 Task 2 bundle-structural tests. These tests read files from
|
|
/// the repo tree (via `#filePath` traversal, not `Bundle.main`) so they
|
|
/// compile under the Xcode 26 broken xctest-launch path. Once that blocker
|
|
/// is cleared we can promote them to Bundle.main-based assertions that also
|
|
/// prove the built `.app` is correctly wired — for now the built-app coverage
|
|
/// is `scripts/smoke-test-hud.sh` + the manual UAT checklist.
|
|
final class WebviewBundleLoadTests: XCTestCase {
|
|
/// `#filePath` resolves to this file's absolute path; climb four levels
|
|
/// to the repo root (.../App/Tests/AppTests/WebviewBundleLoadTests.swift
|
|
/// → .../App/Tests/AppTests → .../App/Tests → .../App → repo root).
|
|
private func repoRoot(file: String = #filePath) -> URL {
|
|
URL(fileURLWithPath: file)
|
|
.deletingLastPathComponent() // AppTests/
|
|
.deletingLastPathComponent() // Tests/
|
|
.deletingLastPathComponent() // App/
|
|
.deletingLastPathComponent() // repo root
|
|
}
|
|
|
|
/// B1: the R3F bundle's index.html must be source-committed under
|
|
/// `App/Resources/webview/`. `scripts/build-webview.sh` regenerates it
|
|
/// from `webview/packages/hud/dist/index.html` on every build — this
|
|
/// test catches "someone committed an index.html-less tree" before the
|
|
/// Xcode pre-build script tries to rsync into an empty dir.
|
|
func test_indexHtmlInRepoWebviewDir() {
|
|
let indexHTML = repoRoot().appendingPathComponent("App/Resources/webview/index.html")
|
|
XCTAssertTrue(
|
|
FileManager.default.fileExists(atPath: indexHTML.path),
|
|
"index.html must be committed at App/Resources/webview/ — run scripts/build-webview.sh then `git add App/Resources/webview/index.html`"
|
|
)
|
|
}
|
|
|
|
/// B3: index.html must reference `./assets/*.js` (relative) — Vite's
|
|
/// `base: './'` setting is critical for WKWebView file:// loading
|
|
/// (Pitfall 3 from RESEARCH). Absolute `/assets/` paths 404 in a
|
|
/// bundled file:// context.
|
|
func test_indexHtmlReferencesRelativeAssets() throws {
|
|
let indexHTML = repoRoot().appendingPathComponent("App/Resources/webview/index.html")
|
|
let html = try String(contentsOf: indexHTML, encoding: .utf8)
|
|
XCTAssertTrue(
|
|
html.contains("./assets/"),
|
|
"index.html must reference relative asset paths per Vite base: './' — check webview/packages/hud/vite.config.ts"
|
|
)
|
|
XCTAssertFalse(
|
|
html.contains("src=\"/assets/"),
|
|
"index.html must NOT reference absolute /assets/ paths (WKWebView file:// rejects them)"
|
|
)
|
|
XCTAssertFalse(
|
|
html.contains("href=\"/assets/"),
|
|
"index.html must NOT reference absolute /assets/ href paths either"
|
|
)
|
|
}
|
|
|
|
// The `assets/` subdirectory is intentionally gitignored — the presence
|
|
// check lives in `scripts/smoke-test-hud.sh`, which inspects the BUILT
|
|
// `.app` after `xcodebuild build` has run the pre-build
|
|
// `scripts/build-webview.sh`. The previous
|
|
// `test_assetsDirectoryGitignored_documentedInSmokeScript` was an
|
|
// `XCTAssertTrue(true)` documentation-as-test removed in the 2026-05-04
|
|
// cleanup batch (`.planning/audit-2026-05-03/tests-audit.md`).
|
|
}
|