Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on creating a Form element group with a lengthy name #1254

Closed
2 of 4 tasks
Tracked by #1636
arjunk opened this issue Jun 17, 2024 · 5 comments
Closed
2 of 4 tasks
Tracked by #1636

Error on creating a Form element group with a lengthy name #1254

arjunk opened this issue Jun 17, 2024 · 5 comments
Assignees

Comments

@arjunk
Copy link
Contributor

arjunk commented Jun 17, 2024

Describe the bug

An error showing up in form designer with FEG name "In the past week, did you or any household member over the age of 15 engage in any of the following activities with your child". Most probably due to the length of the FEG

To Reproduce

Steps to reproduce the behavior:

  1. Go to your test implementation
  2. Create a new FEG with this name "In the past week, did you or any household member over the age of 15 engage in any of the following activities with your child" and some questions in it
  3. Save
  4. See error
    Server error received : ERROR: value too long for type character varying(100)
2024-08-05 07:10:25.121  WARN 1569187 --- [http-nio-8021-exec-36] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 22001
2024-08-05 07:10:25.121 ERROR 1569187 --- [http-nio-8021-exec-36] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: value too long for type character varying(100)
2024-08-05 07:10:25.149 ERROR 1569187 --- [http-nio-8021-exec-36] org.avni.server.util.BugsnagReporter     : could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:263)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:225)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:507)
	at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
	at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:135)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
	at com.sun.proxy.$Proxy189.findByUuidAndOrganisationId(Unknown Source)
	at org.avni.server.dao.ConceptRepository.findByUuid(ConceptRepository.java:67)
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
image

Root cause:

  • The name field of the form element group can be upto 255 chars. But whatever we receive in name we store in display field for which max characters is only 100.
  • The difference in values of display and name field is because before when creating forms via JSON files in repos we were supporting this field. But the support of different values for name and display is dropped now in 'App Designer'.

Analysis:

  • Considering presence of 255 characters for form element group name as well will fit in mobile app, since the page is scrollable, having this display field doesn't seem useful or relevant.

With 100 chars in form element group, in mobile app:
Screenshot 2024-08-05 at 2 56 12 PM

As is:

  • name field of FEG used in DEA, display field of FEG used in mobile app. So, looks like it was done to support small screens, but it doesn't seem to have helped.
  • for translations as well we seem to use name field of FEG: Code link . So for translations to work, custom keys with display value is added when needed.
  • In all cases, display value seems to be sufficient to understand the FEG name. Eg: display value: Service Details, FEG name: Mother Delivery Service Details - but here Mother and Delivery can be interpreted from program name and encounter type.

AC:

  1. Wherever the values of display and name of FEG are different, copy the value of display to FEG name field.
  2. FEG name field value should display in the mobile app as well.
  3. Remove the code/columns related to display(mobile app, web app and server).
  4. Retain FEG getters for Display, for backward compatibility support for older versions of app.
  5. So after this, we should be able to have more than 100 chars and less than 256 chars in name field of form element group
  6. Show error message 'Enter a name with less than 256 characters' when the entered name is more than 255 characters in form element and form element group.

Testing: some of the points:

  • Need backward compatibility testing with older app version and need to check if form element group name displays in mobile app.
  • Need to confirm bundle upload works fine after the change with FEG names set correctly, only for same server version used for download of bundle.

