[roll] Roll fuchsia [check-licenses] Refactor result package and fix resource leaks
This change addresses numerous resource leaks, concurrency risks, and
validation bugs within the `result` package. It also overhauls the
testing strategy to use targeted unit tests rather than
integration-level golden files.
* Resource Leak Fixes: Resolved three massive File Descriptor (FD)
exhaustion bugs across `template.go` and `result.go` (including
`saveReadmeFuchsiaFiles` and `compressTarGZ`) by explicitly
closing files during loop iterations rather than relying on
`defer`.
* OOM Optimization: Rewrote `compressTarGZ` to stream the metrics
archive directly to disk via `os.Create` rather than buffering
the entire `.tar.gz` into RAM, preventing Out-Of-Memory crashes
on large workspaces.
* Concurrency Safety: Replaced all direct accesses to global state
in `result.go`, `checks.go`, and `world.go` (like
`project.FilteredProjects` and `p.LicenseFiles`) with their new
thread-safe accessors (e.g., `project.GetAllFilteredProjects()`)
to prevent data races.
* Linter Bug Fixes:
* Rewrote the HTTP link checker
(`AllComplianceWorksheetLinksAreGood`) to use a bounded worker
pool (10 goroutines) with strict connection timeouts and
Keep-Alive drain/close logic to prevent blocking the main thread
for minutes.
* Fixed `AllLicenseTextsMustBeRecognized` to correctly catch and
flag files that return empty `Matches` arrays from the classifier.
* Fixed a malformed JSON struct tag in `config.go` that was
causing the linter checks to silently ignore `_config.json`
allowlists.
* Code Cleanup: Moved the contents of `init.go` into `config.go` and
deleted `init.go`. Fixed a bug where `compressTarGZ` would compress
the entire current working directory if `OutDir` was left empty.
* Testing: Deleted `testdata/` and created `checks_test.go`,
`config_test.go`, `template_test.go`, and `world_test.go` using
dynamic `t.TempDir()` scaffolding, aggressively covering the HTTP
crawler, template execution, config merging, and deduplication logic.
* Documentation: Added a comprehensive `README.md` documenting the
architecture and the deduplication algorithm in `world.go`.
* Licensing Fixes:
* Modified `checks.go` to explicitly allow new "Permissive",
"Notice", and "Unencumbered" match types without requiring explicit
project allowlists. This is a for organizational purposes; I will work to re-categorize all of these license patterns in follow-up commits.
* Added a temporary "Unclassified" category bypass.
* Extracted missing license patterns into the `assets/patterns/` tree.
* Allowlisted test stubs, marker files, and unclassifiable segments.
* Updated READMEs to correctly specify license file formats.
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1569135
Original-Revision: e050916f1e5c29005afa34df5c3c0fa1f415970b
GitOrigin-RevId: 29ce59a2aa8705013e10df070faefe9b30ebcff0
Change-Id: I40e681fbd783b9f970288377bd37a5d3508d3cab
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.