refactor(go): replace GenerateUUID1 with GenerateToken for entity IDs by Hz-186 · Pull Request #16010 · infiniflow/ragflow (original) (raw)

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/dataset.go` at line 859, The CreateDataset function
generates UUIDv4 IDs using utility.GenerateToken, but downstream functions
including ListDatasets, DeleteDatasets, and GetDataset all validate IDs through
normalizeDatasetUUID1, which explicitly rejects non-v1 UUIDs at Lines 1416-1418.
This causes newly created datasets to fail validation in lookup and delete
operations. Either change the ID generation in CreateDataset to use a
UUIDv1-compatible approach instead of utility.GenerateToken, or refactor the
normalization function to accept both UUID versions and update all callers of
normalizeDatasetUUID1 (in ListDatasets, DeleteDatasets, GetDataset, and any
other locations) to use a new normalization function that handles both UUID v1
and v4 formats.