Fix remaining v0->v1 conversion gaps (third body, gas phase, surface prefix) - #310
Merged
Conversation
Two more v0-parser gaps that broke round-tripping a v0 config to v1: - A CHEM_SPEC with `tracer type: THIRD_BODY` recorded only the tracer-type string, which the unified type does not carry into v1 serialization (v1 represents a third body via `is third body`). Set is_third_body so the designation survives conversion; without it species like M silently lose their third-body role. - v0 reactions left `gas_phase` empty. The v1 parser requires every reaction to name a (non-empty) gas phase, so a converted mechanism failed to re-parse with "Unknown phase ''". Place all v0 reactions in the gas phase, mirroring how all v0 species are placed there. Extends the v0 species and arrhenius tests to cover both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v0 surface parser stored the reaction name as "SURF." + MUSICA name, but it is the only v0 reaction parser that prefixes the name — photolysis, emission, first-order-loss and user-defined all store the bare MUSICA name and rely on the downstream MICM conversion to add the label prefix. Since that conversion also prepends "SURF.", surface labels became "SURF.SURF.<name>", which breaks consumers that build per-reaction columns from the name (e.g. music_box's "SURF.<name>.<property>.<unit>" parsing). Store the bare MUSICA name so the single downstream prefix yields the correct "SURF.<name>" label. Updates the v0 surface test expectations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
boulderdaze
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #309. That PR fixed the diffusion coefficient, but three more v0-parser issues block converting a real v0 (CAMP) config to a loadable v1 mechanism. (#309 was squash-merged with only its first commit, so the third-body and gas-phase fixes below — briefly part of that PR — are not actually in
main; they are re-included here.)Fixes
THIRD_BODY tracer dropped. A
CHEM_SPECwithtracer type: THIRD_BODYrecorded only the tracer-type string, which the unified type does not carry into v1 serialization (v1 usesis third body). Setis_third_bodyso the designation survives conversion — otherwise species likeMsilently lose their third-body role.Empty reaction gas phase. v0 reactions left
gas_phaseempty, but the v1 parser requires every reaction to name a non-empty gas phase, so a converted mechanism failed to re-parse withUnknown phase ''. Place all v0 reactions in thegasphase, mirroring how all v0 species are placed there.Doubled
SURF.prefix. The v0 surface parser stored the name as"SURF." + MUSICA name— the only v0 reaction parser that prefixes the name (photolysis, emission, loss, user-defined all store the bare name and let the MICM conversion add the label prefix). Since that conversion also prependsSURF., surface labels becameSURF.SURF.<name>, breaking consumers that build per-reaction columns from the name (e.g. music_box'sSURF.<name>.<property>.<unit>). Store the bare name so the single downstream prefix yieldsSURF.<name>.Tests
Extends the v0 species, arrhenius, and surface unit tests. All 12 v0 tests pass.
Together with NCAR/musica#983 (stamp v1 version on
--convert), this letsmusica-cli --convertproduce a v1 mechanism that loads directly.🤖 Generated with Claude Code