Skip to content

feat: keyboard magnitude axes, JSON-root config parsing and project setup guide - #14

Open
carlvon17 wants to merge 3 commits into
mainfrom
dev
Open

carlvon17 wants to merge 3 commits into
mainfrom
dev

Conversation

@carlvon17

Copy link
Copy Markdown
Contributor

What's shipping (main..dev, 3 commits)

  • 9dd9b09 feat: keyboard magnitude axes and waypoint constant-axis support
  • 2a3986d feat: restricted YAML parser accepts JSON-root documents (synced mirror with BotLab)
  • eecead7 docs: project setup guide (docs/project-setup.md), README scaffold refresh, wheel doc manifest

Notes

  • SDK mirror (src/botlab/sdk/) is byte-identical with BotLab truth source src/domain/python/botlab/ — only _runtime differs (native runner owned by this repo, never mirrored). No pending sync from BotLab dev.
  • README now documents the config/ file-split layout, PolicyController(robot, target=) signature, and legacy root-level *.preset.yaml read-compatibility.
  • refactor: untangle modules, split runtime god-files, mirror explicit plan contract #4 (refactor/elegance) intentionally left open and independent; it will need a rebase onto the new main after this merges.

Testing

  • ruff check . — All checks passed (exit 0)
  • .venv/bin/python -m pytest tests -x -q --ignore=tests/e2e — exit 0 (one pre-existing overflow RuntimeWarning in test_processors_math)
  • tests/e2e not run locally (needs browser runtime); CI covers it
  • Wheel docs requirement (hatch_build._REQUIRED_DOCS) satisfied — all five docs including project-setup.md are committed

carlvon17 and others added 3 commits November 9, 2026 11:34
- _runtime/_observations: mirror the browser keyboardCommands.ts
  magnitude-axis semantics in the local runner (magnitude axes rest at
  zero, keys command +/- the parameter value clamped to the axis range;
  cruise axes keep the explicit neutral-input guard)
- sdk/_robot (synced mirror): commands waypoint now combines with
  constant axes (tracker pins them via cmdMin/cmdMax), docs updated

Co-Authored-By: Claude Code <noreply@anthropic.com>
…d mirror)

pyodide file-rule handlers write config/*.yaml with json.dumps (no PyYAML
there); the TS end reads those as YAML 1.2, so the local parser must accept
a flow-mapping root as well.

Co-Authored-By: Claude Code <noreply@anthropic.com>
- new docs/project-setup.md: step-by-step CLI-side project scaffold
  (skeleton, assets, presets, declarations, three-section controller)
- README: config/ file-split layout, PolicyController(robot, target=)
  signature, setup guide links
- hatch_build: require project-setup.md in wheel docs

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 03:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@enkeebotpr enkeebotpr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

代码审核

发现 3 个需要核查的问题,按影响从重到轻列出。

1. 【中风险】负轴索引被静默当作负索引,绑定到错误轴

位置:src/botlab/_runtime/_observations.py:1662–1671

  • 触发:commandBindings 写出负数或浮点轴,例如 -1 或 1.7;_magnitude_binding_index 只校验 index &gt;= dim,随后用 int(key) 直接截断/保留符号。
  • 影响:-1 通过校验后被当作 Python 负索引命中最后一维,1.7 静默变成 1,幅值轴被错误绑定,配置错误没有在编译期报错。
  • **建议:**对数值 key 同时校验 0 &lt;= index &lt; dim 且要求整数(或显式拒绝 float/负数),并补一个负索引与浮点 key 的失败用例。

2. 【中风险】缺 cmdMin/cmdMax 时按幅值键会直接抛异常

位置:src/botlab/_runtime/_observations.py:1689–1707

  • **触发:**项目声明了 magnitude 幅值轴但 plan 未带 cmdMin/cmdMax(或长度不足),_magnitude_axis_flags 只校验 dim,_apply_magnitude_axes 里 minimum[index] 取到 None。
  • **影响:**一旦按下 increase/decrease 键,运行期抛 TypeError/IndexError,而不是给出可读的声明错误;未按键时不复现,问题延后暴露。
  • **建议:**在读取 flags 时一并校验 cmdMin/cmdMax 为等长数值序列并报带节点名的错误;需人工确认 plan 是否在所有幅值轴场景都输出该 bounds 向量。

3. 【低风险】同时含幅值轴与巡航轴时,巡航按键被静默忽略

位置:src/botlab/_runtime/_observations.py:1733–1741

  • **触发:**项目既有 magnitude 轴又有普通巡航轴,然后按下巡航轴按键;只要 any(flags) 成立就跳过中性输入护栏。
  • **影响:**本应因“巡航轴按键推进无本地实现”而显式失败的场景改为静默不生效,用户看到按键无效且无提示。
  • **建议:**把护栏拆成只针对未实现推进的巡航轴检查,例如对非幅值且被绑定的轴按键时报错,而不是整体跳过。

仅检查代码安全和技术缺陷;业务判断由负责人负责。本次未运行测试。

审核范围与依据
  • 审核提交:eecead7b05793f729939766d1b7eee65d52751d0
  • 配置版本:v1
  • 团队规则:enkeebot-dev · 2304177fb38a
  • 已加载:SKILL.md、references/projects/botlab-python.md、references/environment.md、references/architecture.md
  • 部分规则仅加载了摘录,未加载的部分未作核对。
  • 根据提供的文本差异审核,未读取完整仓库。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants