Skip to content

Commit 02b1550

Browse files
chirag-madlaniAuto-revert Testclaude
authored
Fixes #32256: Queries tab shows parent table's description provenance (#32292)
The Description component fell back to the page-level GenericProvider change summary whenever changeSummaryEntry was not passed. When TableQueryRightPanel renders a Query's description inside a Table page, the Query's "authored/accepted by" line silently inherited the parent table's provenance ("Accepted by admin • 6 days ago"). Only use the context change summary when the rendered entity type matches the context entity's type. Adds a regression test. Co-authored-by: Auto-revert Test <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 24470b4 commit 02b1550

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎openmetadata-ui/src/main/resources/ui/src/components/common/EntityDescription/Description.test.tsx‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ describe('Description', () => {
340340
it('should render the authored-by footer when change metadata is present', () => {
341341
mockUseGenericContext.mockReturnValue({
342342
isVersionView: false,
343+
type: EntityType.TABLE,
343344
changeSummary: {
344345
description: {
345346
changeSource: ChangeSource.Manual,
@@ -355,6 +356,27 @@ describe('Description', () => {
355356
expect(screen.getByTestId('authored-by-footer')).toBeInTheDocument();
356357
});
357358

359+
it('should not inherit the page-level change summary when entityType differs from the context entity', () => {
360+
// Regression test for #32256: a Query rendered on a Table page must not pick up the
361+
// table's description-provenance from the GenericProvider context.
362+
mockUseGenericContext.mockReturnValue({
363+
isVersionView: false,
364+
type: EntityType.TABLE,
365+
changeSummary: {
366+
description: {
367+
changeSource: ChangeSource.Suggested,
368+
changedBy: 'admin',
369+
changedAt: 1700000000000,
370+
},
371+
},
372+
onThreadLinkSelect: mockOnThreadLinkSelect,
373+
});
374+
375+
render(<Description {...defaultProps} entityType={EntityType.QUERY} />);
376+
377+
expect(screen.queryByTestId('authored-by-footer')).not.toBeInTheDocument();
378+
});
379+
358380
it('should not render the authored-by footer when change metadata is absent', () => {
359381
render(<Description {...defaultProps} />);
360382

‎openmetadata-ui/src/main/resources/ui/src/components/common/EntityDescription/Description.tsx‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,20 @@ const Description = ({
7474
changeSummaryEntry,
7575
}: DescriptionProps) => {
7676
const navigate = useNavigate();
77-
const { isVersionView, changeSummary, onThreadLinkSelect } =
78-
useGenericContext<Domain>();
77+
const {
78+
isVersionView,
79+
changeSummary,
80+
onThreadLinkSelect,
81+
type: contextEntityType,
82+
} = useGenericContext<Domain>();
83+
// The context's changeSummary belongs to the page-level entity. Only fall back to it
84+
// when the entity being rendered is that same entity — otherwise a nested Description
85+
// (e.g. a Query in TableQueryRightPanel) inherits the parent table's provenance.
7986
const descriptionChangeSummary =
80-
changeSummaryEntry ?? changeSummary?.['description'];
87+
changeSummaryEntry ??
88+
(entityType === contextEntityType
89+
? changeSummary?.['description']
90+
: undefined);
8191
const { suggestions, selectedUserSuggestions } = useSuggestionsContext();
8292
const [isEditDescription, setIsEditDescription] = useState(false);
8393
const { fqn } = useFqn();

0 commit comments

Comments
 (0)