harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-4732harbor download openthoughts/tasktrove-exp-rpt-issue-issue-4732SELF-CONTAINED TASK INSTRUCTION
Goal Build a tiny, filesystem-local benchmark that simulates merging two Oakley-style SA (security association) proposals. The inputs are simplified JSON structures. The task is to implement a small Python script that merges two proposals by concatenating their transforms and updating counts, then verify the result with a diff against an explicit expected structure.
What you will deliver (in /app/)
What the task describes (behavior, not patch details)
Before state (example of a starting point that you should replace) The following is a minimal, intentionally incorrect pre-fix version of the merging script and sample inputs. Your task is to implement the correct merge logic and adjust inputs if needed to satisfy the final diff.
Code example: merge_sa.py (before)
# before - incorrect merge (trans_cnt not summed)
import json
def main():
with open('A.json') as f:
A = json.load(f)
with open('B.json') as f:
B = json.load(f)
pa = A['sa']['props'][0]['conjunction']
pb = B['sa']['props'][0]['conjunction']
merged = {
"sa": {
"name": "merged-" + A['sa']['name'],
"props": [
{
"conjunction": {
"transforms": pa['transforms'] + pb['transforms'],
"trans_cnt": pa['trans_cnt'] # incorrect: should be pa + pb
}
}
]
}
}
with open('merged_sa.json', 'w') as f:
json.dump(merged, f, indent=2)
if __name__ == '__main__':
main()
Files to create/modify in /app/
File contents to include (for your task)
A.json
{
"sa": {
"name": "Oakley-Prototype-A",
"props": [
{
"conjunction": {
"transforms": [
{"type": "ENCR", "params": {"algo": "AES128"}},
{"type": "INTEG", "params": {"algo": "SHA256"}},
{"type": "PRF", "params": {"algo": "SHA1"}}
],
"trans_cnt": 3
}
}
]
}
}
B.json
{
"sa": {
"name": "Oakley-Prototype-B",
"props": [
{
"conjunction": {
"transforms": [
{"type": "ENCR", "params": {"algo": "AES256"}},
{"type": "INTEG", "params": {"algo": "SHA384"}}
],
"trans_cnt": 2
}
}
]
}
}
merged_sa.json (example of the incorrect result from the pre-fix script)
{
"sa": {
"name": "merged-Oakley-Prototype-A",
"props": [
{
"conjunction": {
"transforms": [
{"type": "ENCR", "params": {"algo": "AES128"}},
{"type": "INTEG", "params": {"algo": "SHA256"}},
{"type": "PRF", "params": {"algo": "SHA1"}},
{"type": "ENCR", "params": {"algo": "AES256"}},
{"type": "INTEG", "params": {"algo": "SHA384"}}
],
"trans_cnt": 3
}
}
]
}
}
expected_sa.json (the correct merged result)
{
"sa": {
"name": "merged-Oakley-Prototype-A-Oakley-Prototype-B",
"props": [
{
"conjunction": {
"transforms": [
{"type": "ENCR", "params": {"algo": "AES128"}},
{"type": "INTEG", "params": {"algo": "SHA256"}},
{"type": "PRF", "params": {"algo": "SHA1"}},
{"type": "ENCR", "params": {"algo": "AES256"}},
{"type": "INTEG", "params": {"algo": "SHA384"}}
],
"trans_cnt": 5
}
}
]
}
}
(optional) merge.log
MERGE_OK
Exact steps to run
Notes
This task is designed to be completed without cloning any repository. Implement the correct merge logic in merge_sa.py and verify the output against expected_sa.json using the provided inputs.