Skip to content

[Bug]: Preserve order of Move.history.json entries #82

@chrisgitiota

Description

@chrisgitiota

Bug description

There is an issue with the Move.history.json file used by the PackageRegistry to store the network environments and related network aliases. The JSON content changes every time. It’s generated, with the entries being reordered randomly.

This behavior results from:

  • A HashMap is used in the PackageRegistry to store the aliases and envs
  • serde_json - used for serialization + deserialization - doesn't use the preserve_order feature flag.

Probable fixes:

  • Use an IndexMap to store the aliases and envs in the PackageRegistry
  • Enable the preserve_order feature flag for serde_json

Expected behavior

The Move.history.json file shall only be altered in case the Move package has been published to a new environment or a package upgrade has been processed.

Otherwise the Move.history.json file must remain unchanged.

Can the issue reliably be reproduced?

Yes

Example repository

Steps to reproduce

Language

Rust

Language Version

v0.8.7

Version

Hardware specifications

Additional info

As a workaround, so far, we should not commit altered Move.history.json files except their have been published or upgraded packages (No upgrade && No publish --> No Move.history.json commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Product Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions