Skip to content

chore(query-runs): clarify user_public_id documentation - #103

Merged
zfarrell merged 2 commits into
mainfrom
openapi-update-30506452709
Jul 30, 2026
Merged

chore(query-runs): clarify user_public_id documentation#103
zfarrell merged 2 commits into
mainfrom
openapi-update-30506452709

Conversation

@hotdata-automation

Copy link
Copy Markdown
Contributor

Auto-generated from the updated HotData OpenAPI spec.
Source: https://github.com/hotdata-dev/www.hotdata.dev/pull/289

@hotdata-automation
hotdata-automation Bot requested a review from a team as a code owner July 30, 2026 01:44
@hotdata-automation
hotdata-automation Bot requested review from anoop-narang and removed request for a team July 30, 2026 01:44
Comment thread src/apis/query_api.rs
};
req_builder = req_builder.header("X-Session-Id", value);
};
if let Some(token) = configuration.resolve_bearer_token().await {

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.

Blocking — this drops the X-Session-Id header from query, and the same block is removed from get_result/list_results in src/apis/results_api.rs. After this PR, grep -rn "X-Session-Id" src/apis/ returns nothing: no generated operation sends the session header anymore.

That leaves the crate internally inconsistent, because the hand-written twins of these exact operations still send it:

  • src/client.rs:468Client::submit_query (the hand-written POST /v1/query) still emits X-Session-Id, so it now sends different auth headers than the generated query for the same endpoint.
  • src/query.rs:641-656apply_apikey_headers, whose doc comment says it is "mirroring the generated op's isKeyInHeader blocks". That statement is now false.
  • src/arrow.rs:301-321apply_apikey_headers, documented as "mirroring the generated get_result isKeyInHeader blocks so a session-scoped client ... behaves identically on the Arrow path". Also now false, and the unit test at src/arrow.rs:494-526 asserts the header is forwarded "matching the generated get_result" — the rationale that test encodes no longer holds.

Also, ClientBuilder::session_id (src/client.rs:126-131) still exists and still installs the API key, but it is now inert for every generated endpoint. A caller who builds a session-scoped client silently loses session scoping on query, get_result, and list_results with no compile-time or runtime signal.

Please resolve the divergence one way or the other before merging: either drop SESSION_ID_HEADER from the two hand-written apply_apikey_headers helpers and from submit_query (updating those doc comments and the arrow.rs tests), or keep it and rewrite the "mirrors the generated op" comments to state that the divergence is deliberate and why. If session_id is no longer meaningful anywhere, it should be deprecated rather than left as a silent no-op.

Comment thread CHANGELOG.md Outdated

### Changed

- chore(query-runs): clarify user_public_id documentation

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.

Blocking — this entry only records the user_public_id doc wording, but the same PR removes the SessionId security scheme from three operations (query, get_result, list_results), so the generated client stops sending X-Session-Id on all of them. That is a user-facing behavior change for anyone using ClientBuilder::session_id, and it is currently invisible in the changelog under a chore(...) heading.

Please add a separate entry describing the removal, e.g.:

- **Breaking:** `X-Session-Id` is no longer sent on `query`, `get_result`, or `list_results` — the `SessionId` security scheme was removed from these operations upstream.

Callers reading only the changelog would otherwise upgrade expecting a docs-only change.

)]
pub trace_id: Option<Option<String>>,
/// Caller identity derived from the Authorization Bearer token (SHA-256 hash). Format: `user_{first_10_hex_chars}`.
/// Who ran this query: the account id from the access token the request was made with. Use it to group a caller's query history. Requests made with a credential that identifies no account instead record an opaque `user_`-prefixed identifier, which is stable for that credential but cannot be resolved to an account.

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: the doc comment has a stray double space ("query history. Requests made") where the upstream description's paragraph break was flattened into a single line. It renders as one run-on paragraph in rustdoc. Worth fixing in the generator template / spec so the two sentences stay visually separated. (not blocking)

@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.

Review

