Skip to content

Support for the structured products in the registry#728

Open
al-niessner wants to merge 3 commits intodevelopfrom
issue_632
Open

Support for the structured products in the registry#728
al-niessner wants to merge 3 commits intodevelopfrom
issue_632

Conversation

@al-niessner
Copy link
Contributor

🗒️ Summary

In order for the registry-api to use the structured field names, need to quit doing the property name conversions. Made it selectable via the properties file just because the transition from one to the other may take a while. This gives us the freedom to use the same API code for older or newer registry-apis.

⚙️ Test Data and/or Report

All postman tests pass.

♻️ Related Issues

Last step. Closes #632

🤓 Reviewer Checklist

Reviewers: Please verify the following before approving this pull request.

Security & Quality

  • SonarCloud: Confirmed no new High or Critical security findings.
  • Secrets Detection: Verified that the Secrets Detection scan passed and no sensitive information (keys, tokens, PII) is exposed.
  • Code Quality: Code follows organization style guidelines and best practices for the specific language (e.g., PEP 8, Google Java Style).

Testing & Validation

  • Test Accuracy: Verified that test data is accurate, representative of real-world PDS4 scenarios, and sufficient for the logic being tested.
  • Coverage: Automated tests cover new logic and edge cases.
  • Local Verification: (If applicable) Successfully built and ran the changes in a local or staging environment.

Documentation

  • Documentation: README, Wiki, or inline documentation (Sphinx, Javadoc, Docstrings) have been updated to reflect these changes.

Maintenance

  • Issue Traceability: The PR is linked to a valid GitHub Issue or Jira Ticket.
  • Backward Compatibility: Confirmed that these changes do not break existing downstream dependencies or API contracts (or that breaking changes are clearly documented).

Al Niessner added 2 commits February 2, 2026 09:23
In order for the registry-api to use the structured field names, need to quit doing the property name conversions. Made it selectable via the properties file just because the transition from one to the other may take a while. This gives us the freedom to use the same API code for older or newer registry-apis.
@al-niessner al-niessner self-assigned this Feb 2, 2026
@al-niessner al-niessner requested a review from a team as a code owner February 2, 2026 17:28
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE


# signal if the database being used is "flat" or "structured"
# used an enum of strings, "flat" or "structured" for future new types
registry.field.name.architecture=structured No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tloubrieu-jpl

This is how you want to change between flat and structured DB. I am not sure if the postman tests will pass unless you have jumped them to structured already.


