Skip to content

fix(ts-sdk): reject negative stream-bound literals - #1163

Merged
xav-db merged 1 commit into
HelixDB:mainfrom
DevChiniwala:fix/ts-sdk-negative-stream-bound-literal
Oct 5, 2026
Merged

xav-db merged 1 commit into
HelixDB:mainfrom
DevChiniwala:fix/ts-sdk-negative-stream-bound-literal

Conversation

@DevChiniwala

@DevChiniwala DevChiniwala commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem

StreamBound.literal() accepts negative values even though stream bounds map to Rust's non-negative usize. It can emit an invalid request AST, and sufficiently negative bigints can lose precision during conversion.

Reproduction

On current main, StreamBound.literal(-1) emits {literal:-1} and StreamBound.literal(-9007199254740993n) emits a rounded negative literal.

Root cause and fix

The TypeScript literal constructor checked safe-integer overflow but not sign. Reject negative numbers and bigints before conversion; leave expression coercion and valid bounds unchanged.

Regression coverage

Covers -1, -1n, a negative unsafe bigint, zero, the max-safe boundary, and upper overflow.

Validation

  • npm test — pass
  • npm run lint — pass
  • npm run build — pass
  • npm run check reaches the repository-wide Prettier check, which reports 27 files; the untouched upstream/main version of dsl.ts also fails that check.

Related history: #936 was closed without merging; #1097 changed the Go and Python SDKs. Current TypeScript main still reproduces the negative-literal behavior.

Retrigger

The PR appears safe to merge.

Summary

The TypeScript SDK now rejects negative stream-bound literals before converting bigints, with regression tests for negative values and integer boundaries.

Reviews (1) · Last reviewed commit: "fix(ts-sdk): reject negative stream-boun..."

Copilot AI balanced review requested due to automatic review settings October 3, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@xav-db
xav-db merged commit b587d56 into HelixDB:main Oct 5, 2026
21 checks passed
matthewsanetra added a commit that referenced this pull request Oct 5, 2026
Release PR for **CLI 3.4.3** and **Docker image v0.0.10**, following the
same shape as #1161.

```diff
 crates/cli/Cargo.toml           version 3.4.2 → 3.4.3 (and Cargo.lock)
 crates/cli/src/config.rs        DEFAULT_LOCAL_IMAGE_TAG v0.0.9 → v0.0.10
 CLI tests, README, CLAUDE.md    v0.0.9 → v0.0.10
 docs                            default image, release notes, storage v5 warning, llms-full.txt
 docker-image/README.md          published release v0.0.9 → v0.0.10
 CONTRIBUTORS.md                 CLI image v0.0.9 → v0.0.10
 sdks/tests/parity/COVERAGE.md   published-image parity example v0.0.5 → v0.0.10
```

Version-history references stay as written:
- "v0.0.9 and earlier refuse to open" in the docker-image README's index
storage version 5 section.
- "Upgrading S3 deployments from v0.0.8 and earlier".
- The "Docker images through v0.0.9" locator comments in `crates/db`.
- The v0.0.5 compatibility statements.

The TypeScript README's `package-smoke` commands stay on v0.0.5, because
they mirror CI's digest-pinned compatibility check in
`typescript-sdk.yml`.

The `COVERAGE.md` parity pin was bumped together with the CLI default in
v0.0.5 (`620fb543`) and missed afterwards. v0.0.5 can't serve the
`search_consistency` parity fixtures added in #1156.

## Order

1. Merge this. The `Docker image` workflow's publish job requires
`DEFAULT_LOCAL_IMAGE_TAG` on main to equal `release_version`, so the
image can only be published after this lands.
2. Dispatch the `Docker image` workflow from main with
`release_version=v0.0.10`. It reruns the full suite and publishes only
if it passes.
3. Once v0.0.10 is published, run `cli.yml` from main to tag and publish
v3.4.3.

## What's in v0.0.10 / 3.4.3

