FirebaseExtended / FirebaseExtended/reactfire

Add a published .d.ts diff to the release process to catch breaking type changes

未关闭
#749 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
3.6k
派生
403
平均合并
14 小时 53 分钟
30 天内合并 PR
5

描述

## Problem

4.2.4 shipped as a patch but contained breaking TypeScript type changes with no changelog note. The main one: `ObservableStatus` was refactored from a flat interface (`data: T`) into a discriminated union (`data: T | undefined` unless narrowed on `status`), which breaks the standard destructure-and-use pattern across every data hook, including the documented suspense pattern. It is type-only (no runtime impact), but it reds strict-TS consumer CI on upgrade.

It slipped through because:

- The change came in via #583 ("use `useSyncExternalStore` to sync data"), whose title looked like an internals change, not a public API break.
- It then sat unreleased for ~3 years (v4.2.3 was 2022-08, #583 merged 2023-07).
- 4.2.4 batched 35 PRs of accumulated `main` into one bump, with no step auditing the cumulative public type surface.

## Proposal

Add a release-time (or CI) check that diffs the candidate's emitted types against the last published version:

1. `npm pack` the latest published version, extract `dist/*.d.ts`.
2. `npm pack` the release candidate, extract `dist/*.d.ts`.
3. Diff them. Any non-additive change (removed/narrowed/changed signature) fails the check or requires an explicit "breaking" acknowledgment and a minor/major bump.

This exact diff would have flagged both the `ObservableStatus` union change and the `useFirestoreDocData` widening (#733) immediately.

## Related

- Remediation for the live 4.2.4 release is tracked separately (deprecate + re-cut as 4.3.0 with a migration note).
- Surfaced while reviewing #740.

贡献指南

打开贡献指南

调研方向

Start with the repository's existing release or CI process and use npm pack to compare the latest published package with the release candidate. Extract dist/*.d.ts, identify non-additive type changes, and make the check fail or require an explicit breaking acknowledgment with an appropriate version bump.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
ci-cd, release
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。