Add command runner harness coverage#84
Conversation
Add fixture-backed CommandRunner tests for direct command families and expected safety failures, cover the reminders today metadata runner path, and surface the creator line in CLI help. Verification: swift test; swift run icloud-cli --help; swift run icloud-cli drive list --icloud-root Tests/Fixtures/MobileDocuments --format text.
|
Superseded by #85, rebuilt from current origin/main with only the scoped command-runner harness/help commit. This PR inherited older commits from a deleted repair branch and was correctly marked dirty/conflicting. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cac5e878d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let startURL = try scopedURL(for: requestedPath) | ||
| let startValues = try? startURL.resourceValues(forKeys: [.isDirectoryKey, .fileSizeKey, .contentModificationDateKey]) | ||
| if startValues?.isDirectory != true { |
There was a problem hiding this comment.
Reject missing drive paths instead of emitting phantom files
When drive list --path points at a file that does not exist under an existing iCloud root, resourceValues fails and startValues is nil, so this branch treats the missing path as a non-directory and returns a fabricated downloaded file entry. That makes typos like --path does-not-exist succeed with JSON for a file that is not on disk instead of surfacing a missing-path error.
Useful? React with 👍 / 👎.
| let appleFloor = since.flatMap { Int64($0) } | ||
| let floorPredicate = appleFloor.map { "WHERE m.date >= \($0)" } ?? "" |
There was a problem hiding this comment.
Honor ISO --since for native Messages schema
For real Apple chat.db stores, --since is documented as ISO8601, but this parses it with Int64($0) and then omits the WHERE clause when parsing fails; the default 24-hour floor from above is also not used in this branch. As a result, messages recent --since 9999-01-01T00:00:00Z against the native schema still returns older messages instead of filtering them out.
Useful? React with 👍 / 👎.
| guard try tableExists("message"), try tableExists("chat"), try tableExists("chat_message_join") else { | ||
| throw LocalInventoryError.unsupportedSchema(store: database.path, detail: "missing recent_messages or message/chat/chat_message_join tables") | ||
| } | ||
| let appleBodyColumn = includeBody ? "m.text" : "NULL AS body" |
There was a problem hiding this comment.
Alias native message text as body
In the native Apple Messages fallback, --include-body selects m.text without aliasing it to body, while MessageRecentEntry decodes only the body key. For real chat.db reads this means messages recent --confirm-sensitive --include-body silently returns entries with no body even though the user explicitly requested bodies; the select expression needs to expose m.text AS body.
Useful? React with 👍 / 👎.
Summary
CommandRunnerharness covering direct CLI command families, cache/watch behavior, and expected sensitive-data failure paths.reminders todaymetadata runner path in the broad inventory command harness.Created by OMT-Global.toicloud-cli --helpand assert it in tests.Governing Issue
No GitHub issue was provided; this PR follows the direct operator request for command test harnesses, local function testing, and creator attribution in
--help.Validation
swift testpassed: 62 testsswift run icloud-cli --helppassed and printsCreated by OMT-Global.swift run icloud-cli drive list --icloud-root Tests/Fixtures/MobileDocuments --format textpassedCI GateNo checks were skipped locally beyond live/private iCloud account probes; the new harness uses repo fixtures and synthetic stores to avoid reading real local account data.
Bootstrap Governance
CONTRIBUTING.md,.github/PULL_REQUEST_TEMPLATE.md, anddocs/bootstrap/onboarding.mdwhen applicableFlow Contract
Flow Merge Readiness
Merge Automation
gh pr merge --auto --squash, or the reason it is unavailable/unsafe is noted belowAuto-merge has not been enabled yet; this PR needs live required-check and review-state evaluation after creation.
Notes
--confirm-sensitive.