Skip to content

Commit cf10552

Browse files
committed
docs(ingest): finish the file, and hedge where the code hedges
Review found a fourth spot in the same file, and it was the one that matters most for someone writing against the response: the `initial_run_id` FIELD doc still said "Only on the POST /ingests response for a one_time ingest". That is the line a reader hits while handling the value, and it contradicted the corrected comment 370 lines above it. It now says where a run id would appear, that the service does not populate it, and where to actually find the run. The struct doc no longer advertises `initial_run_id` as part of what create returns. Also softened the create comment from a permanent guarantee to current behaviour. The render in commands::ingest deliberately keeps a branch for a run id "in case the service ever starts reporting one", and the client tests cover a populated value; docs asserting it can never be populated would put the file at odds with the hedge the code chose on purpose. The field stays Option for the same reason -- a service that starts reporting one needs no client change. 464 tests pass.
1 parent e0b3a55 commit cf10552

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

‎src/client/ingest.rs‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,13 @@ impl IngestClient {
463463
// --- ingests ----------------------------------------------------------
464464

465465
/// Create a saved load definition. Starts nothing — the scheduler
466-
/// dispatches every run, so `initial_run_id` comes back null for every
467-
/// type. A `one_time` ingest is created DUE, which is what gets it claimed
468-
/// on the next tick and exactly once; it is not run here.
466+
/// dispatches every run, and the service does not populate `initial_run_id`
467+
/// today, for any type. A `one_time` ingest is created DUE, which is what
468+
/// gets it claimed on the next tick and exactly once; it is not run here.
469+
///
470+
/// Stated as current behaviour rather than a guarantee, to match the render
471+
/// in `commands::ingest`, which keeps a branch for a run id in case the
472+
/// service ever reports one.
469473
pub fn create_ingest(&self, req: &IngestCreate) -> Result<Ingest, IngestError> {
470474
self.require_api_key()?;
471475
let body = serde_json::to_value(req).expect("IngestCreate serializes");
@@ -800,9 +804,9 @@ pub struct DeleteAck {
800804
pub deleted: bool,
801805
}
802806

803-
/// An ingest row. `POST /ingests` returns the identity fields plus
804-
/// `initial_run_id`; list/show/resume/schedule return the fuller view — one
805-
/// struct serves them all.
807+
/// An ingest row. `POST /ingests` returns the identity fields;
808+
/// list/show/resume/schedule return the fuller view — one struct serves them
809+
/// all, so most fields are optional by shape rather than by meaning.
806810
#[derive(Debug, Deserialize, Serialize)]
807811
pub struct Ingest {
808812
pub ingest_id: String,
@@ -833,7 +837,11 @@ pub struct Ingest {
833837
pub schedule: Option<serde_json::Value>,
834838
#[serde(default)]
835839
pub next_attempt_at: Option<String>,
836-
/// Only on the `POST /ingests` response for a `one_time` ingest.
840+
/// Where a create's run id WOULD appear. The service does not populate it
841+
/// today — the scheduler dispatches every run — so treat `None` as the
842+
/// normal answer and find the run with `GET /ingests/{id}/runs`. Kept
843+
/// optional rather than removed so a service that starts reporting one
844+
/// needs no client change.
837845
#[serde(default)]
838846
pub initial_run_id: Option<String>,
839847
#[serde(default)]

0 commit comments

Comments
 (0)