Repository navigation
refactor(semantics): fold consumer_report mapping-read accessors into the field_use owner - #8833
Conversation
… the field_use owner
consumer_report.py restated the unambiguous mapping-read accessor set
{get, pop} that field_use.py already owns as MAPPING_READ_CALLS. Import it
as a module-private alias so the semantic inventory keeps seeing no new
public carrier, and add an architecture guard pinning the value, single
ownership, identity and wiring through both scan faces. The isolated
probe-CLI fixture now copies field_use.py and production.py as well, since
the consumer is no longer self-contained.
Signed-off-by: 2430468136 <130272264+2430468136@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent / gpt-6.1-sol / OpenAI / runtime_reported / reasoning effort max
动机
影响使用语义 inventory、消费者证据和开发探针的维护者。同一语料的字面键、动态键、写入及普通方法进入字段扫描与消费者扫描。八组输入的完整分类一致,真实 CLI 的 936 个分类行一致。本次验收覆盖扫描器、开发探针以及源码和隔离 wheel 的消费行为。两个 Python 扫描器分别定义 get/pop,维护者每次调整都要同步两处。
改动思路
把 mapping-read 的值域留在 field_use,在 consumer_report 接入现有私有入口。本次验收覆盖扫描器、开发探针以及源码和隔离 wheel 的消费行为。沿用既有 schema、成员资格与消费顺序。对照真实入口和已经发布的格式,并用隔离安装核对导入依赖。现有值域的 owner
具体改动
one-accessor-set已实现。field_use 的 frozenset 由 consumer_report 私下导入,inventory 保持原定义范围。对应代码scan-parity已实现。936 个实际分类行保留,字面/动态键和误识别控制另有独立对照。对应代码probe-install已实现。补齐探针的 field_use/production 依赖;完整 wheel 从 site-packages 导入并重跑同一语料。对应代码
关键代码讲解
MAPPING_READ_CALLS 定义当前 Python mapping-read 方法集合。scan_python_consumers 实际消费该集合判定字面槽位读取。scan_dynamic_reads 以同一个规则将计算键归为 dynamic_key。实际消费路径
语义与 CI 对齐
架构基线 1842 通过、候选 1854 通过。两边同两项失败,新增 12 项均通过。失败是 content digest 归属和 POSIX 标志检查,测试标识与诊断一致。词汇 drift 输出逐字一致。Ruff 与完整差异检查通过。实际比较基线 8ade78cddeb6bdcd947c0a81507393c4599c7652,对应 docs/architecture/rfcs/semantic-vocabulary-convergence-v0.md。基线规范
对主干的风险
真实报告的输出仍为语法 advisory。计算键及超出既有扫描根的数据流仍以不确定状态呈现。基线和候选都标记 get/pop 的计算键为 unresolved。setdefault 保持 write 限定,普通方法和注释不被划成 slot_read。这里验证 Python 证据扫描和隔离安装输入,未推出跨运行时的数据流证明。基线与当前主干的合并树均已核对。现有输出、历史入口与失败情况在源码和独立安装路径分别读回。
我的整体评价
当前提交 3ab4c70eb4cd5c1e2d792e4b27c781240cc6bc99 通过独立代码评审。复用既有 frozenset 与私有 alias,保留真实 CLI 在脱离完整源码树时所需的两个模块。八组输入的完整分类一致,真实 CLI 的 936 个分类行一致。局部闭集由一处维护,实际消费者的兼容与边界经过同条件对照。
English verdict: APPROVE | Exact head 3ab4c70eb4cd5c1e2d792e4b27c781240cc6bc99. The accessor owner is shared. Literal and computed-key behavior and production report output match the baseline. The isolated wheel and probe pass.
Goal And Delivered Outcome
loopx/semantics/field_use.pyownsMAPPING_READ_CALLS, the closed set of unambiguous mapping-read accessors (get,pop) its scan recognizes.loopx/semantics/consumer_report.pyrestated the same set as a private literal_MAPPING_READS, so one accessor decision had two owners and a drift would let the two scan faces disagree about which calls read a slot.consumer_report.pyimports the owner object as a module-private alias, and a new architecture guard pins the value, single ownership, identity, and wiring through both scan faces (see theunitandregression_parityrows).main.Author Declaration
Implemented against
field_use.MAPPING_READ_CALLS;consumer_report._MAPPING_READSaliastests/architecture/test_semantics_mapping_reads_owner.pyPROBE_CLI_FILESintests/architecture/test_semantic_development_probe.pytests/architecture/test_semantic_development_probe.pytests/architecturesuite on both a pristine base worktree and the head worktree and compared failure sets; ran three mutations against the guard; ran ruff, the public-boundary scan, and the semantic-vocabulary drift smoke. The parity comparison caught the probe-CLI fixture missing the consumer's new dependencies; updatedPROBE_CLI_FILESwithfield_use.pyandproduction.pyand re-ran all 18 probe tests. Deliberately kept the alias module-private: the semantic inventory counts only module-level public uppercase assignments, andconsumer_report's module comment documents that its tree must not add a closed-set carrier — an import binding preserves that. Did not foldMAPPING_WRITE_CALLS(already single-owner).Scope And Continuation
Validation
unitpassedpython -m pytest tests/architecture/test_semantics_mapping_reads_owner.py— 12/12 passed; owner value pin, census-by-value, identity, import-not-assign, and wiring throughfield_use.python_module_scanand the consumer-report scan with read/write/stranger accessor and computed-key controls.unitpassedpython -m pytest tests/architecture/test_semantic_development_probe.py— 18/18 passed; the disposable-repository probe CLI imports the consumer with the owner module and its production dependency present.regression_paritypassedtests/architecturebase 2 failed / 1842 passed, head 2 failed / 1854 passed; failure sets byte-identical (pre-existingtest_content_digest_single_ownerandtest_posix_flag_portability); the +12 are exactly the new guard tests. The comparison caught one real head-only break: the isolated probe-CLI fixture copied the consumer without its new transitive dependencies (3 probe tests failed); addingfield_use.pyandproduction.pytoPROBE_CLI_FILESin this diff repairs it, and all 18 probe tests then pass. Three mutations each caught: restored pre-fold local definition → census + identity + import-not-assign; renamed copy under a new binding → census; divergent owner value (addssetdefault) → value pin + both wiring faces. Dependency-lock and top-level-module-budget invariants pass on head (7/7).staticpassedpython -m ruff checkclean on both changed files.real_entrypointpassedloopx check --scan-path <changed files>reportspublic boundary scan clean: 3 files; the unrelated registry-goal error reproduces identically on the pristine base.integrationpassedpython examples/semantic-vocabulary-drift-smoke.pyreportsokwith byte-identical budget lines between base and head; the alias is import-bound and module-private, so the inventory sees no new carrier and no ratcheted collision budget moves.staticnot_runmypyis not installed in the local environment; neither changed file is in the pinned mypy scope (pyproject.toml[tool.mypy]files) or the Todo CLI adapter gate, so the CI type gates are unaffected.get/pop/setdefault/unknown accessors and computed keys, pins that the consumer adds no module-level assignment, and the probe suite exercises the real CLI entrypoint in a disposable repository. The fulltests/tree was not run locally — scope wastests/architecture(complete), which contains the semantics suite; the pre-existing failures reproduce on the pristine base. No UI impact.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
none.Signed-off-bytrailer (git commit -s).