Commit fff5a37
Fix hsthrift build (internal + OSS)
Summary:
## Summary
This diff fixes two related build issues for hsthrift:
1. **Internal build failure**: The Glean Haskell indexer was failing with `Unstructured annotations are not allowed: 'haxl.batched'`
2. **OSS build failure**: The GitHub CI build was/will be failing because thrift annotation files couldn't be found
### Background
The `math.thrift` file previously used an unstructured annotation:
```thrift
oneway void putMany(1: list<i64> val) (haxl.batched);
```
This was fixed by a codemod in **October 2025** (D83550305) which converted it to a structured annotation. However, that fix was **reverted in November 2025** (D86966535) by Simon Marlow because it broke the GitHub CI - the `thrift/annotation/thrift.thrift` file wasn't accessible in the OSS build environment.
The revert commit message stated:
> *"This broke github CI. The file `thrift/annotations/thrift.thrift` is not present in the hsthrift github repo, and this thrift file is just a test."*
Since then, enforcement of the unstructured annotation ban has become stricter in fbsource, causing the internal Glean Haskell indexer to fail (see Sandcastle workflow [508906757907574458](https://www.internalfb.com/sandcastle/workflow/508906757907574458)).
Additionally, in early **March 2026**, codemods ran across fbsource adding `include "thrift/annotation/thrift.thrift"` to other files in hsthrift that are compiled during the OSS build:
- `tests/if/hs_test.thrift` (March 2, 2026)
- `tests/if/foo.thrift` (March 2, 2026)
- `tests/if/constants.thrift`
- `tests/if/map.thrift`
This means the OSS build is now broken regardless of whether `math.thrift` is fixed - other files also need the annotation include path.
### The Fix
**1. `lib/test/if/math.thrift`** - Convert unstructured to structured annotation:
```thrift
include "thrift/annotation/thrift.thrift"
...
thrift.DeprecatedUnvalidatedAnnotations{items = {"haxl.batched": "1"}}
oneway void putMany(1: list<i64> val);
```
**2. `Makefile`** - Add include path for fbthrift annotation files:
```makefile
HSTHRIFT_PREFIX ?= $(HOME)/.hsthrift
THRIFT_INCLUDE := -I $(HSTHRIFT_PREFIX)/include
```
Then use `$(THRIFT_INCLUDE)` in the `thrift-cpp` target when invoking `thrift1`.
When fbthrift is installed via `new_install_deps.sh` to `~/.hsthrift/`, the thrift compiler can now find the annotation files at `~/.hsthrift/include/thrift/annotation/thrift.thrift`.
### Why this fixes both issues
- **Internal build**: Uses the structured annotation syntax that the Thrift compiler now requires
- **OSS build**: The Makefile now passes `-I ~/.hsthrift/include` to `thrift1`, allowing it to find `thrift/annotation/thrift.thrift` which is installed as part of fbthrift
Reviewed By: malanka, aahanaggarwal
Differential Revision: D96733254
fbshipit-source-id: 13c480f9a4cd11fc8ce4c2211fd47808e6046a991 parent 49fb109 commit fff5a37
2 files changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
125 | | - | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | | - | |
| 132 | + | |
129 | 133 | | |
130 | 134 | | |
131 | | - | |
| 135 | + | |
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
0 commit comments