Skip to content

Add AnalysisCardBase support to json storage methods#5021

Open
mpolson64 wants to merge 1 commit intofacebook:mainfrom
mpolson64:export-D96490723
Open

Add AnalysisCardBase support to json storage methods#5021
mpolson64 wants to merge 1 commit intofacebook:mainfrom
mpolson64:export-D96490723

Conversation

@mpolson64
Copy link
Copy Markdown
Contributor

Summary:
The json storage methods (object_to_json / object_from_json) currently has no support for serializing AnalysisCardBase and its subclasses -- serialization
of analysis cards only exists in the SQA store. This diff adds JSON store
support for the full AnalysisCardBase hierarchy: AnalysisCard,
AnalysisCardGroup, ErrorAnalysisCard, PlotlyAnalysisCard,
MarkdownAnalysisCard, HealthcheckAnalysisCard, and GraphvizAnalysisCard.

Approach: A single encoder function handles all AnalysisCard leaf
subclasses since they share the same fields (name, title, subtitle,
df, blob, timestamp), with a __type discriminator carrying the
concrete class name. A separate encoder handles AnalysisCardGroup which
has children instead of df/blob. On the decoder side, the existing
ax_class_from_json_dict generic dispatcher works since all constructors
accept the serialized fields as kwargs.

Differential Revision: D96490723

Summary:
The json storage methods (`object_to_json` / `object_from_json`) currently has no support for serializing `AnalysisCardBase` and its subclasses -- serialization
of analysis cards only exists in the SQA store. This diff adds JSON store
support for the full `AnalysisCardBase` hierarchy: `AnalysisCard`,
`AnalysisCardGroup`, `ErrorAnalysisCard`, `PlotlyAnalysisCard`,
`MarkdownAnalysisCard`, `HealthcheckAnalysisCard`, and `GraphvizAnalysisCard`.

**Approach:** A single encoder function handles all `AnalysisCard` leaf
subclasses since they share the same fields (`name`, `title`, `subtitle`,
`df`, `blob`, `timestamp`), with a `__type` discriminator carrying the
concrete class name. A separate encoder handles `AnalysisCardGroup` which
has `children` instead of `df`/`blob`. On the decoder side, the existing
`ax_class_from_json_dict` generic dispatcher works since all constructors
accept the serialized fields as kwargs.

Differential Revision: D96490723
@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

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

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.84%. Comparing base (1e48d0f) to head (d54fa79).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5021   +/-   ##
=======================================
  Coverage   96.84%   96.84%           
=======================================
  Files         604      604           
  Lines       65022    65037   +15     
=======================================
+ Hits        62971    62987   +16     
+ Misses       2051     2050    -1     

☔ 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.

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 meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants