We need to make the change API process more clear for changing tests. #792

Open
opened 2025-12-28 17:20:42 +00:00 by sami · 2 comments
Owner

Originally created by @anikeev-yadro on GitHub (Oct 11, 2022).

After API was changed we had output json changed too, as result our tests which use parsing output json had broken.
For example:
the old output was:

COMMAND: 'neofs-cli --config /tests/neofs_cli_configs/empty_passwd.yml object head --rpc-endpoint 'obj-nn-test-node1.spb.yadro.com:8081' --wallet '/tests/TemporaryDir/9e36c117-375a-4bb9-98d4-4069ed75bd85.json' --cid '5bx2Sf6QGH1cwPYygKXbnci54c2r4B7U57nyKqJKSn3F' --oid 'DBLVipfwZ2RidS8VHtEHuytTWPxWm7RCQCrmwfGoaNxt' --json'
OUTPUT:
...
"object":{
		"verb":"DELETE", 
		"address":{
			"containerID":{
					"value":"RGK2R6ck2MYpZwA0fDZjzkEhLNh+jQPy1ppvinOvM34="
					}, 
			"objectID":{"value":"L0Npxk176tmA5R8TG1KUgrKg3PDmyeH4CJ/wwp3oTfA="}
			}}}, 
...

the new output is:

COMMAND: 'neofs-cli --config /tests/wallet_config.yml object head --rpc-endpoint 'obj-nn-test-node2.spb.yadro.com:8081' --wallet '/tests/TemporaryDir/05e48067-b192-429f-973d-d336a449a5d6.json' --cid '43qM2vL1PEUgJ8JDaRqD9YjZW5D8q6QWxUgWbwy6hjib' --oid '3Gyij4fKgWMM5ut75FjP6bpoUWQmYQpVgE1UYhRxKXqU' --json'
OUTPUT:
...
		"object":{
			"verb":"DELETE", 
			"target":{"container":{"value":"LUzi/6K59Svl6oq02HEtf5o1pzVNHtn/4MJe9/rCQWQ="}, 
			"objects":[{"value":"q7OWeKaYaCr+q11OkmA0JiFRaSHCAGOF9K2OsehOeR0="}]}
		}}, 
...
Originally created by @anikeev-yadro on GitHub (Oct 11, 2022). After API was changed we had output json changed too, as result our tests which use parsing output json had broken. For example: the old output was: ``` COMMAND: 'neofs-cli --config /tests/neofs_cli_configs/empty_passwd.yml object head --rpc-endpoint 'obj-nn-test-node1.spb.yadro.com:8081' --wallet '/tests/TemporaryDir/9e36c117-375a-4bb9-98d4-4069ed75bd85.json' --cid '5bx2Sf6QGH1cwPYygKXbnci54c2r4B7U57nyKqJKSn3F' --oid 'DBLVipfwZ2RidS8VHtEHuytTWPxWm7RCQCrmwfGoaNxt' --json' OUTPUT: ... "object":{ "verb":"DELETE", "address":{ "containerID":{ "value":"RGK2R6ck2MYpZwA0fDZjzkEhLNh+jQPy1ppvinOvM34=" }, "objectID":{"value":"L0Npxk176tmA5R8TG1KUgrKg3PDmyeH4CJ/wwp3oTfA="} }}}, ... ``` the new output is: ``` COMMAND: 'neofs-cli --config /tests/wallet_config.yml object head --rpc-endpoint 'obj-nn-test-node2.spb.yadro.com:8081' --wallet '/tests/TemporaryDir/05e48067-b192-429f-973d-d336a449a5d6.json' --cid '43qM2vL1PEUgJ8JDaRqD9YjZW5D8q6QWxUgWbwy6hjib' --oid '3Gyij4fKgWMM5ut75FjP6bpoUWQmYQpVgE1UYhRxKXqU' --json' OUTPUT: ... "object":{ "verb":"DELETE", "target":{"container":{"value":"LUzi/6K59Svl6oq02HEtf5o1pzVNHtn/4MJe9/rCQWQ="}, "objects":[{"value":"q7OWeKaYaCr+q11OkmA0JiFRaSHCAGOF9K2OsehOeR0="}]} }}, ... ```
Author
Owner

@cthulhu-rider commented on GitHub (Oct 11, 2022):

From one side, we do not guarantee backward compatibility in JSON format. From the other side, I think we need to improve JSON UX in tools like NeoFS CLI.

Possible solutions:
0. do nothing and leave it to the user's attention to protocol changes

  1. provide intermediate NeoFS CLI JSON format for some NeoFS entities which
    a) beautifies some fields, e.g. IDs can be string-encoded instead of raw protobuf format
    b) covers breaking cases like the mentioned one
  2. keep the same JSON input format and support all formats programmatically (best effort)
  3. do not solve it programmatically and write about JSON breakages in changelog
@cthulhu-rider commented on GitHub (Oct 11, 2022): From one side, we do not guarantee backward compatibility in JSON format. From the other side, I think we need to improve JSON UX in tools like NeoFS CLI. Possible solutions: 0. do nothing and leave it to the user's attention to protocol changes 1. provide intermediate NeoFS CLI JSON format for some NeoFS entities which a) beautifies some fields, e.g. IDs can be string-encoded instead of raw protobuf format b) covers breaking cases like the mentioned one 2. keep the same JSON input format and support all formats programmatically (best effort) 3. do not solve it programmatically and write about JSON breakages in changelog
Author
Owner

@roman-khimov commented on GitHub (Dec 21, 2023):

JSON can be more stable than regular strings, but it needs to be controlled for that of course.

@roman-khimov commented on GitHub (Dec 21, 2023): JSON can be more stable than regular strings, but it needs to be controlled for that of course.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-node#792
No description provided.