- ⚠️ **Index storage version 4 → 5** (#1156). The first writer open
rewrites only the version marker. After that, v0.0.9 and earlier refuse
the database with `unsupported_index_storage_version`.
  - Upgrade readers before the writer.
  - Back up first if a rollback may be needed.
- The local server guide now carries this warning next to the "set
`tag`" instructions.
- **Asynchronous vector and text index publication** (#1156).
- Writes commit the graph change plus a queued index operation, and a
background worker publishes it.
- `search_consistency: strong | eventual`. Strong is the default and
exact.
- `index_backpressure` (429, retryable) is returned in three cases: past
1 GB or 250K pending entities per index, when a whole-index strong
search is behind more than 800 changes, and when strong text analysis
would exceed one publication's budget.
- `index_operation_batch_too_large` (400) is returned when one write
stages more than 8 MiB for one index.
  - Text admission limits are now per document.
  - Builds no longer livelock under concurrent writes.
- **Failing entries are held back** (#1165).
- An entry whose index update fails deterministically no longer stalls
its whole generation. It is counted in `blocked_index_entity_count` and
retried about once a minute.
  - Insert searches never pick the inserting node as its own neighbour.
- **Fixes the v0.0.9 `missing simhash` known issue** (#1156 C1, #1165).
Re-embeds keep their HNSW reverse-link locators. Indexes damaged by
earlier versions still need a drop and recreate (HEL-952).
- **Range-driven counts apply every filter** (#1169). For example, 149 →
49.
- **CLI 3.4.3:** defaults to v0.0.10. There are no other CLI changes
since 3.4.2.
- **Not in this release:** the SDK changes in #1156, #1163 and #1164
ship with the next SDK releases. The release notes say to send
`search_consistency` over HTTP until then. #1166 is a docs dependency
bump.

## Testing

- `cargo check --workspace --locked` passes, so the hand-edited
`Cargo.lock` is consistent.
- `cargo test --locked -p helix-cli` passes: lib 241, `e2e_cli` 13,
`runtime_commands` 20, `typescript_runtime`, and the other targets. The
Docker-only `e2e_runtime` tests are ignored by design, because they need
the unpublished v0.0.10 image.
- rustfmt 1.9.0 (the pinned 1.97.1 toolchain) `--edition 2024 --check`
is clean on the edited Rust files.
- Docs: `check-docs`, `generate-llms --check`, `generate-llms-full
--check` and `check-openapi` pass.
- Grep: every `helixdb/helixdb:v0.0.x` reference outside release notes
is v0.0.10, except the CI-pinned v0.0.5 TypeScript smoke.
- Workspace clippy is left to CI. The local nix nightly clippy rejects
the repo's clippy configuration before linting, independent of this
change.


<!-- greptile_comment -->

<!-- greptile_summary -->

<p><a
href="https://app.greptile.com/api/retrigger?id=74957602"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><br clear="all"></p>

<!-- greptile-risk -->

The PR appears safe to merge, though the published-image parity
instructions should include an image pull step.

<h3>Summary</h3>

This release PR updates the CLI default to Docker v0.0.10, bumps the CLI
to 3.4.3, and updates image references and release guidance. The
published-image parity instructions need a pull step before their new
image pin can work without a local copy.

<sub>Reviews (1) · Last reviewed commit: ["chore(release): CLI 3.4.3 and
Docker
ima..."](https://github.com/helixdb/helix-db/commit/281197c0c91e5f72a7ce89fb8a248e04176cdee4)</sub>

<!-- /greptile_comment -->

## Also: fix main's workspace tests

`counts_over_range_intersections_apply_every_filter` (#1169) overflows
the default 2 MiB test-thread stack in Linux debug builds. That fails
`Workspace tests`, `DB all targets` and `Workspace and tooling quality`
on main, and the Docker release's `quality` job runs the same tests.
`92c15755` runs it through the file's existing 16 MiB
`run_high_stack_contract`, like the other heavy contracts. It passes
locally even with `RUST_MIN_STACK=524288`.
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.

3 participants