Skip to content

test: [#883] harden #881 guard — loosen regex + sweep all altimate-core tool descriptions#884

Merged
anandgupta42 merged 1 commit into
mainfrom
test/altimate-core-desc-sweep
Jun 4, 2026
Merged

test: [#883] harden #881 guard — loosen regex + sweep all altimate-core tool descriptions#884
anandgupta42 merged 1 commit into
mainfrom
test/altimate-core-desc-sweep

Conversation

@anandgupta42
Copy link
Copy Markdown
Contributor

@anandgupta42 anandgupta42 commented Jun 4, 2026

What does this PR do?

Hardens the #881 regression guard added in #882 (test-only — no runtime change).

  1. Loosens the false-claim regex from /requires?\b[^.]{0,40}\bapi key\b/ to /requires?\b.*?\bapi key\b/, so a long-gap variant like "requires an API key for authentication" can't slip through the 40-char cap. It still does not false-positive on the legitimate "no API key required" copy (there "required" follows "api key", so the require→api-key order never matches).
  2. Adds a source sweep over every altimate-core-*.ts tool, asserting none contains the unambiguous altimate_core.init marker — the fingerprint of the old Python-bridge "needs an API key" claim. No native engine tool calls a dispatcher method by that name, so any occurrence is a regression. Scanning the source (rather than two hard-coded tools) auto-covers tools added later.

Raised by the multi-model review of #882 (DeepSeek V3.2 + Gemini 3.1 Pro).

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other: test hardening

Issue for this PR

Closes #883

How did you verify your code works?

  • bun test test/altimate/altimate-core-tool-descriptions.test.ts → 30 pass / 0 fail (2 focused + 27-file sweep + 1 non-empty guard).
  • Confirmed the sweep is false-positive-free: grep -rn "altimate_core.init" packages/opencode/src/altimate/tools/altimate-core-*.ts → 0 matches across all 27 files.
  • Confirmed the loosened regex still passes against the shipped "no API key required" copy (positive toContain("no api key") assertion guards the corrected wording).
  • bun run typecheck clean; prettier --check clean; marker check reports no upstream-shared files touched.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Summary by cubic

Hardened the #881 regression guard in tests by loosening the false-claim regex and adding a sweep across all altimate-core-* tools to block the old “needs an API key” marker. Test-only; no runtime changes. Addresses #883.

  • Bug Fixes
    • Updated regex from /requires?\b[^.]{0,40}\bapi key\b/ to /requires?\b.*?\bapi key\b/ to catch long-gap variants; still ignores valid “no API key required”.
    • Added a source sweep over altimate-core-*.ts to assert no altimate_core.init occurrences, covering future tools automatically.

Written for commit 2f92369. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Tests
    • Enhanced regression protection for altimate-core tool descriptions with improved validation of API key requirement documentation.
    • Added automated scanning to prevent stale documentation markers from being reintroduced in new tools.

…re tool descriptions

Follow-up to #882. Two test-only improvements to the regression guard:

- Loosen the false-claim regex from `/requires?\b[^.]{0,40}\bapi key\b/` to
  `/requires?\b.*?\bapi key\b/` so long-gap variants ("requires an API key for
  authentication") can't slip through. Still does not match the legitimate
  "no API key required" copy (there "required" follows "api key").
- Add a source sweep over every `altimate-core-*.ts` tool asserting none
  contains the stale `altimate_core.init` marker — the unambiguous fingerprint
  of the Python-bridge-era "needs an API key" claim. No native engine tool calls
  a dispatcher method by that name, so any occurrence is a regression, and
  scanning the source auto-covers tools added later (the original guard only
  covered the two known tools).

Closes #883

Co-Authored-By: Claude Opus 4.8 (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 Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1474c477-c8bf-43b8-93af-2dddacc03347

📥 Commits

Reviewing files that changed from the base of the PR and between ec540eb and 2f92369.

📒 Files selected for processing (1)
  • packages/opencode/test/altimate/altimate-core-tool-descriptions.test.ts

📝 Walkthrough

Walkthrough

This test-only PR hardens regression protection for altimate-core tool descriptions. It loosens the existing API key detection regex to catch longer variants, and adds a new directory-wide file scan that asserts all altimate-core tools lack the stale altimate_core.init marker.

Changes

Tool Description Regression Guards

Layer / File(s) Summary
Enhanced API key detection regex
packages/opencode/test/altimate/altimate-core-tool-descriptions.test.ts
The per-tool description assertion replaces a 40-character-bounded pattern with an unbounded lazy regex that detects longer "requires an API key…" variants while maintaining the "no api key" positive assertion.
Directory-wide tool source marker guard
packages/opencode/test/altimate/altimate-core-tool-descriptions.test.ts
Adds file-system imports and a new test suite that scans the entire src/altimate/tools directory for all altimate-core-*.ts sources and asserts none contain the unambiguous altimate_core.init marker, preventing newly added tools from reintroducing the false claim.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • AltimateAI/altimate-code#882: Earlier hardening of the same test file's regression guards for the original #881 fix; this PR extends that protection with looser regex and directory-wide scanning.

Suggested labels

contributor

🐰 A sweep across the tools so fine,
No stale init markers shall shine,
With regex unbounded, the guard stands proud,
Catching all variants in the code crowd!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description does not include the required 'PINEAPPLE' identifier at the top as mandated by the description template for AI-generated contributions. Add 'PINEAPPLE' at the very beginning of the PR description before any other content to meet the AI contribution requirement.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: hardening a regression guard by loosening a regex pattern and adding a comprehensive sweep across all altimate-core tools.
Linked Issues check ✅ Passed The changes fully address both objectives from #883: loosening the regex pattern and implementing a source sweep across all altimate-core tools to detect the stale altimate_core.init marker.
Out of Scope Changes check ✅ Passed All changes are scoped to test hardening as specified in #883—no runtime code modifications or unrelated alterations are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 test/altimate-core-desc-sweep

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

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

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@anandgupta42 anandgupta42 merged commit b61893e into main Jun 4, 2026
20 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.

Harden #881 regression guard: loosen regex + sweep all altimate-core tool descriptions

1 participant