Skip to main content

Review and repair a tenant-scoped lookup

Download the lab archive. Extract design-review and use Python 3.10+ with the standard library. On Windows, replace python3 with py -3. The extension replaces the old short lab; implementation and review take 8–12 of its 20–28 hours.

Read the contract before the implementation​

Rows contain nonempty string tenant, id, and name fields, unique (tenant,id) pairs, and no nested mutable values. Identifiers match exactly. A directory owns a construction-time snapshot. A lookup returns a fresh matching dictionary or None. Repeated calls and input order must not change results. The tenant argument comes from an already-authorized caller; this is not an authorization implementation.

Review, reproduce, repair​

  1. Inspect candidate.py, write predictions and classify findings before opening reference.py.
  2. Run the public checks and retain the first assertion failure:
python3 check.py candidate
  1. Add your own minimal regression. Copy candidate.py to solution.py and repair it. Keep behavior repair separate from optional cleanup.
python3 check.py solution
  1. Exercise overlapping ids, miss-then-hit sequences, reversed row order, changed input after construction, and changed returned records. The public checks cover 343 three-request sequences plus ownership cases; add a changed case independently.
  2. After your attempt, compare reference.py and run python3 check.py reference. Removing caching is also valid if the observable contract holds.
  3. Write the verdict, ADR, safe recovery plan and remaining limitations. Use a local disposable history exercise; do not rewrite shared branches.

Evidence to retain​

Submit a contract note, actionable review findings, your regression's failing and passing outputs, repaired code, a short decision record and the AR1–AR6 score sheet. Include a source/assistance record and a delayed fresh-case explanation. Do not fabricate reviewer conversations: label solo review and simulated replies.

Checks must fail because of the claimed behavior, not broken imports. A code revert cannot undo a disclosure and must not restore the known tenant leak. The lab replaces only the earlier guided lookup exercise, not the human-centered and accessibility lab.

Use the review workbench to connect this executable repair to the original three review samples, decision record, experiments and HCI work. The practice solutions are separate from the attempt.