static public String jsonPropertyToOpenProperty(String jsonProperty) {
return jsonProperty.replace(".", "/");
if (SearchUtil.fnArch == null || SearchUtil.fnArch.equalsIgnoreCase("flat")) return jsonProperty.replace(".", "/");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jordanpadams @tloubrieu-jpl

I made the default (older registry-api applications.properties file) behave as flat. We will need to change the == to != and the || to && if you want the missing property condition to be structured instead.

@al-niessner
Copy link
Contributor Author

@nutjob4life @tloubrieu-jpl

Why is sonar stuff now hidden? Not very useful that it tells me there is one new problem then will not tell me what it is. Should I just start randomly guessing?

@nutjob4life
Copy link
Member

@al-niessner I'm not sure what's being hidden? I can visit the URL https://sonarcloud.io/dashboard?id=NASA-PDS_registry-api&pullRequest=728 — and I don't have to log in

@al-niessner
Copy link
Contributor Author

al-niessner commented Feb 2, 2026 via email

@nutjob4life
Copy link
Member

@nutjob4life
Copy link
Member

No idea why it doesn't load 🤷

@tloubrieu-jpl tloubrieu-jpl changed the base branch from develop to structured February 2, 2026 20:07
@tloubrieu-jpl
Copy link
Member

Hi @al-niessner , we don't want to merge that in develop I believe because we have other updates which need to go to develop for an earlier release. I creted a 'structured' branch which will be the target branch for this PR.

@al-niessner
Copy link
Contributor Author

@nutjob4life

Different browser. I can see it in this browser. Anyway, gonna have to live with it as it is an artifact of springboot.

@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl

It is written to work in both by changing the java property. If the develop is the flat branch then just change java property to flat. When merged into structured branch, change it to structured.

Maybe I do not understand your development idea. Are develop and structured always going to remain apart or will structured be merged into develop? Anyway, I will be in the meeting tomorrow so we can cover it then.

@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl

I do not understand the build failure that registry-loader-test-init did not complete successfully. Did you want me to dig into the cause?

I see you moved the merge into branch to structured already. Thanks.

@tloubrieu-jpl tloubrieu-jpl changed the title last step Support for the structured products in the registry Feb 5, 2026
@tloubrieu-jpl tloubrieu-jpl changed the base branch from structured to develop March 17, 2026 04:37
Copy link
Member

@tloubrieu-jpl tloubrieu-jpl left a comment

Choose a reason for hiding this comment

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

Thanks @al-niessner , I changed the target branch to main as the behavior would stay the same with the current applications.properties.
We'll test in integration with the structured behavior with the same code but updated application.properties after we are done with the current build release (flat behavior).

Copy link
Member

@tloubrieu-jpl tloubrieu-jpl left a comment

Choose a reason for hiding this comment

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

Actually, I see the sonarcloud comment which should be easy to fix:

Image

I had to log in using my github account to see the error.

Once you re-commit the integration test would re-run, we will see if we are more lucky this time. The tests have been running for 6 hours on the other PR and are not done yet. That is weird too.

@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl

I know what those are and they have nothing to do with this PR. There should be a very large number of functions like that and sonarqube is just off its rocker. They are, as the class says, in the Mock that you created. They have to be implemented to make the interface happy, but we are not testing them today. They are good place holders for when we find out they need tested so doing either suggestion is a tad pointless in a test Mock.

Also, this PR does not touch that file. Not sure why sonarqube is crying about it now.

@tloubrieu-jpl
Copy link
Member

tloubrieu-jpl commented Mar 18, 2026

Thanks @al-niessner . Sonarcube might have changed their rules ?
I could do that, but is there a way to silence these warnings, as they might hide some hypothetical/future relevant one next time ?

@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl

It has not changed its rules. Mr Gemini says that you want the sonarqube admin to ignore the mock files:

https://share.google/aimode/nlpCtoTD08Em8qM5l

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@tloubrieu-jpl
Copy link
Member

Thanks @al-niessner, I added the comments recommended by SonarCube. They were missing on 2 new methods.
Let's cross our fingers for the integration tests.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the registry API to support OpenSearch field names for “structured” products by making property-name conversion behavior configurable, enabling the same API codebase to work against both flat and structured registry indexes during a transition period.

Changes:

  • Add a new configuration property (registry.field.name.architecture) to select between flat and structured field-name handling.
  • Update SearchUtil to conditionally convert property separators based on the configured architecture.
  • Update Terraform ECS task image wiring to use an ECR repository URL (and remove the now-unused aws_fg_image variable).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
terraform/variables.tf Removes the aws_fg_image variable definition.
terraform/ecs.tf Switches ECS task image reference to an ECR repository URL and removes the old repo lookup block.
service/src/main/resources/application.properties Introduces registry.field.name.architecture default value.
service/src/main/java/gov/nasa/pds/api/registry/model/SearchUtil.java Makes property-name conversion conditional on configured architecture.
lexer/src/test/java/api/pds/nasa/gov/api_search_query_lexer/MockedListener.java Adds clarifying no-op comments in mocked listener methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# signal if the database being used is "flat" or "structured"
# used an enum of strings, "flat" or "structured" for future new types
registry.field.name.architecture=structured No newline at end of file
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

registry.field.name.architecture is set to structured in the default application.properties. If existing environments still use the flat-field index, this will flip behavior by default and can break queries/sorts unless they override the property externally. To preserve backward compatibility during the transition, consider defaulting this to flat here (or omitting it and relying on an explicit opt-in for structured).

Suggested change
registry.field.name.architecture=structured
registry.field.name.architecture=flat

Copilot uses AI. Check for mistakes.
Comment on lines 89 to 112
@@ -112,7 +108,7 @@ resource "aws_ecs_task_definition" "pds-registry-ecs-task" {
[
{
"name": "pds-${var.venue}-reg-container",
"image": "${var.aws_fg_image}",
"image": "${aws_ecr_repository.pds-registry-api-service.repository_url}:latest",
"portMappings": [
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

aws_ecr_repository.pds-registry-api-service is referenced for the task image, but there is no aws_ecr_repository resource or data "aws_ecr_repository" declared anywhere in the Terraform module. As-is, terraform plan/apply will fail with an undeclared resource error. Either add the missing ECR repository definition (resource or data source) in this PR, or switch the reference back to the correct declared object name/type.

Copilot uses AI. Check for mistakes.
{
"name": "pds-${var.venue}-reg-container",
"image": "${var.aws_fg_image}",
"image": "${aws_ecr_repository.pds-registry-api-service.repository_url}:latest",
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

The ECS task definition now hardcodes the image tag to :latest, which makes deployments non-deterministic and can unexpectedly roll forward/back depending on what was last pushed. Consider parameterizing the tag (or using an image digest) similarly to the previous aws_fg_image variable so environments can pin an exact version.

Suggested change
"image": "${aws_ecr_repository.pds-registry-api-service.repository_url}:latest",
"image": "${aws_ecr_repository.pds-registry-api-service.repository_url}:${var.registry_image_tag}",

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +31
private static String fnArch;
@Value("${registry.field.name.architecture}")
public void setFnArch(String fnArch) {
SearchUtil.fnArch = fnArch;
}

static public String jsonPropertyToOpenProperty(String jsonProperty) {
return jsonProperty.replace(".", "/");
if (SearchUtil.fnArch == null || SearchUtil.fnArch.equalsIgnoreCase("flat")) return jsonProperty.replace(".", "/");
return jsonProperty;
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

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

@Value("${registry.field.name.architecture}") has no default, so Spring will fail to start if this property is absent (e.g., older deployments/configs), even though the code attempts to handle fnArch == null. If the intent is to keep this optional/selectable, provide a default in the placeholder (for example defaulting to flat) and/or validate unexpected values to avoid silent misconfiguration.

Copilot uses AI. Check for mistakes.
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.

Add Initial Support for Searching Full PDS4 Structured Metadata

4 participants