fix(postman): pass explicit language in AI Search Related by identifier (#35780)#35816
fix(postman): pass explicit language in AI Search Related by identifier (#35780)#35816dsolistorres wants to merge 2 commits into
Conversation
…er (#35780) The Search/Search Related by identifier test posts to /api/v1/ai/search/related without a `language` field, so the server (SearchResource.relatedByPost) falls back to APILocator.getLanguageAPI().getDefaultLanguage().getId(). In test environments where the default is the LANG__404 sentinel (id=-1), this returns -1 and findContentletByIdentifier(id, -1) returns 404, failing the test with "expected response to have status code 200 but got 404". Follow-up to #35795 which fixed the same class of failure in Workflow_Resource_Tests and GraphQLTests. AI was intentionally out of scope in that PR. This change: - Adds a top-level prerequest script that resolves the default language id via GET /api/v2/languages/_getdefault once per Newman run, throws on any resolution error (matches the pattern shipped in #35795 v2). - Patches the failing test body to send `"language": {{defaultLanguageId}}` (note: the server reads AiKeys.LANGUAGE = "language", not "languageId"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @dsolistorres's task in 1m 50s —— View job PR Review — #35816
Clean. The two-commit patch matches the pattern shipped in #35795 v2, the body key ( 1. 2. Drift vs. sibling collections. 3. Nit: 4. Async semantics — verified, no issue. 5. Server-side path — verified. No correctness, security, or design concerns. Ship it once CI is green. |
…valid id Same fallback shipping for Workflow_Resource_Tests + GraphQLTests in #35817. Applied here so AI is consistent before this PR merges. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Pushed an additional commit that adds the same English-fallback handling shipping for Workflow + GraphQL in #35817. Without it, when |
Summary
Refs #35780. Follow-up to PR #35795 which fixed the same
language=-1class of failure inWorkflow_Resource_TestsandGraphQLTests. AI was intentionally out of scope in that PR; this surfaces in the latest CI run as the only remaining Postman-side blocker.What was diagnosed
CI run 26312707306 —
PR Test / Postman Tests - AIfailed onSearch / Search Related by identifier:Server-side log during the failing request:
Same
language:-1symptom as the rest of #35780. The test body is:{"identifier": "{{identifier}}", "fieldVar": "seo"}…with no
languagefield. The endpoint atdotCMS/src/main/java/com/dotcms/ai/rest/SearchResource.java:…falls back to
getDefaultLanguage().getId()— which returns-1(LANG__404 sentinel) in this test env. ThenfindContentletByIdentifier(id, -1)returns 404.The CLI
_makedefaultfix in #35813 affects the CLI test dotCMS instance only — Postman jobs run their own separate Docker containers, so the test env state is unchanged here.Changes
AI.postman_collection.json:Top-level prerequest — adds the same
GET /api/v2/languages/_getdefaultresolver pattern shipped in fix(postman): pass explicit languageId in WorkflowResource + GraphQL tests (#35780) #35795 v2. Idempotent viapm.environment.get('defaultLanguageId')guard, throws on network error / non-200 / missingentity.id(no silent fallback to invalid JSON request bodies).Failing test body — adds
"language": {{defaultLanguageId}}. Note the key is"language"(perAiKeys.LANGUAGE), not"languageId".Diff
+32 / −2— surgical text patch that preserves the file's 2-space formatting (no full reserialize).Test plan
PR Test / Postman Tests - AIshould pass on this branch.🤖 Generated with Claude Code