Files
leleka/engine/strata/data/quant_quality/v1/agent.txt
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree
(570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base =
the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main).

Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR
experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details,
conflict table and left-out files are in docs/upstream.md.

Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61),
docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out.

scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run").
Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR
macros on. No GPU run, no quality gate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:49:15 +01:00

114 lines
5.1 KiB
Plaintext

<|im_start|>system
You are a coding agent working in the user's repository. You can call tools to read files, search the code and run commands. Keep changes small and explain what you did.<|im_end|>
<|im_start|>user
The test `test_parse_duration` fails since yesterday's merge. Can you find out why and fix it?<|im_end|>
<|im_start|>assistant
<think>
I should run the failing test first to see the actual error message, then look at the function it tests.
</think>
<tool_call>
{"name": "run_command", "arguments": {"command": "python -m pytest tests/test_time_utils.py -k test_parse_duration -q"}}
</tool_call><|im_end|>
<|im_start|>user
<tool_response>
F [100%]
=================================== FAILURES ===================================
_____________________________ test_parse_duration ______________________________
def test_parse_duration():
assert parse_duration("90s") == 90
assert parse_duration("5m") == 300
> assert parse_duration("1h30m") == 5400
E ValueError: invalid duration: '1h30m'
tests/test_time_utils.py:14: ValueError
1 failed, 11 deselected in 0.21s
</tool_response><|im_end|>
<|im_start|>assistant
<think>
Single units work but a combined value fails. Let me read the parser.
</think>
<tool_call>
{"name": "read_file", "arguments": {"path": "src/time_utils.py", "start_line": 1, "end_line": 40}}
</tool_call><|im_end|>
<|im_start|>user
<tool_response>
import re
_UNITS = {"s": 1, "m": 60, "h": 3600, "d": 86400}
_PART = re.compile(r"^(\d+)([smhd])$")
def parse_duration(text: str) -> int:
"""Parse a duration like '90s', '5m' or '1h30m' into seconds."""
text = text.strip().lower()
if not text:
raise ValueError("empty duration")
m = _PART.match(text)
if m is None:
raise ValueError(f"invalid duration: {text!r}")
return int(m.group(1)) * _UNITS[m.group(2)]
</tool_response><|im_end|>
<|im_start|>assistant
<think>
The regex is anchored at both ends and matches exactly one number-unit pair, so "1h30m" can never match. The docstring promises combined values. Let me check git history to see what the merge changed.
</think>
<tool_call>
{"name": "run_command", "arguments": {"command": "git log -p -n 1 -- src/time_utils.py | head -40"}}
</tool_call><|im_end|>
<|im_start|>user
<tool_response>
commit 4e1b9c2f7a0d (Merge branch 'cleanup-regex')
Simplify duration parsing
-_PART = re.compile(r"(\d+)([smhd])")
+_PART = re.compile(r"^(\d+)([smhd])$")
@@ def parse_duration(text: str) -> int:
- total = 0
- pos = 0
- for m in _PART.finditer(text):
- if m.start() != pos:
- raise ValueError(f"invalid duration: {text!r}")
- total += int(m.group(1)) * _UNITS[m.group(2)]
- pos = m.end()
- if pos != len(text):
- raise ValueError(f"invalid duration: {text!r}")
- return total
+ m = _PART.match(text)
+ if m is None:
+ raise ValueError(f"invalid duration: {text!r}")
+ return int(m.group(1)) * _UNITS[m.group(2)]
</tool_response><|im_end|>
<|im_start|>assistant
The cleanup merge replaced the loop over all number-unit pairs with a single anchored match, so only one unit per string is accepted now. I will restore the loop, which also rejects garbage between the parts.
<tool_call>
{"name": "edit_file", "arguments": {"path": "src/time_utils.py", "old": "_PART = re.compile(r\"^(\\d+)([smhd])$\")", "new": "_PART = re.compile(r\"(\\d+)([smhd])\")"}}
</tool_call><|im_end|>
<|im_start|>user
<tool_response>
OK: 1 replacement in src/time_utils.py
</tool_response><|im_end|>
<|im_start|>assistant
<tool_call>
{"name": "edit_file", "arguments": {"path": "src/time_utils.py", "old": " m = _PART.match(text)\n if m is None:\n raise ValueError(f\"invalid duration: {text!r}\")\n return int(m.group(1)) * _UNITS[m.group(2)]", "new": " total = 0\n pos = 0\n for m in _PART.finditer(text):\n if m.start() != pos:\n raise ValueError(f\"invalid duration: {text!r}\")\n total += int(m.group(1)) * _UNITS[m.group(2)]\n pos = m.end()\n if pos != len(text):\n raise ValueError(f\"invalid duration: {text!r}\")\n return total"}}
</tool_call><|im_end|>
<|im_start|>user
<tool_response>
OK: 1 replacement in src/time_utils.py
</tool_response><|im_end|>
<|im_start|>assistant
<tool_call>
{"name": "run_command", "arguments": {"command": "python -m pytest tests/test_time_utils.py -q"}}
</tool_call><|im_end|>
<|im_start|>user
<tool_response>
............ [100%]
12 passed in 0.19s
</tool_response><|im_end|>
<|im_start|>assistant
All 12 tests in `tests/test_time_utils.py` pass again. The cause was the `cleanup-regex` merge: it anchored the pattern with `^...$` and replaced the loop with one `match`, so a duration with several parts such as `1h30m` was rejected. I restored the previous loop, which sums every number-unit pair and still raises `ValueError` for text between or after the parts (for example `1h x30m`). You may want to add a test for that rejection case so the next simplification does not drop it.<|im_end|>