feat(serenity): extend async prompt classification to sub-workspace brands (#33) - #3075
Open
byteclimber wants to merge 1 commit into
Open
feat(serenity): extend async prompt classification to sub-workspace brands (#33)#3075byteclimber wants to merge 1 commit into
byteclimber wants to merge 1 commit into
Conversation
…rands (#33) The CSV-import async job runner (serenity-docs#33) was gated to flat-mode brands only, deferred because subworkspace create had extra dynamic-allocation headroom-guard logic that wasn't safely portable at the time (#2920). That allocator (createHeadroomGuard et al.) has since been removed org-wide (SITES-49206, #2995) once Semrush confirmed it no longer enforces AI project/prompt limits, so there is nothing left to port — extending async routing to subworkspace-mode brands is now a pure routing change. Removes the auth.mode !== 'subworkspace' restriction in serenity.js's createPrompts, and teaches the worker's create path (classify-prompts-job.js) to resolve slice->project via a live listing (buildSliceProjectMap) instead of the BrandSemrushProject DB mapping when the job metadata marks it subworkspace, mirroring prompts-subworkspace.js. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
byteclimber
temporarily deployed
to
dev-branches
August 17, 2026 12:55 — with
GitHub Actions
Inactive
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
auth.mode !== 'subworkspace'— i.e. flat-mode brands only. Per the introducing PR (feat(serenity): wire runner mechanics for the deferred Semrush job runner (#186) #2920), subworkspace was deferred because it had extra dynamic-allocation headroom-guard logic that "wasn't safely portable in this pass."createHeadroomGuard,dynamic-allocation-active.js,resource-manager.js,resource-lock.js) has since been removed entirely (SITES-49206, fix(serenity): remove dormant Semrush AI allocator, §10.1/§10.2 (SITES-49206) #2995, merged 2026-08-13) — Semrush confirmed it no longer enforces AI project/prompt limits for LLMO workspaces at all, and the flag gating it was off in every environment anyway. There is nothing left to port.auth.mode !== 'subworkspace'restriction inserenity.js'screatePrompts, and teaches the worker (classify-prompts-job.js'screateAndClassify) to resolve(geoTargetId, languageCode)slices to Semrush projects via a live listing (buildSliceProjectMap, mirroring the sync subworkspace handlerhandleCreatePromptsSubworkspaceinprompts-subworkspace.js) instead of the flat-modeBrandSemrushProjectDB mapping, when the job's metadata marks itsubworkspace: true.subworkspace(distinct from the existingmode: 'create'|'reclassify'field, which is unrelated) andparentWorkspaceId.Not in scope
reclassifyExisting's self-requeue path needed no changes: it patches already-created prompts byprojectId/promptIdcarried in each item, with no slice→project resolution step to branch on.Test plan
test/controllers/serenity.test.js: inverted the "stays synchronous for subworkspace-mode brands" test into an enqueue assertion (enqueues a serenity-classify-prompts job for subworkspace-mode brands too), verifying the newsubworkspace/parentWorkspaceIdmetadata fields; updated the existing flat-mode enqueue test's metadata assertion.test/support/serenity/handlers/classify-prompts-job.test.js: added a subworkspace create-path test asserting the live-listing resolution path is used and the DB mapping (BrandSemrushProject.allByBrandId) is never consulted.npm run lint,npm run type-check, fullnpm test(serenity.test.js + classify-prompts-job.test.js) pass.test/it/postgres/serenity.test.jsIT suite plus a manual CSV-import against a subworkspace brand) before merge.🤖 Generated with Claude Code