Skip to content

feat(lookup)!: return null for not-found, v0.2.1 (AGG-113)#5

Merged
anthrax63 merged 1 commit into
mainfrom
agent/full-stack-developer/bb842c36
Jul 2, 2026
Merged

feat(lookup)!: return null for not-found, v0.2.1 (AGG-113)#5
anthrax63 merged 1 commit into
mainfrom
agent/full-stack-developer/bb842c36

Conversation

@anthrax63

Copy link
Copy Markdown
Member

Summary

AGG-113 API contract fix — /single and /multi now return null for pairs
that don't exist on the PKB replica, and status codes are cleaned up so a
missing pair no longer risks a 408 timeout.

Before: /single returned [] on not-found, which was ambiguous with an
iin-only lookup that happens to have zero rows, and /multi had no way to
express «one item was not found» distinct from «one item's lookup failed».

After:

  • GET /single?iin=X&phone=Y — found → object, not found → null.
  • GET /single?iin=X (no phone) — found → array, not found → null.
  • POST /multi — per-item: object | array | null | error, same order as input.
  • OpenAPI responses.200.schema is oneOf: [object, array, null] for /single
    and array-of-that-plus-error for /multi.
  • 408 stays reserved for real slowness in vaultee-pipelines / DDM; a
    successful pipeline run that returns an empty payload is now a plain 200 null.

Bump: 0.2.00.2.1 — contract widen. Old callers that already
tolerated [] must now also handle null.

Not in this PR

The AGG-113 description also asks for a pipeline-side fast-path on 0-row
ClickHouse lookups. Skipped here because:

  • Pipeline is not currently runnable end-to-end: existing
    lookup_by_beeline*.yaml.tmpl uses publish_to_session { type: file }
    which DDM does not support (Publish file in session is not supported
    ddm/crates/task_executors/io_operation/src/publish_to_session.rs).
  • Per AGG-112 Stage 6, the DDM Beeline executor is not polling tasks
    at all right now, so no lookup pipeline actually runs — the 30s client
    timeouts observed in prod are «tasks stuck in PENDING», not «0-row
    hang in pull → decrypt → publish».
  • Landing a pipeline fast-path is worthwhile only after (a) the executor
    is back and (b) publish_to_session for lookup results is redesigned
    to fit DDM's supported shapes (JSON via extract, not file). Both are
    out of scope for this PR and belong in a follow-up saga.

Test plan

  • pytest -q — 50 passed
  • ruff check src tests — all checks passed
  • Follow-up: DevOps bump image tag to v0.2.1 in
    kartel-deploy/argo/overlays/vaultee/kz-scoring-api.yaml after CI
    publishes the image.
  • Follow-up: consumer of /single / /multi handles null (previously
    []) — coordinate with Beeline-API team before rollout.

🤖 Generated with Claude Code

Contract change (AGG-113):

- GET /single?iin=X&phone=Y  found → object,        not found → null
- GET /single?iin=X          found → array of rows, not found → null
- POST /multi                per-item: object | array | null | error
- OpenAPI: response schema is `oneOf: [object, array, null]`
- Not-found is a valid 200 response — the API no longer conflates
  "no data" with "empty result" and no longer risks a 408 on empty
  CH-lookups (that path was already returning [] but the shape was
  ambiguous with a legitimate iin-only lookup that happens to have
  zero rows).

408 remains reserved for real slowness in vaultee-pipelines /
DDM, not for "the pair does not exist on the replica".

Bump: 0.2.0 → 0.2.1 (contract widen — old callers that already
tolerated empty [] must now also handle null).

Not in scope of this PR:

- Pipeline fast-path on 0-row CH-lookup: separate saga. Existing
  lookup_by_beeline*.yaml.tmpl publish_to_session uses `type: file`
  which DDM does not support (io_operation/publish_to_session.rs
  errors "Publish file in session is not supported"), and per
  AGG-112 Stage 6 the DDM Beeline executor is not polling tasks at
  all, so no lookup pipeline actually runs today. Pipeline-side
  fast-path is worth landing only after the executor is back and
  the publish_to_session shape is redesigned.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
@anthrax63 anthrax63 merged commit 0fa05d0 into main Jul 2, 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