Skip to content

Enable json serialization of ScalarizedOutcomeConstraint (#5025)#5025

Closed
metactc wants to merge 1 commit intofacebook:mainfrom
metactc:export-D96486632
Closed

Enable json serialization of ScalarizedOutcomeConstraint (#5025)#5025
metactc wants to merge 1 commit intofacebook:mainfrom
metactc:export-D96486632

Conversation

@metactc
Copy link
Copy Markdown
Contributor

@metactc metactc commented Mar 13, 2026

Summary:

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

Note: The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632

@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 13, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 13, 2026

@metactc has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96486632.

@meta-codesync meta-codesync Bot changed the title Enable json serialization of ScalarizedOutcomeConstraint Enable json serialization of ScalarizedOutcomeConstraint (#5025) Mar 19, 2026
metactc added a commit to metactc/Ax that referenced this pull request Mar 19, 2026
Summary:

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
metactc added a commit to metactc/Ax that referenced this pull request Mar 19, 2026
Summary:
Pull Request resolved: facebook#5025

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
metactc added a commit to metactc/Ax that referenced this pull request Mar 19, 2026
Summary:

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
metactc added a commit to metactc/Ax that referenced this pull request Mar 19, 2026
Summary:
Pull Request resolved: facebook#5025

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
@metactc metactc force-pushed the export-D96486632 branch 2 times, most recently from 884d91a to 034ea82 Compare March 20, 2026 17:58
metactc added a commit to metactc/Ax that referenced this pull request Mar 20, 2026
Summary:

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
metactc added a commit to metactc/Ax that referenced this pull request Mar 23, 2026
Summary:

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.30%. Comparing base (f426512) to head (ecfaebb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5025   +/-   ##
=======================================
  Coverage   96.30%   96.30%           
=======================================
  Files         611      611           
  Lines       67531    67534    +3     
=======================================
+ Hits        65037    65040    +3     
  Misses       2494     2494           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

metactc added a commit to metactc/Ax that referenced this pull request Mar 24, 2026
Summary:

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
Summary:
Pull Request resolved: facebook#5025

Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.

= Background

ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.

= Solution

This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.

= Motivation

This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.

**Note:** The SQA (database) store already handles this type; the JSON store was the only gap.

Reviewed By: bletham

Differential Revision: D96486632
@meta-codesync meta-codesync Bot closed this in 6e527d5 Mar 24, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 24, 2026

This pull request has been merged in 6e527d5.

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

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants