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 506cafa1..ab0330df 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:55:51.138Z", + "capturedAt": "2026-10-14T19:59:03.819Z", "capturedBy": "stamp", "inputs": { - "prompt": "2ba0edbffb417a1f200b113d1197ccb0e68d6a5ac6aa732e4c94faf554ceaad7", + "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "97545c66b57f59a4810ccffc06658fb9e1b49dccf8ca14bda4242b4ed5a5d1c7", - "atomicRubric": "a6715ef6b8c360cdc2c58b2081717196fbde6d43c3638ed71263bb1f6fcc0bd2", + "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", + "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", "rubricsYaml": null, - "graderContext": "780c5648cbb3fd098e9c88a639b156882ea5c55d02f222e7c430a777d1793556" + "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" } } 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 1086d1fa..961d74ab 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,9 +69,9 @@ The old grades also discuss acknowledgment before database success and, in one r ### Unauthorized effects after ownership failure — holds -- **Guidance says:** “When tenant ownership checks fail or records do not match `userId`, the handler must halt immediately before triggering audio rendering or mutating database records.” The Crux rule says failure “applies a heavy penalty to the overall score.” +- **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.” - **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 restored handler and field names make the rule concrete. +- **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. The tenant-source compatibility target and polling-loop resilience target have plausible stakes. The former manifested in every run; the latter was met. 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 506cafa1..ab0330df 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:55:51.138Z", + "capturedAt": "2026-10-14T19:59:03.819Z", "capturedBy": "stamp", "inputs": { - "prompt": "2ba0edbffb417a1f200b113d1197ccb0e68d6a5ac6aa732e4c94faf554ceaad7", + "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "97545c66b57f59a4810ccffc06658fb9e1b49dccf8ca14bda4242b4ed5a5d1c7", - "atomicRubric": "a6715ef6b8c360cdc2c58b2081717196fbde6d43c3638ed71263bb1f6fcc0bd2", + "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", + "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", "rubricsYaml": null, - "graderContext": "780c5648cbb3fd098e9c88a639b156882ea5c55d02f222e7c430a777d1793556" + "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" } } 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 a0bf91c3..2ee017ae 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 handler, model, tenant-field, record-field, and initial-lookup identifiers are restored. The Crux rule names the failed-ownership trigger and the overall-score penalty target. The routing note distinguishes omitted query filters from downstream side-effect execution. +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. -The four captured grades were reviewed. They were produced under an earlier holistic revision, so they do not establish how graders would apply this revision; they do not expose a competing reading of its current wording. +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. ## Copy-edit issues @@ -19,4 +19,4 @@ None found. ## Overall verdict -The current prose is readable and gives concrete pass/fail boundaries for tenant scoping, ownership-stop behavior, worker resilience, and inherited SQS acknowledgment. The earlier blank-identifier finding is resolved. +The revised holistic rubric reads professionally and states concrete scoring boundaries. No load-bearing ambiguity or disruptive copy-edit 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 506cafa1..ab0330df 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:55:51.138Z", + "capturedAt": "2026-10-14T19:59:03.819Z", "capturedBy": "stamp", "inputs": { - "prompt": "2ba0edbffb417a1f200b113d1197ccb0e68d6a5ac6aa732e4c94faf554ceaad7", + "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "97545c66b57f59a4810ccffc06658fb9e1b49dccf8ca14bda4242b4ed5a5d1c7", - "atomicRubric": "a6715ef6b8c360cdc2c58b2081717196fbde6d43c3638ed71263bb1f6fcc0bd2", + "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", + "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", "rubricsYaml": null, - "graderContext": "780c5648cbb3fd098e9c88a639b156882ea5c55d02f222e7c430a777d1793556" + "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" } } 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 0350e63c..00e9c04d 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 @@ -11,37 +11,37 @@ Assessed: harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md agai | Holistic clause (short, verbatim key phrase) | Criterion id(s) | Status | | --- | --- | --- | -| “All queries and database updates in `voice-cloning-job-handler` ... filter by `userId` in addition to document `_id`” | cloning-tenant-isolation | covered | -| “initial `UserAudioProfile` lookup ... is valid to resolve `userId`” | initial-profile-tenant-resolution | covered | -| “All downstream reads and updates on `RecordingSalutation` and `Recording` ... filter by `userId`” | synthesis-tenant-isolation-queries-updates | covered | -| “halt immediately before triggering audio rendering or mutating database records” | prevent-unauthorized-side-effects | covered | +| “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 | | “applies a heavy penalty to the overall score” | prevent-unauthorized-side-effects | covered | -| “Do not double-charge single defects” | routing note in prevent-unauthorized-side-effects elaboration | partial | -| “wrapped in `try-catch` blocks ... without crashing ... polling loop” | worker-loop-crash-prevention | covered | -| “SQS message deletion and acknowledgment ... must not be penalized” | worker-loop-crash-prevention elaboration | covered | -| “summary or inline code comments must accurately reflect” | refactor-summary-accuracy | 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 | ## Coverage gaps -### Count-once protection is not explicit in the atomic rubric +### SQS acknowledgment non-penalty is absent from the atomic criteria -- **Holistic clause:** The Narrow Correctness routing note ends, “Do not double-charge single defects.” -- **Closest criterion:** The prevent-unauthorized-side-effects elaboration says, “Charge query syntax omissions under cloning-tenant-isolation or synthesis-tenant-isolation-queries-updates; charge side-effect execution under this criterion.” -- **What is lost:** That sentence routes two failure types but does not state what happens when one missing tenant predicate is itself the reason an unowned record is mutated. An atomic grader could charge both the query criterion and the Crux criterion for that one defect, while the holistic rubric explicitly forbids double-charging it. -- **Suggested criterion:** Add the holistic count-once instruction to the routing elaboration, preserving separate charges only for distinct defects. +- **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. ## Invented content -None found. The restored holistic rubric and grader context support the handler, model, and field names used in the atomic answer keys. +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. ## Context integrity -The Evaluation Overview's handler and purpose facts survive in the grader context's architecture section. The tenant-source, model, ownership-stop, and SQS acknowledgment facts are present there or in the criteria. No needed ground-truth fact is missing from both. +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. ## Crux alignment -The holistic Side-Effect Prevention rule applies a heavy penalty to the overall score. The atomic prevent-unauthorized-side-effects criterion carries severity crux. No other holistic overall-score penalty or atomic Crux exists. +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. ## Overall verdict -The source and atomic rubrics now agree on the substantive isolation targets and Crux severity. The remaining material gap is the source's explicit protection against charging a single defect twice; the atomic routing note does not fully preserve it. +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. 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 506cafa1..ab0330df 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:55:51.138Z", + "capturedAt": "2026-10-14T19:59:03.819Z", "capturedBy": "stamp", "inputs": { - "prompt": "2ba0edbffb417a1f200b113d1197ccb0e68d6a5ac6aa732e4c94faf554ceaad7", + "prompt": "c64435de4828437c0e28f203d3d035913cf9e4221a145ee255e736d08a83a4c4", "graderGuidance": null, "sessionJsonl": null, "workspacePatch": null, "gitref": "fcd8a9d0", "graderGuidanceConsolidated": null, - "holisticRubric": "97545c66b57f59a4810ccffc06658fb9e1b49dccf8ca14bda4242b4ed5a5d1c7", - "atomicRubric": "a6715ef6b8c360cdc2c58b2081717196fbde6d43c3638ed71263bb1f6fcc0bd2", + "holisticRubric": "631a377cbe47388c3f2781591c62e427468061dd1832167f34d762a86efe7509", + "atomicRubric": "d29dd39a3e6d05c515bbcd1910f8afe075670c1d66418132c38f8d297ed19928", "rubricsYaml": null, - "graderContext": "780c5648cbb3fd098e9c88a639b156882ea5c55d02f222e7c430a777d1793556" + "graderContext": "561fe762c83d6595f45035c9e3ba1d3977f116b911bf0ed0c0dcb4ccbd579187" } } 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 64cc46e3..176aa7cd 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 @@ -19,32 +19,25 @@ 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” appears in the stop-condition criterion, but describes the failing ownership condition rather than phrasing the requirement negatively. +11. Positive-phrasing pattern sweep over guidelines: pass. The phrase “records do not match” is a condition describing failed ownership, not a negated requirement. ## Atomicity and self-containment -None found. The handler-specific query criteria and stop-condition criterion each state a judgeable requirement. The SQS acknowledgment protection is a non-trigger in the worker-loop elaboration, not a separate scored criterion. +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. ## Phrasing and answer keys -### Factual answer keys are only partly bold +### Bold answer keys omit identifiers present in their guidelines -- **Criterion:** synthesis-tenant-isolation-queries-updates, among others. -- **Where:** “**Answer key:** Downstream **reads** and **updates** to **RecordingSalutation** and **Recording** ... must be scoped by the profile-derived **userId**.” -- **Why:** The key facts are inline and readable, but the full factual relationship is plain text. This is a formatting issue rather than a missing answer key. -- **Suggested rewrite:** Bold the full answer-key sentence in each factual guideline. - -### Crux scoring direction is repeated inside the guideline - -- **Criterion:** prevent-unauthorized-side-effects. -- **Where:** “Failing this crux criterion applies a **heavy penalty** to the **overall score**.” The elaboration repeats the same direction. -- **Why:** This is grading machinery rather than part of the response behavior or factual answer key. The crux severity and elaboration already carry it, so the repetition adds clutter without changing the requirement. -- **Suggested rewrite:** Keep the stop-condition requirement and factual key in the guideline; keep the grading note in the elaboration. +- **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. ## Fair-grading findings -None found. The previous standalone acknowledgment-permission criterion has been removed, and the restored grader context and atomic guidelines supply the facts needed to judge each criterion. +None found. The SQS non-penalty instruction's placement is a holistic-to-atomic coverage issue, not a malformed scored criterion. ## Overall verdict -The six-criterion file passes the deterministic checks and remains independently judgeable. Partial answer-key bolding and a repeated Crux instruction are minor judgment-layer issues. The coverage detector separately assesses whether the count-once protection survives conversion. +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. 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 ff98a50e..a371d37e 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,20 +1,15 @@ -# Refactor Voice Synthesis & Cloning Handlers for Multi-Tenant Data Isolation +# Refactor Voice Worker Handlers for Multi-Tenant Data Isolation ## Overview -Our backend processing pipeline handles voice cloning and speech synthesis jobs via background queue consumers. Currently, these handlers query database records using only document identifiers (`_id`) passed in SQS message payloads, without validating that the requested records belong to the requesting user (`userId`). +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`). -You must audit and refactor the background job handlers in `voice-cloning-job-handler` and `voice-synthsizer-job-handler` to enforce strict tenant data isolation. +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. ## Objectives -1. **Enforce Tenant Isolation in Voice Cloning Handler**: - - Update all database queries and updates in `voice-cloning-job-handler` on `VoiceCloning` and `UserAudioProfile` models to include `userId` scoping alongside record `_id`. - -2. **Enforce Tenant Isolation in Speech Synthesis Handler**: - - In `voice-synthsizer-job-handler`, use the `userAudioProfileId` from the job payload to look up the target `UserAudioProfile` record by `_id` to establish the authenticated `userId` context. - - Scope all downstream database queries and updates on `RecordingSalutation` and `Recording` models by `userId`. - -3. **Prevent Unauthorized Side Effects**: - - If tenant validation fails or record ownership does not match `userId`, halt execution immediately before performing audio synthesis rendering or database mutations. - -4. **Maintain Worker Loop Stability**: - - Ensure exceptions during job processing are caught in a `try-catch` block so worker polling loops do not crash. +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. 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 b4ff5f67..5cc71ba0 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,45 +6,74 @@ 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** on **VoiceCloning** and **UserAudioProfile** 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 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. - 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 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. - id: prevent-unauthorized-side-effects category: primary_intent dimensions: - Narrow Correctness severity: crux call_site_key: voice-synthsizer-job-handler - guideline: The response should prevent unauthorized side effects, including audio rendering and database mutations in voice-cloning-job-handler and voice-synthsizer-job-handler, when tenant validation fails or records do not match userId context. **Answer key:** Synthesis **audio rendering** and **database mutations** must be halted if **userId tenant ownership checks** fail. Failing this crux criterion applies a **heavy penalty** to the **overall score**. - elaboration: 'Routing note: Charge query syntax omissions under cloning-tenant-isolation or synthesis-tenant-isolation-queries-updates; charge side-effect execution under this criterion. Failing this crux criterion applies a heavy penalty to the overall score.' + 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.' - id: initial-profile-tenant-resolution category: dodged_bullet dimensions: - Narrow Correctness severity: possible_dealbreaker call_site_key: voice-synthsizer-job-handler - guideline: 'The response should allow the initial UserAudioProfile lookup by _id: userAudioProfileId in voice-synthsizer-job-handler as a valid tenant-resolution step without requiring userId in that initial query. **Answer key:** The initial lookup on **UserAudioProfile** by **_id: userAudioProfileId** 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. + 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. - 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 in voice-synthsizer-job-handler and voice-cloning-job-handler 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. Standard framework SQS message acknowledgment and deletion on completed or rejected jobs must not be penalized. + 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. - id: refactor-summary-accuracy category: primary_intent dimensions: - Communication severity: unlikely_dealbreaker call_site_key: voice-synthsizer-job-handler - guideline: The response should accurately describe the multi-tenant isolation refactor across voice-cloning-job-handler and voice-synthsizer-job-handler in its written summary or code documentation if provided. **Answer key:** Any written **summary**, **explanation**, or **code documentation** must **accurately reflect** the actual code refactoring and **userId tenant isolation logic** without misleading claims. - elaboration: Evaluates the accuracy and clarity of written response summaries or code documentation. + 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. 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 82153487..932b5bf8 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,23 +1,9 @@ -# Grader Reference Context: Potion Voice User Ownership +# Grader Ground Truth & Reference Context -## Codebase Architecture & Background Workers -The background processing tier ingests SQS messages for voice cloning and speech synthesis: -1. **`voice-cloning-job-handler`**: Processes voice cloning tasks on `VoiceCloning` and `UserAudioProfile` models. -2. **`voice-synthsizer-job-handler`**: Processes speech synthesis tasks on `UserAudioProfile`, `RecordingSalutation`, and `Recording` models. - -## Key Identifiers & Data Models -- **Handlers**: `voice-cloning-job-handler`, `voice-synthsizer-job-handler` -- **Models**: `VoiceCloning`, `UserAudioProfile`, `RecordingSalutation`, `Recording` -- **Fields**: `userId` (tenant identifier), `_id`, `userAudioProfileId`, `recordingId`, `salutationId` - -## Ground Truth Behavior & Verification Rules -1. **Tenant Isolation Flow in Speech Synthesis**: - - SQS message payload provides `userAudioProfileId`, `recordingId`, and `salutationId`. - - Initial lookup: `UserAudioProfile.findOne({ _id: userAudioProfileId })` (or `findById`) is permitted as a tenant resolution step to extract `userAudioProfile.userId`. - - Downstream operations: All subsequent queries and updates on `RecordingSalutation` and `Recording` must include `{ userId: userAudioProfile.userId }`. -2. **Tenant Isolation Flow in Voice Cloning**: - - Reads and updates on `VoiceCloning` and `UserAudioProfile` must incorporate `userId`. -3. **Side-Effect Control**: - - If `userId` validation fails, handlers must return/throw early to prevent audio generation rendering and database writes. -4. **Framework SQS Acknowledgment**: - - SQS message acknowledgment and deletion inherited from the consumer loop is standard framework behavior and is not a security defect. +## 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. 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 941eb255..0ae54f3c 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,37 +1,21 @@ -# Holistic Evaluation Rubric: Potion Voice User Ownership +# Holistic Evaluation Rubric: Voice Worker User Ownership -## Evaluation Overview -This rubric evaluates backend refactoring changes in `voice-cloning-job-handler` and `voice-synthsizer-job-handler` to ensure multi-tenant data isolation and worker resilience. +## 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`. --- -## 1. Narrow Correctness +## Core Dimensions -### Primary Intent: Tenant Isolation & Side-Effect Controls -- **Voice Cloning Query Scoping**: - - All queries and database updates in `voice-cloning-job-handler` accessing `VoiceCloning` or `UserAudioProfile` models must filter by `userId` in addition to document `_id`. -- **Speech Synthesis Query Scoping**: - - The initial `UserAudioProfile` lookup in `voice-synthsizer-job-handler` using `_id: userAudioProfileId` is valid to resolve `userId`. - - All downstream reads and updates on `RecordingSalutation` and `Recording` models must filter by `userId`. -- **Side-Effect Prevention (Crux Requirement)**: - - When tenant ownership checks fail or records do not match `userId`, the handler must halt immediately before triggering audio rendering or mutating database records. - - *Crux Rule*: Failing to halt unauthorized audio rendering or database mutations when tenant validation fails applies a heavy penalty to the overall score. +### 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. -*Routing Note*: Missing query syntax filters should be charged under specific scoping criteria (`cloning-tenant-isolation` or `synthesis-tenant-isolation-queries-updates`). Executing unauthorized audio generation or database writes on unowned records must be charged under `prevent-unauthorized-side-effects`. Do not double-charge single defects. +### 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. ---- - -## 2. Broader Correctness / the craft of software engineering - -### Worker Polling Loop Stability -- Job processing within `voice-synthsizer-job-handler` and `voice-cloning-job-handler` must be wrapped in `try-catch` blocks to handle errors gracefully without crashing the background worker polling loop. - -### Framework Behavior Non-Penalization -- Standard SQS message deletion and acknowledgment behavior inherited from the consumer framework on completed or rejected jobs is standard infrastructure functionality and must not be penalized. - ---- - -## 3. Communication - -### Written Response & Code Documentation -- Any accompanying written summary or inline code comments must accurately reflect the multi-tenant isolation refactor across `voice-cloning-job-handler` and `voice-synthsizer-job-handler` without misleading claims. +### 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.