Skip to content

fix: bump @altimateai/altimate-core to 0.9.0 and fail closed on skipped policy/semantic analysis - #1555

Merged
anandgupta42 merged 3 commits into
mainfrom
chore/altimate-core-0.9.0
Oct 18, 2026
Merged

anandgupta42 merged 3 commits into
mainfrom
chore/altimate-core-0.9.0

Conversation

@anandgupta42

@anandgupta42 anandgupta42 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #1554

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Bumps @altimateai/altimate-core from 0.8.0 to 0.9.0 and makes the policy and semantic consumers fail closed on the one 0.9.0 output change that would otherwise loosen them.

Why: 0.9.0 removes validator false positives that make the SQL tools flag valid queries: DuckDB and SQLite identifier case folding, boolean SUM, PostgreSQL LIKE ANY, and table-valued functions (TVFs) in FROM / JOIN.

Behavior delta (verified by calling the 0.9.0 binding on SELECT * FROM TABLE(my_fn()), ... LATERAL FLATTEN(...) and SELECT * FROM read_csv('x')):

Surface Was (0.8.0) Now (0.9.0, before this PR's fix) Now (this PR)
validate TVF statement reported invalid (E001) valid: true, plan_status: unavailable_table_valued_function, PLAN_UNAVAILABLE warning same (intended: false positives gone)
policy (check --checks policy, agent policy tool) rejected allowed: true, policies_evaluated: 0, plan_unavailable warning, i.e. passed unchecked allowed: false, policy_skipped: true, policy_not_evaluated error violation ("policy could not be evaluated for this statement (table-valued function, no plan available); treated as blocked")
semantics (check --checks semantic, agent semantics tool, sql.analyze) rejected no findings, "plan-based analysis was skipped" note, i.e. looked clean skipped: true; check reports a finding (error with a schema, warning without), the tool reports Semantics: SKIPPED; sql.analyze adds a warning, drops semantics from confidence_factors and lowers confidence to medium

Fix location: the altimate_core.policy and altimate_core.semantics native handlers (src/altimate/native/altimate-core.ts), so the CLI, the agent tools and any other dispatcher consumer inherit it. altimate-core-semantics.ts, check.ts and sql/register.ts (sql.analyze called core directly) surface the skip. Queries with a plan are unchanged.

Other 0.9.0 output changes: nothing in packages/opencode/src consumes POLICY_SKIPPED or plan_status; explain returning explanation: null has no consumer either.

Tenant/user impact: SQL that uses table-valued functions now validates instead of being rejected. Policy gating on such SQL stays blocked, as in 0.8.0, but with an accurate reason. Semantic checks on such SQL now say they were skipped.

bun.lock covers the core package and its five platform bindings, with integrity hashes from the npm registry; bun install --frozen-lockfile installs the 0.9.0 darwin-arm64 binding. Also updates the pin mentioned in docs/internal/deterministic-checks-engine-split.md.

How did you verify your code works?

From packages/opencode:

  • Baseline (origin/main, core 0.8.0): 131 test files touching altimate-core, the native wrapper and the SQL tools, 5156 pass / 111 skip / 0 fail
  • Same files on core 0.9.0 before the fix (local build of core main 91cdf94b, then the published npm package): 5156 pass / 0 fail. The existing suites did not catch the policy change, which is why the new tests exist.
  • This head: 134 files (adds test/altimate/core-plan-skip-fail-closed.test.ts and the policy/semantics tool tests): 5168 pass / 111 skip / 0 fail
  • New tests call the real 0.9.0 binding: three TVF shapes give allowed: false for policy and skipped: true for semantics, and a normal query is unaffected. check-e2e gains a policy-skipped and a semantic-skipped case.
  • Local read-only Codex review of the diff found one P1 (sql.analyze crediting skipped semantics), fixed in the head below. bun run typecheck passes; script/upstream/analyze.ts --markers --base main --strict is clean.

Screenshots / recordings

Not a UI change.

Cost side effects

None. No new LLM calls, automatic queries, warehouse spend or background work.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code


Note

Medium Risk
Changes enforcement semantics for policy and semantic checks on unplannable SQL; behavior is intentional fail-closed but affects CI gates and agent tooling that relied on 0.9.0’s permissive skip signals.

Overview
Upgrades @altimateai/altimate-core from 0.8.0 to 0.9.0 (lockfile, packages/opencode/package.json, internal docs pin).

Core 0.9.0 can return policy allowed / semantics valid with no findings when plan-based analysis is skipped (e.g. table-valued functions). This PR treats that as not evaluated, not clean: native handlers add applyPolicySkipGuard and applySemanticsSkipGuard on altimate_core.policy and altimate_core.semantics, blocking policy with a policy_not_evaluated violation and marking semantics with skipped / skip_reason.

sql.analyze, the check CLI semantic path, and the semantics agent tool surface skips (lower confidence, explicit issues/titles) so TVF SQL no longer passes policy or looks semantically clean by accident. Integration and e2e tests cover TVF shapes and unchanged normal queries.

Reviewed by Cursor Bugbot for commit fb1d6f9. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • SQL analyses now clearly report when policy or semantic checks were skipped, rather than treating unevaluated checks as successful. Skipped policy checks block the query; skipped semantic checks appear as findings, with confidence adjusted to reflect the missing evaluation.
    • The CLI reports skipped checks as findings, with severity based on whether a schema path was supplied.
  • Chores
    • Updated the Altimate Core dependency.

- pin `@altimateai/altimate-core` to `0.9.0` in `packages/opencode/package.json`
- update `bun.lock` for the core package and its five platform bindings
- no source changes needed: nothing in altimate-code reads the new `plan_status`, `POLICY_SKIPPED` or `plan_unavailable` outputs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 3cbb3c7a-83fd-4351-82c7-768778a49b84)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T19:35:08.722831Z fb1d6f9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2f2228b-0d30-4a60-9f49-7da571668df3
📥 Commits

