Skip to content

Commit d2c1fda

Browse files
committed
refactor: Upgrade to obelisk 0.38.0-rc.2
1 parent 359967a commit d2c1fda

10 files changed

Lines changed: 62 additions & 56 deletions

File tree

dev-deps.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
cargo-binstall 1.18.0
2-
cargo-edit-upgrade 0.13.9
1+
cargo-binstall 1.19.1
2+
cargo-edit-upgrade 0.13.10
33
cargo-expand 1.0.121
4-
cargo generate 0.23.8
5-
cargo-nextest 0.9.132
6-
just 1.49.0
7-
obelisk 0.37.7
4+
cargo generate 0.23.9
5+
cargo-nextest 0.9.136
6+
just 1.51.0
7+
obelisk 0.38.0-rc.2
88
pkg-config 0.29.2
99
rustc 1.95.0 (59807616e 2026-04-14)
10-
wasm-tools 1.246.2
11-
wasmtime 43.0.1
12-
node.js v22.22.2
10+
wasm-tools 1.249.0
11+
wasmtime 44.0.1
12+
node.js v22.22.3
1313
wizer 10.0.0
1414
tinygo version 0.40.1 linux/amd64 (using go version go1.25.7 and LLVM version 20.1.8)
1515
wit-bindgen-go-cli 0.7.0

