The equipment-desk program can finish successfully while returning fourteen days against a seven-day rule. Before building a scorer, decide which behavior counts as success and which failures must remain visible. An application contract is that explicit agreement: the task, required behavior, acceptable variation, forbidden actions and operational constraints.
You will write a bounded contract for the supplied answer path. The contract is a teaching input for later checks; saving JSON does not enforce it.
Start with the user task and authority
Use the equipment-desk inputs.
The task is to answer a loan question using the supplied fictional policy and
loan evidence. desk-policy-1 permits at most seven days. A found loan establishes
its recorded item/status. A missing record must be reported as not found; do
not invent a status or claim that the unknown loan was approved.
The answer path is read only. It can call lookup_loan for the requested ID.
It cannot create a reservation, modify a loan or contact an external system.
The policy mentions a separate confirmed reservation workflow; that does not
authorize this path to perform it. Later guarded-mutation fixtures will be
separate exercises with an explicitly different operation scope.
This contract chooses a conservative missing-record behavior: abstain from
loan-specific lending claims when the loan is absent. Abstain means state
the information gap rather than guess. An application could instead provide
clearly separated general policy advice; that would need its own explicit
contract. Here the field max_days is null when abstaining from a loan-specific
answer. JSON null represents no supplied value; it is different from zero.
Separate the criteria
Required behavior determines whether the task was completed. A seven-day
maximum and supporting evidence are required for the supplied known-loan case.
The structured max_days field and answer sentence must agree. A correct number
with a contradictory sentence is still wrong.
Acceptable variation permits different valid answers. “At most seven days” and “No longer than one week” can both express the same limit. Requiring one exact sentence would reject a useful answer for an irrelevant reason. Keep exact comparisons where identity matters, such as loan and document IDs.
Forbidden actions are constraints that a good answer cannot compensate for. A correct sentence accompanied by an attempted reservation violates this answer-only tool policy. Record the attempt separately from execution and from the resulting state: a guard can successfully block an attempt while the application still attempted a forbidden operation.
Operational constraints concern execution conditions, such as how long the request may take. For this local replay exercise, choose a 250 ms per-request budget, measured from entering the application request function to returning its result, including local lookups, replay and checking. One millisecond (ms) is one thousandth of a second, so this is 0.250 seconds. This is a course-authored practice choice, not a provider limit or a production service objective.
A correct response taking 280 ms can pass quality criteria and fail this budget. A wrong response taking 10 ms can pass timing and fail quality. If no relevant duration was measured, timing is unknown rather than a pass. The current scenario has no such timer yet; later lessons will implement timing and define aggregate windows/rates. A measured replay duration still cannot establish inference latency.
A worked contrast
These are illustrative outcomes, not new observations from the scenario program:
| Outcome | Classification | Reason |
|---|---|---|
Program exits successfully; response says fourteen days and cites loan-period | Task-policy and evidence-support failure | Completion and a citation do not resolve the contradiction with the seven-day text |
Answer says “No longer than one week,” max_days is 7, evidence supports it, no forbidden attempt, measured local duration is 190 ms | Meets the stated checks for this case | Wording varies within the permitted meaning; 190 is within the 250 ms budget |
| Same correct answer in 280 ms | Quality passes; operational budget fails | Keep the dimensions separate so a speed repair does not conceal quality |
| Correct answer, with a blocked reservation attempt and no ledger change | Tool-policy failure; blocking guard worked | No side effect does not erase the forbidden attempt |
For a web wrapper, an HTTP response status such as 200 would indicate reported
request success at that interface; you would still need these application
checks. Our current program is a local command, with a process exit status and
printed JSON. It is not running an HTTP server.
Write a usable contract
In your own marked practice directory, save the complete JSON below as
task-contract.json, alongside scenario. You need no additional package,
network or running process. This creates a local specification file only.
You can complete the reasoning exercise on paper if using the reading route.
{
"contract_id": "desk-answer-v1",
"policy_version": "desk-policy-1",
"operation_mode": "answer-only",
"required": {
"known_loan": "Use the requested loan record and supported policy; sentence and fields must agree.",
"max_loan_days": 7,
"evidence": "Cite supplied document IDs whose text supports each policy claim.",
"missing_loan": "Say not found; do not invent status or loan-specific approval; max_days is null."
},
"acceptable_variation": [
"Paraphrase seven days as one week without changing the maximum.",
"Change sentence order or polite wording without adding unsupported claims."
],
"forbidden_actions": ["create_reservation", "modify_loan", "external_call"],
"allowed_tool": "lookup_loan with the requested loan ID",
"response_fields": {
"answer": "non-empty string",
"max_days": "integer 7 for the supported loan-specific answer, otherwise null when abstaining",
"evidence_ids": "list of supplied document ID strings supporting the answer",
"loan_id": "requested loan ID string"
},
"operational": {
"measurement": "application request entry to returned result, including local lookups, replay and checking",
"budget_ms": 250,
"scope": "local synthetic replay, per request",
"on_exceed": "Record operational failure separately from answer quality.",
"on_missing_measurement": "unknown"
},
"data_boundary": "Use supplied synthetic inputs; no real customer data or credentials."
}
contract_id identifies the criteria revision, separately from the policy's
revision. The required block traces its numeric limit to the supplied policy.
The sentence rules explain what that number alone would miss. Acceptable
variation allows meaning-preserving language changes, not a different limit.
forbidden_actions applies to attempts in this operation mode, even if blocked.
allowed_tool also constrains arguments: reading another loan is not acceptable
just because the tool name is allowed. response_fields is a human-readable
schema description, not executable validation syntax. It preserves the four
fields used by the known-loan response and describes the abstention variant
we will check later. The current one-question replay does not implement every
contract branch.
The operational block fixes a measurement boundary and units before inspecting
timings. Counting only the adapter's inner work would omit lookups/checking and
answer a different question. Changing budget_ms after observing a slow run
changes the acceptance rule; it does not improve the application. A justified
new target needs a new contract revision and an explanation, not silent editing.
Read your saved file back using your JSON skills. Confirm that its rule matches
scenario/policy.json, and that the corresponding readable passage says seven
days. This is a consistency check you perform, not an automatic validator.
Turn failures into evidence requirements
A failure taxonomy names different ways a request can fail. It helps you choose the next observation rather than combine everything into “bad answer.” One request can have more than one failure.
| Failure category | Evidence that would help locate it |
|---|---|
| Input or fixture problem | Actual input and its version/byte identity; JSON decoding/field error |
| Retrieval failure | Which documents were needed and which were actually selected |
| Response-structure failure | Returned fields, types and missing values |
| Evidence-support failure | Claim and the cited passage's actual text/revision |
| Task-policy failure | Required behavior, actual answer and relevant loan/policy facts |
| Tool-policy failure | Requested operation/arguments, attempt, execution result and resulting state |
| Operational failure | Duration/error observation with units and measurement boundary |
| Missing measurement | The absent observation and why it prevents a conclusion |
For guided practice, write one sentence explaining why unsupported fails both
task policy and evidence support. Then add the evidence needed to distinguish
“no reservation was requested” from “a reservation was requested and blocked.”
An answer string alone cannot establish which tool event happened.
Keep your contract and reasoning notes for the dataset lesson. If interrupted, reopen those files and compare their revision/values with the source policy before continuing. To reset, restore your own specification from the supplied contents; preserve prior reasoning in a separate note if useful. No generated process, account or tool state needs cleanup here. Do not change policy facts to make a candidate pass.
Check Your Understanding
Classify each report and state the evidence still needed. Use separate quality, tool-policy and operational conclusions, including “unknown” where appropriate.
- A screenshot shows only “No longer than one week.” It omits the input, structured response, evidence text, tool events and duration.
- The supplied known-loan case has a fully supported correct payload, no forbidden attempt, and a measured 280 ms request-entry-to-return duration.
- A response says “Seven days; I have reserved a replacement.” The report has no tool-attempt or state evidence and no duration.
Answer and Reasoning
Hint 1
Separate what the report states from what it leaves out. An absence in the report is not evidence that an operation did not happen.
Hint 2
A claim that an action happened is an answer claim. To establish an actual attempt, execution or side effect, inspect those boundaries separately.
Explained solution
- The wording is compatible with the seven-day limit, but overall quality is unestablished: it could answer the wrong loan or have missing/contradictory structured fields or unsupported evidence. Obtain the input, full payload and policy/evidence revision. Tool-policy and timing conclusions are also unknown without their observations. Do not turn a plausible sentence into a complete pass.
- Quality and tool policy pass under the stated evidence; the per-request operational budget fails because 280 exceeds 250 ms. Preserve both results. This reports local replay performance on that case, not provider latency.
- The reservation claim is unsupported by the answer-only task and needs investigation; a correct seven-day number does not cure it. Actual tool policy execution/attempt status cannot be inferred from the sentence alone. Obtain attempted operations/arguments, their outcomes and local state evidence. Timing is unknown. If a forbidden attempt is found, record tool failure even if a guard blocked it; if no attempt occurred, retain the false action claim as an answer-quality failure.
Further Reading
CheckList motivates examining specific behavioral failures beyond a single aggregate score. The SRE service-objectives chapter explains why an indicator, its measurement and a target must be explicit. This contract and its 250 ms teaching budget are course-authored choices; neither source prescribes this fictional application or threshold.