fix(create): accept vectoria UUID as doc_id (0.6.2)#8
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 hypotheticaldoc_<8+ alnum>form that vectoria has never actually used.The fix
Extend
docIDReto accept both forms:^doc_[a-zA-Z0-9]{8,}$(kept for backward compat)^[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
go test ./...greengo build ./...clean--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
doc_id: <uuid> — polling for completion...could becomedoc_id=<uuid>for cleanerawk/grep-style reuse, but that's a separate UX polish.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.