# Ortak yazılım görevlerinin tam istemleri

Kaynak: gerçek birincil çağrıların FROZEN.json mesajları. Codex kolunun araç kullanmama ek yönergesi ve CLI seçenekleri cloud-main.py; CLI’ye verilen her Codex istemi ham arşivde prompt.txt olarak bulunur. Görünür smoke testi dahildir; gizli kabul testleri bu istemde yer almaz.

## invoice

### system

~~~~text
You are a software engineer. Return only the requested complete JSON file map. Use ordinary static imports. No eval/exec/compile/globals/locals/vars, network, process execution, os.environ or sys.modules. Normal Python constructors and __name__ are allowed. Only use supplied data paths. Allowed imports: sqlite3,json,math,unicodedata,pathlib,re,sys,typing,collections,datetime,argparse,time,hashlib,os,core.
~~~~

### user

~~~~text
Work in Python 3.12 standard library only. Return exactly one JSON object mapping core.py and cli.py to complete source strings, no explanation. Fix/extend the supplied repository, preserving the specified public API. cli.py reads one JSON object from stdin, removes op, calls the corresponding public core function with keyword arguments, prints one JSON result. Unknown operations and invalid inputs exit nonzero. No network/process execution. Only supplied database paths may be written. Do not return tests.
BUG FIX: The current quote function computes a line discount and uses binary floats; it accepts bools as numbers. Fix quote(lines, discount_bps=0, vat_bps=2000) -> {subtotal,discount,net,vat,total}, all integer cents. Each line is exactly {sku:nonempty string,quantity:positive int,unit_price:nonnegative int}. lines must be a list; empty allowed. Integers reject bool, floats and strings. discount_bps integer0..10000, vat_bps integer0..10000. Reject any invalid schema/type/value with ValueError, never silently skip. subtotal=sum(quantity*unit_price); discount=round_half_up(subtotal*discount_bps/10000) ONCE for whole invoice; net=subtotal-discount; vat=round_half_up(net*vat_bps/10000); total=net+vat. Use exact integer arithmetic, also for values above2**53. Do not mutate input. Repeated SKU lines are separate, not deduplicated. All output keys required. CLI op quote.

Starter files:
{
  "core.py": "def quote(lines,discount_bps=0,vat_bps=2000):\n subtotal=sum(x['quantity']*x['unit_price'] for x in lines)\n discount=sum(round(x['quantity']*x['unit_price']*discount_bps/10000) for x in lines)\n net=subtotal-discount;vat=round(net*vat_bps/10000)\n return dict(subtotal=subtotal,discount=discount,net=net,vat=vat,total=net+vat)\n",
  "cli.py": "import json,sys,core\nx=json.load(sys.stdin);op=x.pop('op');functions={name:getattr(core,name) for name in ['quote','create','list_tickets','close','analyze'] if hasattr(core,name)};print(json.dumps(functions[op](**x),ensure_ascii=False))\n"
}

Visible smoke test:
import unittest,os,tempfile
from pathlib import Path
import core
class Smoke(unittest.TestCase):
 def test_contract(self):
  t=os.environ['BENCH_TASK']
  if t=='invoice':self.assertEqual(core.quote([{'sku':'a','quantity':2,'unit_price':100}])['total'],240)
  elif t=='logs':self.assertEqual(core.analyze('{"id":"a","status":200,"bytes":4,"duration_ms":1}')['accepted'],1)
  else:
   with tempfile.TemporaryDirectory() as d:
    p=str(Path(d)/'x.db');a=core.create(p,'a','hello',['x']);self.assertEqual(core.list_tickets(p,'a')[0]['id'],a['id']);self.assertTrue(core.close(p,'a',a['id']))
if __name__=='__main__':unittest.main(verbosity=2)

~~~~

## tickets

### system

~~~~text
You are a software engineer. Return only the requested complete JSON file map. Use ordinary static imports. No eval/exec/compile/globals/locals/vars, network, process execution, os.environ or sys.modules. Normal Python constructors and __name__ are allowed. Only use supplied data paths. Allowed imports: sqlite3,json,math,unicodedata,pathlib,re,sys,typing,collections,datetime,argparse,time,hashlib,os,core.
~~~~

### user

~~~~text
Work in Python 3.12 standard library only. Return exactly one JSON object mapping core.py and cli.py to complete source strings, no explanation. Fix/extend the supplied repository, preserving the specified public API. cli.py reads one JSON object from stdin, removes op, calls the corresponding public core function with keyword arguments, prints one JSON result. Unknown operations and invalid inputs exit nonzero. No network/process execution. Only supplied database paths may be written. Do not return tests.
FEATURE: Extend a simple SQLite ticket repository with tenant isolation, tags and filtering. Public API create(db,tenant,title,tags=None)->record {id,tenant,title,tags,status}; list_tickets(db,tenant,q="",tag=None,offset=0,limit=20)->list of records; close(db,tenant,id)->bool. Auto-create SQLite schema on supplied path; persistence across new processes required. tenant nonempty string, title trimmed string length1..120; tags None defaults[], otherwise list of at most10 unique nonempty strings length<=30; strings preserved, duplicate tags rejected. Invalid inputs raise ValueError. IDs global positive increasing integers; status initially open. List only matching tenant, never another; optional q is Unicode casefold substring of title, optional tag exact tag match; filters AND. q must be string; tag None or nonempty string. offset integer>=0, limit integer1..100, reject bool. Sort newest id first BEFORE pagination. close changes only specified tenant+id open ticket to closed, True on change, False for absent/wrong tenant/already closed. id positive integer, bool rejected. tenant valid in every function. No SQL string interpolation of user values. Input tags must not be mutated or retained as shared state. CLI ops create,list_tickets,close. Migration from old data is not required; existing starter has no schema, preserve interfaces by implementing them.

