fix(bruno): convert drifted body keys to body.data — CLI scenario runs now carry bodies

Follow-up to the sweep route audit, correcting its diagnosis: the CLI
DOES read .yml bodies — via OpenCollection's `body.data` string form
(the NewDevDBSetup script always worked because it used it). The
failing scenario POSTs used `body.json` (structured) / `body.jsonBody`
(string) — keys the CLI silently ignores, sending Content-Length: 0
with form-urlencoded content-type, so every server bind failed.

- 81 bodies converted to data-form (json maps serialized; jsonBody
  strings kept verbatim, {{vars}} intact).
- 6 pre-existing TRUNCATED payloads repaired: the original generator
  cut bodies at the first {{var}} (every SHA-256-identified scenario
  plus Sync Progress/Sync Bookmarks shipped mid-JSON and 400'd from
  day one). Rewritten whole, faithful to each file's documented
  purpose; book_sha256/book_uuid added to the environment.
- environments: opds_base_url correction from the sweep retained.

Verified live against the rebuilt dev container: the full koreader
scenario tree runs green through `bru run` — 14/14 (202s across
immediate/checkpoint/SHA-256 progress, 200s bookmarks, highlights,
notes; SHA-256 book identification exercised against a real
file_sha256).
This commit is contained in:
John O'Keefe committed 2026-10-17 12:22:35 -04:00
1 parent 63a20dcc95
commit 09b6693505
83 files changed
+386 -2769

No files matched your search

