HarperFast / HarperFast/harper

Bun: csv_data_load job stalls permanently on new-attribute upsert as non-super-user

Open
#1,265 0 comments 0 reactions 0 assignees View on GitHub
area:ci tests
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

## Summary

Under the Bun runtime, `csv_data_load` and `csv_file_load` jobs intermittently transition to `IN_PROGRESS` but never reach a terminal status. The stall appears to be a general Bun csv-job issue, not limited to a specific role or operation type.

## Evidence

**Instance 1 — `csv_data_load` as non-SU (new attribute):**
- Run: [27394284006 / job 80958519370](https://github.com/HarperFast/harper/actions/runs/27394284006/job/80958519370), shard 5/6 Bun
- Job ID: `bef99a07-87ba-4d01-9bdc-af1d25a37019`, user: `bulk_load_user` (non-SU restricted role)
- Payload: CSV upsert introducing a new attribute (`new_attr`)
- Ran full 300-second ceiling; row never written (`row_count: 29`)

**Instance 2 — `csv_file_load` as admin (super-user):**
- Run: [27414686473 / job 81024621348](https://github.com/HarperFast/harper/actions/runs/27414686473/job/81024621348), shard 3/6 Bun
- Job ID: `e784fc9e-2bd6-4fdd-aa22-ff00486d7f12`, user: `admin` (super-user)
- Type: `csv_file_load without database param`
- Ran 30-second polling ceiling; job still `IN_PROGRESS`

Both instances: job is created, transitions to `IN_PROGRESS`, but never completes. Equivalent operations complete in 1–3s under Node.js. The stall is **not limited to non-super-user roles or new-attribute introductions** — instance 2 is admin + file load.

## Hypothesis

The Bun runtime has a difference in async scheduling or I/O behavior in the csv job worker path that causes the job to hang. The specific trigger may be in the file-read or table-write pipeline when executed under Bun's event loop. Worth inspecting whether there is any `await` / callback / stream handling in the csv job worker that behaves differently under Bun vs Node.js.

## Current workaround

The `csv_data_load` new-attribute upsert tests are skipped on Bun via the `bunSkip` pattern in [#1262](https://github.com/HarperFast/harper/pull/1262) with a `TODO(harper#1265)` pointing here. The `csv_file_load` test failure (instance 2) is still being assessed (flake vs. systematic).

## Reproduction hint

Run the integration test suite under Bun. Any test that initiates a `csv_data_load` or `csv_file_load` job and polls for completion may trigger this stall. Monitor `get_job` for the resulting job entry — it should stall `IN_PROGRESS`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.