chore(value): scope ObjectSource.deprecated field to pub(crate)#61
Conversation
The `deprecated` map added in #58 is only read by the evaluator's private field-access helper. Marking the field `pub(crate)` keeps that intact while removing the field from pklr's public API. cargo-semver-checks still flags this as a break in the strict sense (`constructible_struct_adds_private_field`: ObjectSource is no longer externally constructible via a struct literal). In practice no one downstream constructs `ObjectSource` literally — it's an internal-ish struct describing evaluator state — so we override the release-plz major bump and ship 0.4.2 manually.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Greptile SummaryScopes the Confidence Score: 5/5Safe to merge — single visibility narrowing with no behavioural changes. The change is a one-line visibility restriction with an updated doc comment. No logic is altered, all 238 tests pass, and clippy is clean. The semver implication is acknowledged and handled intentionally in the release plan. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ObjectSource struct] --> B[pub entries: Vec<Entry>]
A --> C[pub scope: IndexMap]
A --> D[pub is_open: bool]
A --> E[pub type_name: Option<String>]
A --> F["pub(crate) deprecated: IndexMap (was pub)"]
F --> G[Evaluator — crate-internal reader/writer]
style F fill:#f9f,stroke:#333
Reviews (1): Last reviewed commit: "chore(value): scope ObjectSource.depreca..." | Re-trigger Greptile |
## 🤖 Release * `pklr`: 0.4.1 → 0.4.2 The `deprecated` field added in [#58](#58) is scoped to `pub(crate)` ([#61](#61)) so `ObjectSource` no longer exposes new public surface. cargo-semver-checks still flags the struct as no-longer-externally-constructible-via-literal, but in practice nothing downstream constructs `ObjectSource` literally — it's an internal-ish struct describing evaluator state — so this ships as a patch release. The release-plz auto-detected major bump is overridden here manually. ### Changelog #### Fixed - *(eval)* make @deprecated lazy — only warn on access ([#58](#58)) - *(value)* scope `ObjectSource.deprecated` field to `pub(crate)` ([#61](#61)) --- This PR was originally opened by [release-plz](https://github.com/release-plz/release-plz/) as 0.5.0; manually retargeted to 0.4.2. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this PR only updates release metadata (version numbers and changelog) with no functional code changes. > > **Overview** > Publishes release `v0.4.2` by bumping the crate version from `0.4.1` to `0.4.2` in `Cargo.toml`/`Cargo.lock`. > > Updates `CHANGELOG.md` with the `0.4.2` entry noting the fix to make `@Deprecated` warnings lazy (warn only on access). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5ebfa23. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
…#880) ## Summary - Closes [discussion #878](#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#58), [jdx/pklr#61](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 - [x] `mise run test:cargo` — 145 passed. - [x] 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. - [x] `hk` pre-commit hooks pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!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. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 549c070. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Summary
The
deprecatedmap added in #58 is only read by the evaluator's private field-access helper. Marking the fieldpub(crate)keeps that working and removes it from pklr's public API.cargo-semver-checks will still flag this as a break in the strict sense (
constructible_struct_adds_private_field—ObjectSourceis no longer externally constructible via a struct literal). In practice no one downstream constructsObjectSourceliterally — it's an internal-ish struct describing evaluator state — so the plan is to override the release-plz auto-bump and ship 0.4.2 manually instead of 0.5.0 from #59.Test plan
cargo test: 238 passed.cargo clippy --all-targets -- -D warnings: clean.🤖 Generated with Claude Code
Note
Low Risk
Low risk, single-field visibility change with no runtime behavior impact; only potential risk is breaking external code that constructed or accessed
ObjectSourcedirectly.Overview
Makes
ObjectSource.deprecatedpub(crate)so deprecation metadata remains usable by the evaluator but is no longer part of the public API (and can’t be read/constructed via struct literals outside the crate).Reviewed by Cursor Bugbot for commit e960737. Bugbot is set up for automated code reviews on this repo. Configure here.