Skip to content

ViperAsset: soften 'no model' ValueError to empty-string fallback #199

Description

@t-a-y-l-o-r

Summary

ViperAsset.__init__ at blueflow/models/viper.py:127 raises ValueError(\"How did we end up with an asset that has no model???\") when asset.model is empty. This biases the Viper payload builder to reject any Asset that hasn't had a model populated yet — which is most assets in test fixtures and many in real ingest where the product/model field comes from later enrichment.

Impact

38 test failures in the current suite trace to this single raise (largest bucket by far).

Repro

asset = Asset.objects.create(mac_address=\"AA:BB:CC:DD:EE:FF\")  # no model set
ViperAsset(asset)  # raises ValueError

Proposed fix

Replace the raise with the empty-string fallback that the cpe property already handles gracefully (CPE will use * for an unknown product slot):

# Before
if not asset.model:
    raise ValueError(\"How did we end up with an asset that has no model???\")
raw = str(asset.model)

# After
raw = str(asset.model) if asset.model else \"\"

The downstream cpe property at viper.py:182-183 already maps empty self.product to the CPE * wildcard, so the behavior is consistent.

Notes

Same pattern as the OUI fallback fix that landed earlier today (empty string instead of None/raise as the absent-data sentinel). Internal regression-prevention only — no Viper wire-format change.

Metadata

Metadata

Assignees

Labels

needs-reviewMilestone owner needs to confirm scope/fit before work proceedstestingviper

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions