Skip to content

fix(assets): skip validation for existing assets in ensure_assets#658

Merged
afadil merged 2 commits intoafadil:mainfrom
kwaich:fix/ensure-assets-skip-existing-validation
Mar 3, 2026
Merged

fix(assets): skip validation for existing assets in ensure_assets#658
afadil merged 2 commits intoafadil:mainfrom
kwaich:fix/ensure-assets-skip-existing-validation

Conversation

@kwaich
Copy link
Contributor

@kwaich kwaich commented Mar 3, 2026

Description

ensure_assets passes all specs to create_batch, including ones for assets that already exist in the DB. create_batch validates every NewAsset before doing INSERT OR IGNORE, so a UUID-only AssetSpec (e.g. symbol: { id: <uuid> } with no symbol string) fails the MARKET-pricing validation with Invalid input: Investments with MARKET pricing require an instrument_symbol — even though the asset exists and would be skipped by the INSERT OR IGNORE.

Fix: filter out specs whose IDs are already in existing_ids before building NewAsset values, so validation only runs for assets actually being created.

Checklist

By submitting this PR, I agree to the
CLA.

kwaich added 2 commits March 4, 2026 01:10
create_batch validates every NewAsset before INSERT OR IGNORE, including
specs for assets that already exist in the DB. A UUID-only AssetSpec has
instrument_symbol: None, which fails the MARKET-pricing validation even
though the asset would be skipped by the INSERT OR IGNORE.

Filter out specs whose IDs are already in existing_ids before building
NewAsset values, so validation only runs for assets actually being created.
@afadil afadil merged commit f94c399 into afadil:main Mar 3, 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.

2 participants