flake.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
};
1111
};
1212
obelisk = {
13-
url = "github:obeli-sk/obelisk/latest";
13+
url = "github:obeli-sk/obelisk/prerelease";
1414
inputs = {
1515
nixpkgs.follows = "nixpkgs";
1616
flake-utils.follows = "flake-utils";

webhook/webhook-native/webhook.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// Set the environment variable GITHUB_WEBHOOK_SECRET to the webhook secret,
55
// or set GITHUB_WEBHOOK_INSECURE=true to skip verification (development only).
66

7+
import { starAddedSchedule, starRemovedSchedule } from 'stargazers:workflow-obelisk-schedule/workflow';
8+
import { listStargazers } from 'stargazers:db/user';
9+
710
const HTTP_HEADER_SIGNATURE = 'X-Hub-Signature-256';
811
const ENV_GITHUB_WEBHOOK_INSECURE = 'GITHUB_WEBHOOK_INSECURE';
912
const ENV_GITHUB_WEBHOOK_SECRET = 'GITHUB_WEBHOOK_SECRET';
@@ -123,14 +126,10 @@ async function handlePost(request) {
123126
let execId;
124127
if (event.action === 'created') {
125128
console.info(`Scheduling star_added for ${senderLogin} on ${repoFullName}`);
126-
execId = obelisk.executionIdGenerate();
127-
obelisk.schedule(execId, 'stargazers:workflow/workflow.star-added',
128-
[senderLogin, repoFullName]);
129+
execId = starAddedSchedule(null, senderLogin, repoFullName);
129130
} else if (event.action === 'deleted') {
130131
console.info(`Scheduling star_removed for ${senderLogin} on ${repoFullName}`);
131-
execId = obelisk.executionIdGenerate();
132-
obelisk.schedule(execId, 'stargazers:workflow/workflow.star-removed',
133-
[senderLogin, repoFullName]);
132+
execId = starRemovedSchedule(null, senderLogin, repoFullName);
134133
} else {
135134
console.error(`Unknown action: ${event.action}`);
136135
return new Response(`Unknown action: ${event.action}`, { status: 400 });
@@ -179,6 +178,6 @@ function handleGet(request) {
179178

180179
// list-stargazers: func(last: u8, repo: option<string>, ordering: ordering)
181180
// -> result<list<stargazer>, string>
182-
const list = obelisk.call('stargazers:db/user.list-stargazers', [limit, repo, ordering]);
181+
const list = listStargazers(limit, repo, ordering);
183182
return Response.json(list);
184183
}

webhook/webhook-rs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ the user, repo, their relation, and the user should have a generated description
8383

8484
To obtain a list of 5 last updated stargazers, run
8585
```sh
86-
curl -v http://127.0.0.1:9090
86+
curl -v http://127.0.0.1:9090?repo=obeli-sk/obelisk
8787
```
8888

8989
For testing the hash signature see the script in the next section.

workflow/stargazers/workflow-native/backfill-parallel.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
// Pages through all stargazers and submits star-added-parallel for each login
33
// concurrently within each page.
44

5+
import { listStargazers } from 'stargazers:github/account';
6+
import { starAddedParallelSubmit } from 'stargazers:workflow-obelisk-ext/workflow';
7+
58
export default function backfill_parallel(repo) {
69
console.log(`Starting parallel backfill for ${repo}...`);
710
const pageSize = 5;
811
let cursor = null;
912

1013
while (true) {
11-
const resp = obelisk.call(
12-
'stargazers:github/account.list-stargazers', [repo, pageSize, cursor]);
14+
const resp = listStargazers(repo, pageSize, cursor);
1315

1416
if (!resp) {
1517
console.log('No more stargazers found.');
@@ -24,7 +26,7 @@ export default function backfill_parallel(repo) {
2426
for (const login of resp.logins) {
2527
console.log(`Submitting task for ${login}...`);
2628
const js = obelisk.createJoinSet({ name: login });
27-
js.submit('stargazers:workflow/workflow.star-added-parallel', [login, repo]);
29+
starAddedParallelSubmit(js, login, repo);
2830
joinSets.push(js);
2931
}
3032

workflow/stargazers/workflow-native/backfill.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Native JS implementation of stargazers:workflow/workflow.backfill
22
// Pages through all stargazers of a repo and calls star-added for each.
33

4+
import { listStargazers } from 'stargazers:github/account';
5+
import { starAdded } from 'stargazers:workflow/workflow';
6+
47
export default function backfill(repo) {
58
console.log(`Starting backfill for ${repo}...`);
69
const pageSize = 5;
@@ -10,8 +13,7 @@ export default function backfill(repo) {
1013
// list-stargazers: func(repo: string, page-size: u8, cursor: option<string>)
1114
// -> result<option<stargazers>, string>
1215
// Returns null (option None) when there are no more pages.
13-
const resp = obelisk.call(
14-
'stargazers:github/account.list-stargazers', [repo, pageSize, cursor]);
16+
const resp = listStargazers(repo, pageSize, cursor);
1517

1618
if (!resp) {
1719
console.log('No more stargazers found.');
@@ -23,8 +25,7 @@ export default function backfill(repo) {
2325

2426
for (const login of resp.logins) {
2527
console.log(`Processing ${login}...`);
26-
// star-added: func(login: string, repo: string) -> result<_, string>
27-
obelisk.call('stargazers:workflow/workflow.star-added', [login, repo]);
28+
starAdded(login, repo);
2829
}
2930

3031
if (!gotWholePage) {
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// Native JS implementation of stargazers:workflow/workflow.star-added-parallel
22
// Fetches account info and LLM settings concurrently using join sets.
33

4+
import { accountInfoSubmit, accountInfoAwaitNext } from 'stargazers:github-obelisk-ext/account';
5+
import { getSettingsJsonSubmit, getSettingsJsonAwaitNext } from 'stargazers:db-obelisk-ext/llm';
6+
import { addStarGetDescription, updateUserDescription } from 'stargazers:db/user';
7+
import { respond as llmRespond } from 'stargazers:llm/llm';
8+
49
export default function star_added_parallel(login, repo) {
5-
const existingDescription = obelisk.call(
6-
'stargazers:db/user.add-star-get-description', [login, repo]);
10+
const existingDescription = addStarGetDescription(login, repo);
711

812
if (existingDescription !== null && existingDescription !== undefined) {
913
console.log(`Description already exists for ${login} on ${repo}.`);
@@ -14,27 +18,22 @@ export default function star_added_parallel(login, repo) {
1418

1519
// Submit account-info and get-settings-json concurrently.
1620
const jsInfo = obelisk.createJoinSet({ name: `info_${login}` });
17-
const infoExecId = jsInfo.submit('stargazers:github/account.account-info', [login]);
21+
accountInfoSubmit(jsInfo, login);
1822

1923
const jsSettings = obelisk.createJoinSet({ name: `settings_${login}` });
20-
const settingsExecId = jsSettings.submit('stargazers:db/llm.get-settings-json', []);
24+
getSettingsJsonSubmit(jsSettings);
2125

2226
// Await account info.
23-
jsInfo.joinNext();
24-
const infoResult = obelisk.getResult(infoExecId);
25-
if (infoResult.err !== undefined) throw infoResult.err;
27+
const infoResult = accountInfoAwaitNext(jsInfo);
2628

2729
// Await settings.
28-
jsSettings.joinNext();
29-
const settingsResult = obelisk.getResult(settingsExecId);
30-
if (settingsResult.err !== undefined) throw settingsResult.err;
30+
const settingsResult = getSettingsJsonAwaitNext(jsSettings);
3131

3232
console.log(`Got info and settings for ${login}, generating description...`);
3333

3434
// Generate and persist the description sequentially.
35-
const description = obelisk.call('stargazers:llm/llm.respond',
36-
[infoResult.ok, settingsResult.ok]);
37-
obelisk.call('stargazers:db/user.update-user-description', [login, description]);
35+
const description = llmRespond(infoResult, settingsResult);
36+
updateUserDescription(login, description);
3837

3938
console.log(`Generated and saved description in parallel for ${login}`);
4039
}
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// Native JS implementation of stargazers:workflow/workflow.star-added
22

3+
import { accountInfo } from 'stargazers:github/account';
4+
import { getSettingsJson } from 'stargazers:db/llm';
5+
import { addStarGetDescription, updateUserDescription } from 'stargazers:db/user';
6+
import { respond as llmRespond } from 'stargazers:llm/llm';
7+
38
export default function star_added(login, repo) {
49
// 1. Persist the star and check whether a description already exists.
510
// add-star-get-description: func(login: string, repo: string) -> result<option<string>, string>
6-
// obelisk.call unwraps the result: returns the ok value or throws the err string.
7-
const existingDescription = obelisk.call(
8-
'stargazers:db/user.add-star-get-description', [login, repo]);
11+
const existingDescription = addStarGetDescription(login, repo);
912

1013
if (existingDescription !== null && existingDescription !== undefined) {
1114
console.log(`Description already exists for ${login} on ${repo}.`);
@@ -15,16 +18,16 @@ export default function star_added(login, repo) {
1518
console.log(`No description for ${login} on ${repo}, generating...`);
1619

1720
// 2. Fetch the account info from GitHub.
18-
const info = obelisk.call('stargazers:github/account.account-info', [login]);
21+
const info = accountInfo(login);
1922

2023
// 3. Fetch the LLM prompt settings from the database.
21-
const settingsJson = obelisk.call('stargazers:db/llm.get-settings-json', []);
24+
const settingsJson = getSettingsJson();
2225

2326
// 4. Generate the user's description using the LLM.
24-
const description = obelisk.call('stargazers:llm/llm.respond', [info, settingsJson]);
27+
const description = llmRespond(info, settingsJson);
2528

2629
// 5. Persist the generated description.
27-
obelisk.call('stargazers:db/user.update-user-description', [login, description]);
30+
updateUserDescription(login, description);
2831

2932
console.log(`Generated and saved description for ${login}`);
3033
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Native JS implementation of stargazers:workflow/workflow.star-removed
22

3+
import { removeStar } from 'stargazers:db/user';
4+
35
export default function star_removed(login, repo) {
46
// remove-star: func(login: string, repo: string) -> result<_, string>
5-
obelisk.call('stargazers:db/user.remove-star', [login, repo]);
7+
removeStar(login, repo);
68
console.log(`Removed star for ${login} on ${repo}.`);
79
}

0 commit comments

Comments
 (0)