Skip to content

fix(cli): strip endpoint trailing slashes in linear time, deflake projection test - #8285

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/cli-endpoint-redos-projection-test
Sep 25, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/cli-endpoint-redos-projection-test

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • normalizeEndpoint strips trailing / with a backward scan instead of /\/+$/, which is quadratic on a long run of / that doesn't reach the end (100k slashes: ~5.3s before, instant after). Resolves CodeQL js/polynomial-redos on packages/sim-cli/src/config/profile.ts
  • knowledge-projection.integration.ts fixture uses its own one-hot vector (dimension 511, inside the 512-dim candidate projection) instead of [1, 0, …]. Its vector assertions walk the approximate HNSW index, and ~10 other integration files write identical [1, 0, …] rows into the same database; tied at distance 0, those could exhaust the walk's max_scan_tuples cap before it reached this file's second chunk, so "makes a new chunk searchable" flaked in both sync and async modes depending on file order

Type of Change

  • Bug fix

Testing

  • Added a CLI test: inner slashes are kept and a 100k-slash endpoint normalizes in well under 1s (the old regex takes ~5.3s, so the test fails against it)
  • profile.test.ts 57/57, sim-cli type-check, lint, check:audits (49) and docs-manifest:check pass
  • Projection fix verified by CI's PostgreSQL integration job

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 25, 2026 1:47am UTC

Request Review

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Fixes endpoint normalization and test flakiness in CLI config.

The PR appears safe to merge.

Summary

The PR replaces trailing-slash regex removal with a backward scan and changes the projection integration fixture to use a distinct vector direction.

  • Adds coverage for inner slashes and a long endpoint input.
  • Moves the fixture’s one-hot value to a dimension retained by candidate projection.

Reviews (1) · Last reviewed commit: "fix(cli): strip endpoint trailing slashe..."

@waleedlatif1
waleedlatif1 merged commit 4fd0b06 into staging Sep 25, 2026
25 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/cli-endpoint-redos-projection-test branch September 25, 2026 01:51

This branch was previously deployed

1 inactive deployment
Preview — edf3c5d6 Deployed Sep 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant