fix em dashes
This commit is contained in:
@@ -50,7 +50,7 @@ criteria:
|
||||
elaboration: "Failing this crux criterion applies a heavy penalty to Narrow Correctness
|
||||
and a heavy penalty to the overall score. Tenant context is established when the
|
||||
initial UserAudioProfile lookup yields a valid userId. After that point, any
|
||||
userId-scoped no-match is NOT a Crux trigger — it falls under
|
||||
userId-scoped no-match is NOT a Crux trigger - it falls under
|
||||
scoped-update-null-handling. **Exception**: userId-scoped status updates (e.g.,
|
||||
setting status: 'error') in catch blocks after tenant context is established are
|
||||
NOT Crux failures. These writes target the job's own records and cannot mutate
|
||||
@@ -74,7 +74,7 @@ criteria:
|
||||
elaboration: "Failing this crux criterion applies a heavy penalty to Narrow Correctness
|
||||
and a heavy penalty to the overall score. Tenant context is established when the
|
||||
initial UserAudioProfile lookup yields a valid userId. After that point, any
|
||||
userId-scoped no-match is NOT a Crux trigger — it falls under
|
||||
userId-scoped no-match is NOT a Crux trigger - it falls under
|
||||
scoped-update-null-handling. **Exception**: userId-scoped status updates in catch
|
||||
blocks after tenant context is established are NOT Crux failures. These writes
|
||||
target the job's own records and cannot mutate cross-tenant data. Do not
|
||||
@@ -116,7 +116,7 @@ criteria:
|
||||
audio rendering or side effects occur. **Rendering audio after a tenant-scoped
|
||||
update returns null / 0 matched records is a moderate Broader Correctness defect**
|
||||
(the preflight passed, but the subsequent scoped update failed to match). This
|
||||
defect is charged HERE, not under the Crux side-effect criteria — the Crux
|
||||
defect is charged HERE, not under the Crux side-effect criteria - the Crux
|
||||
guidelines exclude later scoped-update failures, so there is no double-counting.'
|
||||
- id: worker-loop-crash-prevention
|
||||
name: Worker Loop Crash Prevention
|
||||
|
||||
@@ -14,10 +14,10 @@ The repository contains background workers consuming job payloads from AWS SQS q
|
||||
## Evaluation Notes
|
||||
1. **Tenant Isolation**:
|
||||
- Every database read and update on `VoiceCloning`, `UserAudioProfile`, `RecordingSalutation`, `Recording`, `Salutation`, and `Job` must be scoped by `userId` (except the initial `UserAudioProfile` lookup by `_id: userAudioProfileId` to resolve tenant identity).
|
||||
- **Equivalent implementations**: Direct model predicates, differently named helpers, filter objects containing `userId`, or conditional updates all satisfy the requirement — the answer-key method names are illustrative.
|
||||
- **Equivalent implementations**: Direct model predicates, differently named helpers, filter objects containing `userId`, or conditional updates all satisfy the requirement - the answer-key method names are illustrative.
|
||||
2. **Side Effects vs. Minor Defects**:
|
||||
- If a preflight query or update fails to match a record **before tenant context is established**, and audio generation rendering or database mutations STILL proceed, this is a **Crux failure** (`cloning-prevent-unauthorized-side-effects` / `synthesis-prevent-unauthorized-side-effects`).
|
||||
- **Tenant context is established** when the initial `UserAudioProfile` lookup yields a valid `userId`. After that point, any `userId`-scoped no-match is **not** a Crux trigger — it falls under `scoped-update-null-handling`.
|
||||
- **Tenant context is established** when the initial `UserAudioProfile` lookup yields a valid `userId`. After that point, any `userId`-scoped no-match is **not** a Crux trigger - it falls under `scoped-update-null-handling`.
|
||||
- **Exception**: `userId`-scoped status updates (e.g., setting `status: 'error'`) in catch blocks **after tenant context is established** are NOT Crux failures. These writes target the job's own records and cannot mutate cross-tenant data.
|
||||
- If a database update is ALREADY scoped by `userId` (preventing cross-tenant data mutations), failing to check its null return value without executing downstream unauthorized side effects is a minor defensive programming defect under **Broader Correctness / the craft of software engineering** (`scoped-update-null-handling`).
|
||||
- **Note**: Rendering audio after a tenant-scoped update returns null / 0 matched records is a moderate Broader Correctness defect (the preflight passed, but the subsequent scoped update failed to match). **This is charged solely to `scoped-update-null-handling`, not to the Crux criteria.**
|
||||
|
||||
@@ -13,7 +13,7 @@ The candidate must audit database operations in both worker handlers, enforce te
|
||||
- **Side-Effect Halting (Crux)**:
|
||||
- Audio generation rendering and database mutations in either handler must be halted if tenant ownership checks fail or if preflight checks return no matching record.
|
||||
- **Crux Rule**: If a preflight lookup or update returns null / 0 matched records **before tenant context is established**, and the handler STILL proceeds to render audio or execute side effects, this is a **Crux failure** (unauthorized side effect executed).
|
||||
- **Tenant context is established** when the initial `UserAudioProfile` lookup yields a valid `userId` (the bootstrap step permitted above). After that point, any `userId`-scoped no-match is **not** a Crux trigger — it falls under `scoped-update-null-handling`.
|
||||
- **Tenant context is established** when the initial `UserAudioProfile` lookup yields a valid `userId` (the bootstrap step permitted above). After that point, any `userId`-scoped no-match is **not** a Crux trigger - it falls under `scoped-update-null-handling`.
|
||||
- **Exception**: `userId`-scoped status updates (e.g., setting `status: 'error'`) in catch blocks after tenant context is established are **not** Crux failures. These writes target the job's own records and cannot mutate cross-tenant data.
|
||||
- **Deduction Guidance**: Failing a Crux side-effect criterion applies a heavy penalty to Narrow Correctness and a heavy penalty to the overall score. Charge preflight side-effect execution under Crux criteria (`cloning-prevent-unauthorized-side-effects` / `synthesis-prevent-unauthorized-side-effects`).
|
||||
|
||||
@@ -31,16 +31,16 @@ The candidate must audit database operations in both worker handlers, enforce te
|
||||
## Single-Deduction Rule
|
||||
Do not double-charge a single code omission across multiple criteria. Charge query syntax omissions under the query isolation criteria (`cloning-tenant-isolation` / `synthesis-tenant-isolation-queries-updates`), charge preflight execution before validation under Crux criteria, and charge unchecked null results on safely scoped updates under `scoped-update-null-handling`.
|
||||
|
||||
**Note on answer-key APIs**: The method names and signatures below are **illustrative examples** of the tenant-scoped operations and control-flow boundaries. Equivalent implementations using direct model predicates, differently named helpers, filter objects containing `userId`, or conditional updates receive full credit — the requirement is the behavioral outcome, not a specific helper surface.
|
||||
**Note on answer-key APIs**: The method names and signatures below are **illustrative examples** of the tenant-scoped operations and control-flow boundaries. Equivalent implementations using direct model predicates, differently named helpers, filter objects containing `userId`, or conditional updates receive full credit - the requirement is the behavioral outcome, not a specific helper surface.
|
||||
|
||||
## Answer Key: Call Sites & Halt Points
|
||||
The following lists the database operations that must be tenant-scoped and the control-flow points where execution must halt on ownership failure.
|
||||
|
||||
### voice-cloning-job-handler
|
||||
**Reads requiring `userId` scope** (after initial `UserAudioProfile` bootstrap):
|
||||
- `VoiceCloning.read({ _id, userAudioProfileId }, userId)` — preflight ownership check (illustrative)
|
||||
- `VoiceCloning` service: `read`, `find`, `update`, `remove` — all filter by `userId` (illustrative)
|
||||
- `UserAudioProfile` service: `read`, `update`, `remove` — all filter by `userId` (illustrative)
|
||||
- `VoiceCloning.read({ _id, userAudioProfileId }, userId)` - preflight ownership check (illustrative)
|
||||
- `VoiceCloning` service: `read`, `find`, `update`, `remove` - all filter by `userId` (illustrative)
|
||||
- `UserAudioProfile` service: `read`, `update`, `remove` - all filter by `userId` (illustrative)
|
||||
|
||||
**Updates requiring `userId` scope**:
|
||||
- `VoiceCloning.update({ _id, status: 'processing' }, userId)`
|
||||
@@ -60,13 +60,13 @@ The following lists the database operations that must be tenant-scoped and the c
|
||||
|
||||
### voice-synthsizer-job-handler
|
||||
**Reads requiring `userId` scope** (after initial `UserAudioProfile` bootstrap):
|
||||
- `UserAudioProfile.readById(userAudioProfileId)` — bootstrap (permitted unscoped by `userId`, filters by `_id` + `deleted:false`) (illustrative)
|
||||
- `RecordingSalutation.findOne({ _id: salutationId, userId, deleted: false })` — preflight (illustrative)
|
||||
- `Recording.findOne({ _id: recordingId, userId, deleted: false })` — preflight (illustrative)
|
||||
- `RecordingSalutation` service: `read`, `find`, `update`, `remove`, `updateOrCreate` — all filter by `userId` (illustrative)
|
||||
- `Recording` service: `read`, `find`, `update`, `remove` — all filter by `userId` (illustrative)
|
||||
- `Salutation` service: `create`, `read`, `find`, `update`, `remove`, `updateOrCreate` — all filter by `userId` (illustrative)
|
||||
- `Job` service: `insertMany` — scopes by `userId` (illustrative)
|
||||
- `UserAudioProfile.readById(userAudioProfileId)` - bootstrap (permitted unscoped by `userId`, filters by `_id` + `deleted:false`) (illustrative)
|
||||
- `RecordingSalutation.findOne({ _id: salutationId, userId, deleted: false })` - preflight (illustrative)
|
||||
- `Recording.findOne({ _id: recordingId, userId, deleted: false })` - preflight (illustrative)
|
||||
- `RecordingSalutation` service: `read`, `find`, `update`, `remove`, `updateOrCreate` - all filter by `userId` (illustrative)
|
||||
- `Recording` service: `read`, `find`, `update`, `remove` - all filter by `userId` (illustrative)
|
||||
- `Salutation` service: `create`, `read`, `find`, `update`, `remove`, `updateOrCreate` - all filter by `userId` (illustrative)
|
||||
- `Job` service: `insertMany` - scopes by `userId` (illustrative)
|
||||
|
||||
**Updates requiring `userId` scope**:
|
||||
- `salutationService.updateOrCreate({ firstName, salutationVideo, userAudioProfileId }, userId)` (illustrative)
|
||||
|
||||
Reference in New Issue
Block a user