fix: cross-runtime consistency fixes#289
Merged
adrianjhunter merged 4 commits intodevelopfrom Mar 17, 2026
Merged
Conversation
…ion timestamp - Change UpdateExpression attribute from `modified_date` to `contract_last_modified_on` - Aligns attribute naming with database schema and improves consistency - Ensures contract modification tracking uses correct DynamoDB column name
…hod signature - Remove hardcoded 'unicorn-web' source parameter from firePropertyEvent call - Update firePropertyEvent method to accept only eventDetail parameter - Replace source parameter with SERVICE_NAMESPACE environment variable for dynamic source resolution
…on result validation - Change metric name from 'ContractUpdated' to 'PropertiesApproved' for accurate tracking - Add validation for evaluationResult to only accept 'APPROVED' or 'DECLINED' values - Log warning and skip DynamoDB update when unknown evaluation result is encountered
…red logging - Replace console.log calls with logger.info in propertySearchFunction - Update debug logging for country, city, street, and number parameters - Update projection properties debug logging - Ensures consistent structured logging throughout the search service
ce6d929 to
4a5c717
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: #288
Summary
Changes
Fixes to align the TypeScript runtime with Java, Python, and .NET for functional equivalence and cross-runtime consistency.
Contracts Service (
unicorn_contracts)contractEventHandler.ts—updateContract: changedUpdateExpressionfrom'set contract_status = :t, modified_date = :m'to'set contract_status = :t, contract_last_modified_on = :m'— fixes a bug where updates wrote to a non-existentmodified_dateattributeWeb Service (
unicorn_web)requestApprovalFunction.ts: replaced hardcoded'unicorn-web'EventBridge source withprocess.env.SERVICE_NAMESPACE ?? 'unicorn-web'publicationEvaluationEventHandler.ts: changedmetrics.addMetric('ContractUpdated', ...)tometrics.addMetric('PropertiesApproved', ...)—ContractUpdatedwas incorrect for this handlerpublicationEvaluationEventHandler.ts: added validation guard — only processes'APPROVED'or'DECLINED'evaluation results; logs a warning and returns for any other valuepropertySearchFunction.ts: replaced allconsole.log(...)calls in thepropertyDetailsmethod withlogger.info(...)to route all output through the Powertools structured loggerUser experience
Before:
updateContractsilently wrote amodified_dateattribute that was never read, leavingcontract_last_modified_onunchanged on update. The publication evaluation handler emitted aContractUpdatedmetric (wrong handler) and processed all evaluation result values without validation. Property search logs bypassed the structured logger.After:
updateContractcorrectly updatescontract_last_modified_onconsistent with all other runtimes. The publication evaluation handler emitsPropertiesApprovedand validates result values before writing to DynamoDB. All log output inpropertyDetailsis structured JSON via the Powertools logger.Checklist
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.