Skip to content

feat!: compute and render resources - #5

Merged
secretpray merged 6 commits into
nextfrom
feat/next-compute-render
Nov 6, 2026
Merged

secretpray merged 6 commits into
nextfrom
feat/next-compute-render

Conversation

@secretpray

@secretpray secretpray commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on #4. Compute and render resources, plus the typed models the following PRs build on.

client.compute

Method Request Returns
list GET /services/compute (key optional; fresher with a key) Array<Types::ComputeMachine>
start(node_number:, image:, **params) POST /services/compute session UUID
start_batch(items) POST /services/compute with an array Array<Types::BatchResult>
restart(uuid, **params) POST /services/compute/{uuid}/restart session UUID
  • start parameters: app disk_size envs ports http_ports entrypoint args ssh fm startup_script. Only parameters that were set are sent, so ssh: nil means the app's setting and ssh: false turns SSH off. Unknown parameters raise ArgumentError before the request.
  • start_batch: items without :id get their position; ids may be integers or strings; duplicate ids raise ArgumentError. A failed item is reported as BatchResult#failed?, not as an exception.
  • restart without parameters keeps the original parameters. With parameters it replaces all of them: omitted ones take their defaults, including disk_size = 1 GB. image, node_number and app raise ArgumentError.
  • Starts and restarts are never retried.

client.render

  • list → Array<Types::RenderMachine>
  • start(node_number:) → UUID; raises ServiceUnavailableError while rendering is unavailable
  • start_batch(items): unavailability is reported per item

Models (OctaSpace::Model)

  • Read-only models with a reader per field (node_number, base_price, net_down_mbps, gpus, reliability, …)
  • Every field stays reachable: machine[:field], and machine.to_h returns the parsed JSON. Pattern matching works via deconstruct_keys.
  • In listings, the string "null" reads as nil and numeric GPU strings as numbers

Removed

Verification

  • rake test: 0 failures; standardrb: clean

The SDK becomes a bare library on the way to the next API:

- remove the Rails playground (test/dummy, bin/playground,
  lib/octaspace/playground), MockTransport, the Rails Engine and the
  Appraisal/Rails matrix; the Railtie stays (no Rails dependency)
- require Ruby >= 3.3 (3.2 is EOL); CI tests 3.3, 3.4 and 4.0
- CI: actions pinned to commit SHAs, read-only token, concurrency,
  runs on main and next and on every PR, strict gem build,
  bundler-audit job
- Dependabot for bundler and actions, targeting next, 3-day cooldown
- faraday >= 2.14.3 (fixes published advisories); minitest 6,
  current webmock/standard/rake; railties and puma removed
- docs/GIT_WORKFLOW_NEXT.md: how to work with the next branch
Transport for the next API (api-dev.octa.space):

- Authorization: Bearer <api_key>; a pasted "Bearer " prefix and
  whitespace are stripped; 401 with a non-octa_ak_ key explains that
  legacy tokens are refused
- per-endpoint auth mode: :required raises AuthenticationError before
  any request when no key is configured, :optional sends the key when
  present, :none never sends it
- default base URL https://api-dev.octa.space (BASE_URL_DEV); the
  production hosts still serve the legacy API
- errors: 400 -> ValidationError, 409 -> ConflictError, 503 ->
  ServiceUnavailableError; message taken from {"message"}; ApiError
  exposes retry_after, rate_limit and body
- RateLimit-* headers parsed into OctaSpace::RateLimit, the latest
  available as client.rate_limit; Retry-After as seconds or HTTP date
- retries only for GET and idempotent requests, on network errors and
  429/502/503/504, honouring Retry-After up to max_retry_after (60 s);
  POST start/restart are never retried
- failover across base_urls only for GET; a request that changes state
  is never sent to a second host
- JSON parsed by the SDK: empty 202/204 bodies are fine, a non-JSON
  2xx body raises ApiError
- logging is one line per request; headers (API key) and bodies are
  never logged, and on_request no longer sees headers
- faraday-retry dependency removed
- client.compute: list (GET /services/compute, key optional),
  start (object -> 201, returns the uuid), start_batch (array -> 200,
  per-item BatchResult), restart (POST .../restart -> 202; no params
  restarts with the original ones, params replace all of them)
- client.render: list, start(node_number:), start_batch
- typed read-only models (OctaSpace::Model) for ComputeMachine,
  RenderMachine, Gpu, Reliability and BatchResult; unknown fields are
  kept and reachable via [] / to_h
- listings repair "null" strings and string GPU integers so one
  misreporting node does not break the listing
- request bodies carry only the parameters that were set (ssh/fm
  stay tri-state), unknown parameters raise ArgumentError; batch items
  get their position as id, duplicate ids raise ArgumentError
- removed: services.mr, services.vpn, services.render,
  ProvisionRejectedError, PayloadHelpers.normalize_marketplace_bandwidth
@secretpray secretpray changed the title feat!: compute and render resources for the next API feat!: compute and render resources Nov 6, 2026
@secretpray
secretpray changed the base branch from feat/next-transport to next November 6, 2026 10:31
@secretpray
secretpray merged commit 5bf0aaf into next Nov 6, 2026
5 checks passed
@secretpray
secretpray deleted the feat/next-compute-render branch November 6, 2026 10:44
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