Skip to content

Address review feedback on add_subtask_response script#173

Merged
shuheng-liu merged 2 commits into
feat/subtask_addition_scriptfrom
claude/review-pr-163-ifLOG
Apr 22, 2026
Merged

Address review feedback on add_subtask_response script#173
shuheng-liu merged 2 commits into
feat/subtask_addition_scriptfrom
claude/review-pr-163-ifLOG

Conversation

@shuheng-liu
Copy link
Copy Markdown
Member

@shuheng-liu shuheng-liu commented Apr 22, 2026

What this does

Addresses review feedback on #163. Targets feat/subtask_addition_script so the fixes land inside that PR.

  • Fix docstring example to reference configs/examples/add_subtask_response.json (the file actually shipped), not the non-existent pi05_subtask.json.
  • Replace module-level logging.basicConfig(...) with init_logging() called inside the main entrypoint. Matches the dominant convention across src/opentau/scripts/ (train.py, inference.py, calculate_value.py, etc.).
  • Remove personal path from configs/examples/add_subtask_response.json; use /path/to/local/dataset like the tutorial docs.
  • Make the parquet rewrite atomic (write to .tmp sibling + os.replace) so a crash mid-write can't corrupt the source parquet.
  • Switch warnings.warnlogger.warning for operational events (missing files, length mismatches) and emit a warning when an existing response column is silently overwritten.
  • In _build_response_array: use slice assignment and switch int()round() for boundary mapping to avoid floating-point drift (e.g. 2.5 * 30 = 74.999… truncating to 74 instead of 75).
  • Tighten type hint: list[dict]list[dict[str, float | str]].
  • Add tests/scripts/test_add_subtask_response.py covering: empty subtasks, zero-length episode, whole-episode coverage, boundary split, pre-first-subtask gap, last-subtask extension, unsorted input, beyond-length skip + warning, end-frame clamping, fp-drift rounding, and simultaneous-time edge case.

How it was tested

  • Added tests/scripts/test_add_subtask_response.py with unit tests for _build_response_array.
  • Verified script syntax parses cleanly.
  • Manual review of atomic-write path and logger changes.

How to checkout & try? (for the reviewer)

pytest -sx tests/scripts/test_add_subtask_response.py
python src/opentau/scripts/add_subtask_response.py \
    --config_path=configs/examples/add_subtask_response.json

Checklist

  • I have added Google-style docstrings to important functions and ensured function parameters are typed.
  • My PR includes policy-related changes.
    • If the above is checked: I have run the GPU pytests (pytest -m "gpu") and regression tests.

https://claude.ai/code/session_01WnAY2eqQqw6aRQqKS5jvGC

claude added 2 commits April 22, 2026 15:53
- Fix docstring example to reference add_subtask_response.json (not
  pi05_subtask.json, which does not exist).
- Replace module-level logging.basicConfig with init_logging() called
  inside the main entrypoint, matching the project-wide convention used
  by train.py, inference.py, calculate_value.py, etc.
- Remove personal path from the example config; use /path/to/local/dataset
  like the tutorial docs.
- Make parquet writes atomic via tmp file + os.replace so a crash
  mid-write cannot corrupt the source parquet.
- Switch warnings.warn to logger.warning for operational events
  (missing files, length mismatches) and emit a warning when an
  existing 'response' column is overwritten.
- Use slice assignment in _build_response_array and round() instead of
  int() for boundary mapping to avoid floating-point drift (e.g.
  2.5 * 30 = 74.999... truncating to 74).
- Tighten type hints on subtasks parameter.
- Add unit tests for _build_response_array covering empty subtasks,
  zero-length episodes, whole-episode coverage, boundary split,
  pre-first-subtask gap, last-subtask extension, unsorted input,
  beyond-length warning, clamping, and fp-drift rounding.

https://claude.ai/code/session_01WnAY2eqQqw6aRQqKS5jvGC
Pre-commit hook flagged a long-line reformat in test_zero_length_episode.

https://claude.ai/code/session_01WnAY2eqQqw6aRQqKS5jvGC
@shuheng-liu shuheng-liu merged commit 80403d3 into feat/subtask_addition_script Apr 22, 2026
5 checks passed
@shuheng-liu shuheng-liu deleted the claude/review-pr-163-ifLOG branch April 22, 2026 16:21
@shuheng-liu shuheng-liu self-assigned this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants