Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Tenant isolation and continuous authorization during execution
- Tenant isolation must cover reads, caches, model context, logs, artifacts, and recovery. Establish trusted tenant identity through authentication and service policy, and preserve the same authorization boundaries during every recovery or fallback.
How does the mechanism work?
Step-by-step explanation
- How are log and vector indexes isolated?
Isolation must cover logs and copies of vector data as well as the database.
- Why might restoring old backups violate deletion requirements?
A durable platform must check whether recovery reintroduces deleted data.
- What can the execution plane do when the control plane is unavailable?
A control-plane failure still requires explicit availability boundaries for the execution plane.
Implementation · Build it
Implement the contract · Tenant isolation and continuous authorization during execution
Objectives of this level: Implement an independent tenant/receipt/drill audit over actual capstone records and connect verified local contracts to proposed platform adapters.
Visual guide · Carry isolation through the run
These are platform boundaries to preserve, not a deployed 50-tenant system. Check caches, artifacts, logs and restored context as well as primary reads. Select the figure to open it at full size.
Start after the existing route, then implement a new reader
Complete the capstone README through recovery in your own extracted project directory, including fault-main (deliberate exit 75), recover-main and stage recovery. Do not rerun old approved writes to manufacture a report. Required inputs are work/recover-main.json and work/recovery.json from that directory; the probe below only reads them. A new directory without those stages cannot supply the input. Read the English and Chinese route links above for the full command order.
In a scratch file platform_audit.py implement this unsolved function before using any reference code:
def audit_platform(recovered, drills):
raise NotImplementedError("implement audit_platform")
Complete consumed-field contract
recovered is a dict with task and merchant_audit. task requires nonempty id, tenant, owner, operation_key and proposal_hash strings. task.receipt is required and may be None; otherwise it is a dict with nonempty task_id, operation_key, proposal_hash and return_id. merchant_audit.returns is a list of dicts with nonempty id, task_id, tenant, owner and proposal_hash. drills requires nonempty source and a rows list; every row has a nonempty drill and a nonnegative exact Python int merchant_return_count. bool is not a count. Validate all consumed fields first; missing/null/wrong types raise exactly ValueError("shape"). Extra capstone fields are ignored, neither input is modified, and no service/database call is made.
Return exactly task_id, tenant, business_returns_for_task (exact int), receipt_binding_ok (bool), checked_drill_count (exact int), findings (sorted distinct strings). Count merchant rows for this exact task ID, not all tenant returns. Receipt binding is true only with exactly one matching return and a non-null receipt whose task_id/operation_key/proposal_hash match the task, whose return_id matches that merchant row's id, and whose row tenant/owner/proposal_hash match the task. A copied success status cannot satisfy this check.
Add findings independently: receipt_binding if binding fails; main_effect_count if the main count is not 1; audit_scope if any merchant row is outside task.tenant; record_source if drills.source is not local_service_and_actual_process_drills; drill_coverage if the rows contain any duplicate/unknown name or omit a required name. Add drill_effect:NAME for any known drill whose count differs from the expected count, even if another finding already exists. Sort/deduplicate findings. Count every supplied row in checked_drill_count.
Required drill names/counts are fixed inputs:
- actual_process_exit_and_resume: 0
- duplicate_and_idempotency_conflict: 1
- two_real_executors_and_service_fence: 1
- cancel_before_business_commit: 0
- cancel_after_business_commit: 1
- memory_revoked_after_approval: 0
- current_user_permission_revoked: 0
- approval_expired: 0
- approval_revoked: 0
- current_policy_version_changed: 0
Unchanged probe, then changed records
Save the following as platform_audit_probe.py next to your implementation and run from the extracted capstone root. A supplied unimplemented function fails first. Keep that baseline, your own diff and the unchanged probe.
from copy import deepcopy
import json
from pathlib import Path
from platform_audit import audit_platform
recovered = json.loads(Path("work/recover-main.json").read_text())
drills = json.loads(Path("work/recovery.json").read_text())
def strict_equal(left, right):
if type(left) is not type(right): return False
if isinstance(right, dict): return left.keys() == right.keys() and all(strict_equal(left[k], v) for k, v in right.items())
if isinstance(right, list): return len(left) == len(right) and all(strict_equal(a, b) for a, b in zip(left, right))
return left == right
def check(recovered, drills, expected):
before = deepcopy([recovered, drills])
assert strict_equal(audit_platform(recovered, drills), expected)
assert strict_equal([recovered, drills], before)
expected = {"task_id": "main-return", "tenant": "acme", "business_returns_for_task": 1,
"receipt_binding_ok": True, "checked_drill_count": 10, "findings": []}
check(recovered, drills, expected)
changed = deepcopy(recovered)
changed["task"]["receipt"]["operation_key"] += ":wrong-new-key"
check(changed, drills, dict(expected, receipt_binding_ok=False, findings=["receipt_binding"]))
changed = deepcopy(recovered)
foreign = deepcopy(changed["merchant_audit"]["returns"][0])
foreign.update(tenant="other", task_id="foreign-probe")
changed["merchant_audit"]["returns"].append(foreign)
check(changed, drills, dict(expected, findings=["audit_scope"]))
changed_drills = deepcopy(drills)
changed_drills["rows"].append(deepcopy(changed_drills["rows"][0]))
check(recovered, changed_drills, dict(expected, checked_drill_count=11, findings=["drill_coverage"]))
changed_drills = deepcopy(drills)
changed_drills["source"] = "claimed_production"
check(recovered, changed_drills, dict(expected, findings=["record_source"]))
changed_drills = deepcopy(drills)
row = next(r for r in changed_drills["rows"] if r["drill"] == "current_user_permission_revoked")
row["merchant_return_count"] = 1
check(recovered, changed_drills, dict(expected, findings=["drill_effect:current_user_permission_revoked"]))
changed = deepcopy(recovered)
changed["merchant_audit"]["returns"] = []
check(changed, drills, dict(expected, business_returns_for_task=0, receipt_binding_ok=False,
findings=["main_effect_count", "receipt_binding"]))
invalid_drills = deepcopy(drills)
invalid_drills["rows"][0]["merchant_return_count"] = True
try:
audit_platform(recovered, invalid_drills)
except ValueError as exc:
assert str(exc) == "shape"
else:
raise AssertionError("bool must not be a merchant count")
print("platform_scope_receipt_and_drill_audit_passed")
python3 platform_audit_probe.py
A conforming reader prints platform_scope_receipt_and_drill_audit_passed and exits 0. A wrong receipt key, a foreign-tenant audit row and duplicate drill row fail separate gates. These are copied JSON negative controls, not newly executed merchant transactions. The real original route records completed/main-return, one bound merchant application and ten drills; task IDs/receipt IDs and durations can vary.
Bridge the local experiments to the proposed platform
Run your own modules through the linked RAG and memory graders; retain failing scaffold and passing imported-module reports, not just guided output. RAG's highest valid duplicate score and every dependency matter; memory's current epoch cannot authorize a revoked second source. For queue handoff, the run-state-outbox exercise commits run/event together and replays a duplicate after consumer commit; it is standalone SQLite, not a queue already implemented by capstone. Describe a future envelope with trusted tenant/owner, task and event IDs, input digest, authorization/schema/config versions, worker fence and budget reservation ID. The worker reloads current authority before reading private data or committing a new effect; payload fields do not create a principal.
A queue delivery or lease release is not a business receipt. Preserve original operation keys for unknown writes and reconcile via an appropriately authorized actor. A revoked user cannot gain a reconciliation bypass; an operational audit must itself be authenticated and minimized. Leave transport authentication, shared quota transactions, real fairness and cross-service revocation ordering marked unimplemented unless you implement and test them.
career-route; approval; capstone; capstone_zh; rag; memory; outbox; queue; workflow; prereq; protocol; pg; aws; owasp
Run the resource boundary with real worker processes
Use the multiprocess project extension and source ZIP after the seven-stage baseline. It connects actual Agent preparation and approved return execution to shared admission, tenant/global limits, reservation settlement, worker epochs and original-key receipt reconciliation. Inspect distinct worker PIDs, persisted state and merchant HTTP before claiming a boundary passed. The merchant and runtime use separate processes/connections to one local SQLite file; this is a declared shared-storage experiment. Synthetic work units and local measured execution windows are not provider tokens, production quotas or the route's hypothetical 300/1200 tasks/minute. The supplied implementation is a reference; complete the separate learner hook, red baseline, personal diff and regression. Use ADR_GUIDE.md for alternatives, failure windows and migration/rollback proposals, labeling unexecuted proposals planned.
code example
Audit sums can hide gaps
Ten local rows with passed=true are insufficient when two rows repeat one drill name and another drill is missing. Coverage and effect counts are independent checks.
Acceptance task for this level
Implement platform_audit.py against the complete field/output contract; retain an unimplemented failing baseline, personal diff and unchanged/changed-record probe output. Attach your own RAG/memory imported-module evidence and state which queue adapters remain proposed.
Reading this browser’s record…
Hide the answer and check your understanding
Why can tenant-wide receipt_count=12 not prove main-return has one correct application?
Expand reference derivation
It aggregates other tasks. Filter the exact task, require one row, and match receipt return ID plus task/key/hash and row tenant/owner. Preserve disagreement as findings instead of hiding it behind a total.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.
- PostgreSQL: RLS strategies and bypassing roles
- AWS: Transactional outbox and duplicate delivery
- OWASP: RAG’s Tenants and Data Security
- Multiprocess resource and recovery lab
- Independent settlement assignment
- Migration, incident and ownership decisions
- Observed learner pilot and rubric calibration
- Source ZIP