Skip to content

fix(import): TAMOC-400: Use model field metadata for numeric change detection in importer#9264

Open
dannash100 wants to merge 3 commits intomainfrom
fix/tamoc-400-invoice-items-update
Open

fix(import): TAMOC-400: Use model field metadata for numeric change detection in importer#9264
dannash100 wants to merge 3 commits intomainfrom
fix/tamoc-400-invoice-items-update

Conversation

@dannash100
Copy link
Copy Markdown
Contributor

@dannash100 dannash100 commented Mar 3, 2026

Changes

FSM go live finding, I will hotfix to 2.49+

DECIMAL columns (like coverageValue and price) are returned as strings by PostgreSQL/Sequelize, causing checkForChanges to miss updates when comparing against number values from the import. Refactored to use rawAttributes field type metadata instead of runtime typeof checks, so all numeric column types (INTEGER, BIGINT, FLOAT, REAL, DOUBLE, DECIMAL) are consistently compared as numbers regardless of their JavaScript representation.

Deploys

  • Deploy to Tamanu Internal

Tests

  • Run E2E Tests

Review Hero

  • Run Review Hero
  • Auto-fix review suggestions Wait for Review Hero to finish, resolve any comments you disagree with or want to fix manually, then check this to auto-fix the rest.
  • Auto-fix CI failures Check this to auto-fix lint errors, test failures, and other CI issues.

Remember to...

  • ...write or update tests
  • ...add UI screenshots and testing notes to the Linear issue
  • ...add any manual upgrade steps to the Linear issue
  • ...update the config reference, settings reference, or any relevant runbook(s)
  • ...call out additions or changes to config files for the deployment team to take note of

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue in the import functionality where decimal column values were not being compared correctly, leading to potential inaccuracies when updating existing records. The changes introduce specific handling for decimal types to ensure that numeric comparisons are performed accurately, preventing unintended skips or updates. New tests have been added to validate this corrected behavior.

Highlights

  • Decimal Column Comparison Fix: Implemented a fix in the import process to correctly compare decimal column values, addressing an issue where updates to decimal fields might not have been accurately detected.
  • Enhanced Decimal Import Testing: Added new unit tests to ensure that the importer correctly identifies updated decimal values and skips records where decimal values remain unchanged during re-import operations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/central-server/tests/importers/invoicePriceListLoader.test.js
    • Added two new test cases to verify the correct detection of updated decimal values and the skipping of unchanged decimal values during re-import.
  • packages/central-server/app/admin/importer/importRows.js
    • Modified the checkForChanges function to include a specific comparison logic for decimal columns, converting existing string-based decimal values to numbers for accurate comparison with imported numeric values.
Activity
  • Planned deployment to Tamanu Internal.
  • Planned E2E test run.
  • Planned Review Hero run.
  • Planned auto-fix of review suggestions.
  • Planned auto-fix of CI failures.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dannash100 dannash100 changed the title fix(import): TAMOC-400: Fix comparison of decimal columns when updating via import fix(import): TAMOC-400: Detect decimal value changes in invoice item import summary Mar 3, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix an issue with comparing decimal values during data import. It introduces a specific check for when a database value (as a string) is compared against an imported numeric value. The PR also adds tests to verify that updates and skips on re-import work as expected for decimal values.

My review found a critical issue in the implementation of the comparison logic that could lead to missed updates in certain scenarios. I've provided a detailed comment with a suggested fix. The new tests are good but do not cover the edge case where the bug occurs.

Comment thread packages/central-server/app/admin/importer/importRows.js Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread packages/central-server/app/admin/importer/importRows.js
Comment thread packages/central-server/app/admin/importer/importRows.js
@review-hero
Copy link
Copy Markdown

review-hero Bot commented Mar 3, 2026

🦸 Review Hero Summary
5 agents reviewed this PR | 0 critical | 2 suggestions | 0 nitpicks

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

Android builds 📱

