-
Notifications
You must be signed in to change notification settings - Fork 0
feat: V1 I/O clients — github, openrouter, workspace context #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e95f06a
feat: V1 I/O clients — github, openrouter, workspace context
aliasunder 4ef75f3
fix(review): block symlink escape in workspace reads
aliasunder a8a673d
style: block bodies, callback extraction, auditable catch logging
aliasunder cbacb7f
test: strengthen assertions and cover untested branches (test audit)
aliasunder 587d47b
fix: bug-check findings — side-effect imports, index.tsx resolution, …
aliasunder d78be98
fix: bot review findings — stat-first size guard, abort-status matrix…
aliasunder d22c179
test: compile-time proof that OctokitLike accepts the real octokit
aliasunder acb53a2
refactor: rename settle → toResult, add one-liners on toResult + pars…
aliasunder d5cb743
refactor: retry loop as while for readability
aliasunder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "id": "gen-fixture-0001", | ||
| "object": "chat.completion", | ||
| "model": "openai/gpt-5-mini", | ||
| "choices": [ | ||
| { | ||
| "finishReason": "stop", | ||
| "message": { | ||
| "role": "assistant", | ||
| "content": "{\"analysis\":\"src/greeter.ts: verified the empty-key guard and traced register() callers.\",\"findings\":[]}" | ||
| } | ||
| } | ||
| ], | ||
| "usage": { "promptTokens": 12000, "completionTokens": 800, "cost": 0.0421 } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "id": "gen-fixture-0002", | ||
| "object": "chat.completion", | ||
| "model": "openai/gpt-5-mini", | ||
| "choices": [ | ||
| { | ||
| "finishReason": "length", | ||
| "message": { | ||
| "role": "assistant", | ||
| "content": "The model rambled instead of emitting JSON {" | ||
| } | ||
| } | ||
| ], | ||
| "usage": { "promptTokens": 11800, "completionTokens": 42, "cost": null } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "id": "gen-fixture-0003", | ||
| "object": "chat.completion", | ||
| "model": "openai/gpt-5-mini", | ||
| "choices": [ | ||
| { | ||
| "finishReason": "stop", | ||
| "message": { | ||
| "role": "assistant", | ||
| "content": "{\"verdict\":\"lgtm\"}" | ||
| } | ||
| } | ||
| ], | ||
| "usage": { "promptTokens": 11900, "completionTokens": 12, "cost": 0.001 } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "number": 7, | ||
| "state": "open", | ||
| "title": "feat: trim names before greeting", | ||
| "body": "Trims whitespace from names and validates registry keys.", | ||
| "head": { | ||
| "sha": "abc123def456abc123def456abc123def456abc1", | ||
| "ref": "feat/trim-names" | ||
| }, | ||
| "base": { "ref": "main" }, | ||
| "html_url": "https://github.com/aliasunder/fixture/pull/7" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Fixture conventions | ||
|
|
||
| Use exact assertions. Never mock what you can stub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { greet } from "../src/greeter.js" | ||
|
|
||
| export const staleGreeting = greet("stale") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { greet } from "../greeter.js" | ||
|
|
||
| export const greeting = greet("fixture") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { LIB_NAME } from "./lib" | ||
|
|
||
| export const describeLib = (): string => `lib: ${LIB_NAME}` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { greet } from "./greeter.js" | ||
| import { registry } from "./registry.js" | ||
|
|
||
| /** Fixture importer that touches two changed files. */ | ||
| export const greetAll = (): string[] => | ||
| [...registry.keys()].map((registeredName) => greet(registeredName)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { greet } from "./greeter.js" | ||
|
|
||
| export const shout = (name: string): string => greet(name).toUpperCase() |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const greet = (name: string): string => `Hello, ${name.trim()}!` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const HUB = "hub" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerOne = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerTwo = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerThree = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerFour = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerFive = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerSix = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerSeven = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerEight = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { HUB } from "../hub.js" | ||
|
|
||
| export const importerNine = HUB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const LIB_NAME = "fixture-lib" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const registry = new Map<string, string>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import { describe, expect, it } from "vitest" | ||
| import { | ||
| extractImportSpecifiers, | ||
| resolveImportSpecifier, | ||
| } from "../import-resolution.js" | ||
|
|
||
| describe("extractImportSpecifiers", () => { | ||
| it("extracts static, dynamic, and require specifiers from one source", () => { | ||
| const source = [ | ||
| `import { a } from "./a.js"`, | ||
| `import type { B } from '../b.js'`, | ||
| `const lazy = await import("./lazy.js")`, | ||
| `const legacy = require("./legacy.cjs")`, | ||
| `import zod from "zod"`, | ||
| ].join("\n") | ||
|
|
||
| const specifiers = extractImportSpecifiers(source) | ||
|
|
||
| expect(specifiers).toEqual([ | ||
| "./a.js", | ||
| "../b.js", | ||
| "./lazy.js", | ||
| "./legacy.cjs", | ||
| "zod", | ||
| ]) | ||
| }) | ||
|
|
||
| it("extracts a side-effect import specifier", () => { | ||
| const specifiers = extractImportSpecifiers(`import "./register.js"`) | ||
|
|
||
| expect(specifiers).toEqual(["./register.js"]) | ||
| }) | ||
|
|
||
| it("returns an empty list for a source with no imports", () => { | ||
| const specifiers = extractImportSpecifiers(`export const answer = 42`) | ||
|
|
||
| expect(specifiers).toEqual([]) | ||
| }) | ||
|
|
||
| it("extracts a quoted specifier inside a comment (grep-style by design)", () => { | ||
| const specifiers = extractImportSpecifiers(`// import { x } from "./x.js"`) | ||
|
|
||
| expect(specifiers).toEqual(["./x.js"]) | ||
| }) | ||
| }) | ||
|
|
||
| describe("resolveImportSpecifier", () => { | ||
| const scenarios = [ | ||
| { | ||
| name: "remaps a sibling .js specifier to .ts and .tsx", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "./greeter.js", | ||
| expected: ["src/greeter.js", "src/greeter.ts", "src/greeter.tsx"], | ||
| }, | ||
| { | ||
| name: "resolves a parent-directory .js specifier", | ||
| importerPath: "src/a/b.ts", | ||
| specifier: "../util.js", | ||
| expected: ["src/util.js", "src/util.ts", "src/util.tsx"], | ||
| }, | ||
| { | ||
| name: "remaps .mjs to .mts", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "./worker.mjs", | ||
| expected: ["src/worker.mjs", "src/worker.mts"], | ||
| }, | ||
| { | ||
| name: "remaps .cjs to .cts", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "./legacy.cjs", | ||
| expected: ["src/legacy.cjs", "src/legacy.cts"], | ||
| }, | ||
| { | ||
| name: "keeps an explicit .ts specifier as the only candidate", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "./greeter.ts", | ||
| expected: ["src/greeter.ts"], | ||
| }, | ||
| { | ||
| name: "expands an extensionless specifier with suffixes and index files", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "./lib", | ||
| expected: [ | ||
| "src/lib", | ||
| "src/lib.ts", | ||
| "src/lib.tsx", | ||
| "src/lib.js", | ||
| "src/lib.jsx", | ||
| "src/lib/index.ts", | ||
| "src/lib/index.tsx", | ||
| "src/lib/index.js", | ||
| "src/lib/index.jsx", | ||
| ], | ||
| }, | ||
| { | ||
| name: "returns no candidates for a package specifier", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "zod", | ||
| expected: [], | ||
| }, | ||
| { | ||
| name: "returns no candidates for a node built-in", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "node:path", | ||
| expected: [], | ||
| }, | ||
| { | ||
| name: "returns no candidates when the join escapes the workspace root", | ||
| importerPath: "src/caller.ts", | ||
| specifier: "../../outside.js", | ||
| expected: [], | ||
| }, | ||
| ] | ||
|
|
||
| it.each(scenarios)("$name", ({ importerPath, specifier, expected }) => { | ||
| const candidates = resolveImportSpecifier({ importerPath, specifier }) | ||
|
|
||
| expect(candidates).toEqual(expected) | ||
| }) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.