Skip to content

fix: cross-runtime consistency fixes#289

Merged
adrianjhunter merged 4 commits intodevelopfrom
cross-runtime-fixes
Mar 17, 2026
Merged

fix: cross-runtime consistency fixes#289
adrianjhunter merged 4 commits intodevelopfrom
cross-runtime-fixes

Conversation

@sliedig
Copy link
Contributor

@sliedig sliedig commented Mar 16, 2026

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.tsupdateContract: changed UpdateExpression from '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-existent modified_date attribute

Web Service (unicorn_web)

  • requestApprovalFunction.ts: replaced hardcoded 'unicorn-web' EventBridge source with process.env.SERVICE_NAMESPACE ?? 'unicorn-web'
  • publicationEvaluationEventHandler.ts: changed metrics.addMetric('ContractUpdated', ...) to metrics.addMetric('PropertiesApproved', ...)ContractUpdated was incorrect for this handler
  • publicationEvaluationEventHandler.ts: added validation guard — only processes 'APPROVED' or 'DECLINED' evaluation results; logs a warning and returns for any other value
  • propertySearchFunction.ts: replaced all console.log(...) calls in the propertyDetails method with logger.info(...) to route all output through the Powertools structured logger

User experience

Before: updateContract silently wrote a modified_date attribute that was never read, leaving contract_last_modified_on unchanged on update. The publication evaluation handler emitted a ContractUpdated metric (wrong handler) and processed all evaluation result values without validation. Property search logs bypassed the structured logger.

After: updateContract correctly updates contract_last_modified_on consistent with all other runtimes. The publication evaluation handler emits PropertiesApproved and validates result values before writing to DynamoDB. All log output in propertyDetails is 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.

@sliedig sliedig requested a review from a team as a code owner March 16, 2026 02:03
@github-actions github-actions bot added the bug Something isn't working label Mar 16, 2026
sliedig added 4 commits March 17, 2026 16:16
…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
Copy link
Contributor

@adrianjhunter adrianjhunter left a comment

Choose a reason for hiding this comment

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

lgtm

@adrianjhunter adrianjhunter merged commit 90e295d into develop Mar 17, 2026
2 checks passed
@adrianjhunter adrianjhunter deleted the cross-runtime-fixes branch March 17, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants