Sync with InsForge-sdk-js v1.5.0

FE
3mo ago
+139-22

Ports the storage changes from InsForge-sdk-js v1.5.0 (diff v1.4.5..v1.5.0), paired with the backend change in InsForge/InsForge#1760.

Ported

  • upload_object(bucket, key, data) — now documented with standard object-storage PUT semantics: uploading to an existing key replaces the object in place (previously the server silently auto-renamed, e.g. photo.png → photo (1).png). Signature unchanged; this is a runtime behavior change driven by the backend.
  • upload_object_auto(bucket, data=..., filename=...) — the backend no longer mints keys, so the unique, collision-free key is now generated client-side (<sanitized-base>-<timestamp-ms>-<random6><ext>, base capped at 32 chars, file fallback for an empty base — same algorithm as the JS generateObjectKey) and the upload is routed through the standard upload_object PUT path instead of the old POST /objects auto-name route. Repeated uploads of the same file never overwrite each other. Signature unchanged.
  • Tests — updated test_upload_auto_and_strategy_endpoints for the new PUT route, and added tests mirroring the new JS coverage: client-side key minting via PUT, distinct keys for repeated uploads of the same filename, and key-generation edge cases (sanitization, 32-char truncation, leading-dot filenames, empty-base fallback).
  • Version — bumped pyproject.toml to 0.2.0 (behavior change, pre-1.0). No changelog file exists in this repo, so none was updated.

Skipped

  • JS test-harness scaffolding, CI workflow tweaks, package.json/package-lock.json version plumbing, and SDK-REFERENCE.md (JS-specific; the Python equivalent is the docstring on upload_object, and this repo's README does not document upload_object_auto).
  • No upsert/autoKey flags existed in the Python SDK, so nothing to remove there.

Notes

  • Requires an InsForge backend that includes the standard-PUT storage change (InsForge/InsForge#1760). Do not run against a pre-change backend.

Test results

pytest on Python 3.12: 88 passed, 15 skipped (skips are live-backend integration tests).

🤖 Generated with Claude Code


Summary by cubic

Syncs the Python SDK’s storage behavior with InsForge-sdk-js v1.5.0, adopting standard PUT semantics and client-side auto-key generation. This removes server auto-renaming and ensures collision-free uploads.

  • New Features

    • upload_object: PUT to an existing key replaces the object in place.
    • upload_object_auto: generates a sanitized unique key client-side (<base>-<timestamp>-<random><ext>) and uploads via PUT; repeated uploads never overwrite.
    • Tests updated for PUT route and key-generation edge cases.
  • Migration