Skip to content

Normalize DESCRIPTION package name for S4 digest parity with load_all()#13

Merged
felix-andreas-finccam merged 5 commits into
mainfrom
copilot/fix-s4-object-hash-difference
Apr 22, 2026
Merged

Normalize DESCRIPTION package name for S4 digest parity with load_all()#13
felix-andreas-finccam merged 5 commits into
mainfrom
copilot/fix-s4-object-hash-difference

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

load_fast() produced different digest::digest() values for S4 objects than pkgload::load_all(). The mismatch came from loader-created S4 metadata: the package name read from DESCRIPTION retained the read.dcf() column name, which changed the class package attribute shape and therefore the object hash.

  • Root cause

    • Strip the name from the Package field when deriving pkg_name from DESCRIPTION.
    • This makes attr(class(obj), "package") match load_all() semantics for S4 instances.
  • Regression coverage

    • Add a subprocess-based regression test that loads the same package with both load_fast() and pkgload::load_all().
    • Assert both loaders produce:
      • the same S4 object digest
      • an unnamed class(..., "package") attribute
  • Test helper cleanup

    • Factor the digest reproduction script lines into shared variables to keep the new regression focused and easy to scan.
obj <- animal("Rex", "dog", 4)
digest::digest(obj)
attr(class(obj), "package")

Under this change, both loaders yield the same digest for the same S4 object, and the package attribute is normalized to the same shape.

Copilot AI and others added 2 commits April 21, 2026 13:46
Agent-Logs-Url: https://github.com/finccam/loadfast/sessions/633055e1-4881-45b4-bbeb-ca92b6414b37

Co-authored-by: felix-andreas-finccam <266759557+felix-andreas-finccam@users.noreply.github.com>
Agent-Logs-Url: https://github.com/finccam/loadfast/sessions/633055e1-4881-45b4-bbeb-ca92b6414b37

Co-authored-by: felix-andreas-finccam <266759557+felix-andreas-finccam@users.noreply.github.com>
@felix-andreas-finccam felix-andreas-finccam marked this pull request as ready for review April 22, 2026 14:38
@felix-andreas-finccam felix-andreas-finccam merged commit d66dfc1 into main Apr 22, 2026
2 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.

2 participants