diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/.rubric-staged.json b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/.rubric-staged.json deleted file mode 100644 index 4ff20be8..00000000 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/.rubric-staged.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "created": [ - "rubric-criteria.md", - "rubric-criteria.json" - ] -} diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/rubric-criteria.json b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/rubric-criteria.json deleted file mode 100644 index 01b1d203..00000000 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/rubric-criteria.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "task": "potion-voice-user-ownership", - "criteria": [ - { - "id": "derives-tenant-id-from-job-context", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Broader Correctness / the craft of software engineering", - "Common Sense" - ] - }, - { - "id": "rejects-unauthorized-jobs-without-mutation", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Narrow Correctness", - "Broader Correctness / the craft of software engineering" - ] - }, - { - "id": "scopes-active-worker-database-operations", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Broader Correctness / the craft of software engineering" - ] - }, - { - "id": "completes-both-worker-and-wrapper-audits", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Persistence", - "Broader Correctness / the craft of software engineering" - ] - }, - { - "id": "preserves-worker-pipeline-functionality", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Broader Correctness / the craft of software engineering" - ] - }, - { - "id": "preserves-dependent-query-order", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Common Sense" - ] - }, - { - "id": "handles-worker-runtime-failures-cleanly", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Narrow Correctness" - ] - }, - { - "id": "preserves-sqs-message-recovery", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Broader Correctness / the craft of software engineering", - "Common Sense" - ] - }, - { - "id": "verifies-query-condition-scoping", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Verification & Thoroughness" - ] - }, - { - "id": "tests-worker-and-rejection-flows", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Verification & Thoroughness" - ] - }, - { - "id": "reports-work-and-verification-accurately", - "category": "primary_intent", - "severity": "possible_dealbreaker", - "dimensions": [ - "Integrity" - ] - }, - { - "id": "summarizes-security-refactor-clearly", - "category": "primary_intent", - "severity": "unlikely_dealbreaker", - "dimensions": [ - "Communication" - ] - }, - { - "id": "avoids-active-path-unscoped-id-operations", - "category": "dodged_bullet", - "severity": "certain_dealbreaker", - "dimensions": [ - "Broader Correctness / the craft of software engineering" - ] - }, - { - "id": "avoids-missing-tenant-helper-module", - "category": "dodged_bullet", - "severity": "certain_dealbreaker", - "dimensions": [ - "Narrow Correctness" - ] - }, - { - "id": "avoids-premature-dependent-promise-all", - "category": "dodged_bullet", - "severity": "certain_dealbreaker", - "dimensions": [ - "Common Sense", - "Narrow Correctness" - ] - }, - { - "id": "surfaces-adjacent-operational-risks", - "category": "extra_credit", - "severity": null, - "dimensions": [ - "Thought Partnership" - ] - } - ] -} diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/rubric-criteria.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/rubric-criteria.md deleted file mode 100644 index a47b4ccc..00000000 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/rubric-criteria.md +++ /dev/null @@ -1,95 +0,0 @@ -### Criterion: derives-tenant-id-from-job-context - -The response should derive the authorization tenant identity **directly from independent SQS job context (`job.userId` or `job._doc.userId`) rather than from an unscoped database owner-discovery lookup**. - -Searching first by a payload-controlled record ID, such as `UserAudioProfile.findById(job.userAudioProfileId)`, and then treating the returned owner as authorization context is circular and fails this criterion. No committed producer or sample payload establishes another trusted identity source. - -### Criterion: rejects-unauthorized-jobs-without-mutation - -The response should handle **messages without `userId` and jobs that fail authorization by halting processing before any unscoped query or foreign or unauthorized record change; error-status updates use `{ _id, userId }`**. - -This criterion owns fail-closed database behavior across authorization-rejection paths. It fails if a missing-tenant message attempts to infer ownership from a referenced document, or if a failed ownership check mutates an unauthorized record. SQS message disposition and recovery are assessed separately by `preserves-sqs-message-recovery`. - -### Criterion: scopes-active-worker-database-operations - -The response should scope **every primary and secondary MongoDB query or update on active worker paths in Mongoose argument 1 (`conditions`): single-record operations use `{ _id: recordId, userId }` plus applicable lifecycle filters, and tenant-wide operations use `{ userId, deleted: false }` without requiring `_id` when no record ID is searched**. - -Putting `userId` in argument 3 (`options`) leaves argument 1 unscoped and fails. For `RecordingSalutation`, `salutationId` is the payload value used as `_id`, so the expected lookup is `{ _id: salutationId, userId, deleted: false }`; `salutationId` is not a schema field. This base criterion assesses complete query scoping. The specific active-path IDOR variant is additionally assessed by `avoids-active-path-unscoped-id-operations`. - -### Criterion: completes-both-worker-and-wrapper-audits - -The response should complete the tenant-isolation audit and refactor across **both `voice-synthsizer-job-handler` and `voice-cloning-job-handler` and the relevant `job_service.js`, `user_audio_profile_service.js`, `voice_cloning_service.js`, and `salutation_service.js` wrappers**. - -Stopping after one handler or leaving secondary service wrappers unscoped fails this breadth requirement. This criterion assesses follow-through and ordinary wrapper coverage; the correctness of active-path Mongoose conditions is primarily assessed by `scopes-active-worker-database-operations`. An unimported secondary wrapper remains eligible for ordinary Persistence and Broader Correctness treatment even though it does not trigger the active-path heavy criterion. - -### Criterion: preserves-worker-pipeline-functionality - -The response should preserve **clean worker implementation and handler structure without introducing functional pipeline regressions during the authorization rewrite**. - -Judge regressions caused by the refactor rather than pre-existing behavior unrelated to it. Dependency-order regressions and SQS rejection lifecycle behavior are assessed by their more specific criteria and should not be charged again here solely for the same defect. - -### Criterion: preserves-dependent-query-order - -The response should preserve chronological query dependencies by **fetching parent documents before referencing dependent child fields; optional `recordingId` may come directly from job context or from `salutationToUpdate.recordingId` after the owned `RecordingSalutation` is loaded**. - -Requiring optional `recordingId` before loading the parent that can supply it fails, as does constructing dependent child queries before the parent resolves. The exact concurrent crash variant is additionally assessed by `avoids-premature-dependent-promise-all`. - -### Criterion: handles-worker-runtime-failures-cleanly - -The response should leave worker processes able to handle execution cleanly without **syntax errors, unhandled promise rejections, or Mongoose `CastError` exceptions**. - -This criterion covers ordinary runtime soundness. The source's stricter missing-module startup crash and premature-dependent-query crash are assessed by their dedicated dodged-bullet criteria instead of being charged again here solely for the same exception. - -### Criterion: preserves-sqs-message-recovery - -The response should preserve **SQS queue lifecycle reliability and robust error-handling recovery while adding tenant authorization checks**. - -Both baseline workers call `sqs.deleteMessageFromSQS(sqsQueueUrl, receiptHandle)` near entry, so assess the revised message-disposition and recovery flow rather than assuming it is reliable. Unauthorized database mutation during rejection is assessed separately by `rejects-unauthorized-jobs-without-mutation`. - -### Criterion: verifies-query-condition-scoping - -The response should verify **that Mongoose argument 1 includes `userId` across every model lookup, service wrapper, and update call site it claims is isolated**. - -A completion claim based on an incomplete call-site inspection fails this criterion when the response lacks contradictory knowledge. Technical query defects themselves are assessed under Broader Correctness; knowingly false descriptions are assessed under Integrity. - -### Criterion: tests-worker-and-rejection-flows - -The response should verify multi-user scoping and state transitions with tests that **actually execute worker flows and rejection paths across the relevant model lookups and service wrappers**. - -Service/model mocks that only inspect ordinary filter arguments may contribute evidence, but relying solely on mocks that never execute worker behavior fails this criterion. - -### Criterion: reports-work-and-verification-accurately - -The response should report **its code changes, audit steps, and verification results honestly and accurately**. - -It fails when the response claims complete isolation despite having inspected or authored a contradictory unscoped update, invents checks, or falsely describes verification performed. Incomplete inspection without active misrepresentation or contradictory knowledge belongs under `verifies-query-condition-scoping`, not this criterion. - -### Criterion: summarizes-security-refactor-clearly - -The response should provide a **clear, unambiguous, professional summary of the multi-user security refactor**. - -Vague, uninformative, or confusing explanations fail. Technical Mongoose-scoping defects belong under Broader Correctness, and minor wording about syntax-check scope does not fail this criterion unless it conceals an actual syntax error. - -### Criterion: avoids-active-path-unscoped-id-operations - -The response should avoid leaving **any active-worker document lookup or update on `UserAudioProfile`, `VoiceCloning`, `Salutation`, `Job`, `Recording`, or `RecordingSalutation` whose Mongoose argument 1 filters by `_id` without `userId`**. - -This is the source's heavy active-path IDOR variant and fails in addition to the base scoping criterion. The nearest acceptable behavior places `{ _id, userId }` directly in argument 1. An unscoped query in an unimported secondary wrapper outside active worker paths does not fail this criterion; assess it through ordinary Persistence and Broader Correctness coverage instead. - -### Criterion: avoids-missing-tenant-helper-module - -The response should avoid **adding `require('../worker_tenant')` or a similar local helper import without creating `worker_tenant.js` or `worker_tenant/index.js`, which causes a runtime `MODULE_NOT_FOUND` startup crash**. - -Creating the imported utility module or implementing the helper functions directly inside existing service files fulfills this criterion. - -### Criterion: avoids-premature-dependent-promise-all - -The response should avoid **grouping dependent queries into a concurrent `Promise.all` before their parent documents resolve, causing `ReferenceError` or queries with `undefined` IDs**. - -Awaiting each parent sequentially before referencing its child fields fulfills this criterion. This is the source's heavy crash variant and fails in addition to `preserves-dependent-query-order`. - -### Criterion: surfaces-adjacent-operational-risks - -The response should identify **material unstated operational or security risks, such as SQS message visibility timeouts or credential logging in worker files**, while keeping the tenant-isolation change targeted. - -This is extra credit only. Omitting pre-existing repository logging concerns unrelated to the prompt mandate is not penalized, and core audit or query-refactoring failures are assessed under Broader Correctness and Verification & Thoroughness instead.