Skip to content

fix(builtins): silence pklr deprecation warnings on Builtins.pkl load#880

Merged
jdx merged 2 commits intomainfrom
fix/pkl-builtins-byte-order-marker-deprecation
Apr 26, 2026
Merged

fix(builtins): silence pklr deprecation warnings on Builtins.pkl load#880
jdx merged 2 commits intomainfrom
fix/pkl-builtins-byte-order-marker-deprecation

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 26, 2026

Summary

  • Closes discussion #878.
  • With HK_PKL_BACKEND=pklr, every load of Builtins.pkl printed [pklr] WARNING: property 'check_byte_order_marker' is deprecated and the same for fix_byte_order_marker, even when the user's hk.pkl did not reference those aliases.
  • Combine the upstream pklr fix with a generator change so the warning only fires when a user actually references the deprecated aliases.

Two coordinated changes

  1. Bump pklr 0.4.1 → 0.4.2 (jdx/pklr#58, jdx/pklr#61). pklr now treats @Deprecated lazily — the warning fires on field access, not on module evaluation.
  2. scripts/gen_builtins.py: special-case the deprecated aliases. Skip them in the auto-loop and emit them as @Deprecated bindings that point at the canonical byte_order_marker step. With this, Builtins.pkl's own bindings no longer access a deprecated property at load, so even the lazy field-access warning stays silent until the user explicitly references Builtins.check_byte_order_marker / .fix_byte_order_marker.

The deprecated stub files (pkl/builtins/check_byte_order_marker.pkl, pkl/builtins/fix_byte_order_marker.pkl) keep their @Deprecated annotations untouched — the migration nudge is preserved for direct importers.

Test plan

  • mise run test:cargo — 145 passed.
  • End-to-end with HK_PKL_BACKEND=pklr:
    • import Builtins.pkl without using deprecated aliases → silent (was 2× warnings per load).
    • access Builtins.check_byte_order_marker → warning fires once per evaluation.
  • hk pre-commit hooks pass.

🤖 Generated with Claude Code


Note

Low Risk
Low risk: changes are limited to a dependency patch bump and generation/mapping of builtin aliases to reduce deprecation warnings, with no impact on core hook execution logic beyond alias resolution.

Overview
Stops Builtins.pkl from triggering deprecation warnings on load when using the pklr backend.

This bumps pklr from 0.4.1 to 0.4.2 and updates scripts/gen_builtins.py to skip generating deprecated builtin bindings in the main loop, then re-add them as explicit @Deprecated aliases pointing to the canonical byte_order_marker builtin.

The pre-commit migration map is updated so check-byte-order-marker and fix-byte-order-marker now resolve directly to Builtins.byte_order_marker instead of the deprecated alias names.

Reviewed by Cursor Bugbot for commit 549c070. Bugbot is set up for automated code reviews on this repo. Configure here.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 26, 2026

Greptile Summary

This PR silences spurious [pklr] WARNING: property '...' is deprecated messages that fired on every Builtins.pkl load by bumping pklr to 0.4.2 (lazy @Deprecated evaluation) and regenerating the deprecated check_byte_order_marker / fix_byte_order_marker bindings to point directly at the canonical byte_order_marker builtin rather than going through the deprecated stub files. The pre-commit migration map is updated in parallel to emit the canonical builtin name for both hooks.

Confidence Score: 5/5

Safe to merge — patch-level dependency bump plus targeted generator fix with no behavioral changes for non-deprecated paths.

All changes are narrow and well-scoped: a pklr patch bump, a generator fix that only affects deprecated alias emission, and a migration map correction. No logic regressions identified; the canonical byte_order_marker target exists and the PKL property name matches the filename stem as required by the generator template.

No files require special attention.

Important Files Changed

Filename Overview
scripts/gen_builtins.py Adds DEPRECATED_ALIASES table; skips those identifiers in the main loop and emits @Deprecated-annotated bindings pointing to the canonical builtin, preventing eager deprecated-property access on module load.
src/cli/migrate/pre_commit.rs Both BOM hook migration entries now map to the canonical "byte_order_marker" builtin name instead of the deprecated aliases.
Cargo.toml Patch-level bump of pklr dependency from 0.4.1 to 0.4.2.
Cargo.lock Lock file updated to reflect pklr 0.4.2 with new checksum.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Builtins.pkl load"] --> B{Identifier in deprecated aliases?}
    B -- No --> C["Emit normal binding\nBuiltins[file].property"]
    B -- Yes --> D["Skip normal binding"]
    D --> E["Emit @Deprecated binding\npointing to canonical\nBuiltins[byte_order_marker.pkl].byte_order_marker"]
    C --> F["pkl format --write"]
    E --> F

    G["User accesses\nBuiltins.check_byte_order_marker"] --> H["pklr >= 0.4.2:\nlazy @Deprecated eval\nfires warning ONLY here"]
    I["User loads Builtins.pkl\nwithout referencing alias"] --> J["Silent — no warning"]
Loading

Reviews (4): Last reviewed commit: "fix(migrate): point pre-commit migration..." | Re-trigger Greptile

Comment thread src/cli/migrate/pre_commit.rs
@jdx jdx closed this Apr 26, 2026
@jdx jdx reopened this Apr 26, 2026
Closes hk discussion #878.

The auto-generated pkl/Builtins.pkl had bindings of the form

  check_byte_order_marker = Builtins["builtins/check_byte_order_marker.pkl"].check_byte_order_marker

whose RHS reads a property annotated @deprecated. With pklr's old
eager handling those warnings fired on every load; even after pklr
0.4.2's lazy @deprecated, the field-access on the deprecated stub
still warns at module-evaluation time because the Builtins.pkl
binding itself performs that access.

Two coordinated changes:

- bump pklr to 0.4.2 (lazy @deprecated, warning fires only on field
  access — see jdx/pklr#58, jdx/pklr#61).
- have scripts/gen_builtins.py special-case the deprecated aliases:
  skip them in the auto-generated loop and emit them as @deprecated
  bindings that point at the canonical byte_order_marker step. The
  Builtins.pkl bindings no longer access a deprecated property at
  load, so the warning only fires when a user references
  Builtins.check_byte_order_marker / .fix_byte_order_marker
  directly — preserving the migration nudge.

End-to-end with HK_PKL_BACKEND=pklr:
- import Builtins.pkl, no use of deprecated aliases → silent.
- use Builtins.check_byte_order_marker → warning fires.
@jdx jdx force-pushed the fix/pkl-builtins-byte-order-marker-deprecation branch from b893395 to 937be35 Compare April 26, 2026 22:07
@jdx jdx changed the title fix(builtins): drop deprecation on byte_order_marker aliases fix(builtins): silence pklr deprecation warnings on Builtins.pkl load Apr 26, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 937be35. Configure here.

Comment thread scripts/gen_builtins.py
The migration map in src/cli/migrate/pre_commit.rs translated the
pre-commit hook IDs `check-byte-order-marker` and
`fix-byte-order-marker` to the deprecated `Builtins.*` aliases.
With pklr 0.4.2's lazy @deprecated, those aliases warn the moment
the user references them — so any config produced by `hk migrate
pre-commit` reintroduced the noise this branch was meant to
eliminate.

Map both pre-commit IDs to `byte_order_marker` (the canonical step)
instead, so freshly migrated configs are clean.
@jdx jdx merged commit e95c30b into main Apr 26, 2026
20 checks passed
@jdx jdx deleted the fix/pkl-builtins-byte-order-marker-deprecation branch April 26, 2026 22:33
@jdx jdx mentioned this pull request Apr 26, 2026
jdx added a commit that referenced this pull request Apr 26, 2026
### 🐛 Bug Fixes

- **(builtins)** silence pklr deprecation warnings on Builtins.pkl load
by [@jdx](https://github.com/jdx) in
[#880](#880)
- **(ci)** serialize docs lint step by [@jdx](https://github.com/jdx) in
[#874](#874)
- **(config)** include main pkl path in cache fresh files by
[@jdx](https://github.com/jdx) in
[#879](#879)
- **(docs)** stack banner message and link on mobile by
[@jdx](https://github.com/jdx) in
[#865](#865)
- **(docs)** pin banner close button to top-right corner on mobile by
[@jdx](https://github.com/jdx) in
[#867](#867)

### 📚 Documentation

- **(site)** show release version and github stars by
[@jdx](https://github.com/jdx) in
[#872](#872)

### 🔍 Other Changes

- add pr-closer workflow by [@jdx](https://github.com/jdx) in
[#876](#876)

### 📦️ Dependency Updates

- bump communique 1.0.3 → 1.0.4 by [@jdx](https://github.com/jdx) in
[#868](#868)
- update anthropics/claude-code-action digest to 2da6cfa by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#869](#869)
- update anthropics/claude-code-action digest to 567fe95 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#870](#870)
- bump communique to 1.1.2 by [@jdx](https://github.com/jdx) in
[#875](#875)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/bugbot) is generating a
summary for commit 62ff432. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: mise-en-dev <[email protected]>
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.

1 participant