Home / Companies / Aspect Build / Blog / Post Details
Content Deep Dive

Preventing production code depending on experiments

Blog post from Aspect Build

Post Details
Company
Date Published
Author
Alex Eagle
Word Count
540
Language
English
Hacker News Points
-
Summary

Google implemented an /experimental folder in their monorepo to facilitate code experimentation without maintaining long-term commitments to the code. This setup allows developers to use shared library code and receive continuous integration feedback while collaborating with others. However, incorporating experimental code into the main branch poses risks, such as unintended dependencies in production services. To mitigate this, Google uses Bazel's testonly feature to restrict dependencies on experimental code, ensuring it is only used for testing purposes. The buildozer tool is employed to automate the configuration of BUILD files under the /experimental folder, marking them as testonly. Additionally, a continuous integration task is set up to query and report any non-testonly targets in the /experimental directory, preventing misuse. Developers are also provided with commands to resolve any CI failures by updating BUILD files accordingly.