From 93a36e026c63220cf31e4e034763330305ba1ed8 Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Tue, 20 Oct 2026 18:39:12 +0800 Subject: [PATCH] docs(flow): correct three comments the PR's own claims contradict Review of the previous commit surfaced three places where a comment describes something the code does not do. `gen_create_table_expr` documented the auto-added `update_at` column as `DEFAULT now()`. It has no default: `create_table_with_expr` builds it with `ColumnSchema::new(..., nullable = true)` and no default constraint, and the sqlness expectations show `"update_at" TIMESTAMP(3) NULL`. The comment added in `table_creator.rs` by the previous commit already said so, leaving the two files disagreeing. State the nullable, default-less layout and why it is kept. `flow_config_ignores_the_removed_num_workers_option` attributed ignoring the unknown key to `#[serde(default)]`. That attribute supplies defaults for absent fields; unknown keys are ignored because `FlowConfig` does not set `deny_unknown_fields`. Separate the two mechanisms. `test_legacy_streaming_flow_metadata_stays_readable_and_droppable` claimed dropping a legacy flow "only needs the metadata". The real `DROP FLOW` procedure also calls the flownode, so scope the claim to deleting this metadata, and pass the value read back rather than the original one, which also shows that value is enough to delete it. The `AGENTS.md` note likewise presented `get_flow_type_from_options` as what keeps legacy metadata listable and droppable; it is only used on the create path. Record the two reasons separately. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- src/common/meta/src/key/flow.rs | 5 +++-- src/flow/AGENTS.md | 7 +++++-- src/flow/src/adapter/tests.rs | 5 +++-- src/flow/src/batching_mode/task.rs | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/common/meta/src/key/flow.rs b/src/common/meta/src/key/flow.rs index e19e2bec886..a3d91b89cc6 100644 --- a/src/common/meta/src/key/flow.rs +++ b/src/common/meta/src/key/flow.rs @@ -898,9 +898,10 @@ mod tests { assert_eq!(names.len(), 1); assert_eq!(names[0].0, "legacy_flow"); - // Dropping a legacy flow only needs the metadata; no runtime is involved. + // Deleting this metadata needs no runtime, so it works for a legacy flow. Passing the + // value read back above also checks that it is enough to delete the flow's metadata. flow_metadata_manager - .destroy_flow_metadata(flow_id, &flow_value) + .destroy_flow_metadata(flow_id, &listed) .await .unwrap(); assert!(mem_kv.is_empty()); diff --git a/src/flow/AGENTS.md b/src/flow/AGENTS.md index 07e576f03b0..c984919a859 100644 --- a/src/flow/AGENTS.md +++ b/src/flow/AGENTS.md @@ -86,5 +86,8 @@ plan-to-schema helper shared with batching. change; it is a reserved internal key and must stay out of `SHOW CREATE FLOW` rendering. Writing it is a deliberate keep, not an oversight: dropping it would change the persisted metadata and the `options` column users can query, for no - runtime benefit. Reading it must keep accepting `streaming` so legacy metadata - stays listable and droppable (`get_flow_type_from_options`). + runtime benefit. Options that already say `streaming` must stay readable: that + is what keeps such legacy metadata listable and droppable, and a test in + `common-meta`'s `key/flow.rs` covers it. Independently, + `get_flow_type_from_options` must keep recognizing `streaming` so the persisted + options and in-flight data of an old create procedure still deserialize. diff --git a/src/flow/src/adapter/tests.rs b/src/flow/src/adapter/tests.rs index e3b0a4fc3c0..2bc6ba7ee2e 100644 --- a/src/flow/src/adapter/tests.rs +++ b/src/flow/src/adapter/tests.rs @@ -130,8 +130,9 @@ fn output_column_schemas_normalizes_dictionary_output_type() { fn flow_config_ignores_the_removed_num_workers_option() { // `flow.num_workers` belonged to the removed flow workers. Deployments still // carry it in their TOML, so parsing must keep ignoring it instead of failing - // the whole config. `FlowConfig` is `#[serde(default)]`, so the unknown key is - // skipped and the remaining fields come from the defaults. + // the whole config. The unknown key is ignored because `FlowConfig` does not + // set `deny_unknown_fields`; `#[serde(default)]` separately makes the fields + // absent from this TOML (such as `batching_mode`) come from the defaults. let config: super::FlowConfig = toml::from_str("num_workers = 4").unwrap(); assert_eq!(config, super::FlowConfig::default()); } diff --git a/src/flow/src/batching_mode/task.rs b/src/flow/src/batching_mode/task.rs index fecb20b5eb4..a12696c3e7e 100644 --- a/src/flow/src/batching_mode/task.rs +++ b/src/flow/src/batching_mode/task.rs @@ -2016,8 +2016,9 @@ impl BatchingTask { /// Generate the create table SQL /// - /// the auto created table will automatically added a `update_at` Milliseconds DEFAULT now() column in the end, - /// matching the layout sink tables created by earlier versions already have + /// the auto created table gets an extra `update_at` millisecond timestamp column appended at the + /// end. It is nullable and has no default value, matching the layout of sink tables created by + /// earlier versions /// /// and it will use first timestamp column as time index, all other columns will be added as normal columns and nullable async fn gen_create_table_expr(