Starter files:
{
  "core.py": "import sqlite3\ndef create(db,tenant,title,tags=None):\n raise NotImplementedError\ndef list_tickets(db,tenant,q='',tag=None,offset=0,limit=20):\n raise NotImplementedError\ndef close(db,tenant,id):\n raise NotImplementedError\n",
  "cli.py": "import json,sys,core\nx=json.load(sys.stdin);op=x.pop('op');functions={name:getattr(core,name) for name in ['quote','create','list_tickets','close','analyze'] if hasattr(core,name)};print(json.dumps(functions[op](**x),ensure_ascii=False))\n"
}

Visible smoke test:
import unittest,os,tempfile
from pathlib import Path
import core
class Smoke(unittest.TestCase):
 def test_contract(self):
  t=os.environ['BENCH_TASK']
  if t=='invoice':self.assertEqual(core.quote([{'sku':'a','quantity':2,'unit_price':100}])['total'],240)
  elif t=='logs':self.assertEqual(core.analyze('{"id":"a","status":200,"bytes":4,"duration_ms":1}')['accepted'],1)
  else:
   with tempfile.TemporaryDirectory() as d:
    p=str(Path(d)/'x.db');a=core.create(p,'a','hello',['x']);self.assertEqual(core.list_tickets(p,'a')[0]['id'],a['id']);self.assertTrue(core.close(p,'a',a['id']))
if __name__=='__main__':unittest.main(verbosity=2)

~~~~

## logs

### system

~~~~text
You are a software engineer. Return only the requested complete JSON file map. Use ordinary static imports. No eval/exec/compile/globals/locals/vars, network, process execution, os.environ or sys.modules. Normal Python constructors and __name__ are allowed. Only use supplied data paths. Allowed imports: sqlite3,json,math,unicodedata,pathlib,re,sys,typing,collections,datetime,argparse,time,hashlib,os,core.
~~~~

### user

~~~~text
Work in Python 3.12 standard library only. Return exactly one JSON object mapping core.py and cli.py to complete source strings, no explanation. Fix/extend the supplied repository, preserving the specified public API. cli.py reads one JSON object from stdin, removes op, calls the corresponding public core function with keyword arguments, prints one JSON result. Unknown operations and invalid inputs exit nonzero. No network/process execution. Only supplied database paths may be written. Do not return tests.
NEW CLI TOOL: Implement analyze(text)->{accepted,duplicates,invalid_lines,status_counts,total_bytes,p95_ms,slow_ids}. text must be string else ValueError. JSONL complete final line without newline IS processed. Ignore blank lines. Each nonblank line exactly {id:nonempty string,status:int100..599,bytes:int>=0,duration_ms:finite number>=0}; bool rejected for all numeric fields. Invalid JSON/schema/value adds original1-based line number to invalid_lines; process remaining lines. IDs first VALID occurrence wins; a later valid duplicate increments duplicates, never changes metrics; malformed duplicate is invalid, not duplicate. accepted counts unique valid IDs. status_counts keys are status codes as strings, counts. total_bytes exact int sum. p95_ms nearest-rank percentile of accepted durations (sorted, rank ceil(.95*n),1-based), null if no accepted. slow_ids lists at most3 IDs sorted duration descending, then id lexicographic ascending on ties. All outputs deterministic. No state retained between calls. CLI op analyze.

Starter files:
{
  "core.py": "def analyze(text):\n raise NotImplementedError\n",
  "cli.py": "import json,sys,core\nx=json.load(sys.stdin);op=x.pop('op');functions={name:getattr(core,name) for name in ['quote','create','list_tickets','close','analyze'] if hasattr(core,name)};print(json.dumps(functions[op](**x),ensure_ascii=False))\n"
}

Visible smoke test:
import unittest,os,tempfile
from pathlib import Path
import core
class Smoke(unittest.TestCase):
 def test_contract(self):
  t=os.environ['BENCH_TASK']
  if t=='invoice':self.assertEqual(core.quote([{'sku':'a','quantity':2,'unit_price':100}])['total'],240)
  elif t=='logs':self.assertEqual(core.analyze('{"id":"a","status":200,"bytes":4,"duration_ms":1}')['accepted'],1)
  else:
   with tempfile.TemporaryDirectory() as d:
    p=str(Path(d)/'x.db');a=core.create(p,'a','hello',['x']);self.assertEqual(core.list_tickets(p,'a')[0]['id'],a['id']);self.assertTrue(core.close(p,'a',a['id']))
if __name__=='__main__':unittest.main(verbosity=2)

~~~~
