Skip to content

Add an api.txt golden for package:web - #590

Merged
kevmoo merged 2 commits into
mainfrom
web-api-txt-golden
Oct 19, 2026
Merged

kevmoo merged 2 commits into
mainfrom
web-api-txt-golden

Conversation

@kevmoo

@kevmoo kevmoo commented Oct 17, 2026

Copy link
Copy Markdown
Member

Adds a golden summary of package:web's public API so every regeneration shows its exact API change in the PR diff. For example, the next IDL roll will show lines like loaded (getter: int) → loaded (getter: double).

  • web/tool/api.txt is generated by package:api_summary and includes member signatures. web/test/api_test.dart fails with a line diff when it is out of date with web/lib; regenerate with dart run api_summary --output tool/api.txt.
  • web.yaml gains a VM test step, since CI previously ran only browser tests.
  • web/.pubignore keeps the 714 KB golden out of the published archive (compressed size stays at 595 KB instead of 691 KB).
  • update_idl_bindings.dart regenerates tool/api.txt after generating package:web, so the API delta lands in the same diff as the generated code.

- web: add package:api_summary as a dev dependency and commit
  `tool/api.txt`, a summary of the public API including member signatures,
  so API changes (e.g. `int` -> `double`) are visible in diffs.
- `test/api_test.dart` (VM-only) verifies the golden with
  `expectApiSummaryClean`; CI runs it in a separate VM step.
- `update_idl_bindings.dart` regenerates the golden after generating
  package:web. Regenerate manually with
  `dart run api_summary --output tool/api.txt` in `web/`.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request integrates package:api_summary to track and verify the public API of package:web via a golden file (tool/api.txt). It adds the necessary dependency, configures .pubignore, implements a test to ensure the golden file remains up to date, updates the IDL generation script to regenerate the golden file automatically, and documents the workflow in the README. Feedback on the changes highlights a potential issue in the new test where Isolate.resolvePackageUriSync is called without a null check, which could lead to static analysis errors or runtime crashes.

Comment thread web/test/api_test.dart Resolved
The summary is SDK-dependent (e.g. 3.12 renders `JSFunction?` where 3.13+
renders `JSFunction<Function>?`), so only check it on `dev` and document
regenerating it with a current SDK. Simplify the test to rely on the package
root being the working directory.
@kevmoo
kevmoo requested a review from srujzs October 17, 2026 19:29
@kevmoo
kevmoo merged commit 7d63637 into main Oct 19, 2026
21 checks passed
@kevmoo
kevmoo deleted the web-api-txt-golden branch October 19, 2026 16:50
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Oct 20, 2026
…, web

Revisions updated by `dart tools/rev_sdk_deps.dart`.

core (https://github.com/dart-lang/core/compare/4d80610..72e71ca):
  72e71ca0  Mon Oct 19 21:57:11 2026 +0200  Jonas Finnemann Jensen  Optimize `HashSink` and `_MD5Sink.updateHash` (RFC impl) (dart-lang/core#1013)

dartdoc (https://github.com/dart-lang/dartdoc/compare/e1859cf..c0e19cf):
  c0e19cf6  Mon Oct 19 11:41:42 2026 -0700  Konstantin Scheglov  Import analyzer ast with explicit show. (dart-lang/dartdoc#4300)

ecosystem (https://github.com/dart-lang/ecosystem/compare/622ef61..0ab0cfd):
  0ab0cfd  Mon Oct 19 15:44:26 2026 +0200  Moritz  fix(firehose): bump dependency_validator to support analyzer 14 (dart-lang/ecosystem#453)
  44a0768  Wed Oct 14 09:37:29 2026 -0700  Nate Bosch  Improve firehose publish validation log output (dart-lang/ecosystem#468)

http (https://github.com/dart-lang/http/compare/7d7aae2..a8a24a0):
  a8a24a0  Mon Oct 19 13:31:34 2026 -0700  Kevin Moore  docs(web_socket): remove non-user-visible changelog entry (dart-lang/http#2023)
  6f6ac5f  Mon Oct 19 16:29:43 2026 -0400  Mouad Debbar  [http_multi_server] Retry `loopback(0)` when IPv6 port is already bound (dart-lang/http#2025)
  6e91ce3  Tue Oct 13 16:25:39 2026 -0700  Kevin Moore  Sync root README.md package table from pubspec.yaml files (dart-lang/http#2024)

native (https://github.com/dart-lang/native/compare/cc7e4b0..3cbe319):
  3cbe319e3  Tue Oct 13 15:47:18 2026 +0200  Daco Harkes  [hooks_runner] Fail eagerly when file locking is not supported on file system (dart-lang/native#3679)

shelf (https://github.com/dart-lang/shelf/compare/b2cb503..b66665b):
  b66665b  Fri Oct 16 15:12:05 2026 -0700  Kevin Moore  chore: add health workflow and prepare shelf 1.4.3, shelf_router 1.1.5, and shelf_static 1.2.0 (dart-lang/shelf#546)

test (https://github.com/dart-lang/test/compare/9bf69a8..d1afeb1):
  d1afeb14  Fri Oct 16 20:41:51 2026 -0400  Mouad Debbar  Confirmation that `tearDown` is called on timeout (dart-lang/test#2798)
  3f6c2f14  Thu Oct 15 18:21:35 2026 -0700  Jacob MacDonald  Enable asserts in the cli compiler (dart-lang/test#2795)

tools (https://github.com/dart-lang/tools/compare/c1471db..f6c7a2d):
  f6c7a2d62  Mon Oct 19 07:59:24 2026 -0700  Kevin Moore  [pubspec_parse] Preserve input maps and YamlMap source spans (dart-lang/tools#2653)
  f1a55d953  Mon Oct 19 07:53:51 2026 -0700  Kevin Moore  [yaml] Fix tag URI decoding, numeric tag RangeErrors, and dead checks (dart-lang/tools#2630)
  340ded284  Mon Oct 19 07:43:31 2026 -0700  Kevin Moore  [unified_analytics] Prepare for 8.2.0 release (dart-lang/tools#2689)
  a73703543  Fri Oct 16 11:55:03 2026 -0700  Kevin Moore  [unified_analytics] Bump version to 8.2.0-wip (dart-lang/tools#2688)

web (https://github.com/dart-lang/web/compare/63e6662..4e60e61):
  4e60e61  Mon Oct 19 10:02:22 2026 -0700  dependabot[bot]  Bump source-map-js from 1.2.1 to 1.2.2 in /web_generator (dart-lang/web#591)
  7d63637  Mon Oct 19 09:50:26 2026 -0700  Kevin Moore  Add an api.txt golden for package:web (dart-lang/web#590)

[email protected]

Change-Id: Ibe6ac8a8246a27caa8a4846ea1acc78c801ee2ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/566781
Commit-Queue: Nate Bosch <[email protected]>
Reviewed-by: Brian Quinlan <[email protected]>
kevmoo added a commit that referenced this pull request Oct 29, 2026
Track `package:js_interop`'s public API surface with `package:api_summary`
(`js_interop/tool/api.txt`, excluded from the published archive via
`.pubignore`) so signature and member changes are visible in PR diffs,
matching `package:web` (#590).

CI runs `test/api_test.dart` on the VM against the `dev` SDK since
`js_interop` defaults to browser and Node test platforms and `api_summary`
output tracks SDK analyzer updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants