-
Notifications
You must be signed in to change notification settings - Fork 33
test: consolidate 18 test PRs — 434 new tests, deduplicated, with bug fixes #545
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
40 commits
Select commit
Hold shift + click to select a range
4ca066f
test: MCP auth — URL validation, token expiry, and client secret life…
claude 9c5b445
test: copilot provider — finish reason mapping and tool preparation
claude fa6288b
test: log-buffer, RWLock concurrency, SSE chunk splitting — 13 new tests
claude 4c39dd6
test: SQL tool formatters — check, equivalence, semantics (38 tests)
claude 01cd4b2
test: stats display + MCP OAuth XSS prevention — 26 new tests
claude f876f7d
test: util — proxy detection and lazy error recovery
claude 5cc85f7
test: session compaction — observation mask and arg truncation
claude 694db3c
test: bus — publish/subscribe/once/unsubscribe mechanics
claude 0ac0b71
test: lazy utility and credential-store — error retry, reset, sensiti…
claude c4a6ca2
test: provider/transform — temperature, topP, topK, smallOptions, max…
claude cd8f16c
test: fingerprint + context — fill coverage gaps in core utilities
claude 3d028c2
test: session todo — CRUD lifecycle with database persistence
claude c53bf3a
test: finops recommendations + dbt manifest edge cases — 12 new tests
claude c55940b
test: provider — sampling parameter functions (temperature, topP, topK)
claude 7e64c74
test: session utilities — isDefaultTitle, fromRow/toRow, createObserv…
claude eb24377
test: provider — temperature, topP, topK model parameter defaults
claude 4a458fe
test: agent — .env read protection and analyst write denial
claude 72819b1
test: docker discovery + copilot provider compatibility
claude fe56135
Merge remote-tracking branch 'origin/test/hourly-20260327-1609' into …
anandgupta42 365d150
Merge remote-tracking branch 'origin/test/hourly-20260327-2019' into …
anandgupta42 2bba8dc
Merge remote-tracking branch 'origin/test/hourly-20260327-2119' into …
anandgupta42 c1df79c
Merge remote-tracking branch 'origin/test/hourly-20260327-2213' into …
anandgupta42 7182c23
Merge remote-tracking branch 'origin/test/hourly-20260328-0321' into …
anandgupta42 1fe1540
Merge remote-tracking branch 'origin/test/hourly-20260328-0627' into …
anandgupta42 7cb4368
Merge remote-tracking branch 'origin/test/hourly-20260328-0722' into …
anandgupta42 b898f34
Merge remote-tracking branch 'origin/test/hourly-20260328-0813' into …
anandgupta42 6e1f2e3
Merge remote-tracking branch 'origin/test/hourly-20260328-1318' into …
anandgupta42 1eceef3
Merge remote-tracking branch 'origin/test/hourly-20260328-1020' into …
anandgupta42 3ee3250
Merge remote-tracking branch 'origin/test/hourly-20260327-2311' into …
anandgupta42 f66e053
Merge remote-tracking branch 'origin/test/hourly-20260328-0414' into …
anandgupta42 1957eb5
Merge remote-tracking branch 'origin/test/hourly-20260328-0507' into …
anandgupta42 b565bd7
Merge remote-tracking branch 'origin/test/hourly-20260328-0910' into …
anandgupta42 4610f26
Merge remote-tracking branch 'origin/test/hourly-20260328-1210' into …
anandgupta42 abb3c40
Merge remote-tracking branch 'origin/test/hourly-20260327-1918' into …
anandgupta42 131974a
Merge remote-tracking branch 'origin/test/hourly-20260328-1414' into …
anandgupta42 3109411
Merge remote-tracking branch 'origin/test/hourly-20260328-0108' into …
anandgupta42 c4eff01
test: consolidate 18 test PRs — 434 new tests, deduplicated, with bug…
anandgupta42 8a4b557
fix: resolve typecheck errors in test files
anandgupta42 3c298ff
fix: remove flaky `setTimeout` in todo bus event test
anandgupta42 5c7de83
fix: address CodeRabbit review feedback
anandgupta42 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| release: v0.5.11 | ||
| fix: remove flaky `setTimeout` in todo bus event test | ||
|
|
||
| Update README changelog to reflect releases v0.5.1 through v0.5.11. | ||
| Previous README only listed up to v0.5.0, missing 10 versions of features | ||
| including `check` CLI, skill management, session tracing, Codespaces support, | ||
| impact analysis, Snowflake Cortex, MCP auto-discovery, and more. | ||
| `Bus.publish` is synchronous — the event is delivered immediately, | ||
| no 50ms delay needed. Removes resource contention risk in parallel CI. | ||
|
|
||
| Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
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,51 @@ | ||
| import { describe, test, expect, beforeEach } from "bun:test" | ||
| import { bufferLog, getRecentDbtLogs, clearDbtLogs } from "../src/log-buffer" | ||
|
|
||
| describe("dbt log-buffer", () => { | ||
| beforeEach(() => { | ||
| clearDbtLogs() | ||
| }) | ||
|
|
||
| test("buffers log messages in insertion order", () => { | ||
| bufferLog("first") | ||
| bufferLog("second") | ||
| bufferLog("third") | ||
| expect(getRecentDbtLogs()).toEqual(["first", "second", "third"]) | ||
| }) | ||
|
|
||
| test("evicts oldest entries when buffer exceeds 100", () => { | ||
| for (let i = 0; i < 105; i++) { | ||
| bufferLog(`msg-${i}`) | ||
| } | ||
| const logs = getRecentDbtLogs() | ||
| expect(logs).toHaveLength(100) | ||
| expect(logs[0]).toBe("msg-5") | ||
| expect(logs[99]).toBe("msg-104") | ||
| }) | ||
|
|
||
| test("clearDbtLogs empties the buffer", () => { | ||
| bufferLog("something") | ||
| clearDbtLogs() | ||
| expect(getRecentDbtLogs()).toEqual([]) | ||
| }) | ||
|
|
||
| test("getRecentDbtLogs returns a copy, not a reference", () => { | ||
| bufferLog("original") | ||
| const copy = getRecentDbtLogs() | ||
| copy.push("injected") | ||
| expect(getRecentDbtLogs()).toEqual(["original"]) | ||
| }) | ||
|
|
||
| test("handles empty buffer", () => { | ||
| expect(getRecentDbtLogs()).toEqual([]) | ||
| }) | ||
|
|
||
| test("buffer stays at exactly 100 after repeated overflow", () => { | ||
| for (let i = 0; i < 200; i++) { | ||
| bufferLog(`msg-${i}`) | ||
| } | ||
| expect(getRecentDbtLogs()).toHaveLength(100) | ||
| expect(getRecentDbtLogs()[0]).toBe("msg-100") | ||
| expect(getRecentDbtLogs()[99]).toBe("msg-199") | ||
| }) | ||
| }) |
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
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
151 changes: 151 additions & 0 deletions
151
packages/opencode/test/altimate/altimate-core-check-formatters.test.ts
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,151 @@ | ||
| import { describe, test, expect } from "bun:test" | ||
| import { formatCheckTitle, formatCheck } from "../../src/altimate/tools/altimate-core-check" | ||
|
|
||
| describe("formatCheckTitle", () => { | ||
| test("returns PASS for all-clean result", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { clean: true, findings: [] }, | ||
| safety: { safe: true }, | ||
| pii: { findings: [] }, | ||
| } | ||
| expect(formatCheckTitle(data)).toBe("PASS") | ||
| }) | ||
|
|
||
| test("lists all failure categories when everything fails", () => { | ||
| const data = { | ||
| validation: { valid: false, errors: [{ message: "bad syntax" }] }, | ||
| lint: { clean: false, findings: [{ rule: "L001" }, { rule: "L002" }] }, | ||
| safety: { safe: false, threats: [{ type: "injection" }] }, | ||
| pii: { findings: [{ column: "ssn", category: "SSN" }] }, | ||
| } | ||
| const result = formatCheckTitle(data) | ||
| expect(result).toContain("validation errors") | ||
| expect(result).toContain("2 lint findings") | ||
| expect(result).toContain("safety threats") | ||
| expect(result).toContain("PII detected") | ||
| }) | ||
|
|
||
| test("treats missing sections as failures (undefined is falsy)", () => { | ||
| // When data is empty, !undefined is true, so each section looks like a failure | ||
| const data = {} as Record<string, any> | ||
| const result = formatCheckTitle(data) | ||
| expect(result).toContain("validation errors") | ||
| expect(result).toContain("safety threats") | ||
| // lint.findings?.length is undefined, ?? 0 yields "0 lint findings" | ||
| expect(result).toContain("0 lint findings") | ||
| }) | ||
|
|
||
| test("shows lint finding count when clean is false but findings is undefined", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { clean: false }, | ||
| safety: { safe: true }, | ||
| pii: { findings: [] }, | ||
| } | ||
| // lint.findings?.length is undefined, ?? 0 yields "0 lint findings" | ||
| expect(formatCheckTitle(data)).toBe("0 lint findings") | ||
| }) | ||
|
|
||
| test("only shows failing sections, not passing ones", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { clean: true }, | ||
| safety: { safe: false, threats: [{ type: "drop_table" }] }, | ||
| pii: { findings: [] }, | ||
| } | ||
| expect(formatCheckTitle(data)).toBe("safety threats") | ||
| }) | ||
| }) | ||
|
|
||
| describe("formatCheck", () => { | ||
| test("formats all-pass result with four sections", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { clean: true }, | ||
| safety: { safe: true }, | ||
| pii: { findings: [] }, | ||
| } | ||
| const output = formatCheck(data) | ||
| expect(output).toContain("=== Validation ===") | ||
| expect(output).toContain("Valid SQL.") | ||
| expect(output).toContain("=== Lint ===") | ||
| expect(output).toContain("No lint findings.") | ||
| expect(output).toContain("=== Safety ===") | ||
| expect(output).toContain("Safe — no threats.") | ||
| expect(output).toContain("=== PII ===") | ||
| expect(output).toContain("No PII detected.") | ||
| }) | ||
|
|
||
| test("formats validation errors", () => { | ||
| const data = { | ||
| validation: { valid: false, errors: [{ message: "syntax error at line 3" }, { message: "unknown column" }] }, | ||
| lint: { clean: true }, | ||
| safety: { safe: true }, | ||
| pii: {}, | ||
| } | ||
| const output = formatCheck(data) | ||
| expect(output).toContain("Invalid: syntax error at line 3; unknown column") | ||
| }) | ||
|
|
||
| test("formats lint findings with severity and rule", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { | ||
| clean: false, | ||
| findings: [ | ||
| { severity: "warning", rule: "L001", message: "Unnecessary whitespace" }, | ||
| { severity: "error", rule: "L003", message: "Indentation not consistent" }, | ||
| ], | ||
| }, | ||
| safety: { safe: true }, | ||
| pii: {}, | ||
| } | ||
| const output = formatCheck(data) | ||
| expect(output).toContain("[warning] L001: Unnecessary whitespace") | ||
| expect(output).toContain("[error] L003: Indentation not consistent") | ||
| }) | ||
|
|
||
| test("formats safety threats", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { clean: true }, | ||
| safety: { | ||
| safe: false, | ||
| threats: [{ severity: "critical", type: "sql_injection", description: "Tautology detected: 1=1" }], | ||
| }, | ||
| pii: {}, | ||
| } | ||
| const output = formatCheck(data) | ||
| expect(output).toContain("[critical] sql_injection: Tautology detected: 1=1") | ||
| }) | ||
|
|
||
| test("formats PII findings with column and confidence", () => { | ||
| const data = { | ||
| validation: { valid: true }, | ||
| lint: { clean: true }, | ||
| safety: { safe: true }, | ||
| pii: { | ||
| findings: [ | ||
| { column: "ssn", category: "SSN", confidence: "high" }, | ||
| { column: "email", category: "EMAIL", confidence: "medium" }, | ||
| ], | ||
| }, | ||
| } | ||
| const output = formatCheck(data) | ||
| expect(output).toContain("ssn: SSN (high confidence)") | ||
| expect(output).toContain("email: EMAIL (medium confidence)") | ||
| }) | ||
|
|
||
| test("handles empty/missing sections without crashing", () => { | ||
| const data = {} as Record<string, any> | ||
| const output = formatCheck(data) | ||
| // Should still produce all four section headers | ||
| expect(output).toContain("=== Validation ===") | ||
| expect(output).toContain("=== Lint ===") | ||
| expect(output).toContain("=== Safety ===") | ||
| expect(output).toContain("=== PII ===") | ||
| // validation.valid is undefined (falsy) → "Invalid: unknown" | ||
| expect(output).toContain("Invalid:") | ||
| }) | ||
| }) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propagate extracted errors into formatted output.
Now that
extractEquivalenceErrorscan surface validation failures,executeshould pass that resolvederrorintoformatEquivalence; otherwise output can conflict with error title/metadata (see Line 55).🛠️ Suggested fix
🤖 Prompt for AI Agents