Skip to content

fix: from_env() names the variable in int parse errors - #18

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
sharadvc:fix/from-env-errors
Sep 16, 2026
Merged

royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
sharadvc:fix/from-env-errors

Conversation

@sharadvc

Copy link
Copy Markdown
Contributor

What

TENANTQ_HNSW_M=abc crashed startup with a raw ValueError from int() that did not say which variable was malformed.

Change

Added an _env_int(name, default) helper that converts for HNSW tuning, payload, and dense-dim vars, raising ValueError(f"{name} must be an integer, got ...") on a bad value.

Tests

Added a failing test first: for each of TENANTQ_HNSW_M, TENANTQ_HNSW_EF, TENANTQ_DENSE_DIM set to "abc", Settings.from_env() must raise with that variable named. Suite: 24 passed. ruff check clean.

Related

Closes #13

TENANTQ_HNSW_M=abc crashed startup with a bare ValueError from int()
that named nothing. Use a helper that reports which variable was
malformed.

Closes AgentPostmortem#13
@royalpinto007
royalpinto007 merged commit eff8190 into AgentPostmortem:main Sep 16, 2026
1 check 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.

Settings.from_env() crashes with a raw ValueError on malformed numeric env vars

2 participants