Skip to content

Conversation

Maosaic
Copy link
Collaborator

@Maosaic Maosaic commented Oct 15, 2025

Description

Fixed data source reference initialization and Dataset conversion in DataView classes to ensure proper metadata handling and avoid async constructor calls.

Problems Fixed

  1. Async call in constructor (data_view.ts:43)
  • Before: initializeDataSourceRef() was called in constructor without await
  • Issue: Constructors cannot be async, causing silent failures in data source initialization
  • Fix: Removed call from constructor, now explicitly called in DataViewsService.create() at line 565
  1. Incorrect saved object type (data_view.ts:49)
  • Before: this.savedObjectsClient.get(this.dataSourceRef.type, ...)
  • Issue: Used engine type (e.g., "OpenSearch", "S3") instead of saved object type
  • Fix: Changed to literal 'data-source' (the correct saved object type)
  1. Missing schema mappings in saved object conversion (data_views.ts:390, 399, 417)
  • Before: Schema mappings were not parsed from saved objects
  • Issue: Lost metadata when loading data views
  • Fix: Added parsing for schemaMappings field in savedObjectToSpec()
  1. Incomplete Dataset conversion (data_view.ts:106-113)
  • Before: toDataset() only returned id, title, type, timeFieldName, dataSource
  • Issue: Missing important metadata fields
  • Fix: Added displayName, description, and schemaMappings
  1. Placeholder name handling (data_view.ts:80, 96-99)
  • Before: Treated generic placeholder 'dataSource' as valid name
  • Issue: Would extract incorrect dataset types or use placeholder as title
  • Fix: Added filter dataSourceReference.name !== 'dataSource' to ignore placeholders
  1. Premature Query Execution (use_initial_query_execution.ts)
  • Before: useInitialQueryExecution triggered executeQueries based only on queryState.dataset existing, did NOT wait for DatasetProvider to finish loading/caching the dataset
  • Issue: Data table stuck at loading when loading dataset from cache
  • Fix: Ensures query execution waits for DatasetProvider to finish caching before attempting to execute.

Issues Resolved

Screenshot

Before data source references fix:

Screenshot 2025-10-14 at 7 16 48 PM

After data source references fix:

Screenshot 2025-10-14 at 7 11 39 PM

Before Premature Query Execution fix:

Screen.Recording.2025-10-15.at.4.02.07.PM.mp4

After Premature Query Execution fix:

Screen.Recording.2025-10-15.at.3.56.11.PM.mp4

Testing the changes

Changelog

  • fix: Fixed data source reference initialization and Dataset conversion in DataView classes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 14.81481% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.35%. Comparing base (6d8e2ec) to head (b2252c1).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...cation/context/dataset_context/dataset_context.tsx 0.00% 10 Missing ⚠️
...ins/data/common/data_views/data_views/data_view.ts 0.00% 9 Missing ⚠️
...s/data/public/ui/dataset_select/dataset_select.tsx 40.00% 2 Missing and 1 partial ⚠️
...ns/data/common/data_views/data_views/data_views.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10726      +/-   ##
==========================================
+ Coverage   60.34%   60.35%   +0.01%     
==========================================
  Files        4462     4463       +1     
  Lines      119480   119602     +122     
  Branches    19746    19773      +27     
==========================================
+ Hits        72095    72186      +91     
- Misses      42382    42405      +23     
- Partials     5003     5011       +8     
Flag Coverage Δ
Linux_1 26.58% <0.00%> (-0.01%) ⬇️
Linux_2 38.82% <0.00%> (-0.01%) ⬇️
Linux_3 38.88% <18.75%> (-0.01%) ⬇️
Linux_4 33.06% <4.54%> (+0.06%) ⬆️
Windows_1 26.59% <0.00%> (-0.01%) ⬇️
Windows_2 38.79% <0.00%> (-0.01%) ⬇️
Windows_3 38.89% <18.75%> (-0.01%) ⬇️
Windows_4 33.06% <4.54%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Maosaic Maosaic added the OSD Changes being merged by the OSD team label Oct 16, 2025
name: attributes.title || this.dataSourceRef.name || this.dataSourceRef.id,
};
} catch (error) {
// If data source fetch fails, keep the existing dataSourceRef as-is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Seems a little weird to have an error and not do anything in this catch block, is there any logging we could do?

timeFieldName: this.timeFieldName,
displayName: this.displayName,
description: this.description,
schemaMappings: this.schemaMappings,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this all the metadata, or is there more metadata? Could there be a version field for the dataset here?

@Maosaic Maosaic merged commit 26ae58e into opensearch-project:main Oct 16, 2025
127 of 131 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distinguished-contributor OSD Changes being merged by the OSD team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants