Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Cross-runtime consistency fixes

未关闭
#178 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
aws, python
领域
backend, cloud

调研方向

将 contract_event_handler.py、contract_status_changed_event_handler.py 和 publication_evaluation_event_handler.py 与 Java、TypeScript 和 .NET runtime 进行比较。先检查所列出的时间戳、DynamoDB、环境变量、验证和指标行为,然后在可用时运行相关的服务测试。当 Python 处理程序符合所述的跨 runtime 合约,且没有非预期写入或重复指标时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

pending-release

Summary

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


Contracts Service

Timestamp format (contract_event_handler.py)
  • create_contract: replaced datetime.now().strftime("%d/%m/%Y %H:%M:%S") with datetime.now(timezone.utc).isoformat() for both contract_created and contract_last_modified_on
  • update_contract: replaced datetime.now().strftime(...) with datetime.now(timezone.utc).isoformat()
  • Format change: custom DD/MM/YYYY HH:MM:SS → ISO 8601 YYYY-MM-DDTHH:MM:SS.ffffff+00:00
  • Uses the non-deprecated timezone-aware API (timezone.utc) instead of datetime.utcnow()
DynamoDB attribute name (contract_event_handler.py)
  • update_contract: 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 update_contract wrote to a non-existent modified_date attribute instead of the correct contract_last_modified_on attribute used in create_contract
Observability metrics (contract_event_handler.py)
  • Added metrics.add_metric(name="ContractCreated", unit=MetricUnit.Count, value=1) to create_contract success path

Approvals Service

Per-invocation timestamp (contract_status_changed_event_handler.py)
  • Removed module-level now = datetime.now() and current_date variable assignments
  • Moved timestamp computation inside the handler function body to ensure each invocation captures its own execution time rather than the container initialisation time
Environment variable error type (contract_status_changed_event_handler.py)
  • Replaced raise InternalServerError(...) with raise EnvironmentError(...) for both SERVICE_NAMESPACE and CONTRACT_STATUS_TABLE missing variable checks
  • Removed the now-unused InternalServerError import from aws_lambda_powertools.event_handler.exceptions

Web Service

Evaluation result validation (publication_evaluation_event_handler.py)
  • Added validation guard: only updates DynamoDB when evaluation_result is "APPROVED" or "DECLINED" (case-insensitive)
  • Logs a warning and returns without writing to DynamoDB for any other value
Metric name correction (publication_evaluation_event_handler.py)
  • Removed duplicate metrics.add_metric(name="PropertiesAdded", ...) call
  • Retained metrics.add_metric(name="PropertiesApproved", ...) as the single metric for this path
主要语言
Python
星标
47
派生
20
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws-samples/aws-serverless-developer-experience-workshop-python 的其他 Issue

查看 aws-samples/aws-serverless-developer-experience-workshop-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。