REPOSITORY CODING · MEDIUM
Finishing a service hides newly accumulated usage
Meter readings continue arriving while a service job is open. Completion incorrectly marks later usage as serviced. Follow the job snapshot into completion.
Incident DebuggingEquipment service bay
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Django · 50 minute session
- register takes id, a nonnegative integer meter and a positive service interval. It starts ready with lastService equal to its initial meter.
- reading accepts only nondecreasing integer meter readings. due lists ready equipment with usage since last service at least its interval, sorted by ID.
- open takes a new job id, equipment and technician. Only ready equipment can enter servicing. The job captures the meter at opening.
- finish is assigned-technician-only and open-job-only. It marks equipment ready and records the captured meter as lastService; newer readings must not be swallowed.
- cancel is assigned-technician-only and open-job-only. It releases equipment without resetting its service history. inspect returns the equipment record.
- Every command includes tenant and op. IDs belong to a tenant. Invalid commands return an error without stopping later commands.
- Mutations and their audit records commit together. failAudit rolls back all changes. Read operations do not increment revision.
- An optional request key makes retries idempotent per tenant. Reusing the key with different fields returns request-conflict.
- Use the authenticated workspace API for state across HTTP requests. /run is a disposable fixture. Time and failures are explicit inputs, so tests are repeatable.
Flask · 50 minute session
- register takes id, a nonnegative integer meter and a positive service interval. It starts ready with lastService equal to its initial meter.
- reading accepts only nondecreasing integer meter readings. due lists ready equipment with usage since last service at least its interval, sorted by ID.
- open takes a new job id, equipment and technician. Only ready equipment can enter servicing. The job captures the meter at opening.
- finish is assigned-technician-only and open-job-only. It marks equipment ready and records the captured meter as lastService; newer readings must not be swallowed.
- cancel is assigned-technician-only and open-job-only. It releases equipment without resetting its service history. inspect returns the equipment record.
- Every command includes tenant and op. IDs belong to a tenant. Invalid commands return an error without stopping later commands.
- Mutations and their audit records commit together. failAudit rolls back all changes. Read operations do not increment revision.
- An optional request key makes retries idempotent per tenant. Reusing the key with different fields returns request-conflict.
- Use the authenticated workspace API for state across HTTP requests. /run is a disposable fixture. Time and failures are explicit inputs, so tests are repeatable.
Python · 50 minute session
- register takes id, a nonnegative integer meter and a positive service interval. It starts ready with lastService equal to its initial meter.
- reading accepts only nondecreasing integer meter readings. due lists ready equipment with usage since last service at least its interval, sorted by ID.
- open takes a new job id, equipment and technician. Only ready equipment can enter servicing. The job captures the meter at opening.
- finish is assigned-technician-only and open-job-only. It marks equipment ready and records the captured meter as lastService; newer readings must not be swallowed.
- cancel is assigned-technician-only and open-job-only. It releases equipment without resetting its service history. inspect returns the equipment record.
- Every command includes tenant and op. IDs belong to a tenant. Invalid commands return an error without stopping later commands.
- Mutations and their audit records commit together. failAudit rolls back all changes. Read operations do not increment revision.
- An optional request key makes retries idempotent per tenant. Reusing the key with different fields returns request-conflict.
- Use the authenticated workspace API for state across HTTP requests. /run is a disposable fixture. Time and failures are explicit inputs, so tests are repeatable.