Skip to content

client-api: Optionally include the current program hash in the database info - #5678

Open
kim wants to merge 1 commit into
masterfrom
kim/info-current-program
Open

client-api: Optionally include the current program hash in the database info#5678
kim wants to merge 1 commit into
masterfrom
kim/info-current-program

Conversation

@kim

@kim kim commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Useful in certain circumstances, including observability.
Including the information in the info endpoint is the obvious choice
without introducing further machinery. It comes with some caveats,
however:

  • If the database is not running, retrieving the module hash as
    implemented will start it.

    This may not be desirable, which is why the behavior is opt-in via the
    current-hash query parameter.

  • If the database is suspended, paused, or faulty, determining the hash
    is not possible.

    For the intended purpose, this is sufficient, as absence is an error
    condition.

Expected complexity level and risk

2

Testing

The feature is (implicitly) tested elsewhere.

I am, however, wondering:

  • Why is the response encoded as JSON via SATS?
  • Do we have documented consumers of the endpoint? The CLI doesn't seem to talk
    to it.

Given answers to those questions, it would be worthwhile to add a smoketest that
fails if the shape of the response changes.

…se info

Useful in certain circumstances, including observability.
Including the information in the info endpoint is the obvious choice
without introducing further machinery. It comes with some caveats,
however:

- If the database is not running, retrieving the module hash as
  implemented will start it.

  This may not be desirable, which is why the behavior is opt-in via the
  `current-hash` query parameter.

- If the database is suspended, paused, or faulty, determining the hash
  is not possible.

  For the intended purpose, this is sufficient, as absence is an error
  condition.
@kim
kim requested a review from gefjon August 6, 2026 12:38

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

Why is the response encoded as JSON via SATS?

I think this is a historical artifact, not any particular reason.

Do we have documented consumers of the endpoint? The CLI doesn't seem to talk
to it.

Not to my knowledge. In my opinion, if we don't have tests of it and the CLI doesn't touch it, then it's not stable.

[extending the database info route] is the obvious choice without introducing further machinery.

I don't think I agree with this. It seems like it's actually pretty non-obvious to extend the existing route without breaking things, and we end up with a more complicated API and worse error handling than if we just added a new endpoint.

Comment on lines +623 to +629
let current_program = async {
current_hash.then_some(())?;
let host = worker_ctx.leader(database.id).await.ok()?;
let module = host.module().await.ok()?;
Some(module.info().module_hash)
}
.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.

I don't love swallowing failures here; it seems like the kind of thing that's going to confuse and frustrate someone 6 months or a year from now.

@kim

kim commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

If you think a new, undocumented, mostly internally-used endpoint is preferable, please specify said endpoint.

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