Skip to content

fix(camera): read the ver140 folder from the card instead of guessing it - #86

Merged
AnnatarHe merged 3 commits into
mainfrom
fix/camera-ver140-folder
Sep 27, 2026
Merged

AnnatarHe merged 3 commits into
mainfrom
fix/camera-ver140-folder

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Why

On an EOS R6 Mark III (CCAPI 1.4.0), rawback camera contents list card1 100CANON answered 404. The session put a literal folder segment into every ver140 contents path. The camera expects its own folder name there (DCIM for stills, XFVC/CRM for movie reels), and contents dirs already prints it: /ccapi/ver140/contents/card1/DCIM/100CANON.

Two related issues:

  • list sent kind=list and kind=number together. A body serves one contents request at a time and answers 503 to an overlap.
  • events poll --wait always sent continue=on, the Ver.1.0.0 hold style. The R6 Mark III serves event/polling at ver110, where the hold parameter is timeout.

What

  • Directory argument. contents list (and --all) plus the contents.listContents / getContentsNumber / deleteDirectory registry entries accept the directory in three forms:

    • a bare name (100CANON), looked up on the card and preferring DCIM
    • DCIM/100CANON
    • a locator printed by contents dirs

    The folderSegment guess is gone. The lookup lives in a new src/camera-locators.ts.

  • Locators parse through @rawback/ccapi-js's parseContentLocator, keeping the bare storage/directory/file form and the CLI's error message.

  • Sequential listing. A page is listed, then counted.

  • events poll --wait maps to getPolling({ hold: true }): timeout=long from ver110, continue=on on ver100.

  • Dependency and docs. Bump @rawback/ccapi-js to 1.1.2 (rawback-app/cccapi-js#27). docs/commands.md and the list help text describe the directory forms.

Testing

  • bun run typecheck, bun run lint, bun run format:check and bun run build pass.
  • bun test: 540 pass, 1 fail. The failure is bootstrapConfig > announces a created file on stderr only, which fails identically on main: the created-file path wraps at the terminal width. It is unrelated to this change.
  • New and updated tests:
    • All three directory forms list through contents/card1/DCIM/100CANON; an XFVC/100CANON reel is present and not picked.
    • The listing and the count are sent one after the other.
    • --wait on a ver110 endpoint sends ?timeout=long, and on ver100 ?continue=on.
    • ver140 fixtures now use the real DCIM folder instead of folder.
  • Not yet run against the real camera.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T02:32:59.819102Z 7f8f9d0 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 914aee7194

ℹ️ 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 thread src/camera-locators.ts Outdated
const trimmed = directory.trim().replace(/^\/+|\/+$/g, '')
if (trimmed.includes('contents/')) {
try {
return parseDirectoryLocator(trimmed)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject locators that disagree with the storage argument

When a full directory locator is supplied, this returns the locator's embedded storage and silently ignores the separately required storage argument. For camera api contents.deleteDirectory, conflicting inputs such as storage=card1 with a locator for card2 therefore delete the directory from card2 after the user explicitly selected card1; validate that both storage values match or retain the explicit argument.

AGENTS.md reference: AGENTS.md:L91-L92

Useful? React with 👍 / 👎.

Comment thread src/camera-locators.ts Outdated
Comment on lines +72 to +74
const { paths } = await session.client.contents
.listDirectories(storage)
.catch(() => ({ paths: [] as string[] }))

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 Preserve directory lookup failures

On a ver140 camera, any transient or actionable listDirectories() error—such as a 503 while the body is busy—is converted into an empty directory list. The code then issues a folderless request like contents/card1/100CANON, which normally fails with an unrelated 404 and hides the original cause; propagate the lookup error instead of treating request failure as proof that the directory has no folder.

AGENTS.md reference: AGENTS.md:L86-L86

Useful? React with 👍 / 👎.

AnnatarHe and others added 3 commits September 27, 2026 10:27
`contents list` on an EOS R6 Mark III answered 404: the session put a
literal `folder` segment into every ver140 contents path, where the
camera expects its own folder name (DCIM for stills), which
`contents dirs` already prints.

- `contents list` and the contents registry entries take the directory
  as a bare name (looked up on the card, preferring DCIM), as
  `DCIM/100CANON`, or as a locator printed by `contents dirs`.
- Locators parse through @rawback/ccapi-js, keeping the bare
  `storage/directory/file` form and the CLI's error message.
- A page is listed and then counted, not both at once: a body serves one
  contents request at a time and answers 503 to an overlap.
- `events poll --wait` holds in the style the event endpoint's version
  takes, so ver110 bodies get `timeout=long` instead of `continue=on`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…event hold

The camera fix reads the ver140 folder with parseDirectoryLocator and
long-polls with event.getPolling({ hold: true }), both new in 1.1.2.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…okup

- A directory locator naming another card than the storage argument is
  refused. It was followed, so `camera api contents.deleteDirectory`
  with storage=card1 and a card2 locator deleted from card2.
- A failed `listDirectories` lookup now surfaces as itself. It was read
  as "no folders", so a busy or unreachable camera turned into a
  folderless listing that 404ed for an unrelated reason.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@AnnatarHe
AnnatarHe force-pushed the fix/camera-ver140-folder branch from 914aee7 to 7f8f9d0 Compare September 27, 2026 02:30
@AnnatarHe
AnnatarHe merged commit 7a9c7fd into main Sep 27, 2026
2 of 8 checks passed
@AnnatarHe
AnnatarHe deleted the fix/camera-ver140-folder branch September 27, 2026 02:34
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.

1 participant