Repository navigation
refactor(tests): an OSS guard pins the caller set of the identity-minting accessors (#2669) - #2685
Merged
Merged
Conversation
…ting accessors (#2669) `get_or_create_installation_id` is a write API wearing a read API's name. Three read-shaped callers have minted durable identity by looking (#1987, the ent#190 benchmark read, the ent#545 funnel GET), each closed by a point fix, and the only static guard lived in the private repo and pinned one module. Nothing in the OSS tree, where the accessor lives, stopped a fourth. `tests/unit/test_2669_minting_accessor_callers.py` pins the caller set: every use of `get_or_create_installation_id`, `get_or_mint_sharing_id` or `get_instance_label` must sit at an allowlisted `(path, enclosing qualname, name)` carrying the reason that site needs the identity to exist. An import is a binding that feeds a per-file alias map, so an aliased or re-bound call is a hit at the call. The identity keys (`installation_id`, `telemetry_sharing_id`) are written only by their home modules. The read twin `get_installation_id` is pinned to exist. Token-prefiltered on case-folded bytes with a fail-closed sentinel for a token-bearing file that does not parse (the #1677 shape); OSS tree only, the private twin is trinity-enterprise#575. Self-tests drive every spelling family, the scope attribution and the verdict in both directions through the same scan the live tree uses; the first run caught the case-folding gap (learnings 2026-09-10). Fixes #2669 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Resolves the append-append conflict in docs/memory/learnings.md: the #2665 entry (2026-09-09) from dev is kept, and the #2669 entry (2026-09-10) is re-appended after it. No other file overlapped. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_or_create_installation_idis a write API wearing a read API's name. Three read-shaped callers have minted durable identity by looking (Canary Slack alerts don't say which instance fired them #1987, the ent#190 benchmark read, the ent#545 funnel GET), each closed by a point fix; the only static guard lived in the private repo and pinned one module. Nothing in the OSS tree, where the accessor lives, stopped a fourth.tests/unit/test_2669_minting_accessor_callers.pypins the caller set: every use ofget_or_create_installation_id,get_or_mint_sharing_idandget_instance_labelmust sit at an allowlisted(path, enclosing qualname, name)carrying the reason that site needs the identity to exist; a read-shaped path uses the non-minting twin. An import is a binding feeding a per-file alias map, sofrom … import x as mint+mint()is a hit at the call, attributed to the caller. The identity keys (installation_id,telemetry_sharing_id) are written only by their home modules. The read twinget_installation_idis pinned to exist (it has no OSS caller yet; enterprise PR refactor: rename template.yaml to trinity.yaml with backward compatibility #570 is its first consumer)./autoplangate (both independent reviewers, approved as filed):get_or_mint_sharing_idis the more sensitive half of the class (opting out deletes it, so a read-path mint would link consent episodes), andget_instance_labelis a minting entry point one hop above the allowlisted tier whose module docstring invites reuse.Changes
tests/unit/test_2669_minting_accessor_callers.py(new) — the bug: platform operator-queue alert emitters bypass #1632 ingestion caps — skill-not-found is agent-triggerable (flood residual, gates pull default-ON) #1677 shape:_EXCLUDE_DIRS = ("enterprise/",), token prefilter on case-folded bytes, a<unparseable>sentinel for a token-bearing file that cannot be read or parsed (fails closed naming the interpreter; CI's bug: CI validates on Python 3.11 while every shipped image runs 3.13 #1891-pinned 3.13 parses every file), scope-correct qualnames (Class.method,outer.inner,<lambda>; decorators/defaults/annotations attribute to the enclosing scope), a pure_judgeproven in both directions. 34 tests: 6 live-tree assertions + 28 self-tests through the same_scanthe live tree uses.tests/registry.json— one appended entry (text insertion, +13 / −0).docs/memory/requirements/lifecycle-observability.mdFR-3,docs/memory/feature-flows/telemetry-sharing.md,docs/memory/feature-flows/first-time-setup.md— pointers where the rule already lived, so a contributor without submodule access can see the guard (the issue's own complaint).docs/memory/learnings.md— 2026-09-10: a pre-parse token filter is a second detector with its own spelling families. The first run of this suite skipped a file whose only identity reference was the upper-case_INSTALLATION_ID_KEY; the self-test caught it before the guard ever saw a PR.Test Plan
cd tests && ../.venv/bin/python -m pytest unit/test_2669_minting_accessor_callers.py -q→ 34 passed, under fixed order and under pytest-randomly.test_ent435_settings_sink_guard.py+test_1677_operator_alert_emitters.py+ this file → 49 passed. Green on an enterprise-mounted clone (the bug: hand-rolled Redis single-flight locks — 7 divergent copies; system_seed_service releases with an unconditional tokenless delete #1920 guard is red there, bug(tests): the #1920 single-flight guard walks the mounted enterprise submodule — red on every enterprise-mounted clone, green in CI #2655), proving the exclusion.python tests/lint_root_test_placement.py→ OK.tests/unit/test_2338_journey_catalog.py(reads the registry) → 50 passed.routers/settings.py, ran, reverted:getattr/ dotted string /__all__, nested / async / class / lambda / decorator) and assert the verdict both ways.What green does not prove
A name assembled at runtime (
importlib, string concatenation); a write reaching the sink over the genericPUT /api/settings/{key}route (#2668 owns the sink); the enterprise tree — its twin is abilityai/trinity-enterprise#575, filed from the plan gate per #2655's acceptance bar. Themint_…rename is the eventual root fix and waits on enterprise PR #570 (its fixture patches the name withraising=True, and the private service imports it at the pinned commit).Fixes #2669
🤖 Generated with Claude Code