Skip to content

Commit e63bd1a

Browse files
authored
Enforce API Extractor error/none policy and tag internal APIs (#8653)
## Summary Configures API Extractor so that every message either **fails the build** (`error`) or is **silenced** (`none`) — no `warning`-level messages remain, and nothing extraneous is written into the committed `*.api.md` reports. This eliminates the line-number "footer" churn that previously rewrote the API reports on unrelated edits. ## Rule policy | Rule | Level | Rationale | |---|---|---| | `ae-incompatible-release-tags` | error | Real signal — a `@public` symbol leaking an `@internal` type. Fixed at source by tagging the internal helpers `@internal`. | | `ae-unresolved-link` | error | Broken `{@link}` references are doc bugs. | | `ae-unresolved-inheritdoc-*`, `ae-internal-mixed-release-tag` | error | Correctness signals (no current violations). | | `ae-forgotten-export` | none | Our public types are projections (`Partial<Omit<Base, …>>`) of internal base types. Exporting the base to satisfy this rule would place the **entire** base type under semver — including members the projection deliberately omits. The base types are already shipped and structurally reachable; only their *name* is intentionally withheld. | | `tsdoc-*`, `ae-missing-release-tag`, `ae-internal-missing-underscore` | none | Cosmetic / not enforced; these were the source of the report churn. | ## Source changes - Tag internal helper functions and types with `@internal` (resolves `ae-incompatible-release-tags` with no public-surface change). - Fix ambiguous `{@link AuthorityType}` → `{@link AuthorityType:type}`. - Mark `BrowserExperimentalOptions` `@public` (it is referenced by the public `Configuration.experimental` field). - Regenerate all API reports. The source edits are TSDoc-comment-only — no functional or runtime change. ## Validation - `build:all`, `lint`, `format:check`, `apiExtractor` pass for all affected packages. - Unit tests pass for msal-common and msal-browser. > Paired with the 1P PR on the matching branch `chore/apiextractor-warning-policy`.
1 parent f34361b commit e63bd1a

18 files changed

Lines changed: 97 additions & 2219 deletions

api-extractor-base.json

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,54 @@
1616
"messages": {
1717
"compilerMessageReporting": {
1818
"default": {
19-
"logLevel": "warning",
20-
"addToApiReportFile": true
19+
"logLevel": "error"
2120
}
2221
},
2322
"extractorMessageReporting": {
2423
"default": {
25-
"logLevel": "warning"
24+
"logLevel": "error"
25+
},
26+
"ae-undocumented": {
27+
"logLevel": "none"
2628
},
2729
"ae-missing-release-tag": {
28-
"logLevel": "warning",
29-
"addToApiReportFile": true
30+
"logLevel": "none"
3031
},
3132
"ae-setter-with-docs": {
32-
"logLevel": "warning",
33-
"addToApiReportFile": true
33+
"logLevel": "none"
34+
},
35+
"ae-internal-missing-underscore": {
36+
"logLevel": "none",
37+
"addToApiReportFile": false
38+
},
39+
"ae-forgotten-export": {
40+
"logLevel": "none",
41+
"addToApiReportFile": false
42+
},
43+
"ae-internal-mixed-release-tag": {
44+
"logLevel": "error",
45+
"addToApiReportFile": false
46+
},
47+
"ae-unresolved-inheritdoc-reference": {
48+
"logLevel": "error",
49+
"addToApiReportFile": false
50+
},
51+
"ae-unresolved-inheritdoc-base": {
52+
"logLevel": "error",
53+
"addToApiReportFile": false
54+
},
55+
"ae-incompatible-release-tags": {
56+
"logLevel": "error",
57+
"addToApiReportFile": false
3458
},
3559
"ae-unresolved-link": {
36-
"logLevel": "warning",
37-
"addToApiReportFile": true
60+
"logLevel": "error",
61+
"addToApiReportFile": false
3862
}
3963
},
4064
"tsdocMessageReporting": {
4165
"default": {
42-
"logLevel": "warning",
43-
"addToApiReportFile": true
66+
"logLevel": "none"
4467
}
4568
}
4669
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Update API Extractor warning policy and tag internal APIs with @internal [#8653](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8653)",
4+
"packageName": "@azure/msal-browser",
5+
"email": "thomas.norling@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Update API Extractor warning policy and tag internal APIs with @internal [#8653](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8653)",
4+
"packageName": "@azure/msal-common",
5+
"email": "thomas.norling@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

lib/msal-browser/apiReview/msal-browser.api.md

Lines changed: 3 additions & 458 deletions
Large diffs are not rendered by default.

lib/msal-browser/src/config/Configuration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ export type BrowserSystemOptions = SystemOptions & {
175175
serverTelemetryEnabled?: boolean;
176176
};
177177

178-
/** @internal */
178+
/**
179+
* Options for configuring experimental features. These features do not follow
180+
* semver and may be changed or removed without a major version bump. Use with caution.
181+
* @public
182+
*/
179183
export type BrowserExperimentalOptions = {
180184
/**
181185
* Enables iframe timeout telemetry experiment for silent iframe bridge monitoring.

lib/msal-browser/src/utils/BrowserUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export interface WaitForBridgeRequest {
258258
state?: string;
259259
}
260260

261+
/** @internal */
261262
export async function waitForBridgeResponse(
262263
timeoutMs: number,
263264
logger: Logger,
@@ -461,9 +462,10 @@ export function preflightCheck(initialized: boolean): void {
461462
}
462463

463464
/**
464-
* Helper to validate app enviornment before making redirect request
465+
* Helper to validate app environment before making redirect request
465466
* @param initialized
466467
* @param config
468+
* @internal
467469
*/
468470
export function redirectPreflightCheck(
469471
initialized: boolean,

lib/msal-common/apiReview/msal-common.api.md

Lines changed: 17 additions & 1665 deletions
Large diffs are not rendered by default.

lib/msal-common/src/authority/Authority.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class Authority {
126126
}
127127

128128
/**
129-
* Get {@link AuthorityType}
129+
* Get {@link AuthorityType:type}
130130
* @param authorityUri {@link IUri}
131131
* @private
132132
*/

lib/msal-common/src/cache/interface/ICacheManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { RefreshTokenEntity } from "../entities/RefreshTokenEntity.js";
1616
import { AuthorityMetadataEntity } from "../entities/AuthorityMetadataEntity.js";
1717
import { StoreInCache } from "../../request/StoreInCache.js";
1818

19+
/** @internal */
1920
export interface ICacheManager {
2021
/**
2122
* fetch the account entity from the platform cache

lib/msal-common/src/cache/utils/AccountEntityUtils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { AccountEntity } from "../entities/AccountEntity.js";
2828

2929
/**
3030
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
31+
* @internal
3132
*/
3233
export function generateAccountId(accountEntity: AccountEntity): string {
3334
const accountId: Array<string> = [
@@ -39,6 +40,7 @@ export function generateAccountId(accountEntity: AccountEntity): string {
3940

4041
/**
4142
* Returns the AccountInfo interface for this account.
43+
* @internal
4244
*/
4345
export function getAccountInfo(accountEntity: AccountEntity): AccountInfo {
4446
const tenantProfiles = accountEntity.tenantProfiles || [];
@@ -78,6 +80,7 @@ export function getAccountInfo(accountEntity: AccountEntity): AccountInfo {
7880

7981
/**
8082
* Returns true if the account entity is in single tenant format (outdated), false otherwise
83+
* @internal
8184
*/
8285
export function isSingleTenant(accountEntity: AccountEntity): boolean {
8386
return !accountEntity.tenantProfiles;
@@ -86,6 +89,7 @@ export function isSingleTenant(accountEntity: AccountEntity): boolean {
8689
/**
8790
* Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
8891
* @param accountDetails
92+
* @internal
8993
*/
9094
export function createAccountEntity(
9195
accountDetails: {
@@ -195,6 +199,7 @@ export function createAccountEntity(
195199
* @param cloudGraphHostName
196200
* @param msGraphHost
197201
* @returns
202+
* @internal
198203
*/
199204
export function createAccountEntityFromAccountInfo(
200205
accountInfo: AccountInfo,
@@ -275,6 +280,7 @@ export function generateHomeAccountId(
275280
/**
276281
* Validates an entity: checks for all expected params
277282
* @param entity
283+
* @internal
278284
*/
279285
export function isAccountEntity(entity: object): entity is AccountEntity {
280286
if (!entity) {

0 commit comments

Comments
 (0)