Feature/partial mock faz0 - #87
Open
Enes-Kayiklik wants to merge 27 commits into
Open
Enes-Kayiklik wants to merge 27 commits into
Enes-Kayiklik wants to merge 27 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines
+61
to
+71
| name: 'Lint OpenAPI Spec' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Check out Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
|
|
||
| - name: Lint OpenAPI spec | ||
| run: npx --yes @redocly/cli lint Core/Server/Sources/Server/Resources/OpenAPI/openapi.yaml |
|
|
||
| steps: | ||
| - name: Check out Repository | ||
| uses: actions/checkout@v4 |
URLRequest lives outside Foundation on Linux; drop unused request shadow. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Redocly struct rule rejects OAS 3.0 nullable in 3.1 specs. Co-authored-by: Cursor <cursoragent@cursor.com>
setUp yield raced the listener Task; CI saw empty lists and stale counts. Co-authored-by: Cursor <cursoragent@cursor.com>
v2.3.1 pulls gcr.io; that registry now requires billing. v2.4.4 uses ghcr.io. Co-authored-by: Cursor <cursoragent@cursor.com>
Xcode 26 treats SwiftyJS-expanded private(set) whitespace as an error. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
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.
Summary
Adds a first-class Modifiers pipeline so MockingStar can transform mock or live HTTP responses with JavaScript
transformer(req, chain)functions, without changing/mockas the only ingress.Definitions live on disk as
{id}.js(id = filename). Enablement is not stored in the file: it is an ephemeral per-(domain, deviceId)activation set (mockorlivesource) that Maestro shards and the macOS UI can replace independently. Unmatched traffic keeps the existing mock-first / live-fallback path. Matched-but-broken transformers fail closed (HTTP 500), they do not silently skip the modifier.The macOS app gains a Modifiers sidebar (list, detail, Claude-assisted authoring, Monaco draft-vs-original diff, Off / Mock / Live). The HTTP control plane adds CRUD, per-device
PUT /modifiers,POST /modifiers/preview, CORS, and Swagger UI for the new OpenAPI spec.Technical Details
/mockstill resolves mocks; when the device has matching active modifiers, the chain terminal is live if any matched modifier requestedlive, otherwise the stored mock.disableLiveEnvironment=true(onlyMock) always forces the mock terminal.PUT /modifiersinherit the UI default ("") set. An explicitPUT(including[]) isolates thatdeviceId. Only the exact headerdeviceIdis used — Android advertisingDeviceIdis ignored so app traffic stays on the UI set.POST /modifiers/preview) evaluates an unsaved draft and returns transformed + original bodies; it does not write.jsor mock files. Mock source loadssampleMockRequestId; live source proxies once without creating a mock.PUTwith a new bodyid) rewrites the file, migrates every device activation set, and rolls back activation on409/store failure.PluginCoreships no-op modifier store/chain (JS engine is macOS-only).deviceIdfor/mockflags: lookup is now exact soDeviceId≠deviceId.PUTafter process death.Relevant domains
No Android channel paths (
trendyol/search,common/, etc.). Whole diff is the MockingStar mock-server / macOS workspace.MockingStar
/modifiers+ preview APIs, OpenAPI/Swagger, Monaco diff editor, Modifiers feature module, sidebar/test-plan wiring, CI OpenAPI lint./mockbehavior unchanged when no modifiers match. ExactdeviceIdmatching can change which activation set a client hits. Live-only modifier terminals do not persist captured mocks (saveFileIfNeededonly on.default).Structure
Architecture
ModifierStore/ filename persistence) vs ephemeralModifierActivationStore(actor,(domain, deviceId)→{id: source}).ModifierMatcher→ModifierChain/ModifierExecutor→ JStransformer(req, chain)viaModifierBridge; terminal is stored-mock loader or liveURLSession.HandleModifier+ CORS; handler registered fromHTTPServer/ app on server start.Features/Modifierspackage (list/detail/create VMs, Claude client, draft editing);Editorisolates Monaco sessions and adds a diff WebView.Dependencies
Features/Modifiers(CommonKit, CommonViewsKit, Editor).Core/Servercopies OpenAPI + Swagger UI resources.Core/MockingStarCoretests now depend onServer.@redocly/cli lintonopenapi.yaml.URLSessionto GenAI Gateway. API key stored inUserDefaults(modifierGenAIGatewayAPIKey), not Keychain.Unit tests
Test Coverage Analysis
FileUrlBuilderTests.swift,MockFileLocationTests.swift,ModifierMatcherTests.swift,ModifierPreviewModelsTests.swiftCommonViewsKitTests.swiftEditorSessionTests.swiftMockingStarDeviceIdTests.swift,ModifierActivationStoreTests.swift,ModifierIntegrationTests.swift,ModifierPreviewTests.swiftModifierChainTests.swift,ModifierExecutorTests.swift,ModifierOnDemandStoreTests.swift,ModifierParserTests.swift,ModifierStoreTests.swiftCORSHandlerTests.swift,HandleDocsTests.swift,HandleModifierTests.swift,PublicEndpointContractTests.swiftMockDetailViewModelTests.swiftClaudeMessagesClientTests.swift,ModifierClaudePromptBuilderTests.swift,ModifierCreateViewModelTests.swift,ModifierTransformerEditingTests.swift,ModifierViewModelTests.swift,UserDefaultsAPIKeyStoreTests.swift[]; rename migrate/rollback; exactdeviceIdvsDeviceId/mockReview order
ModifierModel.swift— Disk definition + activation-aware API shape (enabled/sourcenot in the.jsfile)ModifierPreviewModels.swift— Preview source enum, request/response, API error bodyModifierCreationSeed.swift— Mock List → create prefillMockModel.swift— JS body type / mock identity used as sample mockPluginCore/Modifier/HTTPResult.swift— JS-facing HTTP resultPluginCoreLinux/Modifier/HTTPResult.swift— Linux HTTP result stubModifierDetailDraft.swift— Unsaved detail editor stateMethodColor.swift— Removed; HTTP method color moved to shared badgeModifierMatcher.swift— Which active modifiers wrap a requestMockFileLocation.swift— Shared mock file path extractionFileUrlBuilder.swift— Modifier + mock URL buildingFileManager.swift— File IO used by storesModifierParser.swift—.jsmetadata + transformer extractionPluginCore/Modifier/ModifierChain.swift— Onionproceed/ orderPluginCoreLinux/Modifier/ModifierChain.swift— Linux no-op chainModifierExecutor.swift— Runs transformer, maps JS errorsModifierBridge.swift— QuickJS (macOS) host bindingsModifierTransformerEditing.swift— Draft JS edit helpersModifierClaudePromptBuilder.swift— Schema-only Claude promptModifierClaudeResponseParser.swift— Extractstransformerfrom LLM outputModifierResponseSchemaSummarizer.swift— Token-safe JSON schema for ClaudePluginCore/Modifier/ModifierStore.swift— Filename persist, rename, on-demand loadPluginCoreLinux/Modifier/ModifierStore.swift— Linux store no-opModifierActivationStore.swift— Ephemeral per-device sources, inherit, renameModifierPreviewService.swift— Unsaved draft vs mock/live terminalStoredMockLoader.swift— Preview/mock terminal bysampleMockRequestIdAPIKeyStore.swift— GenAI key in UserDefaultsClaudeMessagesClient.swift— Gateway Chat Completions clientModifierAPIClient.swift— App HTTP client for/modifiersMockFileManager.swift— Test doubles for file IOMockFileUrlBuilder.swift— Test doubles for URLsMockURLSession.swift— Session fake for live terminalMockingStar.swift—/mockrouting, fail-closed chain, modifier handler, exactdeviceIdHandleModifier.swift— REST: list/create/update/delete/activate/previewHandleDocs.swift— Serves OpenAPI + Swagger UIServer.swift— Route + CORS registrationCORSHandler.swift— Browser/control-plane CORSHTTPServer.swift— Registers modifier handler on startEditor.swift— Monaco editor APIEditorSession.swift— Isolated editor sessions + JS languageMonacoDiffSession.swift— Draft vs original line revealWebView.swift— Hosts Monaco / diff HTMLHTTPMethodBadge.swift— Shared method chip (replaces MockListMethodColor)NavigationStore.swift— Modifier routesModifierListViewModel.swift— List + Off/Mock/Live activationModifierDetailViewModel.swift— Save/rename, Run preview, source bindingModifierCreateViewModel.swift— Create flow + seedModifierListView.swift— Sidebar list UIModifierDetailView.swift— Split response / JS / Claude / RunModifierCreateSheet.swift— Create sheetModifierActivationPicker.swift— Off / Mock / Live controlModifierResponsePane.swift— Preview response paneMockDetailView.swift— Editor session wiringMockDetailViewModel.swift— Session-aware detailEditorCache.swift— Per-session Monaco cacheMockListView.swift— Create Modifier from mockAppNavigationSplitView.swift— Modifiers destinationSidebarView.swift— Modifiers entrySideBarServerViewModel.swift— Server start registers modifiersFeatures/Modifiers/Package.swift— New feature packageCore/MockingStarCore/Package.swift— Server test dependencyCore/Server/Package.swift— OpenAPI resource bundleopenapi.yaml— Public modifier + docs contractindex.html— Swagger UI shellindex.css— Swagger UI layoutswagger-initializer.js— Points UI at OpenAPI specdiff.html— Monaco diff pagemain.html— Monaco editor page (JS language)Modifiers.md— Device activation, preview, Maestro setupGettingStarted-CustomClient.md— ClientdeviceIdnotescontents.xcworkspacedata— Workspace includes Modifiersproject.pbxproj— App target wiringLocalizable.xcstrings— Mock List create-modifier copyunit-tests.yml— OpenAPI lint jobTestPlan.xctestplan— Includes Modifiers testsFileUrlBuilderTests.swift— URL builder coverageMockFileLocationTests.swift— Mock path extractionModifierMatcherTests.swift— Path/method/scenario matchModifierPreviewModelsTests.swift— Preview DTO codingCommonViewsKitTests.swift— Badge / navigationEditorSessionTests.swift— Isolated Monaco sessionsMockingStarDeviceIdTests.swift— ExactdeviceIdvsDeviceIdModifierActivationStoreTests.swift— Inherit, explicit clear, renameModifierIntegrationTests.swift—/mock+ chain terminalModifierPreviewTests.swift— Preview mock/live/errorsModifierChainTests.swift— Order and short-circuitModifierExecutorTests.swift— JS success/failureModifierOnDemandStoreTests.swift— Lazy file loadModifierParserTests.swift—.jsparseModifierStoreTests.swift— CRUD, rename, 409CORSHandlerTests.swift— CORS headersHandleDocsTests.swift— Docs routesHandleModifierTests.swift— HTTP control planePublicEndpointContractTests.swift— Public API surfaceMockDetailViewModelTests.swift— Editor sessionClaudeMessagesClientTests.swift— Gateway clientModifierClaudePromptBuilderTests.swift— Prompt contentsModifierCreateViewModelTests.swift— Create + seedModifierTransformerEditingTests.swift— Draft JS editsModifierViewModelTests.swift— List/detail activation + previewUserDefaultsAPIKeyStoreTests.swift— Key persistence