Skip to content

refactor(runtime): read StringHeader payloads through string_data at the eight new open-coded sites - #14751

Merged
TheHypnoo merged 2 commits into
PerryTS:mainfrom
raliclo:fix/lint-payload
Nov 16, 2026
Merged

TheHypnoo merged 2 commits into
PerryTS:mainfrom
raliclo:fix/lint-payload

Conversation

@raliclo

@raliclo raliclo commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

String payload-access inventory (python3 scripts/string_payload_access_inventory.py) fails on main (CI run 43639432681, lint): perry-runtime inline-offset baseline 327, found 335. The eight new sites add size_of::<StringHeader>() to a header pointer by hand; this PR routes them through crate::string::string_data, which computes exactly that address. The count returns to 327; the baseline is not touched.

Changes

Sites found by comparing per-file --list counts between b42fb4361e (the last baseline write, where the gate passes) and upstream/main; the adding commit of each is from git log -S:

No behaviour change: string_data(s) is (s as *const u8).add(size_of::<StringHeader>()).

Related issue

Refs #14595. Main's CI run: https://github.com/PerryTS/perry/actions/runs/43639432681

Test plan

Measured on macOS arm64:

  • b42fb4361e: gate passes; upstream/main: baseline 327, found 335; this branch: passes (357 inline offsets and 11 reader helpers held by the ratchet, all crates).
  • Negative control: restoring the open-coded offset in buffer/error_object_tests.rs fails the gate again (baseline 327, found 328, that line listed).
  • ./scripts/test_affected_crates.sh --base upstream/main --dry-run → ran each crate's tests (CARGO_BUILD_JOBS=4 RUST_TEST_THREADS=1):
    • perry-runtime --lib: 6808 passed, 5 failed — all 5 also fail on upstream/main (rerun there by name: handle_storage_teardown_clears_cache_before_late_scope_drop, three lazy_intrinsic_towers::*_tower_runs_in_a_no_move_window, program_cell_bytes_do_not_carry_the_previous_occupant); none is in a touched module.
    • perry --bins: 1609 passed, 3 failed — the same 3 fail on main.
    • perry-stdlib: 342 passed, 1 failed (sqlite::bind::tests::typed_arrays_are_not_named_parameter_objects, a main failure addressed by test: sqlite's typed-array bind test installs the typed-array family #14736).
    • perry-updater: test binary fails to link on this Mac; identical link failure on upstream/main.
    • perry-ffi, perry-http-server, perry-ui: pass.
  • BASE_SHA=upstream/main scripts/run_lint_gates.sh (full run): FAIL set = main's minus String payload-access inventory; no new FAIL.

Checklist

  • I have NOT bumped the workspace version or edited CHANGELOG.md (maintainer handles these at merge)
  • My commits follow the loose feat: / fix: / docs: / chore: prefix convention used in the log
  • I've read CONTRIBUTING.md and agree to the Code of Conduct

🤖 Generated with Claude Code

https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p

Summary by CodeRabbit

  • Refactor
    • Standardized how string data is accessed across runtime property lookups, buffer operations, and tests. No behavior change is expected.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f096eb6-c855-4aca-bc91-e4a6fe65ffc7
Commits

Reviewing files that changed from the base of the PR and between 59da237 and b7ebbad.

Files selected for processing: 7

  • changelog.d/14751-string-payload-accessor.md
  • crates/perry-runtime/src/array/from_primitive_tests.rs
  • crates/perry-runtime/src/buffer/error_object_tests.rs
  • crates/perry-runtime/src/object/field_get_set/buffer_own_prop.rs
  • crates/perry-runtime/src/object/global_this/declaration_keys_tests.rs
  • crates/perry-runtime/src/object/http_handle_prototype.rs
  • crates/perry-runtime/src/thread/error_stack_clone_tests.rs

No actionable comments were generated in the recent review.

Walkthrough

The changes replace manual StringHeader-based payload address calculations with string_data in runtime code and test helpers. The changelog records the updates and states that behavior is unchanged.

Changes: String payload access

Layer / File(s) Summary
Replace header-offset payload lookups
crates/perry-runtime/src/object/field_get_set/buffer_own_prop.rs, crates/perry-runtime/src/object/http_handle_prototype.rs, crates/perry-runtime/src/array/from_primitive_tests.rs, crates/perry-runtime/src/buffer/error_object_tests.rs, crates/perry-runtime/src/object/global_this/declaration_keys_tests.rs, crates/perry-runtime/src/thread/error_stack_clone_tests.rs, changelog.d/14751-string-payload-accessor.md
Runtime code and test helpers now use string_data to access string payload bytes instead of calculating the address from StringHeader layout. The changelog records the updates.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

  • PerryTS/perry#14604: This PR also concerns the string payload-access ratchet and its reported gate failure.

Suggested reviewers: proggeramlug, thehypnoo

Merge Risk: Minimal · previous review 59da2

This is a behavior-preserving refactor that routes string payload access through a shared accessor and adds a changelog entry. No actionable merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the refactor in the perry-runtime crate: StringHeader payload reads move to string_data at eight open-coded sites. This matches the changeset, which routes eight sites through crate::s…
Description check Passed The description follows the template's main sections: Summary, Changes, Related issue, Test plan, and Checklist. The Summary explains what changes and why, and the Changes section lists files and comm…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the refactor in the perry-runtime crate: StringHeader payload reads move to string_data at eight open-coded sites. This matches the changeset, which routes eight sites through crate::string::string_data in http_handle_prototype.rs, buffer_own_prop.rs, and four test modules. The title is specific and accurate, though it uses jargon and is long (99 characters).

Full details: Description check

Explanation

The description follows the template's main sections: Summary, Changes, Related issue, Test plan, and Checklist. The Summary explains what changes and why, and the Changes section lists files and commits. The Related issue is given as Refs #14595. The Test plan is detailed and reports measured results and a negative control. The template's test plan checkboxes are replaced by prose, and the Screenshots section is omitted, which is optional. The description does not mention the template's note about not bumping the version, but the Checklist confirms it. The description also contains no Screenshots/output section, which is optional.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2241ecba-60c7-4142-86d6-afeb53edc878
Commits

Reviewing files that changed from the base of the PR and between 64257c3 and 59da237.

Files selected for processing: 7

  • changelog.d/14751-string-payload-accessor.md
  • crates/perry-runtime/src/array/from_primitive_tests.rs
  • crates/perry-runtime/src/buffer/error_object_tests.rs
  • crates/perry-runtime/src/object/field_get_set/buffer_own_prop.rs
  • crates/perry-runtime/src/object/global_this/declaration_keys_tests.rs
  • crates/perry-runtime/src/object/http_handle_prototype.rs
  • crates/perry-runtime/src/thread/error_stack_clone_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

ralic and others added 2 commits November 16, 2026 15:11
…the eight new open-coded sites

The string payload-access ratchet fails on main (perry-runtime inline-offset:
baseline 327, found 335). The eight new sites add
size_of::<StringHeader>() to a header pointer by hand instead of calling
crate::string::string_data, which computes exactly that address:

- object/http_handle_prototype.rs (3, from e1fbae4)
- object/field_get_set/buffer_own_prop.rs (1, from b96fcce)
- tests: array/from_primitive_tests.rs (892ad29),
  buffer/error_object_tests.rs (86dc5e9),
  object/global_this/declaration_keys_tests.rs (e5e99ef),
  thread/error_stack_clone_tests.rs (841006a)

No behaviour change: string_data(s) is (s as *const u8).add(size_of::<StringHeader>()).
The count returns to the baseline, which is not changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
@TheHypnoo
TheHypnoo merged commit 0a78484 into PerryTS:main Nov 16, 2026
113 of 134 checks passed
@raliclo
raliclo deleted the fix/lint-payload branch November 17, 2026 01:36
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.

3 participants