Skip to content

Cross-runtime consistency fixes #288

@sliedig

Description

@sliedig

Summary

A set of fixes to align the TypeScript runtime with the other runtimes (Java, Python, .NET) for functional equivalence and cross-runtime consistency.


Contracts Service

DynamoDB attribute name (contractEventHandler.ts)

  • updateContract: changed UpdateExpression from 'set contract_status = :t, modified_date = :m' to 'set contract_status = :t, contract_last_modified_on = :m'
  • This corrects a bug where updateContract wrote to a non-existent modified_date attribute instead of the correct contract_last_modified_on attribute written by createContract

Web Service

Event source from environment variable (requestApprovalFunction.ts)

  • Replaced hardcoded 'unicorn-web' source in the firePropertyEvent call with process.env.SERVICE_NAMESPACE ?? 'unicorn-web'
  • Ensures the EventBridge event Source field reflects the SERVICE_NAMESPACE environment variable, consistent with other runtimes

Metric name correction (publicationEvaluationEventHandler.ts)

  • Changed metrics.addMetric('ContractUpdated', ...) to metrics.addMetric('PropertiesApproved', ...)
  • ContractUpdated was incorrect for this handler (which tracks property publication evaluation, not contract updates)

Evaluation result validation (publicationEvaluationEventHandler.ts)

  • Added guard to only process events where evaluationResult is 'APPROVED' or 'DECLINED'
  • Logs a warning and returns without writing to DynamoDB for any other value

Structured logging in propertySearchFunction.ts

  • Replaced all console.log(...) calls in the propertyDetails method with logger.info(...)
  • Ensures all log output goes through the Powertools structured logger rather than raw console.log

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions