fix(unified): strict item contract, probe fallback, implied kinds, typed SDK 2.1.6 calls (PRO-2196) - #39
Conversation
…ps (PRO-2196) Found by running #38 against staging with the unified switch on. - Follow the strict unified item contract (hydradb-application#1653): a conversation turn is exactly {role, content}, and a turn carrying `name` is refused locally; the speaker is the item's `user_name`, now set with --user-name on text and conversations alike; forceful relations are sent as {context_ids}. The 202's context id is read from `results[].id`. - A failed layout probe no longer fails every command. The probe gets 5s and no retries; on a network error, timeout, 429 or 5xx the command warns on stderr and goes out in the split shape, as before layouts existed, and is redone in the unified shape if the database refuses it as unified (CORPUS_TYPE_UNSUPPORTED, or the unified body the SDK cannot parse). Auth and permission failures are still reported as they are. - The deprecated read/delete aliases (recall full/preferences, memories list/delete, knowledge delete) picked their kind themselves, so on a unified database they now act on the one corpus instead of telling the user to drop a --kind they never typed. - The server's per-item caps are checked before sending: 1 MiB of text, a 1024-byte title, 4000 characters of instructions, a context id of at most 100 characters with no commas. - `database create` without --type leaves the layout to the server (unified on current servers); the help text and the success message now say so. - `list` drops the per-item type column on a unified database. Signed-off-by: Harsh Ranjan <harsh.ranjan@hydradb.com>
… create (PRO-2196) hydradb-sdk 2.1.6 knows the unified contract: /query without `type`, the four-key SearchQueryResult answer, follow_forceful_relations, and `type` on database create. The unified query and `database create --type` now go through it instead of the hand-built raw path, and the pin moves to >=2.1.6. The unified answer is dumped with exclude_unset, so `--output json` stays the server's body verbatim (checked live against staging). The unified ingest stays a JSON body on the raw path: the shared `ingest-unified-json` conformance vector requires one, and the SDK sends `context` only as a multipart form field. With 2.1.6 a type-less query that reaches a unified database while the layout probe is down now parses on the first request, so no redo is needed. Signed-off-by: Harsh Ranjan <harsh.ranjan@hydradb.com>
|
✅ OpenHack SummarySecurity review of fix(unified): strict item contract, probe fallback, implied kinds, typed SDK 2.1.6 calls (PRO-2196). 10 changed files; 0 findings at or above the low reporting threshold. Confidence Score: 5/5No reportable security findings were detected in this scan. Security merge-readiness rubric: 1 = critical, 2 = high, 3 = medium, 4 = low, 5 = no reportable findings. This score reflects scan findings, not a guarantee of correctness or complete coverage. Files Needing Attention: None Important Files Changed
Last reviewed commit: 8d0694a · View review on OpenHack
|
…ver sent it (PRO-2196) hydradb-sdk 2.1.6's four-key SearchQueryResult requires every list key, but the contract lets `forceful_relations` be absent. Such an answer raised a ParsingError and the CLI printed an error for a successful query; the hand-built path it replaced accepted it. The parsed body travels on the ParsingError, so a 2xx answer is now returned as sent (one request, the request id kept) and anything else is still translated to the usual error. Found by the staging pass: a proxied /query with forceful_relations dropped. Signed-off-by: Harsh Ranjan <harsh.ranjan@hydradb.com>
Stacked on #38 (
soham/pro-1618-unified-contract). Found by running #38 against staging with the unified switch on, next to the released 0.2.1.1. Follow the strict unified item contract (hydradb-application#1653)
The server decodes unified items strictly, so three things #38 sent were refused (400):
name. A turn is now exactly{role, content}, and a turn withnameis refused locally, naming the turn. The speaker is the item'suser_name, set with--user-nameon text and conversations alike. feat(unified): follow the PRO-1618 unified API contract on unified databases #38 refused--user-nameon unified.{ids}. They are now{context_ids}.results[].id, which staging sends.source_idis still read from older servers.2. A failed layout probe no longer fails every command
In #38, when
GET /databasesfailed, every command failed with it, including on split databases where 0.2.1 works.CORPUS_TYPE_UNSUPPORTED, matched by code or message), the command is redone in the unified shape. This covers ingest, delete, list and query.--context-id,--llm, and so on) with an unknown layout:--llmand the forceful-relations switch go out unified, and ingest's unified-only flags ask to retry.3. Deprecated aliases that picked their own kind
recall full,recall preferences,memories list,memories deleteandknowledge deletehard-code a kind. On a unified database #38 refused them with "Re-run without --kind", but the user never typed one. They now act on the one corpus. The write aliases (memories add,knowledge upload*) still refuse, pointing athydradb ingest. An explicit--kindon a unified database is still refused.4. Smaller
database createwithout--typeleaves the layout to the server, and current servers make it unified. The help text saidsplitwas the default. The help and the success message now say what happens.listdrops the per-item Type column on a unified database, where it saidmemoryfor every item.5. Typed SDK calls (hydradb-sdk 2.1.6)
hydradb-sdk 2.1.6 knows the unified contract. The unified query and
database create --typeare now typed SDK calls instead of the hand-built raw path, and the pin moves to>=2.1.6. The unified answer is dumped withexclude_unset, so--output jsonis still the server's body verbatim.The unified ingest stays a JSON body on the raw path. The shared
ingest-unified-jsonconformance vector requires a JSON body, and the SDK sendscontextonly as a multipart form field.Testing
pytest: 448 pass, and ruff passes.--kindon unified).nameturns,{ids}, refused--user-nameand aliases) are updated.--user-name, a text item with--user-name, and an item with--forceful-relation: all 400 on feat(unified): follow the PRO-1618 unified API contract on unified databases #38, all 202 here.recall full,recall preferencesandmemories liston unified: refused on feat(unified): follow the PRO-1618 unified API contract on unified databases #38, results here.GET /databasesanswering 503:GET /databaseshanging: 41 s on feat(unified): follow the PRO-1618 unified API contract on unified databases #38, 6 s here.--output jsonon unified equals the server's body.database create --type split|unifiedsendstypethrough the SDK.--kind knowledge), list and ingest requests are byte-identical to 0.2.1.Not in this PR
[]on/query, even on a direct call. This is a server issue.