Reviewing files that changed from the base of the PR and between 86c56fe and fb1d6f9.

📒 Files selected for processing: 7
  • docs/internal/deterministic-checks-engine-split.md
  • packages/opencode/src/altimate/native/altimate-core.ts
  • packages/opencode/src/altimate/native/sql/register.ts
  • packages/opencode/src/altimate/tools/altimate-core-semantics.ts
  • packages/opencode/src/cli/cmd/check.ts
  • packages/opencode/test/altimate/core-plan-skip-fail-closed.test.ts
  • packages/opencode/test/cli/check-e2e.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The pull request updates @altimateai/altimate-core to version 0.9.0. It marks policy and semantics results as skipped when plan-based analysis is unavailable, then reports those results through SQL analysis, the semantics tool, and CLI checks.

Changes: Skipped analysis handling

Layer / File(s) Summary
Update the engine version and guard native results
packages/opencode/package.json, docs/internal/deterministic-checks-engine-split.md, packages/opencode/src/altimate/native/altimate-core.ts, packages/opencode/test/altimate/core-plan-skip-fail-closed.test.ts
The dependency and documented pin change to 0.9.0. Native handlers mark policy results as disallowed when plan-based evaluation is unavailable and mark matching semantics results as skipped. Tests cover table-valued-function queries and normal queries.
Report skipped semantics in SQL analysis
packages/opencode/src/altimate/native/sql/register.ts, packages/opencode/test/altimate/core-plan-skip-fail-closed.test.ts
sql.analyze adds a warning for skipped semantics and reports medium confidence without listing semantics as a confidence factor. Tests verify skipped and normal results.
Report skipped results in tools and CLI checks
packages/opencode/src/altimate/tools/altimate-core-semantics.ts, packages/opencode/src/cli/cmd/check.ts, packages/opencode/test/cli/check-e2e.test.ts
The semantics tool uses a skipped title and skip reason. CLI checks return a finding for skipped analysis and combine it with any structured semantic issues. End-to-end tests cover skipped policy and semantics results.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant AltimateCore
  participant NativeSemanticsHandler
  participant SQLAnalyze
  participant CheckCommand
  AltimateCore->>NativeSemanticsHandler: serialized semantics result
  NativeSemanticsHandler->>NativeSemanticsHandler: mark plan-skip result
  NativeSemanticsHandler->>SQLAnalyze: guarded semantics result
  SQLAnalyze->>SQLAnalyze: add warning and set confidence
  CheckCommand->>CheckCommand: create skipped-analysis finding
Loading

Suggested reviewers: sahrizvi

Merge Risk: ⚪ Minimal · up to fb1d6

