Skip to content

fix(create): accept vectoria UUID as doc_id (0.6.2)#8

Merged
voidkey merged 2 commits into
mainfrom
fix/doc-id-uuid
May 15, 2026
Merged

fix(create): accept vectoria UUID as doc_id (0.6.2)#8
voidkey merged 2 commits into
mainfrom
fix/doc-id-uuid

Conversation

@voidkey
Copy link
Copy Markdown
Collaborator

@voidkey voidkey commented May 14, 2026

Summary

Stacked on #7. Fixes a long-standing usability gap: vk create --from <uuid> now actually works.

The bug

After a successful vk create, the CLI prints:

```
doc_id: 3c498964-2c54-4ac0-97e8-1125d3bed640 — polling for completion...
```

Users naturally try to reuse that ID:

```
vk create --from 3c498964-2c54-4ac0-97e8-1125d3bed640
```

…which silently failed with `stat: no such file or directory` because the doc-id regex (docIDRe) only matched a hypothetical doc_<8+ alnum> form that vectoria has never actually used.

The fix

Extend docIDRe to accept both forms:

  • Legacy: ^doc_[a-zA-Z0-9]{8,}$ (kept for backward compat)
  • Vectoria native: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

One regex, single line. The CLI's existing dispatch (docIDRe.MatchString → skip upload; URL prefix → upload via vectoria; default → local file) is unchanged.

Test plan

  • 13 unit-test cases covering both ID forms + 7 negative cases (paths, URLs, malformed UUIDs, uppercase, etc.)
  • go test ./... green
  • go build ./... clean
  • Real-backend smoke: passed a UUID from a prior run as --from. Output:
    ```
    using doc_id: 3c498964-2c54-4ac0-97e8-1125d3bed640
    initialising task...
    task_id=2009347138430005
    session_id=cb9f43d1-b592-45df-979e-f78f1091df0f
    ```
    Real task created (had to use `--async` to detach since the doc is real); proves end-to-end recognition + task init.

Out of scope

  • The CLI's printed format doc_id: <uuid> — polling for completion... could become doc_id=<uuid> for cleaner awk/grep-style reuse, but that's a separate UX polish.
  • Other places in the CLI that might expect the doc_ prefix on user-facing IDs (audit not done — none surfaced from grep, but a follow-up to enumerate would be cheap).

Stacking

Branches off refactor/test-infra-polish (PR #7). Trivial CHANGELOG-only conflict if #7 lands first; rebase is mechanical.

voidkey added 2 commits May 14, 2026 22:53
Three pieces of integration-test infra hygiene that /simplify
reviewers flagged across the 0.4.x / 0.5.x / 0.6.0 PRs but kept
getting deferred. Bundled into a focused patch release.

1. Shared binary build via sync.Once + TestMain (tests/integration/
   cli_smoke_test.go). 15+ callers of build(t) now share a single
   compile per `go test` run instead of each rebuilding.

2. runVideoCmd signature changed from (stdout, combined, exitCode)
   to (stdout, stderr, exitCode). Callers that want the combined
   string compute `stdout + stderr` explicitly. The 3 existing
   callers in video_flow_test.go and the 4 hand-rollers
   (create_credits, create_engine, create_mode, kb_prune) all
   migrated to use this single helper. Removes ~80 lines of
   duplicated exec.Command / env / ExitError boilerplate.

3. .gitignore covers *.pdf and *.docx so local smoke-test files
   (real-backend manual testing) don't sit as untracked
   commit-bait. test.pdf was already ignored; broader catch-all
   subsumes it.

No behavior change for end users. Internal test refactor.
The docIDRe only matched a hypothetical `doc_<8+ alnum>` form, but
vectoria actually returns UUIDs (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,
lowercase hex) — which is what `vk create` prints back to the user on
every run as `doc_id: <uuid>`. Copying that line into `--from` for a
follow-up invocation got treated as a local file path and failed with
`stat: no such file or directory`.

Real-backend smoke verified: passing a prior run's UUID now resolves
to `using doc_id: <uuid>`, skips upload, and creates the figlens task.

Tests cover legacy `doc_<alnum>` (backward compat), the real UUID
form, file paths, URLs, and malformed UUIDs.
@voidkey voidkey merged commit 4a5078a into main May 15, 2026
3 checks passed
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.

1 participant