Developer Checklist(Developer fixing the bug should fill this checklist)

  • Does the fix require extensive regression testing?
    • Yes
    • No
  • Are you mentioning the required scenarios that could be affected?
    • Yes
    • No
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Jun 17, 2024
@mahalakshme mahalakshme moved this from New Issues to In Analysis Review in Avni Product Aug 5, 2024
@mahalakshme mahalakshme changed the title Error on creating a FEG may be Error on creating a Form element group with a lengthy name Aug 5, 2024
@mahalakshme mahalakshme moved this from In Analysis Review to Analysis Complete in Avni Product Aug 5, 2024
@mahalakshme mahalakshme moved this from Analysis Complete to In Analysis Review in Avni Product Aug 5, 2024
@mahalakshme mahalakshme moved this from Analysis Complete to Ready in Avni Product Aug 20, 2024
@1t5j0y 1t5j0y moved this from Ready to In Progress in Avni Product Aug 20, 2024
@1t5j0y 1t5j0y self-assigned this Aug 20, 2024
@mahalakshme mahalakshme moved this from In Progress to In Analysis in Avni Product Aug 21, 2024
@1t5j0y 1t5j0y removed their assignment Aug 21, 2024
@mahalakshme mahalakshme moved this from In Analysis to Ready in Avni Product Aug 23, 2024
@mahalakshme mahalakshme moved this from Ready to In Analysis Review in Avni Product Aug 23, 2024
@himeshr himeshr self-assigned this Aug 28, 2024
himeshr added a commit to avniproject/avni-models that referenced this issue Aug 28, 2024
himeshr added a commit to avniproject/avni-server that referenced this issue Aug 28, 2024
himeshr added a commit that referenced this issue Aug 28, 2024
himeshr added a commit to avniproject/avni-client that referenced this issue Aug 28, 2024
himeshr added a commit to avniproject/avni-server that referenced this issue Aug 29, 2024
himeshr added a commit to avniproject/rules-server that referenced this issue Aug 29, 2024
himeshr added a commit to avniproject/avni-server that referenced this issue Aug 29, 2024
@himeshr
Copy link
Contributor

himeshr commented Aug 29, 2024

Sample FEG / FE name string length exceeded error screen shot:
Screenshot 2024-08-29 at 2 49 37 PM

@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product Aug 29, 2024
himeshr added a commit to avniproject/avni-client that referenced this issue Aug 29, 2024
@petmongrels petmongrels moved this from In Code Review to QA Ready in Avni Product Aug 30, 2024
@vinayvenu
Copy link
Member

@himeshr any bundle taken before deploying this change will break when uploading. Is it possible to make this deprecated/optional instead?

@himeshr
Copy link
Contributor

himeshr commented Sep 25, 2024

@himeshr any bundle taken before deploying this change will break when uploading. Is it possible to make this deprecated/optional instead?

Replacing the "name" with "display" field contents was one of the primary ACs for this card.. which was achieved via DB migration.
Using an older server version generated bundle is not supported in-order to ensure that above mentioned change is put in effect.
Could you provide a sample bundle which breaks upload on new version.? Since, based on the code, i assumed that the name field of the old bundle would end up being returned by getDisplay() as well and we might lose the "display" field value, but not break the upload.

@vinayvenu
Copy link
Member

vinayvenu commented Sep 25, 2024

sample_failure_scenario.zip

Bundle upload failing for above bundle, marking it as qaFailed due to this error scenario.

@himeshr himeshr moved this from QA Ready to QA Failed in Avni Product Sep 26, 2024
himeshr added a commit to avniproject/avni-server that referenced this issue Oct 1, 2024
…splay field to avid bundle upload failures
himeshr added a commit to avniproject/avni-server that referenced this issue Oct 1, 2024
@himeshr
Copy link
Contributor

himeshr commented Oct 1, 2024

FIxed old version bundle upload to work for:

  • FormElementGroup with display column and
  • GroupPrivilege without privilegeType column

The sample error bundle listed in above comment fails during upload in staging environment due to mismatch in privilegeType UUIDs across staging and prerelease/prod envs, but should work for same env old and new version of bundles.

-- Error privilege types in staging env
select *
from privilege where uuid in
                     ('cac5adae-8d99-4cef-a00b-af7d66e31a09',
'305d8287-731b-4094-8139-71bc171b242e');

@himeshr himeshr moved this from In Progress to QA Ready in Avni Product Oct 1, 2024
@AchalaBelokar AchalaBelokar self-assigned this Oct 17, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

5 participants