Repository navigation
fix(cursor): keep buildHeaders synchronous so it honors the BaseExecutor contract - #15731
Merged
Merged
Conversation
…tor contract ef3b71c made CursorExecutor.buildHeaders async to read the refreshable CLI client version, but the lookup never awaits anything (it answers from env, a local install, the disk cache or the pin and refreshes in the background). The async override broke the BaseExecutor signature (TS2416 / TS2322 in executors/{cursor,credential,index}.ts, red API Route Typecheck) and would hand a Promise to any caller that uses the result directly. Expose the same lookup as getCursorAgentCliVersionSync, keep getCursorAgentCliVersion as an async wrapper for existing callers, and make the override synchronous again. Behavior is unchanged.
…-buildheaders-contract
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ef3b71c6(#15642) madeCursorExecutor.buildHeadersasyncto read the refreshable Cursor CLI client version. That override no longer matchesBaseExecutor.buildHeaders(sync, returnsRecord<string,string>), which turned theAPI Route Typecheckjob red on the release tip (TS2416inexecutors/cursor.tsandTS2322x8 inexecutors/{credential,index}.ts) and would hand a Promise to any caller that uses the result directly (e.g. the base-class paths inbase.ts).The async was never needed:
getCursorAgentCliVersion()awaits nothing — it answers from env, a local install, the disk cache or the pin, and fires the installer scrape in the background.Fix (behavior unchanged):
getCursorAgentCliVersionSync();getCursorAgentCliVersion()as an async wrapper for existing callers;CursorExecutor.buildHeaderssynchronous again.Validation (TDD, Hard Rule #18):
tests/unit/cursor-build-headers-sync-contract.test.tsfails on the tip (buildHeaders returns a Promise; the sync lookup does not exist) and passes with the change. 41/41 across the Cursor suites;check-api-typecheckexits 0 (the 4 Cursor/executor regressions are gone);typecheck:coreandcheck:open-sse-typecheckpass.check-mutation-test-coveragelists 13 covering tests missing fromstryker.conf.jsonon the tip, andcheck-env-doc-syncreportsNEXT_MANUAL_SIG_HANDLE/OMNIROUTE_ESTIMATOR_CALIBRATIONmissing from.env.example.