@dannash100 dannash100 changed the title fix(import): TAMOC-400: Detect decimal value changes in invoice item import summary fix(import): TAMOC-400: Use model field metadata for numeric change detection in importer Mar 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

🍹 up on tamanu-on-k8s/bes/tamanu-on-k8s/fix-tamoc-400-invoice-items-update

Pulumi report
   Updating (fix-tamoc-400-invoice-items-update)

View Live: https://app.pulumi.com/bes/tamanu-on-k8s/fix-tamoc-400-invoice-items-update/updates/6

Downloading plugin random-4.19.0: starting
Downloading plugin random-4.19.0: done
Installing plugin random-4.19.0: starting
Installing plugin random-4.19.0: done

@ Updating....
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running 
@ Updating....
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read kubernetes:core/v1:Namespace tamanu-fix-tamoc-400-invoice-items-update
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read pulumi:pulumi:StackReference bes/k8s-core/tamanu-internal-main
@ Updating....
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read pulumi:pulumi:StackReference bes/k8s-core/tamanu-internal-main
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Using tailscale proxy https://k8s-operator-tamanu-internal-main.tail53aef.ts.net
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read pulumi:pulumi:StackReference bes/core/tamanu-internal
@ Updating....
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read pulumi:pulumi:StackReference bes/core/tamanu-internal
@ Updating....
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read kubernetes:core/v1:Namespace tamanu-fix-tamoc-400-invoice-items-update
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Waiting for central-db...
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Waiting for facility-1-db...
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Waiting for facility-2-db...
~  kubernetes:apps/v1:Deployment facility-1-web updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment central-web updating (0s) [diff: ~spec]
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read kubernetes:core/v1:ConfigMap actual-provisioning
~  kubernetes:apps/v1:Deployment facility-2-web updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment patient-portal-web updating (0s) [diff: ~spec]
@ Updating....
++ kubernetes:batch/v1:Job central-migrator creating replacement (0s) [diff: ~spec]
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running read kubernetes:core/v1:ConfigMap actual-provisioning
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Secret facility-1-db-superuser not found or not ready: Error: HTTP-Code: 404
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Message: Unknown API Status Code!
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"secrets \\\"facility-1-db-superuser\\\" not found\",\"reason\":\"NotFound\",\"details\":{\"name\":\"facility-1-db-superuser\",\"kind\":\"secrets\"},\"code\":404}
"
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Headers: {"audit-id":"3e52ba8b-3985-4b76-bec4-b25096db09ad","cache-control":"no-cache, private","connection":"close","content-length":"220","content-type":"application/json","date":"Sun, 15 Mar 2026 20:16:30 GMT","x-kubernetes-pf-flowschema-uid":"3fb296fc-e46b-45d1-9306-057e37ddd229","x-kubernetes-pf-prioritylevel-uid":"feccf24d-a074-4fa8-aa6f-db82477fc2f5"}
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Secret facility-2-db-superuser not found or not ready: Error: HTTP-Code: 404
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Message: Unknown API Status Code!
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"secrets \\\"facility-2-db-superuser\\\" not found\",\"reason\":\"NotFound\",\"details\":{\"name\":\"facility-2-db-superuser\",\"kind\":\"secrets\"},\"code\":404}
"
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Headers: {"audit-id":"dbd88060-d8c5-4c38-b048-3658e144c479","cache-control":"no-cache, private","connection":"close","content-length":"220","content-type":"application/json","date":"Sun, 15 Mar 2026 20:16:30 GMT","x-kubernetes-pf-flowschema-uid":"3fb296fc-e46b-45d1-9306-057e37ddd229","x-kubernetes-pf-prioritylevel-uid":"feccf24d-a074-4fa8-aa6f-db82477fc2f5"}
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Secret central-db-superuser not found or not ready: Error: HTTP-Code: 404
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Message: Unknown API Status Code!
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"secrets \\\"central-db-superuser\\\" not found\",\"reason\":\"NotFound\",\"details\":{\"name\":\"central-db-superuser\",\"kind\":\"secrets\"},\"code\":404}
"
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update running Headers: {"audit-id":"82fe1e24-cd42-49c5-be1d-df89d06392e7","cache-control":"no-cache, private","connection":"close","content-length":"214","content-type":"application/json","date":"Sun, 15 Mar 2026 20:16:30 GMT","x-kubernetes-pf-flowschema-uid":"3fb296fc-e46b-45d1-9306-057e37ddd229","x-kubernetes-pf-prioritylevel-uid":"feccf24d-a074-4fa8-aa6f-db82477fc2f5"}
++ kubernetes:batch/v1:Job central-migrator creating replacement (0s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (0s) [diff: ~spec]
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (0s) [diff: ~spec]
@ Updating....
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (0s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (0s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (0s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-2-migrator-4a47b00b" to start
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (0s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-2-migrator-4a47b00b" to succeed (Active: 1 | Succeeded: 0 | Failed: 0)
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (0s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-1-migrator-33df51b6" to start
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (0s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-1-migrator-33df51b6" to succeed (Active: 1 | Succeeded: 0 | Failed: 0)
++ kubernetes:batch/v1:Job central-migrator creating replacement (1s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-migrator-163dd5e7" to start
++ kubernetes:batch/v1:Job central-migrator creating replacement (1s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-migrator-163dd5e7" to succeed (Active: 1 | Succeeded: 0 | Failed: 0)
@ Updating....
~  kubernetes:apps/v1:Deployment facility-1-web updating (2s) [diff: ~spec]; Waiting for app ReplicaSet to be available (0/1 Pods available)
~  kubernetes:apps/v1:Deployment patient-portal-web updating (2s) [diff: ~spec]; Waiting for app ReplicaSet to be available (0/1 Pods available)
~  kubernetes:apps/v1:Deployment central-web updating (2s) [diff: ~spec]; Waiting for app ReplicaSet to be available (0/1 Pods available)
~  kubernetes:apps/v1:Deployment facility-2-web updating (2s) [diff: ~spec]; Waiting for app ReplicaSet to be available (0/1 Pods available)
@ Updating.............
~  kubernetes:apps/v1:Deployment patient-portal-web updating (12s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/patient-portal-web-98454be6-79f8c7485d-b4rjs]: containers with unready status: [http]
~  kubernetes:apps/v1:Deployment central-web updating (12s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/central-web-abf3c9bf-dc64d766f-556s7]: containers with unready status: [http]
@ Updating....
~  kubernetes:apps/v1:Deployment patient-portal-web updating (13s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment patient-portal-web updating (13s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment patient-portal-web updated (13s) [diff: ~spec]; 
@ Updating.....
~  kubernetes:apps/v1:Deployment facility-2-web updating (15s) [diff: ~spec]; Waiting for app ReplicaSet to be available (1/2 Pods available)
@ Updating....
~  kubernetes:apps/v1:Deployment central-web updating (16s) [diff: ~spec]; Waiting for app ReplicaSet to be available (1/2 Pods available)
@ Updating.........
~  kubernetes:apps/v1:Deployment facility-1-web updating (22s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/facility-1-web-56f802d3-7b685ff599-r79t5]: containers with unready status: [http]
~  kubernetes:apps/v1:Deployment central-web updating (22s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/central-web-abf3c9bf-dc64d766f-bf2vq]: containers with unready status: [http]
~  kubernetes:apps/v1:Deployment facility-2-web updating (22s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/facility-2-web-dc3c1e77-d59f97d5d-7s54d]: containers with unready status: [http]
@ Updating.....
~  kubernetes:apps/v1:Deployment facility-1-web updating (24s) [diff: ~spec]; Waiting for app ReplicaSet to be available (1/2 Pods available)
@ Updating.....
~  kubernetes:apps/v1:Deployment facility-2-web updating (26s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-2-web updating (26s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-web updating (26s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment central-web updating (26s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-web updated (26s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-web updated (26s) [diff: ~spec]; 
@ Updating.........
~  kubernetes:apps/v1:Deployment facility-1-web updating (32s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/facility-1-web-56f802d3-7b685ff599-9kgmc]: containers with unready status: [http]
@ Updating....
~  kubernetes:apps/v1:Deployment facility-1-web updating (33s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-1-web updating (33s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-web updated (33s) [diff: ~spec]; 
@ Updating.........
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (38s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/facility-1-migrator-33df51b6-scvb4]: Container "migrator" completed with exit code 0
@ Updating....
++ kubernetes:batch/v1:Job central-migrator creating replacement (39s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/central-migrator-163dd5e7-8fh49]: Container "migrator" completed with exit code 0
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (39s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/facility-2-migrator-4a47b00b-qznbr]: Container "migrator" completed with exit code 0
@ Updating....
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (41s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-1-migrator-33df51b6" to succeed (Active: 0 | Succeeded: 0 | Failed: 0)
@ Updating....
++ kubernetes:batch/v1:Job central-migrator creating replacement (41s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-migrator-163dd5e7" to succeed (Active: 0 | Succeeded: 0 | Failed: 0)
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (41s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-2-migrator-4a47b00b" to succeed (Active: 0 | Succeeded: 0 | Failed: 0)
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (41s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-1-migrator-33df51b6" to succeed (Active: 0 | Succeeded: 1 | Failed: 0)
++ kubernetes:batch/v1:Job facility-1-migrator creating replacement (41s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job facility-1-migrator created replacement (41s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job facility-1-migrator replacing (0s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job facility-1-migrator replaced (0.00s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-sync updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment facility-1-tasks updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment facility-1-api updating (0s) [diff: ~spec]
++ kubernetes:batch/v1:Job central-migrator creating replacement (42s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-migrator-163dd5e7" to succeed (Active: 0 | Succeeded: 1 | Failed: 0)
++ kubernetes:batch/v1:Job central-migrator creating replacement (42s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (41s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/facility-2-migrator-4a47b00b" to succeed (Active: 0 | Succeeded: 1 | Failed: 0)
++ kubernetes:batch/v1:Job facility-2-migrator creating replacement (41s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job facility-2-migrator created replacement (41s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job central-migrator created replacement (42s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job facility-2-migrator replacing (0s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job central-migrator replacing (0s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job central-migrator replaced (0.00s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job facility-2-migrator replaced (0.00s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-tasks updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment facility-2-api updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment facility-2-sync updating (0s) [diff: ~spec]
++ kubernetes:batch/v1:Job central-provisioner creating replacement (0s) [diff: ~spec]
++ kubernetes:batch/v1:Job central-provisioner creating replacement (0s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job central-provisioner creating replacement (0s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-provisioner-e13df79b" to start
@ Updating....
++ kubernetes:batch/v1:Job central-provisioner creating replacement (0s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-provisioner-e13df79b" to succeed (Active: 1 | Succeeded: 0 | Failed: 0)
~  kubernetes:apps/v1:Deployment facility-1-api updating (1s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-1-api updating (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-api updated (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-tasks updating (1s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-1-tasks updating (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-tasks updated (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-tasks updating (0s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-2-tasks updating (0s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-tasks updated (0.98s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-sync updating (1s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-1-sync updating (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-1-sync updated (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-sync updating (1s) [diff: ~spec]; warning: Replicas scaled to 0 for Deployment "facility-2-sync"
~  kubernetes:apps/v1:Deployment facility-2-sync updating (1s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-2-api updating (1s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment facility-2-api updating (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-sync updating (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-api updated (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment facility-2-sync updated (1s) [diff: ~spec]; 
@ Updating.........
++ kubernetes:batch/v1:Job central-provisioner creating replacement (6s) [diff: ~spec]; warning: [Pod tamanu-fix-tamoc-400-invoice-items-update/central-provisioner-e13df79b-pdq6l]: Container "provisioner" completed with exit code 0
@ Updating....
++ kubernetes:batch/v1:Job central-provisioner creating replacement (8s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-provisioner-e13df79b" to succeed (Active: 0 | Succeeded: 0 | Failed: 0)
@ Updating....
++ kubernetes:batch/v1:Job central-provisioner creating replacement (8s) [diff: ~spec]; Waiting for Job "tamanu-fix-tamoc-400-invoice-items-update/central-provisioner-e13df79b" to succeed (Active: 0 | Succeeded: 1 | Failed: 0)
++ kubernetes:batch/v1:Job central-provisioner creating replacement (8s) [diff: ~spec]; 
++ kubernetes:batch/v1:Job central-provisioner created replacement (8s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job central-provisioner replacing (0s) [diff: ~spec]; 
+- kubernetes:batch/v1:Job central-provisioner replaced (0.00s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-fhir-resolver updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment central-api updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment central-fhir-refresh updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment central-tasks updating (0s) [diff: ~spec]
~  kubernetes:apps/v1:Deployment central-api updating (0s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment central-api updating (0s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-api updated (0.67s) [diff: ~spec]; 
@ Updating....
~  kubernetes:apps/v1:Deployment central-fhir-refresh updating (0s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment central-fhir-refresh updating (0s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-fhir-refresh updated (0.80s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-fhir-resolver updating (0s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment central-fhir-resolver updating (0s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-fhir-resolver updated (0.96s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-tasks updating (1s) [diff: ~spec]; warning: Replicas scaled to 0 for Deployment "central-tasks-e2555e1e"
~  kubernetes:apps/v1:Deployment central-tasks updating (1s) [diff: ~spec]; Deployment initialization complete
~  kubernetes:apps/v1:Deployment central-tasks updating (1s) [diff: ~spec]; 
~  kubernetes:apps/v1:Deployment central-tasks updated (1s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job central-provisioner deleting original (0s) [diff: ~spec]; 
@ Updating....
-- kubernetes:batch/v1:Job central-provisioner deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job central-provisioner deleted original (0.40s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job central-migrator deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job facility-2-migrator deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job facility-1-migrator deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job facility-2-migrator deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job facility-2-migrator deleted original (0.48s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job facility-1-migrator deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job facility-1-migrator deleted original (0.64s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job central-migrator deleting original (0s) [diff: ~spec]; 
-- kubernetes:batch/v1:Job central-migrator deleted original (0.77s) [diff: ~spec]; 
@ Updating....
   pulumi:pulumi:Stack tamanu-on-k8s-fix-tamoc-400-invoice-items-update  16 messages
Diagnostics:
 pulumi:pulumi:Stack (tamanu-on-k8s-fix-tamoc-400-invoice-items-update):
   Waiting for central-db...
   Waiting for facility-1-db...
   Waiting for facility-2-db...

   Using tailscale proxy https://k8s-operator-tamanu-internal-main.tail53aef.ts.net

   Secret facility-1-db-superuser not found or not ready: Error: HTTP-Code: 404
   Message: Unknown API Status Code!
   Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"secrets \\\"facility-1-db-superuser\\\" not found\",\"reason\":\"NotFound\",\"details\":{\"name\":\"facility-1-db-superuser\",\"kind\":\"secrets\"},\"code\":404}
"
   Headers: {"audit-id":"3e52ba8b-3985-4b76-bec4-b25096db09ad","cache-control":"no-cache, private","connection":"close","content-length":"220","content-type":"application/json","date":"Sun, 15 Mar 2026 20:16:30 GMT","x-kubernetes-pf-flowschema-uid":"3fb296fc-e46b-45d1-9306-057e37ddd229","x-kubernetes-pf-prioritylevel-uid":"feccf24d-a074-4fa8-aa6f-db82477fc2f5"}
   Secret facility-2-db-superuser not found or not ready: Error: HTTP-Code: 404
   Message: Unknown API Status Code!
   Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"secrets \\\"facility-2-db-superuser\\\" not found\",\"reason\":\"NotFound\",\"details\":{\"name\":\"facility-2-db-superuser\",\"kind\":\"secrets\"},\"code\":404}
"
   Headers: {"audit-id":"dbd88060-d8c5-4c38-b048-3658e144c479","cache-control":"no-cache, private","connection":"close","content-length":"220","content-type":"application/json","date":"Sun, 15 Mar 2026 20:16:30 GMT","x-kubernetes-pf-flowschema-uid":"3fb296fc-e46b-45d1-9306-057e37ddd229","x-kubernetes-pf-prioritylevel-uid":"feccf24d-a074-4fa8-aa6f-db82477fc2f5"}
   Secret central-db-superuser not found or not ready: Error: HTTP-Code: 404
   Message: Unknown API Status Code!
   Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"secrets \\\"central-db-superuser\\\" not found\",\"reason\":\"NotFound\",\"details\":{\"name\":\"central-db-superuser\",\"kind\":\"secrets\"},\"code\":404}
"
   Headers: {"audit-id":"82fe1e24-cd42-49c5-be1d-df89d06392e7","cache-control":"no-cache, private","connection":"close","content-length":"214","content-type":"application/json","date":"Sun, 15 Mar 2026 20:16:30 GMT","x-kubernetes-pf-flowschema-uid":"3fb296fc-e46b-45d1-9306-057e37ddd229","x-kubernetes-pf-prioritylevel-uid":"feccf24d-a074-4fa8-aa6f-db82477fc2f5"}

   [Pulumi Neo] Would you like help with these diagnostics?
   https://app.pulumi.com/bes/tamanu-on-k8s/fix-tamoc-400-invoice-items-update/updates/6?explainFailure

Outputs:
   urls: {
       Central      : "https://central.fix-tamoc-400-invoice-items-update.cd.tamanu.app"
       Facility- 1  : "https://facility-1.fix-tamoc-400-invoice-items-update.cd.tamanu.app"
       Facility- 2  : "https://facility-2.fix-tamoc-400-invoice-items-update.cd.tamanu.app"
       PatientPortal: "https://portal.fix-tamoc-400-invoice-items-update.cd.tamanu.app"
   }

Resources:
   ~ 14 updated
   +-4 replaced
   18 changes. 49 unchanged

Duration: 1m0s

   

Copy link
Copy Markdown
Contributor

@chris-bes chris-bes left a comment

Choose a reason for hiding this comment

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

LGTM! Sorry about 1 tiny suggestion, but I think it's going to make it a lot more robust

SurveyScreenComponent: ['componentIndex'],
};

const NUMERIC_FIELD_TYPES = new Set(['INTEGER', 'BIGINT', 'FLOAT', 'REAL', 'DOUBLE', 'DECIMAL']);
Copy link
Copy Markdown
Contributor

@chris-bes chris-bes Mar 3, 2026

Choose a reason for hiding this comment

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

Hmm I believe this is not a full list, we do have more such as 'TINYINT', 'SMALLINT', 'MEDIUMINT'

I think instead of hardcoding the numeric field types like this, there is a more robust way to check if it's a number by checking if it is an instance of DataTypes.NUMBER, as all the numeric types inherit from the top parent class NUMBER

import { DataTypes } from 'sequelize';

// Check if a model attribute's type is numeric
  return attrType instanceof DataTypes.NUMBER;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh thats a very good call 🙏

@dannash100 dannash100 requested a review from chris-bes March 4, 2026 00:03
Copy link
Copy Markdown
Contributor

@chris-bes chris-bes left a comment

Choose a reason for hiding this comment

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

lgtm!

Use instanceof DataTypes.NUMBER instead of typeof to identify numeric
fields, so DECIMAL values (returned as strings by Sequelize) are
correctly compared during import change detection.

Made-with: Cursor
@dannash100 dannash100 force-pushed the fix/tamoc-400-invoice-items-update branch from 179277a to 287a895 Compare March 4, 2026 00:28
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.

2 participants