Skip to content

DriveSomethingGreater: guard against empty vin or value#30516

Merged
andig merged 1 commit into
masterfrom
fix/dsg
Jun 4, 2026
Merged

DriveSomethingGreater: guard against empty vin or value#30516
andig merged 1 commit into
masterfrom
fix/dsg

Conversation

@andig
Copy link
Copy Markdown
Member

@andig andig commented Jun 4, 2026

No description provided.

@andig andig added the vehicles Specific vehicle support label Jun 4, 2026
@andig andig changed the title DriveSomethingGreater: guard against empty vin is result set DriveSomethingGreater: guard against empty vin or value Jun 4, 2026
@andig andig enabled auto-merge (squash) June 4, 2026 21:14
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • By removing the VIN from parseDataset and the subsequent VIN equality check in update, all datasets are now merged regardless of which vehicle they belong to; if the intent was only to ignore entries with an empty VIN, consider keeping the VIN return and guard while explicitly skipping only when dvin == "".
  • The new p.Value == "" filter in parseDataset changes behavior by dropping points that previously would have been included; if this is meant to address a specific case (e.g. bogus VIN entries), consider tightening the condition to that case or documenting why empty values should be ignored across all fields.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- By removing the VIN from `parseDataset` and the subsequent VIN equality check in `update`, all datasets are now merged regardless of which vehicle they belong to; if the intent was only to ignore entries with an empty VIN, consider keeping the VIN return and guard while explicitly skipping only when `dvin == ""`.
- The new `p.Value == ""` filter in `parseDataset` changes behavior by dropping points that previously would have been included; if this is meant to address a specific case (e.g. bogus VIN entries), consider tightening the condition to that case or documenting why empty values should be ignored across all fields.

## Individual Comments

### Comment 1
<location path="vehicle/vw/eudataact/store.go" line_range="118-121" />
<code_context>
 		}

-		dvin, data, err := parseDataset(b)
+		data, err := parseDataset(b)
 		if err != nil {
 			return newest, err
</code_context>
<issue_to_address>
**issue (bug_risk):** Removing VIN filtering may merge data from multiple vehicles into the same store entry.

Previously, `parseDataset` yielded a VIN and `update` skipped datasets whose VIN didn’t match the requested `vin`. Without that check, every dataset from `contentDatasets` is now merged into `v.data`, even if it belongs to another vehicle. If `contentDatasets` can surface multiple or incorrect VINs, this will mix data across vehicles. If the contract now guarantees a single VIN, please enforce it at the boundary (e.g., validate `ds.VIN` in `parseDataset` and fail on mismatch) rather than relying on this implicit behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +118 to 121
data, err := parseDataset(b)
if err != nil {
return newest, err
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Removing VIN filtering may merge data from multiple vehicles into the same store entry.

Previously, parseDataset yielded a VIN and update skipped datasets whose VIN didn’t match the requested vin. Without that check, every dataset from contentDatasets is now merged into v.data, even if it belongs to another vehicle. If contentDatasets can surface multiple or incorrect VINs, this will mix data across vehicles. If the contract now guarantees a single VIN, please enforce it at the boundary (e.g., validate ds.VIN in parseDataset and fail on mismatch) rather than relying on this implicit behavior.

@andig andig merged commit 380416e into master Jun 4, 2026
20 checks passed
@andig andig deleted the fix/dsg branch June 4, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vehicles Specific vehicle support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant