Skip to content

FIREFLY-1331: Add Version validation for compatibility check between python client and firefly server#1936

Merged
jaladh-singhal merged 1 commit intodevfrom
FIREFLY-1331-version-validation
Apr 10, 2026
Merged

FIREFLY-1331: Add Version validation for compatibility check between python client and firefly server#1936
jaladh-singhal merged 1 commit intodevfrom
FIREFLY-1331-version-validation

Conversation

@jaladh-singhal
Copy link
Copy Markdown
Member

@jaladh-singhal jaladh-singhal commented Apr 10, 2026

Fixes FIREFLY-1331

Exposed the version info as cmd=CmdVersion at the commands servelet endpoint (CmdSrv/sync).

Firefly client is not using the raw=true param but it maybe helpful in future if validation logic becomes complicated.

See Firefly client PR: Caltech-IPAC/firefly_client#79

Testing

  1. http://aac8ce8bef8604e7ca9d38b934ab83c5-4855331a01d9fb87.elb.us-east-1.amazonaws.com/firefly-1331/firefly (yes I managed to deploy the PR build on AWS using helm!)

    • Open the version dialog and check if it matches the JSON returned by /CmdSrv/sync?cmd=CmdVersion query params

    • Check that /CmdSrv/sync?cmd=CmdVersion?raw=true query params returns primitive version object which can also be useful in some cases

  2. https://firefly-1331-version-validation.irsakubedev.ipac.caltech.edu/irsaviewer/CmdSrv/sync?cmd=CmdVersion

Copy link
Copy Markdown
Contributor

@robyww robyww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not looked at the python yet but I think this is fine after the clean up I suggested.


public static class GetVersion extends ServCommand {
public String doCommand(SrvParam params) throws Exception {
boolean raw = Boolean.parseBoolean(params.getOptional("raw"));
Copy link
Copy Markdown
Contributor

@robyww robyww Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use

parmas.getOptionalBoolean(“raw”,false)

boolean raw = Boolean.parseBoolean(params.getOptional("raw"));
Object data = raw ? VersionUtil.getAppVersion()
: VersionUtil.getVersionInfo().stream().collect(Collectors.toMap(KeyVal::getKey, KeyVal::getValue));
return Serializer.getJsonMapper().writeValueAsString(data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a little verbose but wrap all out returns in an object.

this is SimpleJson taken from GetUserInfo (a few lines below) just to demonstrate

map.put( "success", true);
map.put("data", data);

Copy link
Copy Markdown
Contributor

@loitly loitly Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Jackson for JSON conversion is a good approach, and I’d like to gradually migrate SimpleJson to Jackson.

The added complexity here comes from converting a list of <name, value> pairs into a map. This could be simplified if VersionUtil.getVersionInfo() returned a Map directly. From what I’ve seen, all current usages end up converting or streaming the list anyway to access the values.

Copy link
Copy Markdown
Member Author

@jaladh-singhal jaladh-singhal Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robyww I was using the imperative approach earlier to create map by looping over list. I reverted functional streaming approach back to it.

@loitly this still keeps the jackson JSON conversion since I am working with map object directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a little verbose but wrap all out returns in an object.

I was reviewing from my ipad last night and the above line got garbled. Let me try that again.

Our standard return style is a little verbose, but we always wrap the json data returned in an outer json object. You are just returning the data and it should be wrapped in an object {status: true, data:data}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. I jumped the gun and merged already. Should I revert this merge and make this change in this branch? OR just push this change directly to dev?

Copy link
Copy Markdown
Contributor

@loitly loitly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

boolean raw = Boolean.parseBoolean(params.getOptional("raw"));
Object data = raw ? VersionUtil.getAppVersion()
: VersionUtil.getVersionInfo().stream().collect(Collectors.toMap(KeyVal::getKey, KeyVal::getValue));
return Serializer.getJsonMapper().writeValueAsString(data);
Copy link
Copy Markdown
Contributor

@loitly loitly Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Jackson for JSON conversion is a good approach, and I’d like to gradually migrate SimpleJson to Jackson.

The added complexity here comes from converting a list of <name, value> pairs into a map. This could be simplified if VersionUtil.getVersionInfo() returned a Map directly. From what I’ve seen, all current usages end up converting or streaming the list anyway to access the values.

FIREFLY-1331: Add VersionServlet to return application version information as JSON

FIREFLY-1331: Add raw param to VersionServlet

FIREFLY-1331: Change Version Servlet to Cmd

FIREFLY-1331: Simplify the JSON generation for version

FIREFLY-1331: Apply feedback from PR
@jaladh-singhal jaladh-singhal force-pushed the FIREFLY-1331-version-validation branch from ee1181c to 19c2722 Compare April 10, 2026 20:37
@jaladh-singhal jaladh-singhal merged commit c7b7997 into dev Apr 10, 2026
@jaladh-singhal jaladh-singhal deleted the FIREFLY-1331-version-validation branch April 10, 2026 20:37
@jaladh-singhal jaladh-singhal restored the FIREFLY-1331-version-validation branch April 10, 2026 20:44
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