Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion bunfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
exact = true
# Only install newly resolved package versions published at least 3 days ago.
minimumReleaseAge = 259200
minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "opentui-spinner", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron-builder", "electron-publish"]
# altimate_change start — first-party @altimateai/altimate-core* packages are adopted on release day
minimumReleaseAgeExcludes = ["@altimateai/altimate-core", "@altimateai/altimate-core-darwin-arm64", "@altimateai/altimate-core-darwin-x64", "@altimateai/altimate-core-linux-arm64-gnu", "@altimateai/altimate-core-linux-x64-gnu", "@altimateai/altimate-core-win32-x64-msvc", "@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "opentui-spinner", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron-builder", "electron-publish"]
# altimate_change end

[test]
root = "./do-not-run-tests-from-root"
2 changes: 1 addition & 1 deletion docs/internal/deterministic-checks-engine-split.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Relevant because it sets the cost of "add something engine-side".
layer), `altimate-core-node` (napi-rs), plus `polyglot-sql` for multi-dialect parse and
transpile.
- Published as the npm package `@altimateai/altimate-core` (per-platform native addon).
altimate-code pins it exactly: `packages/opencode/package.json` → `"@altimateai/altimate-core": "0.7.0"`.
altimate-code pins it exactly: `packages/opencode/package.json` → `"@altimateai/altimate-core": "0.8.0"`.
- Consumer binding: `packages/opencode/src/altimate/native/altimate-core.ts` registers 42
`altimate_core.*` handlers on the dispatcher. Registration is lazy — the napi binary loads
on the first `Dispatcher.call()` (`packages/opencode/src/altimate/native/index.ts`), so a
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@ai-sdk/togetherai": "2.0.41",
"@ai-sdk/vercel": "2.0.39",
"@ai-sdk/xai": "3.0.82",
"@altimateai/altimate-core": "0.7.0",
"@altimateai/altimate-core": "0.8.0",
"@altimateai/drivers": "workspace:*",
"@aws-sdk/credential-providers": "3.1057.0",
"@clack/prompts": "1.0.0-alpha.1",
Expand Down
16 changes: 9 additions & 7 deletions packages/opencode/test/altimate/tools/sql-classify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,20 @@ describe("SQL-building aggregates are reads", () => {
})
}

// Known core-parser gap (altimate-core-internal): DuckDB `//` integer division fails to parse,
// so a read-only string_agg query using it is conservatively classified as a write.
// Flip to `test` once the parser supports it.
test.skip("duckdb: `//` integer division in a string_agg query → read (core parser gap)", () => {
test("duckdb: `//` integer division in a string_agg query → read", () => {
const sql = "SELECT 'c' || (rn // 240) c, count(*), string_agg('''' || Symbol || '''', ',' ORDER BY Symbol) FROM t GROUP BY 1"
expect(classifyAndCheck(sql, "duckdb").queryType).toBe("read")
expect(classifyAndCheck(sql, "duckdb")).toEqual({ queryType: "read", blocked: false })
})

test("duckdb: `//` currently fails closed with an explanatory diagnostic", () => {
test("duckdb: `//` classifies as read without a parse diagnostic", () => {
const r = classifyAndCheck("SELECT 'c' || (rn // 240) c, string_agg(Symbol, ',') FROM t GROUP BY 1", "duckdb")
expect(r).toEqual({ queryType: "read", blocked: false })
})

test("duckdb: malformed string_agg fails closed with an explanatory diagnostic", () => {
const r = classifyAndCheck("SELECT string_agg(Symbol, ','", "duckdb")
expect(r.queryType).toBe("write")
expect(r.blocked).toBe(false)
expect(r.parseError).toBeTruthy()
expect(r.parseError).toMatch(/Parse error.*Expected RParen/)
})
})
14 changes: 10 additions & 4 deletions packages/opencode/test/altimate/tools/sql-execute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,20 @@ describe("sql_execute parser read boundary", () => {
["sqlite", "SELECT 'article' NOT GLOB 'a*'"],
["duckdb", "SELECT TIMESTAMPTZ '2024-02-03 00:00:00+00'"],
["duckdb", "SELECT * FROM items match"],
])("explains unsupported %s read syntax: %s", async (type, query) => {
])("accepts %s read syntax the parser now supports: %s", async (type, query) => {
const config = spyOn(Registry, "getConfig").mockReturnValue({ type })
const tool = await initTool(SqlExecuteTool)
const ask = spyOn(ctx, "ask").mockImplementation(() => Effect.die(new Error("write denied by test")))
try {
await expect(tool.execute({ query, warehouse: "source" }, ctx)).rejects.toThrow("write denied by test")
expect(ask).toHaveBeenCalledTimes(1)
expect(dispatch).not.toHaveBeenCalled()
const result = await tool.execute({ query, warehouse: "source" }, ctx)
expect(result.metadata.error).toBeUndefined()
expect(ask).not.toHaveBeenCalled()
expect(dispatch).toHaveBeenCalledTimes(1)
expect(dispatch).toHaveBeenCalledWith(
"sql.execute",
expect.objectContaining({ sql: query, warehouse: "source" }),
expect.anything(),
)
} finally {
ask.mockRestore()
config.mockRestore()
Expand Down
Loading