Repository navigation
Conversation
fdussert
left a comment
There was a problem hiding this comment.
Thanks for this, Livio, and for splitting the provider from the widget. That makes it much easier to review. The shape is right: one bounded events call that goes through the existing conditional get() (ETag, 304, rate-limit handling), an activity section that keeps its last rows when it fails, and an openRepo that takes a name, never a URL, checks it against the current snapshot, refuses anything that is not a local socket, and runs /usr/bin/open with an argument list. I replayed the commit on current main (v0.5.0) and ran it with pnpm: pnpm typecheck is clean, and pnpm test passes (server 2680 passed / 2 skipped, ui 874 passed).
A few things before it can go in, roughly in order of importance:
1. A personal name in the provider's doc comment (server/src/providers/github.ts, the new GET /users/{login}/events bullet: "ordered by what Livio did"). The repository keeps names, hosts and accounts out of code, docs and fixtures. Something like "by what the account's owner did" would work.
2. Demo mode has no repoActivity (server/src/demo/connections.ts, githubSnapshot). The fake GitHub snapshot gets no repoActivity, so with FREMKIT_DEMO=1, and in pnpm widget:preview --dir captures, My Scope shows its empty state. A short list built from the repos already in the fake (example-org/api, website, mobile-app, cli) with recent updatedAts would fix it. The demo has no openRepo either, which is fine because it never opens anything.
3. Docs and changelog. docs/connections.md → GitHub still describes four sources and "one poll a minute: the inbox, two pull-request searches and one call per repository". Could you:
- add the events call and the
activitykey of theerrorsmap; - say plainly that the feed covers the account's own recent activity, private repositories included when the token can see them, and that it lags and only goes back a limited window;
- list
github-my-scopeunder Used by once the sietch PR lands.
CHANGELOG.md also needs a line under ## Unreleased, written for the user, e.g. "GitHub connections now also report which repositories you were active in recently, for widgets like My Scope."
4. openRepo passes a built string to open. The rule for commands that open things is that what reaches /usr/bin/open is a parsed URL that was then checked. The regex makes the template string safe today, but please build it the way open does: const url = new URL(https://${host}/${repo}), check url.hostname === host and url.pathname === /${repo}``, then pass url.href. Then both commands follow the same pattern. While you're there: `OWNER_REPO_RE` accepts `owner/..`, which `normalizeUserRepoActivity` already rejects but the payload schema doesn't. Adding the same `.`/`..` check to `OpenRepoPayload` would close that too.
5. X-Poll-Interval can now be overwritten by a lower value (get(), serverIntervalMs = poll * 1000). The events endpoint sends X-Poll-Interval as well, and it is now requested after /notifications in the same poll, so its value (usually 60) overwrites a larger one that notifications asked for under load. Keeping the largest value seen during a poll would fix that. The comment "Only the notifications endpoint sends it" also needs updating.
6. Small points, take or leave:
visibleReposcovers activity, notifications, reviews and my PRs but notruns, so a widget can open a run but not the repository it belongs to. Either is defensible; if it's deliberate, a short comment would help.- Every widget bound to a GitHub connection now receives
repoActivity, including the existing inbox and actions widgets. That's fine (they already see private repo names via notifications and PRs), but it's worth one sentence in the docs, since it is a timeline of the user's activity rather than a list of items. - The PR description says it was tested with Bun. Running it with
pnpm test/pnpm typecheckas CI does is the reference here (it passes, see above).
None of this changes the design, so once 1–5 are addressed I'm happy with it.
The widget bridge adds instanceId to every command payload, so a strict schema that does not declare it rejects the tap. OpenRowPayload already declared it; openRepo was missed and every repo tap failed with "Could not open this repository". Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
fdussert
left a comment
There was a problem hiding this comment.
Thanks Livio, and good catch on instanceId: the bridge stamps it on every command, so openRepo could never have worked from a real tile. Could you add one assertion that passes it (like the open test at github.test.ts:564), so it can't regress?
That commit is the only change since my review, though, so points 1–5 are all still open:
- "by what Livio did" is still in the doc comment (
github.ts:25). - The demo GitHub snapshot (
server/src/demo/connections.ts) still has norepoActivity, so My Scope shows its empty state in demo mode. The registry now also wants apreview.webpfor each widget, andpnpm widget:previewcan only capture one once the demo has data. docs/connections.md(events call,activityerror key, what the feed covers and its limits) and the## Unreleasedline inCHANGELOG.md.openReposhould buildnew URL(...), checkhostnameandpathname, and passurl.href.OpenRepoPayloadshould refuse./..the waynormalizeUserRepoActivitydoes.- Keep the largest
X-Poll-Intervalseen during a poll, and update the comment. Since the events call now runs in aPromise.allwith the two searches, the last response to arrive currently wins.
I merged current main into the branch locally. There are no conflicts, pnpm typecheck is clean, and pnpm test passes (server 2725 / 2 skipped, ui 931). Once 1–5 are in, I'm happy to merge.
Adds the provider contract required by the GitHub My Scope widget: a bounded authenticated-user events feed for ranking repositories by the user’s own recent activity, plus a loopback-only
openRepocommand that validates repository names against the current snapshot and constructs the HTTPS URL locally.The companion widget package is being prepared in
LivioGama/fremkit-sietch; this draft keeps the provider interface reviewable separately. No GitHub writes are made by the activity feed.Validation:
bun test github.test.ts(49 passed, 0 failed; 172 expectations),bunx @typescript/native-preview --noEmit -p server/tsconfig.jsonpassed, and the activity-only open regression was first reproduced red then passed after the allowlist fix.