Skip to content

Add command runner harness coverage#84

Closed
jmcte wants to merge 3 commits into
mainfrom
codex/test-harness-help-creator
Closed

Add command runner harness coverage#84
jmcte wants to merge 3 commits into
mainfrom
codex/test-harness-help-creator

Conversation

@jmcte

@jmcte jmcte commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a fixture-backed CommandRunner harness covering direct CLI command families, cache/watch behavior, and expected sensitive-data failure paths.
  • Cover the reminders today metadata runner path in the broad inventory command harness.
  • Add Created by OMT-Global. to icloud-cli --help and 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

  • Relevant local checks passed
    • swift test passed: 62 tests
    • swift run icloud-cli --help passed and prints Created by OMT-Global.
    • swift run icloud-cli drive list --icloud-root Tests/Fixtures/MobileDocuments --format text passed
  • Required PR checks are expected to satisfy CI Gate
  • Skipped checks are explained below

No 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

  • Changes are scoped to the direct operator request
  • Contributor or PR guidance changes are reflected in CONTRIBUTING.md, .github/PULL_REQUEST_TEMPLATE.md, and docs/bootstrap/onboarding.md when applicable
  • PR author enabled auto-merge where GitHub allows it, or GitHub plan-limit evidence/unavailable reason is recorded and the fallback merge-readiness policy applies
  • No real secrets, runtime auth, or machine-local env files are committed

Flow Contract

  • Owner lane: operator-requested CLI quality
  • Repair owner: Codex
  • Autonomy class: scoped implementation with local validation
  • Risk class: low; tests and help text only

Flow Merge Readiness

  • Every blocker has a next actor and next action
  • No active blocking requested changes remain
  • Non-author approval is present when required
  • PR author enabled auto-merge where GitHub allows it, or recorded why it is unavailable/unsafe

Merge Automation

  • PR author enabled auto-merge with gh pr merge --auto --squash, or the reason it is unavailable/unsafe is noted below

Auto-merge has not been enabled yet; this PR needs live required-check and review-state evaluation after creation.

Notes

  • The direct command harness intentionally verifies safety failures for sensitive commands without --confirm-sensitive.
  • Fixture-backed local execution avoids touching real iCloud, Safari, Messages, Contacts, Photos, or Wallet data.

jmcte and others added 3 commits June 11, 2026 17:08
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.
@jmcte jmcte requested a review from pheidon as a code owner June 21, 2026 07:39
@jmcte

jmcte commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

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.

@jmcte jmcte closed this Jun 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 79 to +81
let startURL = try scopedURL(for: requestedPath)
let startValues = try? startURL.resourceValues(forKeys: [.isDirectoryKey, .fileSizeKey, .contentModificationDateKey])
if startValues?.isDirectory != true {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +318 to +319
let appleFloor = since.flatMap { Int64($0) }
let floorPredicate = appleFloor.map { "WHERE m.date >= \($0)" } ?? ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants