Skip to content

refactor(tokens): own the letter-led compact token shape once - #7588

Merged
huangruiteng merged 1 commit into
loopx-project:mainfrom
CTYQAQ:refactor/domain-state-token-owner
Oct 29, 2026
Merged

huangruiteng merged 1 commit into
loopx-project:mainfrom
CTYQAQ:refactor/domain-state-token-owner

Conversation

@CTYQAQ

@CTYQAQ CTYQAQ commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: no written specification; the request in this PR is the basis. The owner rule it follows is stated inside loopx/public_safe_text.py: "Shared identifier shapes stay here with the sibling public-safe text shapes."
  • Goal/source and gap: two contracts compiled the same identifier body ^[A-Za-z][A-Za-z0-9_.:-]{0,79}$ under their own names — loopx/domain_state.py (_DOMAIN_STATE_TOKEN_RE) and loopx/domain_packs/ml_experiment.py (_TOKEN_RE). Both arrived in the same quality change, so any future bound fix had two places to land and no owner to read.
  • Observable before → after, with the validation row that proves it: a body census over loopx/**/*.py finds the shape in 2 modules and 0 owners before, and in 1 owner and 0 consumers after; re-adding a local copy fails test_the_letter_led_token_body_is_compiled_only_by_the_owner_and_declared_sites.
  • Issue/task and intended base: no issue; base main at 53dcb03082985bf894b1fca8813ab9f6e92503c5.

Author Declaration

  • Written by: model_agent (Qoder); operator CTYQAQ

Implemented against

  • Specification and revision: the shared-identifier-shape rule in loopx/public_safe_text.py and the existing census in tests/control_plane/test_compact_identifier_shape_owner.py, both at 53dcb03082985bf894b1fca8813ab9f6e92503c5.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
a shared identifier shape is stated once, in the owner implemented public_safe_text.LETTER_LED_COMPACT_TOKEN_PATTERN body census over loopx/**/*.py
each consumer holds the owner's object implemented domain_state._DOMAIN_STATE_TOKEN_RE, ml_experiment._TOKEN_RE test_domain_state_and_ml_experiment_share_the_letter_led_token_shape
a new local copy fails closed implemented census test mutation row below
  • Self-check before submission: read both call sites and their error text; kept field names, error strings and every accept/reject decision unchanged; ran the affected suites, the two architecture gates and ruff; re-added a local copy to prove the census fails. Not run: browser and TypeScript lanes (no shared code touched).

Scope And Continuation

  • Completed scope and remaining work: complete within this scope.
  • Slice boundary / successor: N/A.

Validation

  • Tested revision: 0c1aef4
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Public-safe evidence / limitation
static passed python -m ruff check on the four changed files
unit passed tests/control_plane/test_compact_identifier_shape_owner.py, tests/test_ml_experiment_volc_packet.py, tests/control_plane/test_public_safe_text_classifier.py — 74 passed together (2 tests added)
regression_parity passed re-adding the local body in ml_experiment.py makes the new census fail (1 failed, 18 passed); the restored tree passes
integration passed tests/architecture/test_top_level_module_budget.py + tests/test_stage2c_dependency_lock.py — 7 passed
  • Coverage and gaps: the shape is exercised through both consumers' validators; no untested path was changed.
  • Rebase note: rebased onto b6db7f7c415b356ac94ebfc643977d381a314eb9 after submission; the branch patch-id is unchanged (e2051219…), and the three affected files plus the two architecture gates were re-run on the rebased tree — 81 passed.

Frontend / Visual Evidence

N/A — no user-visible surface changed.

The domain-state key validator and the ML-experiment public-token validator
compiled the same body `^[A-Za-z][A-Za-z0-9_.:-]{0,79}$` under their own
names since they were split out of one quality change. Both now import
`public_safe_text.LETTER_LED_COMPACT_TOKEN_PATTERN`, the module that already
hosts the sibling compact identifier shapes, and a census guard rejects a new
local copy.

Each consumer keeps its own field names and error text; the value and every
acceptance/rejection decision are unchanged.

Signed-off-by: CTYQAQ <135084081+CTYQAQ@users.noreply.github.com>
@CTYQAQ
CTYQAQ force-pushed the refactor/domain-state-token-owner branch from 82565f9 to 0c1aef4 Compare October 28, 2026 15:49

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

未发现当前精确 head 0c1aef4 的阻断问题,结论为 APPROVE。

动机 / Motivation

维护领域状态和 ML 实验公共标识符的开发者。

同一个字母开头、最长80字符的标识符规则原来分散在两处;现在修改一处共同语法即可,原调用方的字段政策和错误仍各自保留。

已验证实际 CLI 的接受、拒绝、完整输出和账本读回不变,并删除两处同体规则。

本次不扩大标识符语法、发布策略、领域能力权限或训练执行权。 这是具体的维护增量;基线本来就能处理合法输入,不能把删除重复声明说成修复了既有执行故障或已经提高模型效果。

改动思路 / Approach

共享语法属于既有 public_safe_text owner;具体字段的公共文本政策继续留在消费者,不能因同用正则而合并业务规则。

本 PR 完成既有两个消费者的语法归一及相称回归,不增加状态、配置或第二个验证器。

只抽取两者真正共有的语法。domain-state 继续验证路径段;ML token 仍先经过自己的长度、路径、远端位置和隐私标记过滤。合并这些业务validator会误改政策,另建框架也没有必要。原CLI处理、锁、原子写入和持久格式均沿原owner;这里用文字即可解释直接调用链,不额外画图。

具体改动 / Changes

无针对本次内部整理的独立书面产品规格;验收依据是PR的明确维护目标、既有两个消费者的语义和仓库相称重构规则,不把新测试当作独立规格。已检查不可变基线 b6db7f7 与当前完整差异:4文件 +32/-6,其中生产3文件 +12/-5,既有测试1文件 +20/-1。

关键代码讲解

共享owner的定义普查从两个本地body变成一个;两个新增断言复用原census文件。三生产文件除明确的import、重复赋值和未使用re导入外,AST逐项相同。这证明改动范围,不能单独替代下面的运行对照。

对主干的风险 / Risks

最强反例是抽取时把80字符上限误改成79,或者把ML额外过滤误套到所有路径字段。独立执行35个真实console输入配对:31项覆盖合法/非法token、可选source、错误优先级、默认路径、重复/状态更新及完整JSON/Markdown;另4项覆盖数字起首的普通文本字段、第二个任务、非法任务拒绝及随后恢复。完整stdout、stderr、exit和JSONL逐字段相同,没有归一化。原账本正确保留两个主体,重复及失败恢复不增行。

同一console进程内故意把共享上限改为79,80字符task_id和goal_id两项独立预期确实失败;真实head均通过。默认、明确false及true的原pack公共API结果也与基线相同,默认off不会因导入语法常量而激活,更没有新训练或生产执行权。

PASS:五个相关/架构模块81项;不可变base的原三个focused模块72项。改动文件Ruff、配置17文件mypy、完整TS typecheck、diff/DCO/双语差分均通过。标准premerge的6项direct与2项selected全部通过,零失败/跳过/人工hold;当前严格CQR有效。未查询或等待CI。

早先私有probe先用了不存在的模块入口,随后又被本机默认runtime路由冲突拦住;这些失败保留,未算产品测试。改用实际console和显式隔离registry/runtime后才取得上述真实证据,没有修改全局环境或产品断言。

语义与 CI 对齐

复用既有syntax owner,没有新增状态枚举、默认开关、配置或第二份authority。差分advisory无支持的新carrier;该空报告不证明语义,完整CLI对照和负向mutation承担验证。公共兼容导出和原持久JSONL仍有消费者,保留它们有实际依据,不需为减行删除。

我的整体评价 / Verdict

APPROVE,当前维护目标达到。long_horizon 与 user_experience 均为 preserved:实际接受、拒绝、持久结果和合法后继保持,无新增设置、确认或人工改命令。减少重复知识的增量成立,长期模型/维护成本收益尚未测量。

共享语法属于既有 public_safe_text owner;具体字段的公共文本政策继续留在消费者,不能因同用正则而合并业务规则。 本 PR 完成既有两个消费者的语法归一及相称回归,不增加状态、配置或第二个验证器。

有界整理已应用,不需要新框架或人为后继。已检查 ml-experiment CLI、领域状态写入和现有消费者;没有渲染组件、布局或新前端交互变化,视觉评审不适用。 正式安装、原生 Windows 与真实模型长期收益未在本轮验证。 本评审不授权合并或安装;公开结论只适用于当前未变head。

English verdict: APPROVE — 0c1aef4. All35 real CLI pairs preserve complete output and persisted rows; the stricter-bound mutation fails two independent cases. 81 Python tests, static checks, standard premerge and exact-scope CQR pass. Live adoption and long-term benefit remain unqualified.

@huangruiteng
huangruiteng merged commit 85a2967 into loopx-project:main Oct 29, 2026
2 checks passed
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.

3 participants