diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.inputs.json b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.inputs.json index ab0330df..f2166b68 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.inputs.json +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.inputs.json @@ -1,17 +1,17 @@ { "version": 1, - "capturedAt": "2026-10-14T19:59:03.819Z", + "capturedAt": "2026-10-14T20:03:21.432Z", "capturedBy": "stamp", "inputs": { - "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", + "prompt": "427adf9dd0a79938e71a3e631208f43bc6862007ab9a37c6487d1ff47eb04c9f", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", - "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", + "holisticRubric": "c2d8bf2ffbc26e70e08ac8b17328479fde3be26560a67f7b1fde6441464e8b2b", + "atomicRubric": "0d2dd44fdd404c3074f21431f0f80781769d102a7269fa9b4097842867f1c609", "rubricsYaml": null, - "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" + "graderContext": "062756b472897d794d59e832a7b2303436a985572eabbf0a92a62399346046ae" } } diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.md index 961d74ab..d99db60a 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-meaningful-failure.md @@ -69,7 +69,7 @@ The old grades also discuss acknowledgment before database success and, in one r ### Unauthorized effects after ownership failure — holds -- **Guidance says:** “If tenant validation fails or records do not match the expected `userId`, the job must immediately halt prior to audio rendering or database updates.” The same clause says failure “applies a heavy penalty to the overall score.” +- **Guidance says:** “If tenant context checks fail or records do not belong to the requesting user, execution must halt before rendering audio or mutating database records.” The same clause says failure “applies a heavy penalty to the overall score.” - **Reachability / evidence / proportionality:** Both workers perform model writes and audio work after record lookups. The 0.62 and 0.66 grades describe concrete later side effects after scoped-update failures. Preventing cross-tenant effects is a proportionate core security requirement. - **Call:** The consequence is real, and a heavy penalty for actual cross-tenant rendering or writes is proportionate. The current scoping clauses name both handlers and the `userId` field. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.inputs.json b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.inputs.json index ab0330df..f2166b68 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.inputs.json +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.inputs.json @@ -1,17 +1,17 @@ { "version": 1, - "capturedAt": "2026-10-14T19:59:03.819Z", + "capturedAt": "2026-10-14T20:03:21.432Z", "capturedBy": "stamp", "inputs": { - "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", + "prompt": "427adf9dd0a79938e71a3e631208f43bc6862007ab9a37c6487d1ff47eb04c9f", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", - "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", + "holisticRubric": "c2d8bf2ffbc26e70e08ac8b17328479fde3be26560a67f7b1fde6441464e8b2b", + "atomicRubric": "0d2dd44fdd404c3074f21431f0f80781769d102a7269fa9b4097842867f1c609", "rubricsYaml": null, - "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" + "graderContext": "062756b472897d794d59e832a7b2303436a985572eabbf0a92a62399346046ae" } } diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.md index 2ee017ae..b0cdabd8 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-clarity.md @@ -9,9 +9,9 @@ Assessed: harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md ## Material ambiguities -None found. The cloning and synthesis scoping bullets name their handlers, models, and fields; the initial profile query establishes the tenant source. The Crux rule names its trigger and overall-score target. The charge-once rule explicitly prevents duplicate deductions for a single defect. +None found. The rubric names the handlers, models, tenant field, record field, initial tenant-resolution lookup, ownership-stop trigger, and overall-score Crux target. It also explicitly protects the initial lookup and standard SQS acknowledgment and prevents double-charging a single defect. -The four reference-run grades were reviewed. They were produced under an earlier holistic revision, so they cannot establish how this version would be graded, but they do not reveal a competing reading of its current terms. +The four captured reference grades were reviewed. They predate this holistic revision, so they do not establish how graders would apply its wording; they do not reveal an unresolved competing reading of the current rules. ## Copy-edit issues @@ -19,4 +19,4 @@ None found. ## Overall verdict -The revised holistic rubric reads professionally and states concrete scoring boundaries. No load-bearing ambiguity or disruptive copy-edit issue remains. +The revised holistic rubric reads clearly and gives a grader concrete boundaries for the task's scored behavior. No material ambiguity or disruptive prose issue remains. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.inputs.json b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.inputs.json index ab0330df..f2166b68 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.inputs.json +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.inputs.json @@ -1,17 +1,17 @@ { "version": 1, - "capturedAt": "2026-10-14T19:59:03.819Z", + "capturedAt": "2026-10-14T20:03:21.432Z", "capturedBy": "stamp", "inputs": { - "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", + "prompt": "427adf9dd0a79938e71a3e631208f43bc6862007ab9a37c6487d1ff47eb04c9f", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", - "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", + "holisticRubric": "c2d8bf2ffbc26e70e08ac8b17328479fde3be26560a67f7b1fde6441464e8b2b", + "atomicRubric": "0d2dd44fdd404c3074f21431f0f80781769d102a7269fa9b4097842867f1c609", "rubricsYaml": null, - "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" + "graderContext": "062756b472897d794d59e832a7b2303436a985572eabbf0a92a62399346046ae" } } diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.md index 00e9c04d..d89a8722 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-coverage.md @@ -1,6 +1,6 @@ --- detector: detector-rubric-coverage -verdict: material-issues +verdict: clear confidence: MEDIUM --- # Rubric-coverage check: potion-voice-user-ownership @@ -11,37 +11,32 @@ Assessed: harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md agai | Holistic clause (short, verbatim key phrase) | Criterion id(s) | Status | | --- | --- | --- | -| “All database reads and updates in `voice-cloning-job-handler` ... incorporate `userId` alongside record `_id`” | cloning-tenant-isolation | covered | -| “initial `UserAudioProfile` query resolves `userId` via `userAudioProfileId`” | initial-profile-tenant-resolution | covered | -| “subsequent `RecordingSalutation` and `Recording` queries and updates ... scoped by `userId`” | synthesis-tenant-isolation-queries-updates | covered | -| “halt prior to audio rendering or database updates” | prevent-unauthorized-side-effects | covered | +| “reads and updates ... `VoiceCloning` and `UserAudioProfile` ... `userId` ... `_id`” | cloning-tenant-isolation | covered | +| “downstream queries and updates ... `RecordingSalutation` and `Recording` ... `userId`” | synthesis-tenant-isolation-queries-updates | covered | +| “execution must halt before rendering audio or mutating database records” | prevent-unauthorized-side-effects | covered | | “applies a heavy penalty to the overall score” | prevent-unauthorized-side-effects | covered | +| “initial query ... `_id: userAudioProfileId` ... permitted without requiring `userId`” | initial-profile-tenant-resolution | covered | | “Do not double-charge a single defect” | prevent-unauthorized-side-effects elaboration | covered | -| “caught cleanly in a `try-catch` block to keep the polling loop active” | worker-loop-crash-prevention | covered | -| “SQS message deletion and acknowledgment ... must be allowed without penalizing” | none; grader-context.md only | missing | -| “summaries or inline code comments must accurately reflect” | refactor-summary-accuracy | covered | +| “caught gracefully in a try-catch block” | worker-loop-crash-prevention | covered | +| “SQS queue message deletion and acknowledgment ... must not be penalized” | inherited-sqs-acknowledgment-protection | covered | +| “summary, code explanations, or inline documentation ... without misleading claims” | refactor-summary-accuracy | covered | ## Coverage gaps -### SQS acknowledgment non-penalty is absent from the atomic criteria - -- **Holistic clause:** Under Framework Message Handling, “Standard SQS message deletion and acknowledgment behavior inherited from the consumer framework must be allowed without penalizing standard message deletion on completed or rejected jobs.” -- **Closest criterion:** worker-loop-crash-prevention scores exception handling, but neither its guideline nor elaboration carries this non-trigger. The protection appears only in grader-context.md. -- **What is lost:** An atomic grader applying criteria can treat ordinary message deletion as a worker-resilience or side-effect failure even though the holistic rubric expressly protects it. The context note helps, but the coverage rule requires load-bearing non-penalty instructions to map to a criterion. -- **Suggested criterion:** Add the allowance as a non-trigger in the worker-loop or side-effect criterion's elaboration, without creating a separate scored criterion. +None found. ## Invented content -None found. The specific handler, model, tenant-source, stop-condition, and polling requirements in the criteria are supported by the holistic rubric or grader context. +None found. The criteria's handler, model, tenant-source, side-effect, and polling facts are supported by the holistic rubric or grader context. The scored design of the SQS protection is assessed by the rubric-form detector, not counted as an unsupported requirement here. ## Context integrity -The holistic summary's worker and tenant-isolation facts survive in the architecture context. The context also preserves the initial profile tenant source and the SQS acknowledgment allowance. No fact needed by the criteria is missing from both the context and criteria. +The holistic rubric's architecture and tenant-resolution facts survive in grader-context.md, which also preserves the standard queue acknowledgment allowance. Facts needed by the criteria are present in the context or the criteria themselves. ## Crux alignment -The holistic unauthorized-side-effect rule applies a heavy penalty to the overall score. prevent-unauthorized-side-effects carries severity crux and an elaboration naming that effect. There is no mismatch in either direction. +The holistic side-effect rule applies a heavy penalty to the overall score. prevent-unauthorized-side-effects is the one atomic crux criterion and its elaboration repeats that effect. No other Crux mismatch exists. ## Overall verdict -The count-once routing rule is now faithfully represented, resolving the prior finding. The one remaining material gap is that the holistic SQS acknowledgment protection lives in context but is absent from every atomic criterion. +The seven atomic criteria now represent the holistic rubric's load-bearing requirements, protections, charge-once rule, and overall-score Crux. Coverage is clear; the separate form detector assesses whether those criteria are well shaped for scoring. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.inputs.json b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.inputs.json index ab0330df..f2166b68 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.inputs.json +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.inputs.json @@ -1,17 +1,17 @@ { "version": 1, - "capturedAt": "2026-10-14T19:59:03.819Z", + "capturedAt": "2026-10-14T20:03:21.432Z", "capturedBy": "stamp", "inputs": { - "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", + "prompt": "427adf9dd0a79938e71a3e631208f43bc6862007ab9a37c6487d1ff47eb04c9f", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", - "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", + "holisticRubric": "c2d8bf2ffbc26e70e08ac8b17328479fde3be26560a67f7b1fde6441464e8b2b", + "atomicRubric": "0d2dd44fdd404c3074f21431f0f80781769d102a7269fa9b4097842867f1c609", "rubricsYaml": null, - "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" + "graderContext": "062756b472897d794d59e832a7b2303436a985572eabbf0a92a62399346046ae" } } diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.md index 176aa7cd..d78a211b 100644 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/detectors/detector-rubric-form.md @@ -1,7 +1,7 @@ --- detector: detector-rubric-form -verdict: minor-issues -confidence: MEDIUM +verdict: material-issues +confidence: HIGH --- # Rubric-form check: potion-voice-user-ownership @@ -9,7 +9,7 @@ Assessed: harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml and ## Deterministic contract -1. YAML parses with the task slug and six criteria: pass (parsed with the installed yaml package). +1. YAML parses with the task slug and seven criteria: pass (parsed with the installed yaml package). 2. Task slug matches: pass. 3. IDs are unique kebab-case: pass. 4. Categories use the allowed vocabulary: pass. @@ -19,25 +19,37 @@ Assessed: harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml and 8. Guidelines are nonempty: pass. 9. Numeric-penalty pattern sweeps over the atomic rubric and grader context: pass; no candidates matched. 10. The detector contract defines no check numbered 10. -11. Positive-phrasing pattern sweep over guidelines: pass. The phrase “records do not match” is a condition describing failed ownership, not a negated requirement. +11. Positive-phrasing pattern sweep over guidelines: pass; no negated-requirement candidates matched. ## Atomicity and self-containment -None found. Each criterion states one judgeable behavior. The count-once routing rule is in the side-effect elaboration and does not add a separate response requirement. +None found. The main behavior requirements are recognizable as separate criteria without reading sibling criteria. ## Phrasing and answer keys -### Bold answer keys omit identifiers present in their guidelines +### Every factual answer key is outside its guideline -- **Criterion:** cloning-tenant-isolation and initial-profile-tenant-resolution. -- **Where:** The cloning answer key says, “**Answer key: All database reads and updates in voice-cloning-job-handler must filter by userId in addition to record _id.**” Its preceding requirement names VoiceCloning and UserAudioProfile. The initial-profile answer key says, “**Answer key: The initial lookup on UserAudioProfile by _id is necessary to resolve userId and establish tenant context.**” Its preceding requirement names the lookup value userAudioProfileId. -- **Why:** The full answer-key sentences are bold, resolving the prior formatting issue, but omit model names and the lookup value that distinguish the graded facts. The facts are elsewhere in the same guidelines, so the criteria remain judgeable. -- **Suggested rewrite:** Include VoiceCloning and UserAudioProfile in the cloning answer key, and _id: userAudioProfileId in the profile-lookup answer key. +- **Criterion:** All seven criteria. +- **Where:** For example, cloning-tenant-isolation's guideline ends “queries and updates in the voice cloning handler.” Its elaboration begins “**Answer key:** All **database reads** and **updates** ...”. The same guideline/elaboration split occurs in every criterion. +- **Why:** The form rule requires a factual criterion's answer key inline and in bold in its guideline. A grader reading guidelines alone has to search elaborations for the expected facts. The problem is material because it affects every scored criterion. +- **Suggested rewrite:** Move each factual answer key into its own guideline, with the full factual relationship in bold; keep elaborations for clarification and routing. + +### Substantive requirements appear only in elaborations + +- **Criterion:** synthesis-tenant-isolation-queries-updates and worker-loop-crash-prevention. +- **Where:** The synthesis elaboration requires “the profile-derived **userId**,” while the guideline only says “tenant identity (userId).” The worker-loop elaboration requires a “**try-catch block**,” while its guideline only says to catch and handle exceptions. +- **Why:** Those are graded specifics from the holistic rubric. A reader applying only guidelines could credit a queue-supplied userId or a different exception mechanism, while the elaborations require the profile source and try-catch form. +- **Suggested rewrite:** State “profile-derived userId” and “try-catch block” in the respective guidelines. ## Fair-grading findings -None found. The SQS non-penalty instruction's placement is a holistic-to-atomic coverage issue, not a malformed scored criterion. +### Framework allowance is a standalone scored criterion + +- **Criterion:** inherited-sqs-acknowledgment-protection. +- **Where:** “The response should allow standard framework SQS message deletion and acknowledgment behavior without penalizing message deletion on completed or rejected jobs.” +- **Why:** The allowance instructs the grader not to deduct for baseline queue behavior. It is not an independent property an agent's response can meaningfully fail, so awarding a scored dodged-bullet pass can dilute functional criteria. +- **Suggested rewrite:** Put the allowance in the relevant functional criterion's elaboration as a non-trigger rather than a separate scored criterion. ## Overall verdict -The deterministic contract passes, and every criterion is independently judgeable. The remaining answer-key omissions are minor because each missing fact appears elsewhere in the same guideline. +The YAML passes the deterministic contract, but the judgment layer has material defects. Every factual answer key sits outside its guideline, two substantive facts are hidden in elaborations, and the SQS non-penalty instruction is scored as though it were an agent behavior. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/instruction.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/instruction.md index a371d37e..4c214b0f 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/instruction.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/instruction.md @@ -1,15 +1,18 @@ -# Refactor Voice Worker Handlers for Multi-Tenant Data Isolation +# Refactor Worker Handlers for Multi-Tenant Data Isolation -## Overview -Our backend background workers currently suffer from a critical security vulnerability regarding data separation. Specifically, asynchronous processes handling voice synthesis and voice cloning jobs retrieve database entries using only a document identifier provided in queue messages (e.g., `userAudioProfileId`, `recordingId`, `salutationId`), neglecting to check or enforce if the record matches the correct user (`userId`). +## Context & Problem +Our backend background worker services (`voice-cloning-job-handler` and `voice-synthsizer-job-handler`) process asynchronous job queue messages for voice cloning and speech synthesis. Currently, database queries and updates retrieve and modify records (`VoiceCloning`, `UserAudioProfile`, `RecordingSalutation`, and `Recording`) using only the document identifier (`_id`) provided in the job message. -You must audit and refactor all database queries and updates within these background worker handlers (`voice-cloning-job-handler` and `voice-synthsizer-job-handler`) to enforce robust multi-tenant data isolation. +Because queries lack explicit tenant scoping (`userId`), malformed, unvalidated, or cross-tenant job payloads can inspect or mutate records belonging to other users, creating a critical multi-tenant data separation vulnerability. -## Objectives -1. **Multi-Tenant Isolation in Querying and Updating**: - - Ensure all database reads, updates, and deletes across `VoiceCloning`, `UserAudioProfile`, `RecordingSalutation`, and `Recording` models enforce `userId` tenant scoping. - - For `voice-synthsizer-job-handler`, resolve `userId` from the initial `UserAudioProfile` record lookup using `userAudioProfileId`, then scope all subsequent `RecordingSalutation` and `Recording` queries and updates using that resolved `userId`. -2. **Prevent Unauthorized Side Effects**: - - Immediately halt processing, audio rendering, or cross-tenant database mutations if tenant validation fails or if requested records do not belong to the tenant. -3. **Worker Polling Loop Resilience**: - - Ensure exceptions during message handling are caught gracefully in a `try-catch` block so that background worker polling loops remain active without crashing. +## Task Requirements +1. **Multi-Tenant Query & Update Scoping**: + - Refactor all database reads and updates in `voice-cloning-job-handler` (`VoiceCloning`, `UserAudioProfile`) to filter by `userId` in addition to document `_id`. + - Refactor downstream queries and updates in `voice-synthsizer-job-handler` (`RecordingSalutation`, `Recording`) to enforce tenant scoping using the profile-derived `userId`. + - Ensure the initial lookup on `UserAudioProfile` by `_id: userAudioProfileId` is permitted as the valid tenant-resolution step needed to establish the job's `userId`. + +2. **Side-Effect & Mutation Protection**: + - Ensure that if tenant ownership validation fails, unauthorized side effects (such as audio rendering or cross-tenant database updates) are immediately halted. + +3. **Polling Loop Error Resilience**: + - Wrap job processing logic in proper exception handling (try-catch blocks) so unhandled processing errors do not crash background worker polling loops. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml index 5cc71ba0..8717618d 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml @@ -6,40 +6,35 @@ criteria: - Narrow Correctness severity: certain_dealbreaker call_site_key: voice-cloning-job-handler - guideline: 'The response should enforce tenant isolation using userId on all VoiceCloning - and UserAudioProfile queries and updates in voice-cloning-job-handler. **Answer - key: All database reads and updates in voice-cloning-job-handler must filter by - userId in addition to record _id.**' - elaboration: Verifies that voice cloning queries and updates incorporate userId - to prevent unauthorized cross-tenant operations. + guideline: The response should enforce tenant isolation using userId on all VoiceCloning + and UserAudioProfile queries and updates in the voice cloning handler. + elaboration: '**Answer key:** All **database reads** and **updates** in **voice-cloning-job-handler** + on **VoiceCloning** and **UserAudioProfile** must filter by **userId** in addition + to record **_id**.' - id: synthesis-tenant-isolation-queries-updates category: primary_intent dimensions: - Narrow Correctness severity: certain_dealbreaker call_site_key: voice-synthsizer-job-handler - guideline: 'The response should scope all synthesis queries and database updates - by tenant identity (userId) across RecordingSalutation and Recording records in - voice-synthsizer-job-handler. **Answer key: Downstream reads and updates to RecordingSalutation - and Recording in voice-synthsizer-job-handler must be scoped by the profile-derived - userId.**' - elaboration: Ensures that both queries and database updates in the speech synthesis - handler enforce tenant isolation using userId. + guideline: The response should scope all synthesis queries and database updates + by tenant identity (userId) across RecordingSalutation and Recording records. + elaboration: '**Answer key:** Downstream **reads** and **updates** to **RecordingSalutation** + and **Recording** in **voice-synthsizer-job-handler** must be scoped by the profile-derived + **userId**.' - id: prevent-unauthorized-side-effects category: primary_intent dimensions: - Narrow Correctness severity: crux call_site_key: voice-synthsizer-job-handler - guideline: 'The response should halt audio generation and database mutations across - both voice-cloning-job-handler and voice-synthsizer-job-handler when tenant ownership - validation fails or records do not match tenant context. **Answer key: Audio generation - and database mutations must be halted if tenant ownership checks fail.**' - elaboration: 'Evaluates halting execution on unauthorized jobs. Routing note: Charge - query filter syntax omissions under cloning-tenant-isolation or synthesis-tenant-isolation-queries-updates. - Charge unauthorized execution of audio rendering or side effects under this criterion. - Do not double-charge a single defect across query criteria and side-effect criteria. - Failing this crux criterion applies a heavy penalty to the overall score.' + guideline: The response should prevent unauthorized side effects, including audio + generation and database mutations across both handlers, when tenant validation + fails. + elaboration: 'Failing this crux criterion applies a heavy penalty to the overall + score. Routing note: Do not double-charge a single defect across query criteria + and side-effect criteria. **Answer key:** Synthesis **audio generation** and **database + mutations** must be halted if **tenant ownership checks** fail.' - id: initial-profile-tenant-resolution category: dodged_bullet dimensions: @@ -48,32 +43,39 @@ criteria: call_site_key: voice-synthsizer-job-handler guideline: 'The response should allow the initial UserAudioProfile lookup by _id: userAudioProfileId as a valid tenant-resolution step without requiring userId - in that initial query. **Answer key: The initial lookup on UserAudioProfile by - _id is necessary to resolve userId and establish tenant context.**' - elaboration: Prevents improperly docking points for the initial profile query needed - to discover the tenant identity. + in that initial query.' + elaboration: '**Answer key:** The initial lookup on **UserAudioProfile** by **_id: + userAudioProfileId** is necessary to resolve **userId** and establish tenant context.' +- id: inherited-sqs-acknowledgment-protection + category: dodged_bullet + dimensions: + - Broader Correctness / the craft of software engineering + severity: possible_dealbreaker + call_site_key: voice-synthsizer-job-handler + guideline: The response should allow standard framework SQS message deletion and + acknowledgment behavior without penalizing message deletion on completed or rejected + jobs. + elaboration: '**Answer key:** **SQS message deletion** and **acknowledgment** inherited + from the baseline framework is standard queue processing behavior and must not + be penalized.' - id: worker-loop-crash-prevention category: primary_intent dimensions: - Broader Correctness / the craft of software engineering severity: possible_dealbreaker call_site_key: voice-synthsizer-job-handler - guideline: 'The response should catch and handle exceptions during message processing - to prevent background worker polling loops from crashing. **Answer key: Errors - during job processing must be caught gracefully in a try-catch block so the worker - polling loop remains active.**' - elaboration: Ensures background worker loops remain resilient against unhandled - errors. + guideline: The response should catch and handle exceptions during message processing + to prevent background worker polling loops from crashing. + elaboration: '**Answer key:** Errors during job processing must be caught gracefully + in a **try-catch block** so the worker **polling loop** remains active.' - id: refactor-summary-accuracy category: primary_intent dimensions: - Communication severity: unlikely_dealbreaker call_site_key: voice-synthsizer-job-handler - guideline: 'The response should accurately summarize the refactored multi-tenant - isolation changes across the background worker handlers in its written response - summary or inline code documentation. **Answer key: Any written summary, explanation, - or code documentation must accurately reflect the actual code refactoring and - multi-tenant security logic without misleading claims.**' - elaboration: Evaluates the factual accuracy and clarity of the written refactoring - summary and code documentation. + guideline: The response should accurately summarize the multi-tenant isolation refactor + in its written response or code documentation. + elaboration: '**Answer key:** Any written **summary**, **explanation**, or **code + documentation** must accurately reflect the multi-tenant isolation changes without + misleading claims.' diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md index 932b5bf8..2f3dec0e 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md @@ -1,9 +1,20 @@ -# Grader Ground Truth & Reference Context +# Grader Context & Ground Truth Reference -## Architectural & Domain Context -- Handlers: `voice-cloning-job-handler` and `voice-synthsizer-job-handler`. -- In `voice-synthsizer-job-handler`, SQS messages provide `userAudioProfileId`, `recordingId`, and `salutationId`. -- The initial lookup on `UserAudioProfile` by `_id: userAudioProfileId` is necessary to obtain `userAudioProfile.userId`. -- Once `userId` is resolved, downstream `RecordingSalutation` and `Recording` queries and updates must include `userId`. -- In `voice-cloning-job-handler`, incoming messages provide `userAudioProfileId` and `voiceCloningId`. All database operations must filter by `userId`. -- Framework behavior: Baseline queue message deletion and acknowledgment on finished or rejected jobs is standard consumer infrastructure and must not be penalized. +## Background Worker Architecture +The application runs background tasks handling voice cloning and speech synthesis via AWS SQS queue messages. + +### Key Components & Models +1. **`voice-cloning-job-handler`**: + - Manages `VoiceCloning` job state and `UserAudioProfile` updates. + - Requires filtering reads and updates by `userId` alongside `_id`. + +2. **`voice-synthsizer-job-handler`**: + - Message payload contains `userAudioProfileId`, `recordingId`, and optional `salutationId`. + - **Step 1 (Tenant Resolution)**: Resolves tenant context by querying `UserAudioProfile` using `_id: userAudioProfileId` to retrieve `userAudioProfile.userId`. + - **Step 2 (Scoped Operations)**: Uses the resolved `userId` to scope all subsequent queries and updates on `RecordingSalutation` and `Recording`. + +3. **Side-Effect Protection**: + - If `userId` resolution fails or records do not match `userId`, execution must abort before calling audio synthesis engines or saving updates. + +4. **Framework Queue Behavior**: + - Baseline worker loops handle SQS message acknowledgment and deletion upon job completion or rejection. This standard queue behavior must not be flagged as a flaw. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md index 0ae54f3c..a2d0b97b 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md @@ -1,21 +1,15 @@ -# Holistic Evaluation Rubric: Voice Worker User Ownership +# Holistic Evaluation Rubric: Multi-Tenant Data Isolation Refactor -## Summary -Evaluates the candidate's refactoring of background worker handlers (`voice-cloning-job-handler` and `voice-synthsizer-job-handler`) to enforce multi-tenant data isolation using `userId`. +## Narrow Correctness +- **Voice Cloning Tenant Isolation**: All database reads and updates in `voice-cloning-job-handler` on `VoiceCloning` and `UserAudioProfile` records must explicitly filter by `userId` in addition to record `_id`. +- **Synthesis Tenant Isolation**: All downstream queries and updates in `voice-synthsizer-job-handler` on `RecordingSalutation` and `Recording` records must be scoped by `userId`. +- **Side-Effect Control (Crux Requirement)**: If tenant context checks fail or records do not belong to the requesting user, execution must halt before rendering audio or mutating database records. *Crux requirement*: Failing to halt unauthorized side effects applies a heavy penalty to the overall score. +- **Initial Profile Lookup Exemption**: The initial query on `UserAudioProfile` by `_id: userAudioProfileId` is the necessary tenant-resolution step to discover `userId`. It must be permitted without requiring `userId` in that initial lookup. +- **Deduction Routing**: Do not double-charge a single defect across query criteria and side-effect criteria. ---- +## Broader Correctness / the craft of software engineering +- **Polling Loop Resilience**: Errors occurring during message processing must be caught gracefully in a try-catch block so background worker polling loops remain active. +- **SQS Framework Acknowledgment Protection**: Standard SQS queue message deletion and acknowledgment behavior inherited from the baseline framework code is standard infrastructure operation and must not be penalized as a defect. -## Core Dimensions - -### Narrow Correctness -- **Voice Cloning Tenant Scoping**: All database reads and updates in `voice-cloning-job-handler` for `VoiceCloning` and `UserAudioProfile` must incorporate `userId` alongside record `_id`. -- **Speech Synthesis Tenant Scoping**: In `voice-synthsizer-job-handler`, the initial `UserAudioProfile` query resolves `userId` via `userAudioProfileId`. All subsequent `RecordingSalutation` and `Recording` queries and updates must be scoped by `userId`. -- **Prevent Unauthorized Side Effects (Crux Requirement)**: If tenant validation fails or records do not match the expected `userId`, the job must immediately halt prior to audio rendering or database updates. Failing this crux requirement applies a heavy penalty to the overall score. -- **Charge-Once Routing Rule**: Charge missing `userId` query filter syntax under handler scoping criteria. Charge unauthorized side-effect execution under the side-effect criterion. Do not double-charge a single defect across query criteria and side-effect criteria. - -### Broader Correctness / the craft of software engineering -- **Worker Polling Loop Resilience**: Errors encountered during processing must be caught cleanly in a `try-catch` block to keep the polling loop active. -- **Framework Message Handling**: Standard SQS message deletion and acknowledgment behavior inherited from the consumer framework must be allowed without penalizing standard message deletion on completed or rejected jobs. - -### Communication -- **Refactor Summary and Documentation Accuracy**: Written summaries or inline code comments must accurately reflect the multi-tenant isolation logic without misleading or false claims. +## Communication +- **Refactor Summary & Documentation Accuracy**: Any written response summary, code explanations, or inline documentation must accurately describe the multi-tenant isolation refactor without misleading claims.