Skip to content

feat: add topic and table forms#3909

Open
ksvfs wants to merge 19 commits into
ydb-platform:mainfrom
ksvfs:forms
Open

feat: add topic and table forms#3909
ksvfs wants to merge 19 commits into
ydb-platform:mainfrom
ksvfs:forms

Conversation

@ksvfs

@ksvfs ksvfs commented May 18, 2026

Copy link
Copy Markdown

Stand

Greptile Summary

This PR introduces GUI-based create/update dialogs for YDB topics (TopicFormDialog) and tables (TableFormDialog), along with a reusable RangeInputPicker component. It also refactors the topic store reducer from a flat file into a directory with separate concerns (topic.ts, utils.ts), and adds a new tableApi with RTK Query endpoints for describe/create/update operations.

  • Topic form supports create and update modes with fields for partitions, write quota, retention (time or size), and auto-partitioning strategy; it uses the existing topicApi query result (via a new selectTopicFormValues selector) to pre-populate the update form.
  • Table form supports row and column table types in create and update modes, with sections for columns (including PK, autoincrement, default values, families), secondary indexes, TTL, settings, and explicit split-point partitioning.
  • The TreeKeyProvider context is moved up from ObjectSummary to Tenant so that schema tree refreshes triggered by dialog success callbacks share the right context boundary.

Confidence Score: 4/5

The PR is safe to merge; the form dialogs work correctly end-to-end and all current callers always pass onSuccess, so the inconsistency noted is latent rather than immediately observable.

The bulk of the change is well-structured new UI code backed by tests for the query builders and validation. The issues found are non-blocking: the TopicFormDialog missing onClose fallback is not exercised by any current caller, the date-regex allowing 00 only affects client-side pre-validation (server rejects invalid dates), and the multi-statement ALTER TABLE batch is an accepted pattern for similar operations in this codebase. The unused expire field is a minor type cleanliness issue.

src/containers/Tenant/TopicFormDialog/TopicFormDialog.tsx (missing close fallback), src/containers/Tenant/TableFormDialog/columnValueValidation.ts (date regex), and src/store/reducers/table/table.ts (multi-statement batch ordering)

Important Files Changed

Filename Overview
src/containers/Tenant/TopicFormDialog/TopicFormDialog.tsx Large new file (1142 lines) implementing the topic create/update dialog; handleTopicSubmit lacks a fallback onClose() call when onSuccess is not provided (unlike TableFormDialog)
src/containers/Tenant/TableFormDialog/TableFormDialog.tsx New dialog for table create/update; correctly closes on success via either onSuccess or onClose fallback
src/containers/Tenant/TableFormDialog/columnValueValidation.ts Client-side column value validation; date/datetime/timestamp regex patterns allow invalid day 00 and month 00
src/store/reducers/table/utils.ts Query builders for CREATE/UPDATE TABLE; generates correct YDB syntax confirmed by tests; buildRenameQuery and buildResetQuery can be sequenced in the same request without transactional guarantees
src/store/reducers/table/table.ts New RTK Query endpoints (getTable, createTable, updateTable); update mutation joins up to 3 ALTER statements in one sendQuery call without transactional safety
src/store/reducers/topic/topic.ts Expanded topic reducer with createTopic/updateTopic mutations and selectTopicFormValues selector; migration from flat topic.ts file is clean
src/containers/Tenant/utils/schemaActions.tsx Adds 'Update Table' and 'Update Topic' dialog-backed menu items; they are unconditionally added to action sets but their callbacks safely no-op when handlers are absent
src/components/RangeInputPicker/RangeInputPicker.tsx New slider+input combo component; clamps out-of-range input on blur, correctly synchronizes focused input state with external value updates
src/containers/Tenant/TableFormDialog/validation.ts Zod-based schema validation covering name patterns, columns, indexes, partitioning, and TTL; logic is correct
src/store/reducers/table/types.ts Defines table form value types; TTLSettings has an expire?: number field that is unused in the form and query builder

Sequence Diagram

sequenceDiagram
    participant User
    participant SchemaTree
    participant Dialog as TopicFormDialog / TableFormDialog
    participant RTKQuery as RTK Query API
    participant YDB

    User->>SchemaTree: Right-click node → "Create/Update Table/Topic"
    SchemaTree->>Dialog: openTableFormDialog / openTopicFormDialog (NiceModal)
    Note over Dialog: Loads existing data (update mode)<br/>via useGetTableQuery / useGetTopicQuery
    Dialog-->>User: Renders pre-populated form
    User->>Dialog: Submits form
    Dialog->>RTKQuery: createTable / updateTable / createTopic / updateTopic
    RTKQuery->>YDB: sendQuery (CREATE / ALTER TABLE/TOPIC)
    alt update table — multiple statements
        YDB-->>RTKQuery: RESET TTL result
        YDB-->>RTKQuery: ALTER TABLE (add/drop/set) result
        YDB-->>RTKQuery: RENAME TABLE result
    end
    YDB-->>RTKQuery: Response
    RTKQuery-->>Dialog: success / error
    Dialog-->>SchemaTree: onSuccess(newPath)
    SchemaTree->>SchemaTree: onActivePathUpdate + setSchemaTreeKey (tree refresh)
Loading

Fix All in Codex Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 4 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 4
src/containers/Tenant/TopicFormDialog/TopicFormDialog.tsx:518-519
Dialog doesn't close on success if `onSuccess` is not provided. In `TableFormDialog.tsx` the equivalent handler uses an explicit `else { onClose(); }` branch, so the dialog always closes after a successful submit. Here, if a caller passes no `onSuccess` the toast fires but the dialog stays open.

