[Bug]: `DISABLE_PAYG` and `COUNTER_SYNC` are incorrectly decoded as `SET_TIME` in extended token mode
还没有人认领这个 Issue。
评估
调研方向
首先使用提供的 Python 代码片段,在扩展 token 模式下通过 OpenPAYGOTokenEncoder 和 OpenPAYGOTokenDecoder 重现该问题。将 DISABLE_PAYG 和 COUNTER_SYNC 的解码 token 类型与预期类型进行比较;当两个 token 都被解码为其编码时所使用的类型时即完成。
由索引模型根据 Issue 内容生成。
描述
Preflight Checklist
- I have read the Contributing Guidelines for this project, if it exists.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Expected Behavior
When using OpenPAYGO in Extended Token mode I would expect DISABLE_PAYG and COUNTER_SYNC to be decoded as such.
Actual Behavior
However, they are decoded as SET_TIME Tokens.
Steps to reproduce
# OpenPAYGO-python
from openpaygo import OpenPAYGOTokenEncoder, TokenType
encoder = OpenPAYGOTokenEncoder()
new_count, final_token = encoder.generate_token(
secret_key="bc41ec9530f6dac86b1a29ab82edc5fb",
count=4,
value=None,
token_type=TokenType.DISABLE_PAYG,
starting_code=516959010,
restricted_digit_set=False,
extended_token=True,
)
print(f"{new_count=}")
print(f"{final_token=}")
new_count=5
final_token='223770960008'
# OpenPAYGO-python
from openpaygo import OpenPAYGOTokenDecoder
decoder = OpenPAYGOTokenDecoder()
value, token_type, count, updated_counts = decoder.decode_token(
secret_key="bc41ec9530f6dac86b1a29ab82edc5fb",
starting_code=516959010,
restricted_digit_set=False,
token="223770960008",
count=4,
)
print(f"{value=}")
print(f"{token_type=}")
print(f"{count=}")
print(f"{updated_counts=}")
value=998.0
token_type=2
count=5
updated_counts=None
Note that token_type=2 is wrong.
What operating system(s) are you using?
macOS
Additional Information
No response
- 主要语言
- Python
- 星标
- 15
- 派生
- 15
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
EnAccess/OpenPAYGO-python 的其他 Issue
-
Provide explicit type hints and pydantic validation for robust usage可能已有人在做 @lupppig 于 216 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
EnAccess/OpenPAYGO-python#34 ·
-
bug
难度 3/5 1-2 天 新手友好度 45/100
EnAccess/OpenPAYGO-python#25 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 45/100
EnAccess/OpenPAYGO-python#22 ·
-
bug
难度 3/5 1-2 天 新手友好度 35/100
EnAccess/OpenPAYGO-python#21 ·
-
Create test cases for all token modes可能已有人在做 @dmohns 于 704 天前认领。 未关闭documentation enhancement good first issue hacktoberfest help wanted
难度 5/5 一周以上 新手友好度 25/100
EnAccess/OpenPAYGO-python#15 ·
查看 EnAccess/OpenPAYGO-python 的全部 Issue
相似的 Issue
-
feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 73/100
githubnext/gh-aw-workshop#4455 ·
维护者通常 1 天内回复
-
Triage 🩺
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_wait未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 77/100
krkn-chaos/krkn#1627 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
NousResearch/hermes-agent#136483 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复