Skip to content

Commit 5f08dcf

Browse files
fix: Release collection issues for java-core (Java Server SDK), react-client-sdk, and vue-client-sdk (#366)
This pull request fixes the issues around switching to prefixed release tags. - Draft releases and releases without dates: Filtered out draft releases and releases missing a publish date to avoid ingesting incomplete data. - Missing releases due to tag-prefix: The java-core, react-client-sdk, and vue-client-sdk repos switched to prefixed release tags but their metadata didn't specify a tag-prefix, so the crawl couldn't match new releases. Added the correct tag-prefix to each repo's cached metadata. - Same-repo backfill: Added support for same-repo backfill files ("same-repo": true) so the crawl ingests both old unprefixed and new prefixed tag formats. The crawl now runs in three ordered phases (old-repo backfills, same-repo backfills, main crawl) so that repos.json always points to the current canonical repository.
1 parent c43d1e1 commit 5f08dcf

10 files changed

Lines changed: 119 additions & 7 deletions

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,56 @@ make html
6767
This generates both HTML files in the `_sites_/` directory. The pages are automatically deployed to GitHub Pages when changes are pushed to the main branch.
6868

6969

70+
## backfill
71+
72+
The `backfill/` directory contains metadata files that supplement the main crawl. Each file is named
73+
`<org>_<repo>.json` (e.g., `launchdarkly_java-server-sdk.json`), and the filename determines which
74+
GitHub repo is queried for releases.
75+
76+
There are two types of backfill files:
77+
78+
### Old-repo backfill (default)
79+
80+
Used when an SDK has migrated from a standalone repo to a monorepo. The backfill file references the
81+
**old** repo to capture historical releases that used simple unprefixed tags (e.g., `7.7.0`). The new
82+
monorepo's `.sdk_metadata.json` uses a `tag-prefix` to capture new releases (e.g.,
83+
`launchdarkly-java-server-sdk-7.8.0`).
84+
85+
When the main crawl encounters a repo that has a backfill file, it **skips** that repo — since the
86+
old repo's metadata is no longer authoritative.
87+
88+
Example (`backfill/launchdarkly_java-server-sdk.json`):
89+
```json
90+
{
91+
"version": 1,
92+
"sdks": {
93+
"java-server-sdk": {}
94+
}
95+
}
96+
```
97+
98+
### Same-repo backfill (`"same-repo": true`)
99+
100+
Used when a repo changed its tag format (e.g., from `3.3.2` to `launchdarkly-react-client-sdk-v3.4.0`)
101+
without migrating to a different repo. The backfill file references the **same** repo to capture the
102+
old unprefixed releases, while the repo's `.sdk_metadata.json` uses a `tag-prefix` to capture the
103+
new prefixed releases.
104+
105+
Setting `"same-repo": true` tells the crawl that this repo is still the canonical home for the SDK.
106+
The main crawl will **still process** this repo (rather than skipping it), so that full metadata and
107+
prefixed releases are also ingested.
108+
109+
Example (`backfill/launchdarkly_java-core.json`):
110+
```json
111+
{
112+
"same-repo": true,
113+
"version": 1,
114+
"sdks": {
115+
"java-server-sdk": {}
116+
}
117+
}
118+
```
119+
70120
## versioning policy
71121

72122
The JSON products have an implicit 'v1' version at this time.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"same-repo": true,
3+
"version": 1,
4+
"sdks": {
5+
"java-server-sdk": {}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"same-repo": true,
3+
"version": 1,
4+
"sdks": {
5+
"react-client-sdk": {}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"same-repo": true,
3+
"version": 1,
4+
"sdks": {
5+
"vue": {}
6+
}
7+
}

metadata/launchdarkly_java-core.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"Java"
1010
],
1111
"userAgents": ["JavaClient"],
12+
"releases": {
13+
"tag-prefix": "launchdarkly-java-server-sdk-"
14+
},
1215
"features": {
1316
"allFlags": { "introduced": "1.0" },
1417
"appMetadata": { "introduced": "5.8" },

metadata/launchdarkly_react-client-sdk.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"languages": [
88
"JavaScript", "TypeScript"
99
],
10-
"wrapperNames": ["react-client-sdk"]
10+
"wrapperNames": ["react-client-sdk"],
11+
"releases": {
12+
"tag-prefix": "launchdarkly-react-client-sdk-"
13+
}
1114
}
1215
}
1316
}

