Repository navigation
Scenario workflow: 11-12. scenario osw writer - #20
Merged
JieXiong9119 merged 4 commits intoNov 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
7 open issues
These helpers look intentionally internal (tests call them viasend, and their names/behavior are… · New These helpers look intentionally internal (tests call them viasend, and their names/behavior are… · New These helpers look intentionally internal (tests call them viasend, and their names/behavior are… · Newworkflow_phases.index(...)is O(n) and is executed for every step during the sort, making the… · New These helpers look intentionally internal (tests call them viasend, and their names/behavior are… · New These helpers look intentionally internal (tests call them viasend, and their names/behavior are… · Newresolved_measure_directoriesis called twice here, which repeats manifest parsing/iteration work… · New
What changed in this PR
Adds support for generating scenario OSWs from BuildingSync package scenarios, including data-driven workflow-phase ordering and a mechanism to keep scenario-only measures out of baseline workflows.
Changes:
- Add
workflow_phasesto the scenario measure map and validate/propagateworkflow_phaseper mapped step. - Add
BOSS::Boss.write_baseline_and_scenario_oswsto write baseline + per-scenario OSWs, including safe scenario ID handling and step assembly. - Extend external measure repo management with
scenario_onlyrepos and optional inclusion.
| File | Description |
|---|---|
| spec/tests/unit/scenario_measure_mapper_spec.rb | Updates expectations for mapped steps to include workflow_phase and adds mapper phase validation tests. |
| spec/tests/unit/scenario_measure_map_spec.rb | Verifies shipped map declares workflow phases and every step is tagged. |
| spec/tests/unit/external_measure_repo_manager_spec.rb | Adds coverage for scenario_only filtering and validation. |
| spec/tests/unit/boss_spec.rb | Adds unit tests for scenario OSW writing, step ordering, and scenario ID warnings; updates stubs for new repo behavior. |
| spec/tests/integration/scenario_osw_generation_spec.rb | Adds a smoke-style integration spec ensuring mapped measures resolve on real measure_paths. |
| lib/BOSS/scenario_measure_mapper.rb | Introduces workflow phase loading/validation and exposes workflow_phases. |
| lib/BOSS/scenario_measure_map.json | Declares top-level workflow_phases and tags each step with workflow_phase. |
| lib/BOSS/external_measure_repo_manager.rb | Adds include_scenario_only: option and validates scenario_only manifest entries. |
| lib/BOSS/boss.rb | Implements scenario OSW writing, safe output ID checks, phase ordering, and measure existence validation. |
| docs/scenario_workflow_translation_plan.md | Updates plan/status and documents the new writer/ordering behavior and repo config. |
| config/external_measure_repos.yml | Documents and adds a pinned scenario_only repo for scenario mappings. |
Review effort: Lite
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Existing generation tests would not catch removal of sorting, so a writer-level test must verify serialized OSW phase order and within-phase reference order for a multi-measure package.
8 open issues
These helpers look intentionally internal (tests call them viasend, and their names/behavior are… These helpers look intentionally internal (tests call them viasend, and their names/behavior are…workflow_phases.index(...)is O(n) and is executed for every step during the sort, making the… These helpers look intentionally internal (tests call them viasend, and their names/behavior are… These helpers look intentionally internal (tests call them viasend, and their names/behavior are… These helpers look intentionally internal (tests call them viasend, and their names/behavior are… Add writer-level test for multi-measure phase and reference ordering · Newresolved_measure_directoriesis called twice here, which repeats manifest parsing/iteration work…
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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.


Why do we need this PR
BOSS only writes
baseline/in.osw. This PR also writes one OSW per BuildingSyncPackageOfMeasuresscenario, which is the core of the scenario workflow roadmap. It combines roadmap PR 11 (writer API) and PR 12 (step assembly), because the writer can't be tested meaningfully without step assembly.Core change explanation
Boss.write_baseline_and_scenario_osws(xml, out, epw, std)writesbaseline/in.oswplusscenarios/<scenario_id>/in.oswfor each package scenario that has at least one mapped measure.:writtenor:skipped, with the OSW path, skipped measure IDs and warnings) and the parser warnings.write_baseline_osw,run_baseline_oswand the CLI are unchanged.openstudio_resultsas complete step hashes, so baseline steps are never changed. This includes the baselineSetLightingLoadsByLPDstep, which is also the LED mapping target.scenario_measure_map.jsonnow declaresworkflow_phases(envelope → internal_loads → hvac_equipment → controls_operations), and every step has aworkflow_phase. Mapped steps are stable-sorted by phase, then by package reference order. The mapper validates the phases. Map files without phases still load.measure.rbon the scenariomeasure_paths, the writer raises before writing anything and tells you to runbundle exec rake measures:install_external.config/external_measure_repos.ymlcan set an optionalscenario_onlyflag.buildingsync-measures-gemis added, pinned todevelop@c40c2ed. It providesmodify_envelope_insulation.scenario_only, it goes on scenario OSWmeasure_pathsonly, never the baseline.Which files are affected
lib/BOSS/boss.rblib/BOSS/scenario_measure_mapper.rblib/BOSS/scenario_measure_map.jsonlib/BOSS/external_measure_repo_manager.rbconfig/external_measure_repos.ymlspec/tests/unit/boss_spec.rb,scenario_measure_mapper_spec.rb,scenario_measure_map_spec.rb,external_measure_repo_manager_spec.rbspec/tests/integration/scenario_osw_generation_spec.rb(new; generates OSWs only and does not simulate)docs/scenario_workflow_translation_plan.md(PR 10 marked Done; PR 11/12 In Progress; handoff notes added)What kind of tests are done
bundle exec rspec spec/tests/unit spec/tests/integration/scenario_osw_generation_spec.rb: 128 examples, 0 failures (afterbundle exec rake measures:install_external).building_151.xmlwith the real installed repos: 12 scenario OSWs written; Scenario4, 5, 6 and 18 skipped (unmapped HVAC and daylighting measures).bundle exec rubocopon changed files: no new offenses beyond specMetrics/BlockLengthand the existingclass << selfindentation inboss.rb.Out of scope
Note for reviewers
CI already runs
rake measures:install_externalbeforerspec, so it will now also clonebuildingsync-measures-gem. The new integration spec depends on that install.