Skip to content

feat: keymap_put / keymap_lookup verbs for the KeyMap primitive - #23

Merged
AminChirazi merged 1 commit into
mainfrom
feat/keymap-verbs
Jul 15, 2026
Merged

feat: keymap_put / keymap_lookup verbs for the KeyMap primitive#23
AminChirazi merged 1 commit into
mainfrom
feat/keymap-verbs

Conversation

@AminChirazi

Copy link
Copy Markdown
Collaborator

Companion to automators-com/datamaker#2796 (issue automators-com/datamaker#2787): the DataMaker API now has a first-class KeyMap primitive that records old-to-new key mappings during migrations. This adds the SDK verbs.

Note: dm.save_set / dm.get_set (the other half named in the issue) already exist in this SDK, so this PR only adds what was missing.

What changed

  • New KeyMapsClient (routes/keymaps.py):
    • keymap_put(map_name, object, entries, run_id=None, project_id=None) - batch upsert; entries is a dict of old key to new key; same old key written again overwrites its new key; server caps batches at 5000
    • keymap_lookup(map_name, object, old_keys, project_id=None) - batch translate; returns mappings plus a missing list
    • get_keymaps, get_keymap_entries (paginated inspection), delete_keymap
  • Delegated on the DataMaker class (dm.keymap_put(...), dm.keymap_lookup(...)) with a keymaps property for direct access, matching the sets wiring
  • Project scope falls back to DATAMAKER_PROJECT_ID, as everywhere else

Verification

  • 6 new unit tests following the existing mock patterns; all 68 unit tests pass
  • ruff check/format clean on the touched files (the 3 repo-wide F401 findings pre-date this change)

🤖 Generated with Claude Code

Companion to automators-com/datamaker#2796 (issue #2787): the API now has a
first-class KeyMap primitive for old-to-new key mappings during migrations.

- KeyMapsClient: get_keymaps, keymap_put (batch upsert, dict of old to new),
  keymap_lookup (returns mappings + missing), get_keymap_entries, delete_keymap
- Delegated on the DataMaker class (dm.keymap_put / dm.keymap_lookup) with a
  keymaps property for direct access, matching the sets wiring
- Unit tests following the existing mock patterns (6 new, all 68 pass)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 17:39

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AminChirazi
AminChirazi merged commit d78cfff into main Jul 15, 2026
4 checks passed
AminChirazi added a commit that referenced this pull request Jul 15, 2026
Ships the KeyMap SDK verbs (dm.keymap_put / dm.keymap_lookup and the
KeyMapsClient) added in #23, companion to the API-side KeyMap primitive
(automators-com/datamaker#2796). Minor, backward compatible.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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