test: tighten oversized metadata assertion to check exact id in __ope… · openclaw/openclaw@aff8e64
SebTardif
·
2026-05-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2007,11 +2007,21 @@ describe("oversized transcript line guards", () => {
|
2007 | 2007 | maxMessages: 10, |
2008 | 2008 | }); |
2009 | 2009 | |
| 2010 | +// The oversized line's id and parentId are extracted by regex from the |
| 2011 | +// prefix bytes. parentId drives active-tree selection; id is attached |
| 2012 | +// to the __openclaw metadata. Both must be correct for the record to |
| 2013 | +// appear in the right position. |
| 2014 | +expect(out).toHaveLength(2); // root-msg + oversized-child |
| 2015 | +const oversized = out[1] as Record<string, unknown>; |
| 2016 | +expect(oversized.role).toBe("assistant"); |
| 2017 | +// id is preserved in __openclaw transcript metadata |
| 2018 | +const meta = (oversized as Record<string, Record<string, unknown>>).__openclaw; |
| 2019 | +expect(meta?.id).toBe("oversized-child"); |
| 2020 | +// parentId extraction is proven by the record being included: |
| 2021 | +// if parentId was not extracted, the tree would orphan this node. |
| 2022 | + |
| 2023 | +// The oversized content must NOT appear in the output. |
2010 | 2024 | const serialized = JSON.stringify(out); |
2011 | | -// The oversized line's id and parentId must be extracted correctly |
2012 | | -// from the prefix via regex-based field extraction. |
2013 | | -expect(serialized).toContain("oversized-child"); |
2014 | | -expect(serialized).toContain("root-msg"); |
2015 | 2025 | expect(serialized).not.toContain(oversizedContent); |
2016 | 2026 | }); |
2017 | 2027 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。