Skip to content
Agent Field Notes
Practice topicsFilter practice questions by topic.All practice →
knowledge unit 42AdvancedSystem designAbout 30 minutes

Understand → Implement → Debug → Design

Tenant isolation and continuous authorization during execution

Build evidence from strict scoped application work to independent recovery/audit, then platform capacity and failure-window decisions.

Platform architecturemulti-tenantDelivery

Knowledge content check2026-10-03 · Check the source of the original question2026-10-02

Which step do you want to learn from this knowledge point?

Select the starting point based on the current basis, or you can go deeper one by one. When you encounter an unfamiliar concept, go back to the core principles first; use the knowledge exercises to check your understanding when you are finished.

Understand first

New to this knowledge point

Complete the prerequisite concepts, read the principles and counterexamples, and then explain why in your own words.

Start with core principles →

Implement next

Prepare to write the principles into code

Understand implementation steps and boundaries, complete small tasks, and check results against acceptance requirements.

Reading implementation and trade-offs →

Debug failures

Need to handle failures and changes in conditions

Follow the continuous questioning to locate the failure premise, and then compare the migration cases to explain how the plan should be adjusted.

Continue to delve deeper into the problem →

Compare designs

Need to design or review plans

Combine engineering deductions and senior self-evaluation standards to explain the applicable conditions, costs and alternatives of the plan.

Analyze engineering scenarios →
Knowledge unit directory

LEARN · PRACTICE · REFLECT

Knowledge learning and personal records

My notes and review ↗

First read along the principles, Q&A and migration cases. When you need to check your understanding, switch to reinforcement exercises or start personal recording.

Answers and personal notes

Each modified commit will be kept as an independent history. Your level of mastery is up to you to evaluate yourself against the standards.

Core concept · Tenant isolation and continuous authorization during execution

Understand the core principles first

Preparatory concepts:Trusted identity, Row level permissions, control surface and execution surface

Preserve trusted identity and current authorization across data copies, queues, checkpoints and external effects; implement local audits and estimate bounded resources, while declaring unimplemented deployment races and validation.

Visual guide · Current authority follows every copied byte

Current authority follows every copied byte

Historical task status cannot grant new access. Apply current identity and version checks across copies, recovery and external commit. Select the figure to open it at full size.

One platform; learning modes and job capabilities are separate

The case is the same after-sales Agent: read an order, retrieve current return policy, draft a return-application proposal, obtain human approval, execute and reconcile its receipt. The existing capstone uses fictional acme/other tenants, Alice/Bob ownership and an independent merchant HTTP service. It does not implement a 50-tenant managed platform, a general queue/outbox, production identity, an embedding index or production capacity.

Foundation/implementation/debugging/design are four learning modes, not four job ranks. Use an evidence ladder separately:

  • Junior application work: implement strict input and tenant-boundary functions, call an API, explain why model-provided tenant/approved fields cannot authorize it, and retain actual negative controls. Start with the four prerequisite contracts.
  • Intermediate ownership: implement a personal read/audit or business change, preserve identity/receipt across restart, reject revoked cache/checkpoint sources, and explain a reproducible failure using the independent receipt rather than local status.
  • Senior platform work: own cross-service invariants, capacity and fairness assumptions, authorization races, migration/recovery release conditions, operational audits and a failure-window ADR. Supply executable local evidence plus the unimplemented production validation plan. Local scripts alone do not establish senior production experience or a hiring outcome.

Fixed input: identify authority before choosing storage

This JSON is a platform design input, not an added capstone schema. The authenticated session is trusted; the request and historical copies are not current authority.