@@ -8,16 +8,8 @@ http:
auth: inherit
body:
type: json
jsonBody: "{\n \"media_item_ids\": [\n \"{{bookUUID1"
data: "{\n \"media_item_ids\": [\n \"{{bookUUID1"
headers:
- key: Authorization
value: Bearer {{userToken
docs: |-
## Add Books to Kobo Shelf
Add one or more books to a Kobo device shelf. Manages which books should be synced to a specific Kobo device. Supports multiple shelves for organization.
**Method:** POST
**Endpoint:** /api/devices/{deviceID
docs: "## Add Books to Kobo Shelf\n\n Add one or more books to a Kobo device shelf. Manages which books should be synced to a specific Kobo device. Supports multiple shelves for organization.\n\n **Method:** POST\n\n **Endpoint:** /api/devices/{deviceID"
@@ -2,51 +2,15 @@ info:
name: Check Pending Registration
type: http
seq: 4
http:
method: POST
url: '{{base_url}}/api/devices/register/status'
auth: none
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
registration_id: registration-uuid-here
docs: |-
## Check Registration Status
Checks the current status of a device registration request.
**Method:** POST
**Endpoint:** /api/devices/register/status
**Authentication:** None
**Request Body:**
- `registration_id` (string): UUID received from registration request
**Response:**
- `registration_id` (string): The registration UUID
- `status` (string): Current status
- `pending`: Awaiting user approval
- `approved`: Registration approved, device ready
- `rejected`: Registration rejected by user
- `expired`: Registration expired (not approved in time)
- `device_name` (string): Name of the device
- `device_type` (string): Type of device
- `created_at` (string): Registration timestamp
- `updated_at` (string): Last status update timestamp
**Status Codes:**
- 200: Status retrieved successfully
- 404: Registration ID not found
- 400: Invalid registration ID format
**Polling Recommendations:**
- Poll every 5-10 seconds while status is `pending`
- Stop polling when status changes to `approved`, `rejected`, or `expired`
- Use exponential backoff for mobile devices to save battery
data: "{\n \"registration_id\": \"registration-uuid-here\"\n}"
docs: "## Check Registration Status\n\nChecks the current status of a device registration request.\n\n**Method:** POST\n\n**Endpoint:** /api/devices/register/status\n\n**Authentication:** None\n\n**Request Body:**\n- `registration_id` (string): UUID received from registration request\n\n**Response:**\n- `registration_id` (string): The registration UUID\n- `status` (string): Current status\n - `pending`: Awaiting user approval\n - `approved`: Registration approved, device ready\n - `rejected`: Registration rejected by user\n - `expired`: Registration expired (not approved in time)\n- `device_name` (string): Name of the device\n- `device_type` (string): Type of device\n- `created_at` (string): Registration timestamp\n- `updated_at` (string): Last status update timestamp\n\n**Status Codes:**\n- 200: Status retrieved successfully\n- 404: Registration ID not found\n- 400: Invalid registration ID format\n\n**Polling Recommendations:**\n- Poll every 5-10 seconds while status is `pending`\n\
- Stop polling when status changes to `approved`, `rejected`, or `expired`\n- Use exponential backoff for mobile devices to save battery"
@@ -8,30 +8,5 @@ http:
auth: none
body:
type: json
jsonBody: "{\n \"registration_id\": \"{{registrationId}}"
docs: |-
## Check Registration Status
Checks the current status of a device registration request.
**Method:** POST
**Endpoint:** /api/devices/register/status
**Authentication:** None
**Request Body:**
- `registration_id` (string, required): Registration request ID
**Response:**
- `status` (string): Registration status (pending, approved, rejected, expired)
- `device_name` (string): Device name
- `device_type` (string): Device type
- `created_at` (string): Request timestamp
- `expires_at` (string): Expiration timestamp
**Status Codes:**
- 200: Success
- 404: Registration ID not found
- 410: Registration expired
data: "{\n \"registration_id\": \"{{registrationId}}"
docs: "## Check Registration Status\n\n Checks the current status of a device registration request.\n\n **Method:** POST\n\n **Endpoint:** /api/devices/register/status\n\n **Authentication:** None\n\n **Request Body:**\n - `registration_id` (string, required): Registration request ID\n\n **Response:**\n - `status` (string): Registration status (pending, approved, rejected, expired)\n - `device_name` (string): Device name\n - `device_type` (string): Device type\n - `created_at` (string): Request timestamp\n - `expires_at` (string): Expiration timestamp\n\n **Status Codes:**\n - 200: Success\n - 404: Registration ID not found\n - 410: Registration expired"
@@ -8,48 +8,12 @@ http:
auth: inherit
body:
type: json
jsonBody: "{\n \"file_path\": \"/mnt/sd/books/my-book.kepub.epub\",\n \"\
media_item_id\": \"{{media_item_id"
data: "{\n \"file_path\": \"/mnt/sd/books/my-book.kepub.epub\",\n \"media_item_id\": \"{{media_item_id"
headers:
- key: Content-Type
value: application/json
runtime:
scripts:
- type: tests
code: "test_create_device_file_alias_success(status, headers, body) {\n if\
\ (status !== 201 && status !== 200) {\n throw new Error(\"Expected status\
\ 201 or 200, got \" + status);"
docs: |-
## Create Device File Alias
Creates a new file alias for a device. File aliases map device-specific file paths to media items.
**Method:** POST
**Endpoint:** /api/devices/:id/file-aliases
**Authentication:** Required (Bearer token)
**Path Parameters:**
- `id` (string, required): Device UUID
**Request Body:**
- `file_path` (string, required): Device-specific file path
- `media_item_id` (string, required): Media item UUID to link to
**Response:** Created file alias object
- `id` (string): Alias UUID
- `device_id` (string): Device UUID
- `file_path` (string): Device-specific file path
- `media_item_id` (string): Associated media item UUID
- `created_at` (string): Creation timestamp
- `updated_at` (string): Last update timestamp
**Status Codes:**
- 201: Created
- 200: Success
- 400: Invalid request body
- 401: Unauthorized
- 404: Device not found
- 500: Internal server error
code: "test_create_device_file_alias_success(status, headers, body) {\n if (status !== 201 && status !== 200) {\n throw new Error(\"Expected status 201 or 200, got \" + status);"
docs: "## Create Device File Alias\n\n Creates a new file alias for a device. File aliases map device-specific file paths to media items.\n\n **Method:** POST\n\n **Endpoint:** /api/devices/:id/file-aliases\n\n **Authentication:** Required (Bearer token)\n\n **Path Parameters:**\n - `id` (string, required): Device UUID\n\n **Request Body:**\n - `file_path` (string, required): Device-specific file path\n - `media_item_id` (string, required): Media item UUID to link to\n\n **Response:** Created file alias object\n - `id` (string): Alias UUID\n - `device_id` (string): Device UUID\n - `file_path` (string): Device-specific file path\n - `media_item_id` (string): Associated media item UUID\n - `created_at` (string): Creation timestamp\n - `updated_at` (string): Last update timestamp\n\n **Status Codes:**\n - 201: Created\n - 200: Success\n - 400: Invalid request body\n - 401: Unauthorized\n - 404: Device not found\n - 500: Internal server error"
+31 -11
View File
@@ -2,57 +2,77 @@ info:
name: Disable Device Sync
type: http
seq: 8
http:
method: PUT
url: '{{base_url}}/api/devices/{{device_id}}'
auth: inherit
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
device_name: My Kobo Clara
sync_enabled: false
auto_sync: false
sync_frequency_minutes: 30
data: "{\n \"device_name\": \"My Kobo Clara\",\n \"sync_enabled\": false,\n \"auto_sync\": false,\n \"sync_frequency_minutes\": 30\n}"
docs: '## Disable Device Sync
docs: |-
## Disable Device Sync
Disables synchronization for a specific device.
**Method:** PUT
**Endpoint:** /api/devices/:device_id
**Authentication:** Required (Bearer token)
**Path Parameters:**
- `device_id` (string): UUID of the device
**Request Body:**
- `device_name` (string, optional): Device name
- `sync_enabled` (boolean): Must be `false`
- `auto_sync` (boolean): Should be `false`
- `sync_frequency_minutes` (integer, optional): Any value (sync disabled)
**Response:**
- `id` (string): Device UUID
- `device_name` (string): Device name
- `sync_enabled` (boolean): `false`
- `auto_sync` (boolean): `false`
- `message` (string): Confirmation message
**Status Codes:**
- 200: Sync disabled successfully
- 401: Unauthorized
- 403: Forbidden
- 404: Device not found
**Use Cases:**
- Temporarily disable sync for troubleshooting
- Stop sync for a lost or stolen device
- Disable sync before selling or giving away device
- Prevent data usage on limited connections
- Prevent data usage on limited connections'
@@ -8,32 +8,5 @@ http:
auth: none
body:
type: json
jsonBody: "{\n \"device_name\": \"My Kindle Paperwhite\",\n \"device_type\"\
: \"koreader\",\n \"device_identifier\": \"kindle-pw5-hardware-id-12345\""
docs: |-
## Initiate Device Registration
Initiates a new device registration request that requires admin approval.
**Method:** POST
**Endpoint:** /api/devices/register
**Authentication:** None (open endpoint)
**Request Body:**
- `device_name` (string, required): Human-readable device name (max 100 chars)
- `device_type` (string, required): Device type (kobo, koreader, kindle, etc.)
- `device_identifier` (string, required): Unique hardware ID (max 200 chars)
**Response:**
- `registration_id` (string): Unique registration request ID
- `status` (string): Initial status (pending)
- `expires_at` (string): Expiration timestamp (usually 24 hours)
- `message` (string): Informational message
**Status Codes:**
- 201: Registration initiated
- 400: Invalid request
- 409: Device already registered
data: "{\n \"device_name\": \"My Kindle Paperwhite\",\n \"device_type\": \"koreader\",\n \"device_identifier\": \"kindle-pw5-hardware-id-12345\""
docs: "## Initiate Device Registration\n\n Initiates a new device registration request that requires admin approval.\n\n **Method:** POST\n\n **Endpoint:** /api/devices/register\n\n **Authentication:** None (open endpoint)\n\n **Request Body:**\n - `device_name` (string, required): Human-readable device name (max 100 chars)\n - `device_type` (string, required): Device type (kobo, koreader, kindle, etc.)\n - `device_identifier` (string, required): Unique hardware ID (max 200 chars)\n\n **Response:**\n - `registration_id` (string): Unique registration request ID\n - `status` (string): Initial status (pending)\n - `expires_at` (string): Expiration timestamp (usually 24 hours)\n - `message` (string): Informational message\n\n **Status Codes:**\n - 201: Registration initiated\n - 400: Invalid request\n - 409: Device already registered"
+24 -10
View File
@@ -2,48 +2,62 @@ info:
name: Register Device
type: http
seq: 1
http:
method: POST
url: '{{base_url}}/api/devices/register'
auth: none
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
device_name: My Kobo Clara
device_type: kobo
device_identifier: N1234567890123
data: "{\n \"device_name\": \"My Kobo Clara\",\n \"device_type\": \"kobo\",\n \"device_identifier\": \"N1234567890123\"\n}"
docs: '## Register Device
docs: |-
## Register Device
Initiates device registration by sending device information to the server.
**Method:** POST
**Endpoint:** /api/devices/register
**Authentication:** None (public endpoint)
**Request Body:**
- `device_name` (string): Human-readable name for the device
- `device_type` (string): Type of device - `kobo`, `koreader`, or `web`
- `device_identifier` (string): Unique device identifier (serial number or other ID)
**Response:**
- `registration_id` (string): UUID for tracking registration status
- `status` (string): Registration status - `pending`, `approved`, or `rejected`
- `message` (string): Status message
**Status Codes:**
- 201: Registration initiated successfully
- 400: Invalid request data
- 409: Device already registered
**Notes:**
- Device registration requires user approval before activation
- Registration ID should be stored for status checking
- Device identifier must be unique per device
- Device identifier must be unique per device'
@@ -2,47 +2,60 @@ info:
name: Register KOReader Device
type: http
seq: 2
http:
method: POST
url: '{{base_url}}/api/devices/register'
auth: none
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
device_name: My Kindle Paperwhite
device_type: koreader
device_identifier: G090GP123456789
data: "{\n \"device_name\": \"My Kindle Paperwhite\",\n \"device_type\": \"koreader\",\n \"device_identifier\": \"G090GP123456789\"\n}"
docs: '## Register KOReader Device
docs: |-
## Register KOReader Device
Registers a KOReader device (typically Kindle devices running KOReader software).
**Method:** POST
**Endpoint:** /api/devices/register
**Authentication:** None (public endpoint)
**Request Body:**
- `device_name` (string): Human-readable name for the device
- `device_type` (string): Must be `koreader`
- `device_identifier` (string): Kindle serial number or unique device ID
**Response:**
- `registration_id` (string): UUID for tracking registration status
- `status` (string): Registration status - `pending`
- `message` (string): Confirmation message
**Status Codes:**
- 201: Registration initiated
- 400: Invalid device type or data
**KOReader Notes:**
- KOReader runs on Kindle, Kobo, PocketBook, and Android devices
- Device identifier is typically the device serial number
- Supports bookmarks, progress, highlights, and annotations sync
- Supports bookmarks, progress, highlights, and annotations sync'
+24 -10
View File
@@ -2,48 +2,62 @@ info:
name: Register Web Device
type: http
seq: 3
http:
method: POST
url: '{{base_url}}/api/devices/register'
auth: none
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
device_name: Chrome Browser
device_type: web
device_identifier: web-client-abc123
data: "{\n \"device_name\": \"Chrome Browser\",\n \"device_type\": \"web\",\n \"device_identifier\": \"web-client-abc123\"\n}"
docs: '## Register Web Device
docs: |-
## Register Web Device
Registers a web browser client for reading progress sync.
**Method:** POST
**Endpoint:** /api/devices/register
**Authentication:** None (public endpoint)
**Request Body:**
- `device_name` (string): Browser identification (e.g., "Chrome Browser")
- `device_type` (string): Must be `web`
- `device_identifier` (string): Unique browser/client identifier
**Response:**
- `registration_id` (string): UUID for tracking
- `status` (string): `pending` or `auto-approved`
- `message` (string): Status message
**Status Codes:**
- 201: Registration successful
- 400: Invalid request
**Web Device Notes:**
- Web devices use localStorage for device identification
- May be auto-approved without admin intervention
- Used for browser-based reading progress tracking
- Supports manual progress updates, highlights, and notes
- Supports manual progress updates, highlights, and notes'
@@ -2,60 +2,83 @@ info:
name: Update Device Settings
type: http
seq: 7
http:
method: PUT
url: '{{base_url}}/api/devices/{{device_id}}'
auth: inherit
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
device_name: Updated Device Name
sync_enabled: true
auto_sync: true
sync_frequency_minutes: 10
data: "{\n \"device_name\": \"Updated Device Name\",\n \"sync_enabled\": true,\n \"auto_sync\": true,\n \"sync_frequency_minutes\": 10\n}"
docs: '## Update Device Settings
docs: |-
## Update Device Settings
Updates device configuration and sync settings.
**Method:** PUT
**Endpoint:** /api/devices/:device_id
**Authentication:** Required (Bearer token)
**Path Parameters:**
- `device_id` (string): UUID of the device
**Request Body:**
- `device_name` (string, optional): New device name
- `sync_enabled` (boolean, optional): Enable/disable sync
- `auto_sync` (boolean, optional): Enable automatic sync
- `sync_frequency_minutes` (integer, optional): Sync interval (5-1440 minutes)
**Response:**
- `id` (string): Device UUID
- `device_name` (string): Updated device name
- `sync_enabled` (boolean): Updated sync status
- `auto_sync` (boolean): Updated auto-sync setting
- `sync_frequency_minutes` (integer): Updated sync interval
- `updated_at` (string): Update timestamp
**Status Codes:**
- 200: Settings updated successfully
- 400: Invalid sync frequency or data
- 401: Unauthorized
- 403: Forbidden (device belongs to different user)
- 404: Device not found
**Sync Frequency Guidelines:**
- Mobile devices: 10-30 minutes
- E-readers on WiFi: 15-60 minutes
- Web clients: 5-15 minutes
- Minimum: 5 minutes
- Maximum: 1440 minutes (24 hours)
- Maximum: 1440 minutes (24 hours)'
+2 -32
View File
@@ -8,35 +8,5 @@ http:
auth: inherit
body:
type: json
jsonBody: "{\n \"device_name\": \"My Updated Kindle\",\n \"sync_enabled\"\
: true,\n \"auto_sync\": true,\n \"sync_frequency_minutes\": 10"
docs: |-
## Update Device
Updates device settings and synchronization preferences.
**Method:** PUT
**Endpoint:** /api/devices/{device_id}
**Authentication:** Required (Bearer token, admin or device owner)
**Path Parameters:**
- `device_id` (string): Device ID
**Request Body:**
- `device_name` (string, optional): New device name (max 100 chars)
- `sync_enabled` (boolean, optional): Enable/disable synchronization
- `auto_sync` (boolean, optional): Enable automatic synchronization
- `sync_frequency_minutes` (integer, optional): Sync frequency in minutes (5-1440)
**Response:**
- Updated device object
**Status Codes:**
- 200: Success
- 400: Invalid request
- 401: Unauthorized
- 403: Forbidden (not device owner)
- 404: Device not found
data: "{\n \"device_name\": \"My Updated Kindle\",\n \"sync_enabled\": true,\n \"auto_sync\": true,\n \"sync_frequency_minutes\": 10"
docs: "## Update Device\n\n Updates device settings and synchronization preferences.\n\n **Method:** PUT\n\n **Endpoint:** /api/devices/{device_id}\n\n **Authentication:** Required (Bearer token, admin or device owner)\n\n **Path Parameters:**\n - `device_id` (string): Device ID\n\n **Request Body:**\n - `device_name` (string, optional): New device name (max 100 chars)\n - `sync_enabled` (boolean, optional): Enable/disable synchronization\n - `auto_sync` (boolean, optional): Enable automatic synchronization\n - `sync_frequency_minutes` (integer, optional): Sync frequency in minutes (5-1440)\n\n **Response:**\n - Updated device object\n\n **Status Codes:**\n - 200: Success\n - 400: Invalid request\n - 401: Unauthorized\n - 403: Forbidden (not device owner)\n - 404: Device not found"
@@ -2,65 +2,92 @@ info:
name: Update Sync Frequency
type: http
seq: 9
http:
method: PUT
url: '{{base_url}}/api/devices/{{device_id}}'
auth: inherit
headers:
- key: Content-Type
value: application/json
- key: Content-Type
value: application/json
body:
type: json
json:
device_name: My Kobo Clara
sync_enabled: true
auto_sync: true
sync_frequency_minutes: 15
data: "{\n \"device_name\": \"My Kobo Clara\",\n \"sync_enabled\": true,\n \"auto_sync\": true,\n \"sync_frequency_minutes\": 15\n}"
docs: '## Update Sync Frequency
docs: |-
## Update Sync Frequency
Changes how often the device automatically syncs with the server.
**Method:** PUT
**Endpoint:** /api/devices/:device_id
**Authentication:** Required (Bearer token)
**Path Parameters:**
- `device_id` (string): UUID of the device
**Request Body:**
- `device_name` (string, optional): Device name
- `sync_enabled` (boolean): Must be `true` for auto-sync
- `auto_sync` (boolean): Must be `true`
- `sync_frequency_minutes` (integer): New sync interval (5-1440)
**Response:**
- `id` (string): Device UUID
- `sync_enabled` (boolean): `true`
- `auto_sync` (boolean): `true`
- `sync_frequency_minutes` (integer): Updated interval
- `next_sync_at` (string): Estimated next sync time
- `updated_at` (string): Update timestamp
**Status Codes:**
- 200: Frequency updated successfully
- 400: Invalid frequency value
- 401: Unauthorized
- 403: Forbidden
- 404: Device not found
**Recommended Frequencies:**
- **Active reading:** 5-10 minutes
- **Normal usage:** 15-30 minutes
- **Occasional reading:** 30-60 minutes
- **Battery saving:** 60+ minutes
- **WiFi only (3G):** 30-60 minutes
**Notes:**
- More frequent sync = more battery usage
- Sync only occurs when device is online
- Manual sync can be triggered anytime regardless of frequency
- Manual sync can be triggered anytime regardless of frequency'