Skip to content

fix(tables): send --key-determines as constant_per_key - #316

Merged
shefeek-jinnah merged 2 commits into
mainfrom
fix/tables-constant-per-key
Sep 23, 2026
Merged

shefeek-jinnah merged 2 commits into
mainfrom
fix/tables-constant-per-key

Conversation

@shefeek-jinnah

Copy link
Copy Markdown
Contributor

Summary

hotdata databases tables add --key-determines <col> is rejected by the server today.

  • Cause: runtimedb #1300 renamed the table declaration field from key_determines to constant_per_key. AddManagedTableRequest has deny_unknown_fields and no alias for the old name, but the CLI still sent "key_determines", so the request got a 400.
  • Fix: the CLI now sends constant_per_key. The --key-determines flag keeps its name, so nothing changes for users.
  • Refactor: the request body is now built in table_declaration_body, so a unit test can check the field name.

The CLI builds this body as raw JSON rather than through the SDK, so the SDK version doesn't matter here. This PR doesn't depend on #315.

Test plan

  • cargo test: 597 passed, including the new table_declaration_body_sends_key_determines_as_constant_per_key
  • cargo clippy --all-targets -- -D warnings and cargo fmt --check
  • Manual check: tables add --key <col> --key-determines <col> against a live server

runtimedb #1300 renamed the table declaration field from key_determines to
constant_per_key, and the add-table request rejects unknown fields. The CLI
still sent the old name, so `tables add --key-determines` got a 400.

Send constant_per_key. The flag keeps its name. Move the body into
table_declaration_body so the wire name is unit-tested.
@shefeek-jinnah
shefeek-jinnah requested a review from a team as a code owner September 23, 2026 11:25
@shefeek-jinnah
shefeek-jinnah requested review from rohan-hotdata and removed request for a team September 23, 2026 11:25
Comment thread src/commands/databases.rs
}

/// `databases tables add` — declare a table on an existing instant database.
/// Build the request body for `POST /v1/databases/{id}/schemas/{schema}/tables`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

super nit: add_table lost its doc comment (not blocking). The sentence on line 960 describes the databases tables add command, so it now sits on the wrong function. Move that sentence back above add_table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in de0e182. The sentence is back above add_table.

claude[bot]
claude Bot previously approved these changes Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/commands/databases.rs 95.23% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prior comment addressed. No new findings.

@shefeek-jinnah
shefeek-jinnah merged commit 7ef1066 into main Sep 23, 2026
15 checks passed
@shefeek-jinnah
shefeek-jinnah deleted the fix/tables-constant-per-key branch September 23, 2026 12:09
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