No actionable merge-blocking issue is established; merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue #1554 requires the exact @altimateai/altimate-core 0.9.0 pin and a consumer compatibility check. packages/opencode/package.json, bun.lock, and the internal pin use 0.9.0 for all five platf…
Out of Scope Changes check Passed The changes stay within Issue #1554. The native guards, CLI and tool propagation, sql.analyze handling, lockfile updates, documentation pin, and regression tests all support the dependency upgrade a…
Title check Passed The title clearly and concisely identifies both primary changes: upgrading @altimateai/altimate-core and failing closed when policy or semantic analysis is skipped.
Description check Passed The description includes the issue reference, change type, detailed implementation rationale, behavior changes, verification results, screenshots status, cost impact, and completed checklist items.
Full details: Linked Issues check

Explanation

Issue #1554 requires the exact @altimateai/altimate-core 0.9.0 pin and a consumer compatibility check. packages/opencode/package.json, bun.lock, and the internal pin use 0.9.0 for all five platform bindings. The native policy and semantics handlers guard plan_unavailable and POLICY_SKIPPED results. sql.analyze, the check command, and the semantics tool surface skipped analysis. Tests cover three table-valued-function forms and an unaffected normal query. The reported test and typecheck results pass. The changed explain and equivalence outputs have no reported consumers.

Full details: Out of Scope Changes check

Explanation

The changes stay within Issue #1554. The native guards, CLI and tool propagation, sql.analyze handling, lockfile updates, documentation pin, and regression tests all support the dependency upgrade and its output changes. No unrelated product behavior is identified.

Full details: Docstring Coverage

Explanation

Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the query trail,
And finds a plan that is not there.
A skip is marked, a warning shown,
No missing check is called a pass.
The tests hop through each changed path,
Then rest beneath a carrot patch.

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@kilo-code-bot

kilo-code-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (9 files)
  • bun.lock
  • docs/internal/deterministic-checks-engine-split.md
  • packages/opencode/package.json
  • packages/opencode/src/altimate/native/altimate-core.ts
  • packages/opencode/src/altimate/native/sql/register.ts
  • packages/opencode/src/altimate/tools/altimate-core-semantics.ts
  • packages/opencode/src/cli/cmd/check.ts
  • packages/opencode/test/altimate/core-plan-skip-fail-closed.test.ts
  • packages/opencode/test/cli/check-e2e.test.ts
Previous Review Summary (commit 86c56fe)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 86c56fe)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • bun.lock
  • packages/opencode/package.json

Reviewed by gemini-4-argon · Input: 182.9K · Output: 4.5K · Cached: 1.6M

Review guidance: REVIEW.md from base branch main

…tic analysis

altimate-core 0.9.0 validates statements that 0.8.0 rejected as invalid
(table-valued functions such as `TABLE(fn())`, `LATERAL FLATTEN`,
`read_csv('x')`), but it has no logical plan for them. `checkPolicy` then
returns `allowed: true` with a `plan_unavailable` warning and
`policies_evaluated: 0`, and `checkSemantics` returns no findings with a
"plan-based analysis was skipped" note. Both read as clean.

- `altimate_core.policy` handler: treat a `plan_unavailable` / `POLICY_SKIPPED`
  warning as not evaluated: `allowed: false`, `policy_skipped: true`, plus a
  `policy_not_evaluated` error violation. CLI `check`, the agent policy tool
  and every other consumer inherit this.
- `altimate_core.semantics` handler: set `skipped` and `skip_reason` when the
  engine skipped analysis; `check --checks semantic` reports a finding (error
  with a schema, warning without) and the semantics tool reports `SKIPPED`
  instead of VALID.
- add tests pinning the 0.9.0 behavior for three TVF shapes and an unaffected
  normal query
- update the pin in `docs/internal/deterministic-checks-engine-split.md`

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: d33be78e-e817-44d1-b00a-8f5965128907)

@anandgupta42 anandgupta42 changed the title chore: bump @altimateai/altimate-core to 0.9.0 fix: bump @altimateai/altimate-core to 0.9.0 and fail closed on skipped policy/semantic analysis Oct 18, 2026
…t as evaluated

`sql.analyze` called `core.checkSemantics` directly, so a table-valued-function
statement (no plan, analysis skipped by altimate-core 0.9.0) still returned
confidence `high` with `semantics` listed as evaluated and "no issues".

- apply the same skip guard as `altimate_core.semantics`
- add a semantic warning issue, drop `semantics` from `confidence_factors` and
  lower confidence to `medium` when skipped
- add tests for a TVF statement and an unaffected normal query

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 4451fca3-0417-4b47-a890-2fc81372e0f7)

@anandgupta42
anandgupta42 merged commit 9348082 into main Oct 18, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump altimate-core to 0.9.0

1 participant