```suggestion
            if (onSuccess) {
                onSuccess(buildFullTopicPath(preparedData, databaseFullPath));
            } else {
                onClose();
            }
        } catch (error) {
```

### Issue 2 of 4
src/containers/Tenant/TableFormDialog/columnValueValidation.ts:46-47
The day pattern `[0-2]\d|3[0-1]` matches `00` (and months `0\d` match `00`), which are not valid calendar values. While YDB server performs the authoritative validation, this lets obviously invalid literals such as `2025-00-00` or `2025-01-00` pass client-side pre-validation silently.

```suggestion
function isDate32(stringValue: string) {
    const dateRegex = /^-?\d{4,6}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[0-1])$/;
```

### Issue 3 of 4
src/store/reducers/table/table.ts:113-153
**Partial-update risk from non-atomic multi-statement batch**

When TTL is disabled *and* there are also column or setting changes, the mutation pushes up to three separate `ALTER TABLE` statements (`RESET (TTL)`, `ALTER TABLE … ADD/DROP/SET …`, `ALTER TABLE … RENAME TO …`) joined with `\n` and sent in a single `sendQuery` call. If YDB executes them sequentially and a later statement fails, the earlier ones have already committed — e.g. TTL is dropped but the new column is never added, leaving the table in an intermediate state. The user sees an error toast but has no automatic rollback or retry hint.

### Issue 4 of 4
src/store/reducers/table/types.ts:159-164
The `expire` field is never read by the query builder (`buildSettingsCreateItems`) or by the form — only `lifetime` is used. Leaving an unused field in the interface can mislead future contributors. Per the project's learnings, unused interface members should be cleaned up.

```suggestion
export interface TTLSettings {
    status: 'enabled' | 'disabled';
    column?: string;
    columnWithEpochMode?: boolean;
    lifetime?: number;
```

Reviews (1): Last reviewed commit: "feat: add topic and table forms" | Re-trigger Greptile

Greptile also left 4 inline comments on this PR.

Context used:

  • Rule used - Remove unused interfaces and CSS classes that are ... (source)

Learned From
ydb-platform/ydb-embedded-ui#2729

@ksvfs ksvfs changed the title [WIP] feat: add topic and table forms feat: add topic and table forms Jun 3, 2026
@ksvfs
ksvfs marked this pull request as ready for review June 3, 2026 09:49
Comment thread src/containers/Tenant/TopicFormDialog/TopicFormDialog.tsx Outdated
Comment thread src/containers/Tenant/TableFormDialog/columnValueValidation.ts Outdated
Comment thread src/store/reducers/table/table.ts
Comment thread src/store/reducers/table/types.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abe059d7ea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/store/reducers/table/utils.ts Outdated
Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ac16c7631

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 935240fc89

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/store/reducers/topic/utils.ts Outdated
Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5c76827c6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/containers/Tenant/TableFormDialog/TableFormDialog.tsx
Comment thread src/containers/Tenant/TableFormDialog/validation.ts
Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@astandrik astandrik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found two merge-blocking issues: JsonDocument defaults generate invalid YQL, and a split point can lose its explicit value after reopening the dialog. Details are in the inline comments.

Comment thread src/store/reducers/table/utils.ts
Comment thread src/containers/Tenant/TableFormDialog/sections/SplitPointDialog.tsx Outdated
Comment thread src/store/reducers/table/utils.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2ac17d715

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/store/reducers/table/utils.ts Outdated
Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c036ec0b4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/containers/Tenant/TableFormDialog/validation.ts
Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51166dbe76

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10d6ce7e40

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/store/reducers/topic/topic.ts
Comment thread src/containers/Tenant/TableFormDialog/validation.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3eec5953f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/containers/Tenant/TableFormDialog/columnValueValidation.ts
Comment thread src/store/reducers/table/utils.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80bfdf8a49

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/containers/Tenant/TableFormDialog/constants.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eece85b50c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/containers/Tenant/TopicFormDialog/utils.ts
Comment thread src/containers/Tenant/TableFormDialog/sections/SettingsSection.tsx

@astandrik astandrik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the current head 11b577803e66a0f28e86e9cec17c29c18625081f against base 838e82e6f28f8e9d9cd6cd85a4d9517556756f0d.

Checked:

  • table/topic create and update forms, reducers, query builders, validation, and tests;
  • previously raised points around date/time literals, topic auto-partitioning defaults, 2048 MB partition size, split points, and rename validation;
  • SchemaTree action wiring, ObjectSummary/CreateDirectoryDialog, TreeKeyProvider move, and refresh behavior;
  • SCSS/layout changes for ObjectSummary, create-directory breadcrumbs, table/topic dialogs, RangeInputPicker, and column selector;
  • relevant YDB source/docs for backend contracts and lightweight Arcadia/YDB EM probes for wrapper/package impact.

Verification:

  • npm run typecheck passed;
  • npm run lint:styles passed;
  • npm test -- src/containers/Tenant/TableFormDialog src/containers/Tenant/TopicFormDialog passed: 6 suites, 94 tests;
  • focused earlier Jest pass for table validation/query paths passed: 3 suites, 96 tests;
  • git diff --check 838e82e6f28f8e9d9cd6cd85a4d9517556756f0d..HEAD passed;
  • GitHub checks are green for Verify Files, Unit Tests, Check Bundle Size, Merge Playwright Reports, and Playwright shards 1/8 through 8/8. The remaining failed Update PR Description job is the fork/reporting write step, not a product check.

Result: no remaining blocking findings from my side. Approving.

Known limit: I did not run a separate local browser screenshot pass for the new dialogs; CI Playwright is the current interaction smoke.

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.

[ux] Move table/topic/document table creation forms to YDB UI

2 participants