Blocking Issues

  1. X-Session-Id silently dropped from all generated operations, leaving hand-written paths divergentsrc/apis/query_api.rs:57 and src/apis/results_api.rs:79,153. The SessionId security scheme is removed from query, get_result, and list_results; after this PR no generated operation sends the header. But the hand-written twins of those same operations still do, and their doc comments/tests explicitly claim to mirror the generated ops:

    • src/client.rs:468Client::submit_query still sends X-Session-Id for POST /v1/query, diverging from generated query.
    • src/query.rs:641 — "mirroring the generated op's isKeyInHeader blocks" — no longer true.
    • src/arrow.rs:301 — "mirroring the generated get_result isKeyInHeader blocks so a session-scoped client ... behaves identically on the Arrow path" — no longer true, and the test at src/arrow.rs:494 asserts the session header is forwarded "matching the generated get_result".

    ClientBuilder::session_id (src/client.rs:126) still installs the API key but is now inert for every generated endpoint, so session scoping is lost with no signal to the caller.

  2. Behavior change not disclosed in the changelogCHANGELOG.md:12. The only entry is the user_public_id doc wording; the removal of session auth from three operations is unrecorded.

Action Required

  • Reconcile the hand-written header helpers with the new spec: either drop SESSION_ID_HEADER from apply_apikey_headers in src/query.rs and src/arrow.rs and from submit_query in src/client.rs (updating the doc comments and the arrow.rs session-header tests), or keep them and rewrite the "mirrors the generated op" comments to state the divergence is intentional and why.
  • Decide the fate of ClientBuilder::session_id: if no endpoint consumes X-Session-Id anymore, deprecate it rather than leaving a silent no-op.
  • Add a changelog entry for the X-Session-Id removal, flagged as breaking for session-scoped clients.
  • .openapi-generator-templates/README.md:7 still documents X-Session-Id as one of the supported schemes — update it if the scheme is gone for good.

@zfarrell

Copy link
Copy Markdown
Contributor

Reworded the changelog entry from the raw commit subject to a caller-facing description (a3ad306), which addresses the non-blocking nit from the earlier review.

Worth flagging for whoever merges: this is a behavior change, not a docs clarification, so the PR title understates it. The upstream source is runtimedb#1000fix(http): attribute query runs to the verified token subject — which switches query_runs.user_public_id from a hash of the bearer token to the verified token's sub claim. The old value churned every few minutes as short-lived JWTs were reminted, so anyone grouping query history by this field was silently getting fragmented groups. The bearer-fingerprint fallback remains for requests with no verified subject.

The two blocking issues from the earlier review were both about the X-Session-Id removal overlapping this regen. Those are resolved on main by #102, and this branch's query_api.rs / results_api.rs are now byte-identical to main. It merges cleanly and all checks were green.

The remaining super-nit (stray double space in the user_public_id doc comment) is in generated code and comes from the upstream spec description, so fixing it here would be reverted by the next regen — it belongs in the spec.

@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.

Review

Cycle 1's two blocking findings were wrong and I'm withdrawing them: they were read off gh pr diff, which diffs against a stale merge base. The X-Session-Id removal from query/get_result/list_results and the corresponding docs changes already landed on main in #102 (chore(api): stop injecting SessionId into merged spec), together with the removal of ClientBuilder::session_id/SESSION_ID_HEADER from the hand-written paths and the Breaking ### Removed changelog entry at CHANGELOG.md:12-15. grep -rn 'session' src/ on the merged tree turns up nothing session-related, so there is no divergence between the generated and hand-written operations, and the changelog already covers the behavior change.

Against current main, this PR is docs-only:

CHANGELOG.md                 | 7 +++++++
docs/QueryRunInfo.md         | 2 +-
src/models/query_run_info.rs | 2 +-

The regenerated user_public_id description matches between the model doc comment and docs/QueryRunInfo.md, and the changelog entry accurately describes the server-side semantics change. Approving.

@zfarrell
zfarrell merged commit 195609b into main Jul 30, 2026
4 checks passed
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