Skip to content

refactor(tests): an OSS guard pins the caller set of the identity-minting accessors (#2669) - #2685

Merged
vybe merged 2 commits into
devfrom
feature/2669-minting-accessor-guard
Sep 11, 2026
Merged

vybe merged 2 commits into
devfrom
feature/2669-minting-accessor-guard

Conversation

@webmixgamer

Copy link
Copy Markdown
Contributor

Summary

  • 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 (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.py pins the caller set: every use of get_or_create_installation_id, get_or_mint_sharing_id and get_instance_label must 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, so from … 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 twin get_installation_id is 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).
  • Scope widened from the issue's one name on the /autoplan gate (both independent reviewers, approved as filed): get_or_mint_sharing_id is the more sensitive half of the class (opting out deletes it, so a read-path mint would link consent episodes), and get_instance_label is 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 _judge proven in both directions. 34 tests: 6 live-tree assertions + 28 self-tests through the same _scan the live tree uses.
  • tests/registry.json — one appended entry (text insertion, +13 / −0).
  • docs/memory/requirements/lifecycle-observability.md FR-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

What green does not prove

A name assembled at runtime (importlib, string concatenation); a write reaching the sink over the generic PUT /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. The mint_… rename is the eventual root fix and waits on enterprise PR #570 (its fixture patches the name with raising=True, and the private service imports it at the pinned commit).

Fixes #2669

🤖 Generated with Claude Code

…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]>
@webmixgamer
webmixgamer requested a review from dolho September 10, 2026 14:06
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]>

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

merge-train: batch validated on train/20260911-0925 (#2701)

@vybe
vybe merged commit 0afbcce into dev Sep 11, 2026
27 checks passed
@webmixgamer
webmixgamer deleted the feature/2669-minting-accessor-guard branch September 11, 2026 10:41
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