{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/verify-hub/issues/44","repository_url":"https://api.github.com/repos/alphagov/verify-hub","labels_url":"https://api.github.com/repos/alphagov/verify-hub/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/verify-hub/issues/44/comments","events_url":"https://api.github.com/repos/alphagov/verify-hub/issues/44/events","html_url":"https://github.com/alphagov/verify-hub/pull/44","id":311695501,"number":44,"title":"TT-2117: Improve the backwards compatibility of State objects","user":{"login":"richardTowers","id":1696784,"avatar_url":"https://avatars3.githubusercontent.com/u/1696784?v=4","gravatar_id":"","url":"https://api.github.com/users/richardTowers","html_url":"https://github.com/richardTowers","followers_url":"https://api.github.com/users/richardTowers/followers","following_url":"https://api.github.com/users/richardTowers/following{/other_user}","gists_url":"https://api.github.com/users/richardTowers/gists{/gist_id}","starred_url":"https://api.github.com/users/richardTowers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardTowers/subscriptions","organizations_url":"https://api.github.com/users/richardTowers/orgs","repos_url":"https://api.github.com/users/richardTowers/repos","events_url":"https://api.github.com/users/richardTowers/events{/privacy}","received_events_url":"https://api.github.com/users/richardTowers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-05T17:09:48Z","updated_at":"2018-04-05T23:12:34Z","closed_at":null,"author_association":"OWNER","pull_request":{"url":"https://api.github.com/repos/alphagov/verify-hub/pulls/44","html_url":"https://github.com/alphagov/verify-hub/pull/44","diff_url":"https://github.com/alphagov/verify-hub/pull/44.diff","patch_url":"https://github.com/alphagov/verify-hub/pull/44.patch"},"body":"Policy has a data store where it stores the session state. This data is\r\nstored in serialized form using Java's default Serializable behaviour\r\n(see [the javadoc for Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)).\r\n\r\nOccasionally we need to refactor these State objects, for example by:\r\n- Renaming a class or field for clarity\r\n- Changing the type of a field (e.g. a guava Optional<T> to a java Optional<T>)\r\n- Removing fields which we don't need anymore\r\n- Adding new fields to store new data\r\n\r\nBecause we're not specifying the serialVersionUID on our state classes\r\nwe're reliant on the JVM to calculate these numbers based on the\r\nalgorithm described [here](https://docs.oracle.com/javase/8/docs/platform/serialization/spec/class.html#a4100).\r\nThis means that even simple changes to objects cause the serialized\r\nversions to break.\r\n\r\n[The javadoc for Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html) say:\r\n\r\n> ... it is strongly recommended that all serializable classes\r\n> explicitly declare serialVersionUID values, since the default\r\n> serialVersionUID computation is highly sensitive to class details that\r\n> may vary depending on compiler implementations, and can thus result in\r\n> unexpected InvalidClassExceptions during deserialization.\r\n\r\n... so we should specify them explicitly. The serialVersionUIDs in this\r\ncommit were calculated on the un-modified classes, so they should be\r\nconsistent with the serialized objects from the last release.\r\n\r\nTo make future breaking changes to State classes more explicit we've\r\nadded a suite of DeserializationTests which attempt to deserialize a\r\nserialized version of each of the States. These should fail if any\r\nchanges are made that prevent old versions from deserializing. There's a\r\ncomment on the test class describing what the developer should do."},"comment":{"url":"https://api.github.com/repos/alphagov/verify-hub/issues/comments/379103550","html_url":"https://github.com/alphagov/verify-hub/pull/44#issuecomment-379103550","issue_url":"https://api.github.com/repos/alphagov/verify-hub/issues/44","id":379103550,"user":{"login":"rhowe-gds","id":23742767,"avatar_url":"https://avatars1.githubusercontent.com/u/23742767?v=4","gravatar_id":"","url":"https://api.github.com/users/rhowe-gds","html_url":"https://github.com/rhowe-gds","followers_url":"https://api.github.com/users/rhowe-gds/followers","following_url":"https://api.github.com/users/rhowe-gds/following{/other_user}","gists_url":"https://api.github.com/users/rhowe-gds/gists{/gist_id}","starred_url":"https://api.github.com/users/rhowe-gds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhowe-gds/subscriptions","organizations_url":"https://api.github.com/users/rhowe-gds/orgs","repos_url":"https://api.github.com/users/rhowe-gds/repos","events_url":"https://api.github.com/users/rhowe-gds/events{/privacy}","received_events_url":"https://api.github.com/users/rhowe-gds/received_events","type":"User","site_admin":false},"created_at":"2018-04-05T23:12:34Z","updated_at":"2018-04-05T23:12:34Z","author_association":"NONE","body":"I wholeheartedly approve of this - if we're doing Java serialisation we should at least do it properly. +100 for the tests."}}
{"actor":{"display_login":"rhowe-gds"}}