Skip to content

refactor: centralize nanoseconds constant - #77

Merged
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
nightcityblade:fix/issue-63
Aug 21, 2026
Merged

refactor: centralize nanoseconds constant#77
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
nightcityblade:fix/issue-63

Conversation

@nightcityblade

Copy link
Copy Markdown
Contributor

Summary

Define NANOSECONDS_PER_SECOND once in hflow.format and import it from resample and testing.

Closes #63.

Why

The identical time-unit constant was maintained in two modules. Moving it to the established shared format-constants module removes that duplication without changing behavior.

Validation

  • uv sync --locked --all-extras — passed.
  • uv run ruff check --fix — passed.
  • uv run ruff format — 88 files left unchanged.
  • uv run ty check — passed.
  • uv run pytest -q in Debian with Python 3.11 and FFmpeg — 307 passed, 3 skipped.
  • rg -n "NANOSECONDS_PER_SECOND = " src/hflow/ — exactly one definition.

Checklist

  • N/A — no business logic changed; the full existing test suite covers the moved imports.
  • N/A — no behavior, flags, formats, or requirements changed.
  • I ran uv run ruff check --fix, uv run ruff format, and uv run ty check.
  • I ran the relevant pytest suite.
  • I did not add recordings, generated media, credentials, private URLs, or runtime artifacts.
  • I preserved stored-data compatibility or documented an explicit version change.

nightcityblade and others added 2 commits August 21, 2026 11:22
The shared NANOSECONDS_PER_SECOND landed between the grid-resampling
policy comment and the RESAMPLE_POLICY_VERSION it documents. Move it
above that block with its own note.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @nightcityblade, and welcome! Exactly the change the issue asked for, with the verification command in the description so the result is easy to confirm.

What I validated locally:

  • Full quality gate is clean (ruff check, ruff format --check, ty check) and all 307 tests pass.
  • Confirmed rg -n "NANOSECONDS_PER_SECOND = " src/hflow/ now reports exactly one definition.
  • Checked that importing hflow.format from resample.py introduces no import cycle. format.py is leaf-level by design, which is what makes it the right home.

One fixup pushed to your branch (f0521b1): the constant landed between the grid-resampling policy comment and the RESAMPLE_POLICY_VERSION that comment documents ("bump this when the grid or selection semantics change"), so I moved it above that block with its own note. That placement was my issue text's fault for saying "near RESAMPLE_POLICY_VERSION, which already describes the grid semantics"; your reading of it was reasonable.

Merging now. If you want another, the open good first issues have plenty left, and #62 is the close cousin of this one (same shape, different constants). Issues with an assignee are taken; everything else is fair game. We also hang out on Discord.

@kstonekuan
kstonekuan merged commit 8f18e12 into Hebbian-Robotics:main Aug 21, 2026
3 checks passed
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.

Define NANOSECONDS_PER_SECOND once in format.py (currently duplicated)

2 participants