{
  "scope": "fictional_platform_design_input_not_capstone_schema",
  "trusted_session": {
    "subject": "alice",
    "tenant": "acme",
    "auth_version": 2,
    "active": false
  },
  "request": {
    "order_id": "o-other",
    "tenant": "other",
    "subject": "other",
    "approved": true
  },
  "queued_task": {
    "task_id": "main-return",
    "tenant": "acme",
    "owner": "alice",
    "admitted_auth_version": 1,
    "status": "ready"
  },
  "derived_copies": [
    {
      "entry": "index",
      "tenant": "acme",
      "source_version": 1,
      "policy_version": 1
    },
    {
      "entry": "cache",
      "tenant": "acme",
      "owner": "alice",
      "auth_version": 1,
      "policy_version": 1
    },
    {
      "entry": "checkpoint",
      "tenant": "acme",
      "owner": "alice",
      "auth_version": 1,
      "policy_version": 1
    }
  ],
  "current_policy_version": 2,
  "merchant_receipt": null,
  "public_policy": {
    "publication_approved": true,
    "contains_private_dependency": false
  }
}

Derive the decisions in order. Alice is currently inactive, so suspend sensitive order reads and new writes. Neither request.tenant=other nor approved=true changes her authority. queued_task.status=ready records historical workflow state, not a new permission grant. The index, cache and checkpoint are stale candidates; restoring or querying them must not release private body to the model, user, evaluation worker or export process. A separately publication-approved policy with no private dependency may use a bounded public path, but public text does not authorize the private order. No receipt here proves a committed application; do not claim one.

Follow the copy and execution chain

For each entry write down trusted principal, resource scope, version check, failure decision and evidence: admission; queue claim/resume; database/order API; index/reranker/model context; cache and every dependency; checkpoint/summary; tool commit; log/artifact/export. A tenant prefix isolates names but does not authenticate a subject or prove permission freshness. The same tenant's Alice and Bob still have different order ownership. A privileged log reader is also an authenticated role, not a blanket exception.

Control plane owns approved policy/configuration/quotas/releases; execution plane consumes bounded versions and reports actual state. Separate authorization version, document/source version, workflow schema version and worker fence: advancing one does not refresh the others. PostgreSQL RLS may add a database boundary; superusers/BYPASSRLS and normally owners bypass it, so test the actual connection role. RLS does not cover an external cache, index or already-built model context.

Deliver tenant-boundaries.json with the predicted decisions before running examples. Contrast a current active Alice/acme order with this revoked session and a Bob-owned order. Record which bytes might already have been sent: filtering later cannot recall an earlier model/provider response, log or backup.

Existing evidence and scope

The RAG permission lab checks five read entries, versions, cross-user cache and all dependency rows; its scores are simulated metadata. The memory revocation lab rejects a current-epoch summary whose second source is revoked/missing while retaining an unrelated preference. The capstone rechecks current merchant identity/policy/memory at business commit and audits actual local receipts. Their fixtures differ; map the invariant and restate each input contract rather than renaming fields blindly.

career-route; approval; capstone; capstone_zh; rag; memory; outbox; queue; workflow; prereq; protocol; pg; aws; owasp

Check understanding with a question

From a Demo to an enterprise multi-tenant Agent platform, which layers would you add first?

Compare with the reference answer

Keep trusted identity/current permission continuous across copies and handoffs; verify independent receipts rather than local status. Start with a scoped application, then deliver a personal audit/fault repair, and finally resource estimates, per-tenant operating gates and four failure-window ADRs. Existing local experiments support individual invariants, not a completed enterprise platform or certified seniority.

Implementation and trade-offs

Start with one after-sales invariant, then increase ownership

The same Agent reads current order/policy, proposes a return application, obtains bound human approval, executes once under its business intention and reconciles an independent merchant receipt. Ingress resolves tenant/subject from a trusted service; request tenant, a model decision or a queued ready status never creates current permission. A 50-tenant platform is a design assignment, not an already-implemented production system.

Junior evidence: implement strict JSON/tenant/API functions and show an authorized control plus same-tenant-other-owner/cross-tenant refusals. Intermediate evidence: implement the personal platform_audit reader in the linked course, retain receipt binding, exact per-task count, complete drill coverage, source versions and all derivative dependency checks across restart. Senior evidence: supply the copy-path inventory, bounded resource/tenant scheduler design, executable capacity_plan arithmetic, operational audit plan and four-window ADR. These are separate responsibilities, not a claim that finishing four course tracks assigns a job rank.

Identity and authorization must survive every handoff

Carry trusted tenant/owner, task/event/input identity and authorization/schema/config versions through proposed queue, cache/index, checkpoint, tool gateway and audit/artifact paths. Reload current authority at each private body-release/new-effect boundary; every cache/summary dependency must be allowed and version-current. The platform must prevent revoke/regrant from reviving an old cache/approval generation. The RAG cache and standalone approval experiments test these generation gates; the capstone reviewer check currently tests active/role/tenant and approval expiry/revocation, without binding reviewer auth_version. Treat adding that generation binding as proposed work. Schema migration and worker fencing do not refresh user permission. Real principal authentication, cross-service atomic reservations and immediate revocation coordination must be separately implemented; historical payload claims are insufficient.

If permission changes after a read check but before body dispatch, specify an actual synchronization boundary or a bounded weaker guarantee. During unknown sensitive authority, pause; retain minimal audited operational facts. Filtering the final answer cannot recall already-sent model context. RLS adds only a database boundary and requires actual connection-role checks, not an assumption that every data copy is protected.

Use real local evidence without inventing platform coverage

The capstone's permission-revocation drill has a denied worker, a local ready task and zero independent merchant applications; status is not permission. A committed-then-cancelled task retains one receipt. RAG permission and memory revocation exercises cover every derivative dependency with negative and useful positive controls. The outbox course is a standalone SQLite experiment; capstone has durable task state and merchant fencing, not a general production queue/outbox. Implement the course audit/probe over work/recover-main.json and work/recovery.json after their required stages; preserve your own diff. Supplied route execution and disclosed repair are useful reproduction, not independent unseen diagnosis.

Capacity is a calculation plus a measurement plan

Use the course's fictional inputs: 50 tenants, peak 120 tasks/min, active duration 12 seconds, 3 model calls/6,000 token units/2 tool calls per task; 32 workers, 420 model RPM, 840,000 token units/min and 10 tool requests/sec; 70% planning utilization. Resource limits derive to 112/98/98/210 tasks/min, limiting planned start 98. If all offered tasks queue for ten minutes from 50 pending, the fluid estimate is 270; doubling token units lowers planned start to 49 and estimate to 760, exceeding the 500 queue cap. These are assumptions and offered-load estimates, not observed throughput, token usage, prices or p95 latency.

Separate admission, tenant queue/concurrency, shared resource and provider budgets. Reserve/reconcile one task lineage across replay rather than double charge; unknown real usage stays null. Plan A-heavy/B-small bursts with throttling, per-tenant queue age/completion and rejected/unknown denominators, actual usage source, audit-access checks and unchanged isolation/receipt gates. A global average and extra workers do not prove fairness or remove a token bottleneck. Mark unrun measurements pending.

Four-window ADR is the senior delivery

Describe permission-check→body-dispatch race; outbox/consumer commit→lost delivered mark; merchant commit→lost response/lease/cancel; old backup restore→unavailable current tombstones. For each provide authority timing, durable facts, same-key replay/fencing, containment, alternative and residual race. Quarantine every restored consumer until newer permission/deletion facts are available; logical invalidation is not physical erasure. Use shared versus dedicated tenant storage based on risk, operational cost and measured workloads, not microservice count.

Submit tenant-boundaries.json, platform_audit.py with unchanged/changed-input outputs, incident-before.md and personal diff, capacity_plan.py, a budget/audit workload and ADR-001-platform-boundaries.md. A reviewer supplies a new complete constraint after the public submission and checks personal reasoning. Local evidence supports declared mechanisms; it does not certify employer seniority or prior production experience.

career-route; approval; capstone; capstone_zh; rag; memory; outbox; queue; workflow; prereq; protocol; pg; aws; owasp

Engineering deduction

scene
Fictional design extension: operate the same after-sales return Agent for 50 tenants under the stated capacity/revocation inputs.
design decisions
Bind trusted principals and current release/commit gates; ship a personal audit, bounded capacity plan and an ADR before claiming a platform.
Verify target
Expected local evidence is one bound main receipt, complete ten-drill audit and 98→49 planned task/min under changed token cost; deployment metrics remain pending.
applicable boundary
Reference reproduction/public repair, arithmetic and proposed architecture do not prove learner independence, production SLOs or employer seniority.

Continuous questions and answers

Continue reading along with the premises and constraints of the problem. Understand the reference answers first, then try to put away the answers and explain the cause and effect and trade-offs in your own words.

Draw inferences from one example: If the conditions change, how to deduce it?

First find out the conditions for change, and then determine which premises in the original plan still hold true. The following cases are teaching deductions to facilitate the transfer of principles to new problems.

Mixing public and private data

Changing conditions:A combined public/private summary adds a second private source whose ACL version changes after caching.

Extended question:Does all data need to be replicated to each tenant?

Derivation and reference solutions

A public first dependency cannot authorize the mixed body. Check every current source/ACL and audience; invalidate the whole cached derivative when the second fails. Public regeneration requires a separately approved audience/output, not removing a number. Retain a two-valid-dependency positive control.

The principles that remain unchanged:Each piece of evidence must be within the scope allowed by the current subject.

The control plane is down but tasks are still running

Changing conditions:Control policy becomes unavailable during a 120-task/min burst and per-task token units double from 6,000 to 12,000.

Extended question:Can extra workers plus the old local permit preserve both availability and isolation?

Derivation and reference solutions

No. Unknown sensitive permission pauses; planned provider token capacity falls from 98 to 49 tasks/min while mean worker demand is unchanged. Bound admission/queues, preserve receipt reconciliation and budgets, and state what is pending. More workers neither restores current authority nor fixes the provider bottleneck.

The principles that remain unchanged:Failure recovery and downgrade do not change authorization boundaries.

Easy to make mistakes

  • Trust historical ready or payload tenant as current permission
  • Protect one database/cache entry while other body paths bypass it
  • Treat average-load arithmetic or public pass counts as production seniority

References

It is designed based on public technical information; the reference materials support the technical mechanism, and the scenarios and scoring standards are designed by this website and do not represent the original interview questions of a certain company. New Q&A and migration cases are added for principle explanation, and source verification and case operation verification are recorded separately.

Check how far you understand

After reading, you can explain the principles, boundaries, and trade-offs against these standards. It is up to you to evaluate your mastery; if further verification is needed, complete the small tasks below.

Basic standards met
Junior-scope evidence: strict function/API boundary and tenant/owner negative controls; explain trusted identity and distinguish local status from receipts.
Intermediate and advanced signals
Intermediate ownership: personal imported audit/business code, failing baseline→same-input repair, all derived dependencies and independent per-task receipt checks; explain pending adapters.
Senior criteria
Senior design evidence: executable multi-resource estimate, per-tenant budget/audit workload and four-window ADR with synchronization alternatives, residual races and pending production validation. Reviewer observes a fresh complete constraint; this is an authored teaching rubric, not job certification.

Hands-on verificationComplete on demand · Suggestions40 minutes

With the course inputs and your completed capstone records, explain one revoked-resume path, implement the audit/capacity probes before the session, then defend the 6,000→12,000-unit bottleneck and one permission-dispatch failure-window ADR under a reviewer-changed condition. Mark prework versus observed session work.

Expand acceptance requirements and checkpoints
  • Own code and unchanged-input evidence, with useful positive controls and explicit scope/source labels
  • Capacity calculation names units/bottleneck, distinguishes mean estimate from measured per-tenant tail latency
  • ADR preserves current authorization/receipt lineage and states coordination races and pending deployment tests

Key inspections

  • Trusted identity and current permissions survive copies/recovery
  • Independent receipt, scope and complete drill audit
  • Resource bottlenecks, per-tenant operating gates and failure-window ADR