Changes to FIDL can often have a large number of downstream effects. This
document provides checklists for items that should be considered when changing
FIDL. Note that not all elements of the checklist will necessarily apply to
every change, but they should at least be helpful for developers to double check
that their changes are complete.

## Changes to the `fidlc` compiler

This checklist is for changes that affect FIDL itself, such as syntax or
semantics changes.

- Update specifications.
  - [Language reference](https://fuchsia.dev/docs/reference/fidl/language/language) and code snippets where applicable.
  - [FIDL grammar](https://fuchsia.dev/docs/reference/fidl/language/grammar).
  - [Bindings spec](https://fuchsia.dev/docs/reference/fidl/language/bindings-spec) for guidance for how backends should generate code for this feature.
  - When appropriate, update the [lexicon](https://fuchsia.dev/docs/reference/fidl/language/lexicon).
- Update associated tools.
  - The FIDL formatter/linter and their associated TreeVisitors.
  - The [fidldoc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidldoc) tool, for language changes that should be reflected in the generated documentation, e.g. a new data type or modifier.
  - [Editors](https://fuchsia.dev/docs/development/languages/fidl/guides/editors) and syntax highlighting.
- Update FIDL files. For syntax changes, update existing FIDL source including:
  - Actual FIDL source files in tree (and out of tree, if required).
  - FIDL source specified as strings in test source code, such as the [compiler unit tests](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidlc/tests) and the [fidlgen end-to-end tests](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/lib/fidlgentest).
  - FIDL snippets in documentation.
- Ensure that interactions with attributes are handled.
  - For example, does the feature require a new placement?
- Update integration tests
  - For larger language features, it may be worth adding test coverage in existing integration tests. For example, ensuring cross binding consistency through the compatibility tests, or transitionability through the source compatibility tests.
- For parser changes specifically:
  - Update the [`span_tests`](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidlc/tests/span_tests.cc) to ensure that the parsed spans are correct, and not just that parsing succeeds
- For raw AST changes:
  - Ensure updates to the AST are propagated to the raw AST tree visitor and its downstream users as well. For example, adding a new field to a node probably should be accompanied with a visitor change that visits that new field.
- For semantics changes:
  - Update the feature specific unittest, e.g. [`table_tests`](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidlc/tests/table_tests.cc) when making a modification to tables, or create a new test file.

It is expected for changes to FIDL which cascade to backends to update all
Fuchsia FIDL team owned bindings, i.e. Rust, Dart, HLCPP, New C++ (natural
and wire).

## Changes to the JSON IR

- Ensure that the change is reflected by a change in the IR goldens.
- Update the [JSON schema](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidlc/schema.json).
- Update any JSON consumers, including:
  - [fidlgen lib](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/lib/fidlgen)
  - [fidl codec](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/lib/fidl_codec)
  - [fidlmerge](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidlmerge)
  - [fidldoc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidldoc)
  - [banjo](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/devices/tools/fidlgen_banjo)
  - [measure-tape](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/measure-tape)
  - [GIDL](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/gidl)
  - [zither](https://cs.opensource.google/fuchsia/fuchsia/+/main:/zircon/tools/zither)
  - [summarize](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidl_api_summarize/)

## Changes to `fidlgen_<lang>` backends

- Update the [bindings docs](https://fuchsia.dev/docs/reference/fidl/bindings/overview) if the generated code has changed.
- Update the [bindings tutorials](https://fuchsia.dev/docs/development/languages/fidl/tutorials/overview) to reflect the current best practices and patterns.
  - Incorporate example code which compiles and runs in the build (e.g. [//examples/fidl/rust/fidl_crates/src/main.rs](https://cs.opensource.google/fuchsia/fuchsia/+/main:/examples/fidl/rust/fidl_crates/src/main.rs)).
- Update any relevant guides:
  - [FIDL API rubric](https://fuchsia.dev/docs/development/api/fidl) for guidance on using this feature.
  - For example, when changing the memory allocation APIs in C++ wire types, the [C++ wire domain object memory ownership guide](https://fuchsia.dev/docs/development/languages/fidl/tutorials/cpp/topics/wire-memory-ownership) should be updated.
  - We've also found it good practice to present to API Council in order to socialize new features, and explain to council members how to review APIs in light of evolutions.
- If changing bindings API, update [GIDL backends](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/gidl) to use the updated API.
- If changing behavior or adding dynamic features, update [client](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/dynsuite/client_suite/) and [server](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/dynsuite/server_suite/) dynamic test suites.

## Changes to the FIDL wire format

- Update the bindings to support the new wire format.
- Update the [wire format specification](https://fuchsia.dev/docs/reference/fidl/language/wire-format/README) to document the new wire format.
- Update [measure-tape](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/measure-tape) to support size calculation in new wire format.
- Update [fidl-codec](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/lib/fidl_codec) to support encoding/decoding in the new wire format.
- Update targets which have to manually encode/decode FIDL (the following list and reasons was reviewed on Feb 2023):
  - [userboot](https://cs.opensource.google/fuchsia/fuchsia/+/28e6aba6f37d7c5430f41d93e31674d2d401a47a:zircon/kernel/lib/userabi/userboot/start.cc;l=308): as the first userspace process, it cannot use mutable data segment, cannot use [RELRO](https://fuchsia.dev/fuchsia-src/contribute/contributing-to-fidl/a%20flavor%20of%20relocation%20hardening%20technique%20used%0Aon%20Fuchsia), and cannot use thread local storage. The lack of RELRO precludes const global/static variables whose initializer contains non-NULL pointer values, which rules out many libraries including FIDL bindings. This will be addressed by <https://fxbug.dev/42072759>.
  - [ldmsg](https://cs.opensource.google/fuchsia/fuchsia/+/main:/zircon/system/ulib/ldmsg/ldmsg.c): used by the C library to load libraries during process startup. It cannot use full-fledged FIDL bindings due to [sanitizer ABI requirements](https://cs.opensource.google/fuchsia/fuchsia/+/main:/zircon/system/ulib/ldmsg/BUILD.gn). This will be addressed by <https://fxbug.dev/42072830>.
  - [libc sanitizers/debugdata](https://cs.opensource.google/fuchsia/fuchsia/+/main:/sdk/lib/c/sanitizers/debugdata.cc): the sanitizer support libraries themselves cannot use functions built with sanitizers. This will be addressed by <https://fxbug.dev/42072760>.

## Horizontal testing requirements

Add coverage to:

- The [at-rest conformance suite](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/conformance_suite/).
- The [dynamic compatibility suite](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/compatibility/).
- The dynamic [client suite](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/dynsuite/client_suite/) and [server suite](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/dynsuite/server_suite/).
- The [dangerous identifiers suite](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/tests/fidl/dangerous_identifiers/).

[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/contribute/contributing-to-fidl/fidl-project-checklist.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/contribute/contributing-to-fidl/fidl-project-checklist.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/contribute/contributing-to-fidl/fidl-project-checklist.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/contribute/contributing-to-fidl/fidl-project-checklist.md "Edit the source code of this page")