Skip to content

fix(Types): Align Interval with the API and keep __version__ in sync - #31

Open
szemyd wants to merge 1 commit into
mainfrom
claude/site-audit-broken-snippets-z36lap
Open

szemyd wants to merge 1 commit into
mainfrom
claude/site-audit-broken-snippets-z36lap

Conversation

@szemyd

@szemyd szemyd commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two independent drifts found while auditing the aperiodic.io code snippets against this SDK.

1. Interval disagreed with the API in both directions

Interval = Literal["1s", "1m", "5m", "15m", "30m", "1h", "4h", "1d"]

The API's enum (apps/data/config/data-catalog.config.ts in dream-faster/unravel-router) is 15s, 30s, 1m, 5m, 15m, 30m, 1h, 4h, 1d. So:

  • 1s was typed as valid but the API rejects it with a 400 — it isn't in the endpoint's enum at all.
  • 15s and 30s are real but were missing, so a caller passing either failed type-checking despite the request being perfectly valid.

Both sub-minute intervals are Tier-3 gated (403 without the entitlement), which is now noted on the literal and in the docstrings.

The five docstrings listed a third, different set — ('1m', '5m', '15m', '30m', '1h', '4h', '1d') — omitting sub-minute entirely. All updated.

2. __version__ was three majors behind

src/aperiodic/__init__.py said "0.1.0"; pyproject.toml said 4.1.0. Anything logging or asserting on aperiodic.__version__ reported the wrong version.

The cause: [tool.bumpver.file_patterns] only covered pyproject.toml, so __init__.py was never going to be touched by a release. Set to the current version and added to file_patterns so the two can't drift again.

Kept as a literal rather than reading from importlib.metadata — that's unreliable under Pyodide, and this package ships a Pyodide transport (_backends/_pyfetch_transport.py).

Confirmed with a dry run that bumpver now picks it up:

$ bumpver update --patch --dry
--- pyproject.toml
-version = "4.1.0"
+version = "4.1.1"
--- src/aperiodic/__init__.py       ← now included

Test plan

  • ruff check passes on every file this PR touches
  • The 2 PLR0917 errors in endpoints/utils.py are pre-existing — identical on unmodified main, and that file isn't touched here
  • pytest: 76 failed / 38 passed both before and after — byte-identical baseline. The failures are this sandbox's blocked egress (test_readme.py and friends make real calls expecting APIError(401)), not a regression from this change. Worth a clean run in CI to confirm.
  • No '1s' reference remains anywhere in src/, README.md or tests/

Follow-up

The API is the source of truth for this enum and the two are hand-synced. If it drifts again, a generated types module or a contract test against the live enum would prevent it — out of scope here.

Found by the site audit in dream-faster/unravel-router#814 (Task 11).


Generated by Claude Code

The Interval literal advertised '1s', which the API rejects with a 400 — it
is not in the endpoint's interval enum. Meanwhile the API's real sub-minute
intervals, 15s and 30s, were absent, so a caller passing either failed type
checking despite the request being valid. Both are Tier 3 gated, noted on the
literal and in the docstrings, which listed a third and different set again.

__version__ read "0.1.0" while pyproject said 4.1.0. bumpver's file_patterns
only covered pyproject.toml, so __init__.py was never going to be updated by
a release. Set to the current version and added to file_patterns so the two
cannot drift again — kept as a literal rather than read from
importlib.metadata, which is unreliable under Pyodide, and this package
ships a Pyodide transport.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MYkNnTCck1hxLyLgb5hoYp
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