metadata/launchdarkly_vue-client-sdk.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"languages": [
88
"JavaScript", "TypeScript"
99
],
10-
"wrapperNames": ["vue-client-sdk"]
10+
"wrapperNames": ["vue-client-sdk"],
11+
"releases": {
12+
"tag-prefix": "launchdarkly-vue-client-sdk-"
13+
}
1114
}
1215
}
1316
}

scripts/crawl.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,48 @@ rm -rf "$temp_dir"
2222
sqlite3 "$temp_db" < ./schemas/sdk_metadata.sql
2323
mkdir "$temp_dir"
2424

25+
# Phase 1: Old-repo backfills. These capture releases from repositories that are
26+
# no longer the canonical home for an SDK (e.g. standalone repos that have been
27+
# merged into a monorepo). They run first so their sdk_repos entries have lower
28+
# rowids, which matters because generate-products.sh uses jq reduce (last writer
29+
# wins) to build repos.json.
2530
for file in ./backfill/*.json; do
31+
same_repo=$(jq -r '."same-repo" // false' "$file")
32+
if [ "$same_repo" = "true" ]; then
33+
continue
34+
fi
2635
repo=$(basename "$file" .json | tr '_' '/')
2736
echo "backfilling $repo"
37+
./tool/ingest -metadata "$file" -db "$temp_db" -repo "$repo"
38+
done
2839

40+
# Phase 2: Same-repo backfills. These capture old unprefixed releases from repos
41+
# that have transitioned to prefixed tags but are still the canonical home for the
42+
# SDK. They run after old-repo backfills so their sdk_repos entries take precedence
43+
# in repos.json.
44+
for file in ./backfill/*.json; do
45+
same_repo=$(jq -r '."same-repo" // false' "$file")
46+
if [ "$same_repo" != "true" ]; then
47+
continue
48+
fi
49+
repo=$(basename "$file" .json | tr '_' '/')
50+
echo "backfilling $repo"
2951
./tool/ingest -metadata "$file" -db "$temp_db" -repo "$repo"
3052
done
3153

54+
# Phase 3: Main crawl. Fetch live metadata and prefixed releases from GitHub.
55+
# Repos with old-repo backfills are skipped (their metadata lives elsewhere now).
56+
# Repos with same-repo backfills are still crawled for metadata and new releases.
3257
./scripts/repos.sh | while read -r repo; do
3358
echo "checking $repo"
3459
sanitized_repo=$(echo "$repo" | tr '/' '_')
3560

3661
if [ -f "./backfill/$sanitized_repo.json" ]; then
37-
echo "skipping $repo, it was backfilled"
38-
continue
62+
same_repo=$(jq -r '."same-repo" // false' "./backfill/$sanitized_repo.json")
63+
if [ "$same_repo" != "true" ]; then
64+
echo "skipping $repo, it was backfilled"
65+
continue
66+
fi
3967
fi
4068

4169
metadata=$(gh api "repos/$repo/contents/.sdk_metadata.json" -q '.content') || {

tool/cmd/ingest/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func insertName(tx *sql.Tx, id string, metadata *metadataV1) error {
249249
}
250250

251251
func insertRepo(tx *sql.Tx, id string, repo string) error {
252-
stmt, err := tx.Prepare("INSERT INTO sdk_repos (id, github) VALUES (?, ?)")
252+
stmt, err := tx.Prepare("INSERT INTO sdk_repos (id, github) VALUES (?, ?) ON CONFLICT DO NOTHING")
253253
if err != nil {
254254
return err
255255
}

tool/lib/releases/releases.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ const supportWindowYears = 1
1616

1717
// Raw is the raw tag data returned from the github GraphQL releases query.
1818
type Raw struct {
19-
Tag string `graphql:"tagName"`
20-
Date string `graphql:"publishedAt"`
19+
Tag string `graphql:"tagName"`
20+
Date string `graphql:"publishedAt"`
21+
IsDraft bool `graphql:"isDraft"`
2122
}
2223

2324
// Parsed is the post-processed version of a Raw structure, with the version extracted and date
@@ -159,6 +160,9 @@ func Filter(releases []Raw, prefix string) ([]Parsed, error) {
159160

160161
var processed []Parsed
161162
for _, r := range releases {
163+
if r.IsDraft || r.Date == "" {
164+
continue
165+
}
162166
if !parser.Relevant(r.Tag) {
163167
continue
164168
}

0 commit comments

Comments
 (0)