Skip to content

refactor(semantics): fold consumer_report mapping-read accessors into the field_use owner - #8831

Closed
psychologister wants to merge 1 commit into
loopx-project:mainfrom
psychologister:codex/semantics-mapping-reads-owner
Closed

psychologister wants to merge 1 commit into
loopx-project:mainfrom
psychologister:codex/semantics-mapping-reads-owner

Conversation

@psychologister

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: Self-contained ordinary maintenance contribution (single-owner convergence); no issue or roadmap id invented.
  • Goal/source and gap: loopx/semantics/field_use.py owns MAPPING_READ_CALLS, the closed set of unambiguous mapping-read accessors (get, pop) its scan recognizes. loopx/semantics/consumer_report.py restated 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.
  • Observable before → after, with the validation row that proves it: Before — two modules each stated the same frozenset, so a renamed or value-drifted copy was undetected. After — consumer_report.py imports 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 the unit and regression_parity rows).
  • Issue/task and intended base: Related to the single-owner convergence direction; base main.

Author Declaration

  • Written by: model_agent

Implemented against

  • Specification and revision: no written specification; the request in this PR is the basis.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
The mapping-read accessor set is stated only by the owner and read by identity in the consumer report implemented field_use.MAPPING_READ_CALLS; consumer_report._MAPPING_READS alias tests/architecture/test_semantics_mapping_reads_owner.py
The isolated probe-CLI fixture carries the consumer's transitive dependencies implemented PROBE_CLI_FILES in tests/architecture/test_semantic_development_probe.py tests/architecture/test_semantic_development_probe.py
  • Self-check before submission: ran the new guard and the full tests/architecture suite 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; updated PROBE_CLI_FILES with field_use.py and production.py and re-ran all 18 probe tests. Deliberately kept the alias module-private: the semantic inventory counts only module-level public uppercase assignments, and consumer_report's module comment documents that its tree must not add a closed-set carrier — an import binding preserves that. Did not fold MAPPING_WRITE_CALLS (already single-owner).

Scope And Continuation

  • Completed scope and remaining work: complete within this scope. The fold removes the duplicate definition and adds a guard that pins the decision by value, by census, by identity, and by wiring through both public scan faces, including the computed-key unresolved parity.
  • Slice boundary / successor: N/A — the maintenance outcome is complete. The write-side accessor set was already single-owner and is unchanged.

Validation

  • Tested revision: 2ff0332
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Public-safe evidence / limitation
unit passed python -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 through field_use.python_module_scan and the consumer-report scan with read/write/stranger accessor and computed-key controls.
unit passed python -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_parity passed Pristine base vs head on identical selections: tests/architecture base 2 failed / 1842 passed, head 2 failed / 1854 passed; failure sets byte-identical (pre-existing test_content_digest_single_owner and test_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); adding field_use.py and production.py to PROBE_CLI_FILES in 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 (adds setdefault) → value pin + both wiring faces. Dependency-lock and top-level-module-budget invariants pass on head (7/7).
static passed python -m ruff check clean on both changed files.
real_entrypoint passed loopx check --scan-path <changed files> reports public boundary scan clean: 3 files; the unrelated registry-goal error reproduces identically on the pristine base.
integration passed python examples/semantic-vocabulary-drift-smoke.py reports ok with 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.
static not_run mypy is 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.
  • Coverage and gaps: the changed paths are the consumer binding, its two use sites, and the probe-CLI fixture list; the guard exercises both scan faces across 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 full tests/ tree was not run locally — scope was tests/architecture (complete), which contains the semantics suite; the pre-existing failures reproduce on the pristine base. No UI impact.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • First viewport and preview: N/A
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A
  • Craft review: N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference, when applicable: N/A (single-owner maintainability convergence).

Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A
  • Semantic dimensions changed, or reviewed no-impact rationale: N/A — no TypeScript control-plane or shared Goal Authority claim.
  • Provider conformance arms run: N/A
  • Read-only legacy/file/PostgreSQL three-arm rehearsal: N/A

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths.
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • Existing English/Chinese RFC pairs both have a diff and the local premerge check passes, or no paired RFC changed. (no paired RFC changed)
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

… 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: psychologister <230141834+psychologister@users.noreply.github.com>
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