Skip to content

dpd: parse xcvr_defaults.rs without snake_case - #422

Open
taspelund wants to merge 1 commit into
mainfrom
trey/xcvr-csv
Open

taspelund wants to merge 1 commit into
mainfrom
trey/xcvr-csv

Conversation

@taspelund

Copy link
Copy Markdown
Contributor

Use the older version of the PortFec type when parsing xcvr_defaults.csv then convert to the newer type. This allows us to parse old versions of the file without needing any producers of the file to update them.

Use the older version of the PortFec type when parsing xcvr_defaults.csv
then convert to the newer type. This allows us to parse old versions of
the file without needing any producers of the file to update them.

Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
@taspelund taspelund self-assigned this Nov 10, 2026
@taspelund taspelund added the rust Pull requests that update rust code label Nov 10, 2026

@bnaecker bnaecker left a comment

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.

Are we ever expected to have a situation in which dpd is parsing a file that was built from a different commit?

@taspelund

taspelund commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Are we ever expected to have a situation in which dpd is parsing a file that was built from a different commit?

I'm not familiar enough with all the different dendrite deployments (e.g. in mfg) to answer that. This seemed like the conservative approach that would allow other suppliers of the CSV file (if they exist) to keep working.

I'm happy to modify the CSV to use the new format, but I didn't want to cause breakages later for components I wasn't aware of.

@bnaecker

Copy link
Copy Markdown
Contributor

This seemed like the conservative approach that would allow other suppliers of the CSV file (if they exist) to keep working.

I feel like that's more risky than conservative. As an example, if we happened to publish an Omicron release with main, we'd be hosed when trying to load this file! Do we actually know when this was introduced and whether we have this in the wild anywhere?

IMO, we should not do this, and instead enforce that the file and parsing code are always in-sync. Another option, possibly safer, is to make the defaults a static somewhere in the code. That avoids any parsing issues, at the cost of losing the flexibility to drop in a new file as an escape hatch. We've never needed that, while we do have an example of a code / file mismatch. So I'm not sure it's worth keeping that flexibility.

@taspelund

taspelund commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

This seemed like the conservative approach that would allow other suppliers of the CSV file (if they exist) to keep working.

I feel like that's more risky than conservative. As an example, if we happened to publish an Omicron release with main, we'd be hosed when trying to load this file! Do we actually know when this was introduced and whether we have this in the wild anywhere?

IMO, we should not do this, and instead enforce that the file and parsing code are always in-sync. Another option, possibly safer, is to make the defaults a static somewhere in the code. That avoids any parsing issues, at the cost of losing the flexibility to drop in a new file as an escape hatch. We've never needed that, while we do have an example of a code / file mismatch. So I'm not sure it's worth keeping that flexibility.

I'm fine with that approach, and would be happy to update the branch accordingly.

I believe this was introduced quite recently in #418. I'm not sure yet whether this is in the wild. I asked in the mfg matrix channel but haven't heard back yet

@rcgoodfellow

Copy link
Copy Markdown
Collaborator

I've modified this on a few occasions. I think every time it was when a transceiver MPN or MPN variant was missing from the list. But that's always been experimenting for a follow-on PR that fixes the file.

Making these constants seems like a nice simplification. And we can always override them from the CLI or through the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants