Skip to content

fix: resolve all 5 Verdaccio sanity test failures#572

Merged
anandgupta42 merged 1 commit intomainfrom
fix/verdaccio-sanity
Mar 29, 2026
Merged

fix: resolve all 5 Verdaccio sanity test failures#572
anandgupta42 merged 1 commit intomainfrom
fix/verdaccio-sanity

Conversation

@anandgupta42
Copy link
Copy Markdown
Contributor

@anandgupta42 anandgupta42 commented Mar 29, 2026

Summary

Fixes 5 failures in the Verdaccio sanity test suite (test/sanity/):

  • altimate-core napi binding + NAPI module failed: After npm install -g, dependencies live under the global prefix's node_modules, which node doesn't search by default. Set NODE_PATH to $(npm root -g) so require('@altimateai/altimate-core') resolves correctly.
  • --help contains upstream branding: Replace leftover "opencode" references in user-facing describe strings (uninstall, tui/thread, pr commands) and internal API docs (server.ts, config.ts) with "altimate-code".
  • no drivers resolvable at all: Set NODE_PATH in the driver resolvability check loop (same root cause as NAPI fix), and install duckdb alongside the main package so at least one peer dependency is present for validation.
  • hardcoded CI paths found: Restrict the grep to JS/JSON files only (--include='*.js' etc.) — Bun's single-file compiler embeds build-machine paths in binary debug info which is unavoidable and harmless.

Test plan

  • Run Verdaccio sanity suite: docker compose -f test/sanity/docker-compose.verdaccio.yml up --build --abort-on-container-exit --exit-code-from sanity
  • Verify all 5 previously failing tests now pass
  • Verify no regressions in other sanity phases
  • Verify altimate --help and altimate run --help contain no "opencode" branding leaks

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated CLI command descriptions, configuration documentation, and API metadata to reflect product name change from "opencode" to "altimate-code".
  • Tests

    • Improved installation verification scripts with enhanced module resolution for globally installed packages.
    • Optimized asset scanning in verification to target JavaScript and JSON files while excluding compiled binaries and sourcemaps.

- altimate-core NAPI binding: set `NODE_PATH` to global npm root so
  `require('@altimateai/altimate-core')` resolves after `npm install -g`
- upstream branding: replace "opencode" with "altimate-code" in user-facing
  `describe` strings (uninstall, tui, pr commands, config, server API docs)
- driver resolvability: set `NODE_PATH` in driver check loop and install
  `duckdb` alongside the main package so at least one peer dep is present
- hardcoded CI paths: restrict grep to JS/JSON files only — compiled Bun
  binaries embed build-machine paths in debug info which is unavoidable
- NAPI module exports: already had correct `NODE_PATH` in extended test;
  root cause was the base test (fix 1) which is now resolved

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

📝 Walkthrough

Walkthrough

This pull request updates product branding references from "opencode" to "altimate-code" across CLI commands, configuration schemas, and API documentation. Additionally, test scripts are modified to handle npm global installation layouts and add duckdb to the global install step.

Changes

Cohort / File(s) Summary
Branding Updates
packages/opencode/src/cli/cmd/pr.ts, packages/opencode/src/cli/cmd/tui/thread.ts, packages/opencode/src/cli/cmd/uninstall.ts, packages/opencode/src/config/config.ts, packages/opencode/src/server/server.ts
Updated CLI command descriptions, configuration schema descriptions, and OpenAPI documentation metadata from "opencode" to "altimate-code".
Test Script Enhancements
test/sanity/phases/verify-install-extended.sh
Refined file type filtering in CI path leakage detection to exclude compiled binaries, native modules, and sourcemaps; added clarifying comments about exclusions.
Install Resolvability Fixes
test/sanity/phases/verify-install.sh
Added NODE_PATH environment variable configuration to support npm global installation layouts for resolving @altimateai/altimate-core and driver packages.
Global Install Dependencies
test/sanity/verdaccio/entrypoint.sh
Added duckdb to the global npm install step alongside altimate-code@$VERSION.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #503: Directly modifies test/sanity/verdaccio/entrypoint.sh for global install configuration.
  • PR #411: Adds duckdb to install/test flows and adjusts related test setup.
  • PR #514: Adjusts driver/install/resolvability behavior in the same sanity test scripts.

Suggested labels

contributor

Poem

🐰 From "opencode" to "altimate" it flows,
With branding fresh as spring that grows,
And install paths now properly set,
So Node resolves without regret,
DuckDB joins the global feast—hooray! 🥳

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: resolving 5 Verdaccio sanity test failures, which aligns with the changeset's primary focus across multiple files.
Description check ✅ Passed The description comprehensively covers all required sections: Summary explains what changed and why (5 test fixes with specific root causes), Test Plan outlines validation steps, and Checklist indicates status of required items.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/verdaccio-sanity

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

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/sanity/verdaccio/entrypoint.sh (1)

167-169: Pin duckdb to a major version to ensure test determinism.

The sanity suite installs duckdb as a peer dependency to test driver resolution. Without a version constraint, future duckdb 2.x releases could break this pipeline if incompatible with the locked altimate-code version. Pinning to @1 aligns with the existing "duckdb": "^1.0.0" peer dependency constraint in packages/drivers/package.json and prevents unrelated upstream breaking changes from affecting this test.

♻️ Proposed change
-npm install -g "altimate-code@$VERSION" duckdb --registry "$REGISTRY_URL" 2>&1
+npm install -g "altimate-code@$VERSION" "duckdb@1" --registry "$REGISTRY_URL" 2>&1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/sanity/verdaccio/entrypoint.sh` around lines 167 - 169, Update the npm
install command in entrypoint.sh to pin duckdb to the major v1 series to avoid
future breaking 2.x releases; replace the unpinned "duckdb" token in the npm
install invocation (the line that runs npm install -g "altimate-code@$VERSION"
duckdb --registry "$REGISTRY_URL" 2>&1) with a pinned spec such as "duckdb@1"
(or "duckdb@^1.0.0") so it matches the drivers' peer dependency major version.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/src/cli/cmd/pr.ts`:
- Line 9: The command description string and the runtime behavior are
inconsistent: the "description" field says it runs "altimate-code" but the
handler still logs "Starting opencode..." and spawns the "opencode" binary. Fix
by making them consistent—either change the description to say it runs
"opencode" or update the handler to log "Starting altimate-code..." and spawn
the "altimate-code" binary; update the description field, the handler function
(the log statement "Starting opencode...") and the spawn/exec invocation that
currently calls "opencode" so all three refer to the same binary name.

---

Nitpick comments:
In `@test/sanity/verdaccio/entrypoint.sh`:
- Around line 167-169: Update the npm install command in entrypoint.sh to pin
duckdb to the major v1 series to avoid future breaking 2.x releases; replace the
unpinned "duckdb" token in the npm install invocation (the line that runs npm
install -g "altimate-code@$VERSION" duckdb --registry "$REGISTRY_URL" 2>&1) with
a pinned spec such as "duckdb@1" (or "duckdb@^1.0.0") so it matches the drivers'
peer dependency major version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4f64ff24-d567-4fc8-a9bd-63d14999a049

📥 Commits

Reviewing files that changed from the base of the PR and between 22c9c38 and 8505605.

📒 Files selected for processing (8)
  • packages/opencode/src/cli/cmd/pr.ts
  • packages/opencode/src/cli/cmd/tui/thread.ts
  • packages/opencode/src/cli/cmd/uninstall.ts
  • packages/opencode/src/config/config.ts
  • packages/opencode/src/server/server.ts
  • test/sanity/phases/verify-install-extended.sh
  • test/sanity/phases/verify-install.sh
  • test/sanity/verdaccio/entrypoint.sh

export const PrCommand = cmd({
command: "pr <number>",
describe: "fetch and checkout a GitHub PR branch, then run opencode",
describe: "fetch and checkout a GitHub PR branch, then run altimate-code",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Command description now conflicts with actual launched binary/message.

Line 9 says this command runs altimate-code, but the handler still logs “Starting opencode...” and spawns opencode. Please align either the description or runtime text/command to avoid user confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/opencode/src/cli/cmd/pr.ts` at line 9, The command description
string and the runtime behavior are inconsistent: the "description" field says
it runs "altimate-code" but the handler still logs "Starting opencode..." and
spawns the "opencode" binary. Fix by making them consistent—either change the
description to say it runs "opencode" or update the handler to log "Starting
altimate-code..." and spawn the "altimate-code" binary; update the description
field, the handler function (the log statement "Starting opencode...") and the
spawn/exec invocation that currently calls "opencode" so all three refer to the
same binary name.

@anandgupta42 anandgupta42 merged commit 7d1c9f4 into main Mar 29, 2026
15 checks passed
anandgupta42 added a commit that referenced this pull request Mar 29, 2026
- altimate-core NAPI binding: set `NODE_PATH` to global npm root so
  `require('@altimateai/altimate-core')` resolves after `npm install -g`
- upstream branding: replace "opencode" with "altimate-code" in user-facing
  `describe` strings (uninstall, tui, pr commands, config, server API docs)
- driver resolvability: set `NODE_PATH` in driver check loop and install
  `duckdb` alongside the main package so at least one peer dep is present
- hardcoded CI paths: restrict grep to JS/JSON files only — compiled Bun
  binaries embed build-machine paths in debug info which is unavoidable
- NAPI module exports: already had correct `NODE_PATH` in extended test;
  root cause was the base test (fix 1) which is now resolved

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
anandgupta42 added a commit that referenced this pull request Mar 29, 2026
…ccess retry (#571)

* fix: defensive null guards in tool formatters and DuckDB concurrent access retry (#570)

- Add null/undefined guards across 8 tool formatters to prevent literal
  `undefined` in user-facing output (sql-analyze, schema-inspect,
  sql-translate, dbt-manifest, finops-analyze-credits, warehouse-list,
  altimate-core-check, altimate-core-rewrite)
- Add `error: msg` to catch block metadata in schema-inspect,
  dbt-manifest, warehouse-list so telemetry can classify exceptions
- DuckDB driver: auto-retry in `READ_ONLY` mode on `database is locked`
  errors, with clear actionable error message
- Add simulation suite (839 mock + 346 real E2E scenarios) covering
  10 personas x 11 dialects x 14 use-case categories

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add telemetry intelligence signals for debugging and improvements (#564)

* feat: add implicit quality signal telemetry event

Add `task_outcome_signal` event that maps agent outcomes to behavioral
signals (accepted/error/abandoned/cancelled). Emitted alongside
`agent_outcome` at session end with zero user cost — pure client-side
computation from data already in memory.

- New event type with `signal`, `tool_count`, `step_count`, `duration_ms`,
  `last_tool_category` fields
- Exported `deriveQualitySignal()` for testable outcome→signal mapping
- MCP tool detection via `mcp__` prefix for accurate categorization
- 8 unit tests covering all signal derivations and event shape

Closes AI-6028

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add task intent classification telemetry event

Add `task_classified` event emitted at session start with keyword/regex
classification of the first user message. Categories: debug_dbt, write_sql,
optimize_query, build_model, analyze_lineage, explore_schema, migrate_sql,
manage_warehouse, finops, general.

- `classifyTaskIntent()` — pure regex matcher, zero LLM cost, <1ms
- Includes warehouse type from fingerprint cache
- Strong/weak confidence levels (1.0 vs 0.5)
- 15 unit tests covering all intent categories + edge cases

Closes AI-6029

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: emit aggregated tool chain outcome at session end

Add `tool_chain_outcome` event that captures the ordered tool sequence,
error count, recovery count, and final outcome at session end. Only
emitted when tools were actually used (non-empty chain).

- Tracks up to 50 tool names in execution order
- Detects error→success recovery patterns for auto-fix insights
- Aggregates existing per-tool-call data — near-zero additional cost
- 3 unit tests for event shape and error/recovery tracking

Closes AI-6030

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: link error-recovery pairs with hashed fingerprint

Add `error_fingerprint` event emitted per unique error at session end.
SHA256-hashes normalized error messages for anonymous grouping, links
each error to its recovery tool (if the next tool succeeded).

- `hashError()` — 16-char hex hash of masked error messages
- Tracks error→recovery pairs during tool chain execution
- Capped at 20 fingerprints per session to bound telemetry volume
- 4 unit tests for hashing, event shape, and recovery tracking

Closes AI-6031

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: emit SQL structure fingerprint using altimate-core

Add `sql_fingerprint` event emitted after successful SQL execution via
`sql_execute`. Uses `extractMetadata()` + `getStatementTypes()` from
altimate-core NAPI — local parsing, no API calls, ~1-5ms.

- Captures: statement types, categories, table/function count,
  subqueries, aggregation, window functions, AST node count
- No table/column names or SQL content — PII-safe by design
- Wrapped in try/catch so fingerprinting never breaks query execution
- `computeSqlFingerprint()` exported from sql-classify for reuse
- 6 unit tests including PII safety verification

Closes AI-6032

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: expand environment_census with dbt project fingerprint

Add optional dbt project metrics to the existing `environment_census`
event: snapshot/seed count buckets, materialization distribution
(table/view/incremental/ephemeral counts). Data already parsed at
startup — just extracts more fields from the same manifest parse.

- Backward compatible — new fields are optional
- No extra file reads or API calls

Closes AI-6033

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: emit schema complexity signal during warehouse introspection

Add `schema_complexity` event emitted alongside `warehouse_introspection`
after successful schema indexing. Uses data already computed during
introspection — no extra warehouse queries.

- Bucketed table/column/schema counts + avg columns per table
- Division-by-zero guard for empty warehouses
- Emitted inside existing try/catch — never breaks introspection

Closes AI-6034

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: update telemetry reference with 7 new intelligence signals

Add task_outcome_signal, task_classified, tool_chain_outcome,
error_fingerprint, sql_fingerprint, schema_complexity to the event
catalog. Update environment_census description for new dbt fields.
Update naming convention section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add comprehensive integration tests for telemetry signals

Add 38 integration tests that verify all 7 telemetry signals fire
through real code paths with spy on Telemetry.track():

- Signal 1: quality signal derivation + error/abandoned/cancelled cases
- Signal 2: intent classifier with 10 real DE prompts + PII safety
- Signal 3: tool chain collection with error recovery state machine
- Signal 4: error fingerprint hashing + consecutive error flush
- Signal 5: SQL fingerprint via altimate-core (aggregation, CTE, DDL)
- Signal 6: environment_census expansion + backward compatibility
- Signal 7: schema complexity bucketing + zero-table edge case
- Full E2E: complete session simulation with all 7 signals in order

Also fixes regex patterns for natural language flexibility:
- dbt debug: allows words between "dbt" and error keywords
- migrate: allows words between "to/from" and warehouse name

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add altimate-core failure isolation tests

Verify computeSqlFingerprint resilience when altimate-core NAPI:
- throws (segfault, OOM) — returns null, never leaks exception
- returns undefined — uses safe defaults (empty arrays, 0 counts)
- returns garbage data — handled gracefully via ?? fallbacks

Also verifies sql-execute.ts code structure ensures fingerprinting
runs AFTER query result and is wrapped in isolated try/catch.

Tests crash-resistant SQL inputs (control chars, empty, incomplete,
very wide queries) and deterministic output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address stakeholder review findings

Fixes from 5-stakeholder review (architect, privacy, perf, markers, tests):

- Marker fix: remove nested altimate_change start/end, fold new variables
  into existing session telemetry tracking block
- Performance: cap errorRecords at 200 entries (prevent unbounded growth)
- Performance: slice intent classifier input to 2000 chars (bound regex)
- Architecture: fix import path in sql-execute.ts (../telemetry not ../../altimate/telemetry)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump altimate-core to 0.2.6

Picks up extractMetadata fixes:
- Aggregate function names (COUNT, SUM, AVG, etc.) now in functions array
- IN (SELECT ...) and EXISTS (SELECT ...) subquery detection
- Any/All quantified comparison subquery detection (guarded)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve all 5 Verdaccio sanity test failures (#572)

- altimate-core NAPI binding: set `NODE_PATH` to global npm root so
  `require('@altimateai/altimate-core')` resolves after `npm install -g`
- upstream branding: replace "opencode" with "altimate-code" in user-facing
  `describe` strings (uninstall, tui, pr commands, config, server API docs)
- driver resolvability: set `NODE_PATH` in driver check loop and install
  `duckdb` alongside the main package so at least one peer dep is present
- hardcoded CI paths: restrict grep to JS/JSON files only — compiled Bun
  binaries embed build-machine paths in debug info which is unavoidable
- NAPI module exports: already had correct `NODE_PATH` in extended test;
  root cause was the base test (fix 1) which is now resolved

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant