mengw15 opened a new issue, #8721:
URL: https://github.com/apache/texera/issues/8721

   ## What happened?
   
   `bin/single-node.sh up --with-examples` (equivalently `docker compose 
--profile examples up`)
   is documented to pre-create two example datasets and two example workflows. 
The workflows are
   created correctly, but **both datasets end up with no files and no version** 
— every file upload
   fails with `400 Dataset not found`.
   
   `bin/single-node/examples/load-examples.sh:30` derives
   
   ```bash
   OWNER_EMAIL="[email protected]"      # -> [email protected]
   ```
   
   and then uses that one variable for two different purposes:
   
   1. the `email` field of the `/auth/register` call (line 95), which since 
#6402 must match
      `^[^\s@]+@[^\s@]+\.[^\s@]+$`;
   2. the `ownerEmail` query parameter of file-service's 
`dataset/multipart-upload` calls
      (lines 167, 178, 188, 196), which must be the **actual** email of the 
dataset's owner.
   
   In a single-node deployment the loader never reaches the register branch: 
`.env` seeds
   `USER_SYS_ADMIN_USERNAME=texera`, and `AuthResource.createAdminUser` stores 
that username as the
   email (`AuthResource.scala:149`, `user.setEmail(adminUsername)`). So the 
admin's email is `texera`,
   login succeeds, register is skipped, and `[email protected]` 
matches no user.
   
   `dataset/create` is unaffected because it authorizes via the bearer token — 
which is why the
   dataset rows do get created and only the uploads fail.
   
   Isolating that one parameter confirms the cause. Same token, same dataset, 
only `ownerEmail` differs:
   
   ```
   [email protected]  ->  {"code":400,"message":"Dataset not found"}
   ownerEmail=texera              ->  
{"missingParts":[1],"completedPartsCount":0}
   ```
   
   ### Second defect: the failure is invisible
   
   The script runs under `set -euo pipefail`, but `print_error` (line 49) only 
echoes, and the upload
   failures are swallowed by `continue` (lines 173, 191). `main` then prints
   `=== Example data loading complete ===` and the container exits **0**. 
Neither the user nor CI gets
   any signal, which is why this has gone unnoticed.
   
   ### Expected
   
   Both example datasets contain their CSV and a `v1` version so the example 
workflows run; and if the
   loader cannot load the example data, it exits non-zero.
   
   ### User-visible effect
   
   The two example workflows are created and open fine, but their CSV scan 
operators point at
   `/dataset/texera/iris-species/v1/Iris.csv` and
   `/dataset/texera/popular-movies-of-imdb/v1/TMDb_updated.csv`, which do not 
exist — so a new user's
   first Run fails. The agent example in `bin/single-node/README.md` ("Enable 
the Texera Agent")
   references the same missing path.
   
   ### Regression
   
   Introduced on 2026-07-29 by bf25dd2d47 (#6402). That PR made the register 
email required and
   format-validated, so the loader's old value (`texera`) would no longer pass; 
the line was changed
   and the comment documenting the coupling was removed:
   
   ```diff
   -# In Texera, registration sets email = username
   -OWNER_EMAIL="$USERNAME"
   +OWNER_EMAIL="[email protected]"
   ```
   
   `load-examples.sh` has only three commits in total and none after that one, 
so this has been broken
   continuously for 60 days.
   
   ### Affected branches
   
   `main` and `release/v1.3` carry `"[email protected]"`. `release/v1.2` 
and `release/v1.1` still
   have `"$USERNAME"` and are unaffected.
   
   `create-release-candidate.yml` copies `bin/single-node/examples/` into the 
RC bundle (lines
   216-217), so a release candidate cut from `release/v1.3` ships this loader.
   
   ### Why CI does not catch it
   
   `bin/single-node/tests/test_single_node_sh.sh` only checks flag parsing — 
its `--with-examples` case
   asserts the flag is accepted, nothing more. The `build.yml` boot smoke test 
starts services natively
   and asserts they reach LISTEN; it never brings up the compose stack or the 
`examples` profile.
   
   ### Possible fix
   
   Split the two roles: keep an `@example.com` address for the register call, 
and resolve the owner
   email used for lookups from the authenticated user instead of deriving it 
from the username. Also
   make the loader exit non-zero when any dataset or workflow fails to load.
   
   ## How to reproduce?
   
   ```bash
   git checkout e0f49897db          # current main
   cd bin/single-node
   docker compose --profile examples down --volumes   # start from empty volumes
   docker compose --profile examples up
   ```
   
   The `example-data-loader` output shows the failures (see the log below). Its 
exit code is still 0:
   
   ```bash
   docker inspect texera-single-node-example-data-loader-1 --format 
'{{.State.ExitCode}}'
   # -> 0
   ```
   
   Two datasets exist, with zero versions:
   
   ```bash
   docker exec texera-postgres psql -U texera -d texera_db -tAc \
     "select (select count(*) from texera_db.dataset), (select count(*) from 
texera_db.dataset_version)"
   # -> 2 | 0
   ```
   
   In the GUI at http://localhost:8080 (logging in with the seeded admin) both 
example datasets appear
   but are empty, and running `[Example] Machine Learning on Iris Dataset` 
fails at the CSV scan.
   
   Reproduced on a completely fresh set of volumes, so this is not leftover 
state.
   
   ## Version/Branch
   
   1.4.0-incubating-SNAPSHOT (main) — also affects release/v1.3
   
   ## Commit Hash
   
   e0f49897db (reproduced on); introduced by bf25dd2d47
   
   ## Relevant log output
   
   ```
   [INFO] Logging in as texera...
   [INFO] Login successful
   [INFO] Processing dataset: iris-species
   [INFO] Created dataset 'iris-species' with ID 1
   [INFO] Uploading file: Iris.csv
   [ERROR] Failed to init upload for Iris.csv: {"code":400,"message":"Dataset 
not found"}
   [INFO] Creating version for iris-species
   [ERROR] Failed to create version for iris-species
   [INFO] Processing dataset: popular-movies-of-imdb
   [INFO] Created dataset 'popular-movies-of-imdb' with ID 2
   [INFO] Uploading file: TMDb_updated.csv
   [ERROR] Failed to init upload for TMDb_updated.csv: 
{"code":400,"message":"Dataset not found"}
   [INFO] Creating version for popular-movies-of-imdb
   [ERROR] Failed to create version for popular-movies-of-imdb
   [INFO] All datasets processed
   [INFO] Processing workflow: [Example] Data Exploration on Movies Dataset
   [INFO] Workflow '[Example] Data Exploration on Movies Dataset' created with 
ID 1
   [INFO] Processing workflow: [Example] Machine Learning on Iris Dataset
   [INFO] Workflow '[Example] Machine Learning on Iris Dataset' created with ID 
2
   [INFO] All workflows processed
   [INFO] === Example data loading complete ===
   ```
   
   ---
   
   *Investigated and drafted with assistance from Claude (Claude Code); every 
claim above was verified
   by running the single-node deployment locally on a fresh set of volumes.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to