Fix residual detail row aggregation
This commit is contained in:
@@ -719,6 +719,138 @@ describe('financial taxonomy internals', () => {
|
||||
expect(standardizedRows.some((row) => row.key.includes('BusinessAcquisitionsProFormaNetIncomeLoss'))).toBe(true);
|
||||
});
|
||||
|
||||
it('merges detail rows across taxonomy-version concept drift for Microsoft residuals', () => {
|
||||
const aggregated = __financialTaxonomyInternals.aggregateDetailRows({
|
||||
statement: 'income',
|
||||
selectedPeriodIds: new Set(['2024-fy', '2025-fy']),
|
||||
snapshots: [
|
||||
{
|
||||
...createSnapshot({
|
||||
filingId: 90,
|
||||
filingType: '10-K',
|
||||
filingDate: '2024-07-30',
|
||||
statement: 'income',
|
||||
periods: [{
|
||||
id: '2024-fy',
|
||||
periodStart: '2023-07-01',
|
||||
periodEnd: '2024-06-30',
|
||||
periodLabel: 'FY24'
|
||||
}]
|
||||
}),
|
||||
detail_rows: {
|
||||
income: {
|
||||
unmapped: [
|
||||
{
|
||||
key: 'http://fasb.org/us-gaap/2024#AdvertisingExpense',
|
||||
parentSurfaceKey: 'unmapped',
|
||||
label: 'Advertising Expense',
|
||||
conceptKey: 'http://fasb.org/us-gaap/2024#AdvertisingExpense',
|
||||
qname: 'us-gaap:AdvertisingExpense',
|
||||
namespaceUri: 'http://fasb.org/us-gaap/2024',
|
||||
localName: 'AdvertisingExpense',
|
||||
unit: 'iso4217:USD',
|
||||
values: { '2024-fy': 1_500_000_000 },
|
||||
sourceFactIds: [101],
|
||||
isExtension: false,
|
||||
dimensionsSummary: [],
|
||||
residualFlag: true
|
||||
},
|
||||
{
|
||||
key: 'https://xbrl.microsoft.com/2024#BusinessAcquisitionsProFormaRevenue',
|
||||
parentSurfaceKey: 'unmapped',
|
||||
label: 'Business Acquisitions Pro Forma Revenue',
|
||||
conceptKey: 'https://xbrl.microsoft.com/2024#BusinessAcquisitionsProFormaRevenue',
|
||||
qname: 'msft:BusinessAcquisitionsProFormaRevenue',
|
||||
namespaceUri: 'https://xbrl.microsoft.com/2024',
|
||||
localName: 'BusinessAcquisitionsProFormaRevenue',
|
||||
unit: 'iso4217:USD',
|
||||
values: { '2024-fy': 247_442_000_000 },
|
||||
sourceFactIds: [102],
|
||||
isExtension: true,
|
||||
dimensionsSummary: [],
|
||||
residualFlag: true
|
||||
}
|
||||
]
|
||||
},
|
||||
balance: {},
|
||||
cash_flow: {},
|
||||
equity: {},
|
||||
comprehensive_income: {}
|
||||
}
|
||||
} satisfies FilingTaxonomySnapshotRecord,
|
||||
{
|
||||
...createSnapshot({
|
||||
filingId: 91,
|
||||
filingType: '10-K',
|
||||
filingDate: '2025-07-30',
|
||||
statement: 'income',
|
||||
periods: [{
|
||||
id: '2025-fy',
|
||||
periodStart: '2024-07-01',
|
||||
periodEnd: '2025-06-30',
|
||||
periodLabel: 'FY25'
|
||||
}]
|
||||
}),
|
||||
detail_rows: {
|
||||
income: {
|
||||
unmapped: [
|
||||
{
|
||||
key: 'http://fasb.org/us-gaap/2025#AdvertisingExpense',
|
||||
parentSurfaceKey: 'unmapped',
|
||||
label: 'Advertising Expense',
|
||||
conceptKey: 'http://fasb.org/us-gaap/2025#AdvertisingExpense',
|
||||
qname: 'us-gaap:AdvertisingExpense',
|
||||
namespaceUri: 'http://fasb.org/us-gaap/2025',
|
||||
localName: 'AdvertisingExpense',
|
||||
unit: 'iso4217:USD',
|
||||
values: { '2025-fy': 1_700_000_000 },
|
||||
sourceFactIds: [201],
|
||||
isExtension: false,
|
||||
dimensionsSummary: [],
|
||||
residualFlag: true
|
||||
},
|
||||
{
|
||||
key: 'https://xbrl.microsoft.com/2025#BusinessAcquisitionsProFormaRevenue',
|
||||
parentSurfaceKey: 'unmapped',
|
||||
label: 'Business Acquisitions Pro Forma Revenue',
|
||||
conceptKey: 'https://xbrl.microsoft.com/2025#BusinessAcquisitionsProFormaRevenue',
|
||||
qname: 'msft:BusinessAcquisitionsProFormaRevenue',
|
||||
namespaceUri: 'https://xbrl.microsoft.com/2025',
|
||||
localName: 'BusinessAcquisitionsProFormaRevenue',
|
||||
unit: 'iso4217:USD',
|
||||
values: { '2025-fy': 219_790_000_000 },
|
||||
sourceFactIds: [202],
|
||||
isExtension: true,
|
||||
dimensionsSummary: [],
|
||||
residualFlag: true
|
||||
}
|
||||
]
|
||||
},
|
||||
balance: {},
|
||||
cash_flow: {},
|
||||
equity: {},
|
||||
comprehensive_income: {}
|
||||
}
|
||||
} satisfies FilingTaxonomySnapshotRecord
|
||||
]
|
||||
});
|
||||
|
||||
const unmapped = aggregated.unmapped ?? [];
|
||||
expect(unmapped).toHaveLength(2);
|
||||
|
||||
const advertising = unmapped.find((row) => row.label === 'Advertising Expense');
|
||||
expect(advertising?.values).toEqual({
|
||||
'2024-fy': 1_500_000_000,
|
||||
'2025-fy': 1_700_000_000
|
||||
});
|
||||
|
||||
const proFormaRevenue = unmapped.find((row) => row.label === 'Business Acquisitions Pro Forma Revenue');
|
||||
expect(proFormaRevenue?.values).toEqual({
|
||||
'2024-fy': 247_442_000_000,
|
||||
'2025-fy': 219_790_000_000
|
||||
});
|
||||
});
|
||||
|
||||
it('resolves CASY-style income gaps with ordered fallbacks and tighter interest income exclusions', () => {
|
||||
const period = createPeriod({
|
||||
id: '2025-fy',
|
||||
|
||||
Reference in New Issue
Block a user