fix(adagents): inline-resolution path for publisher_properties selectors + publisher_domains[] fan-out#750
Draft
bokelley wants to merge 4 commits into
Draft
Conversation
…ors + publisher_domains[] fan-out Fixes the bug where _resolve_agent_properties with authorization_type "publisher_properties" returned raw selector dicts instead of resolved property objects. Implements the inline-resolution path from adcp#4827: for each selector, fan out over publisher_domain / publisher_domains[], match against the parent file's top-level properties[] by publisher_domain, apply selection_type filter (all / by_tag / by_id), and extend the result. Also adds _selector_domains() and _resolve_inline() as internal helpers with the None-vs-[] sentinel contract documented in their docstrings. Federated fetch (HTTP per-domain fallback) is deferred per #749. Refs #749
…e docstring - Deduplicate by property_id across multi-selector/multi-domain fan-out so a property appearing in two selectors isn't returned twice - Filter by_id property_ids to str members (matches the by_tag pattern) - Reword _resolve_inline docstring: None means no inline data for the domain (federated not yet implemented), not a MUST-federate contract - Add by_id selection_type unit test Refs #749
7 tasks
…femedia scale Pre-builds a domain→properties index in _resolve_agent_properties before the selector loop so each per-domain inline lookup is O(1) rather than O(N). At cafemedia scale (6,843 properties × 6,800 domains) the unindexed path was ~46 M comparisons; with the index it is O(N+M). Also adds the cafemedia/interchange.io canonical fixture (6,843 properties, publisher_domains[] compact form) to the test suite — sized to expose O(N×M) regressions and validate the raptive_managed tag filter against the production managed-network shape. Part of #749. https://claude.ai/code/session_01RDYrywLhVbd4crrAHkTnsH
Reviewer noted the subset assertion (<=) would pass even if half the domains were missing. Changed to equality so all 6,800 child domains must appear in the resolved result. Part of #749. https://claude.ai/code/session_01RDYrywLhVbd4crrAHkTnsH
5 tasks
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.
Refs #749
Fixes the two bugs in
_resolve_agent_propertiesfor thepublisher_propertiesauthorization type (Part 1 of #749):Wrong return value — the function was returning raw selector dicts (objects with
publisher_domain,selection_type,property_tags, etc.) instead of the resolved property objects those selectors describe.get_properties_by_agent(cafemedia_data, "https://interchange.io")now returns the inline properties rather than 1 selector dict.No
publisher_domains[]fan-out — the compactpublisher_domains[]array form from adcp#4825/4827 wasn't expanded into per-domain resolution._selector_domains()now handles both the scalarpublisher_domainfield and the compact array form.New helpers:
_selector_domains(selector)— extracts domain(s) from either scalar or array form_resolve_inline(selector, parent_properties, domain)— attempts inline resolution from the parent file's top-levelproperties[]; returnsNonewhen no inline data exists for the domain (federated fallback hook-point),[]when inline data exists but nothing matches the selector filter (real empty; no fallback)Deferred from #749:
Nonereturn from_resolve_inlineis where it hooks infetch_agent_authorizations_from_directory) — held pending clarification on endpoint path and return type (see comment on feat(adagents): inline-resolution path for publisher_properties selectors + directory inverse-lookup wrapper #749)revoked_publisher_domains[]revocation — deferred pending schema definitionWhat was tested
ruff check src/adcp/adagents.py tests/test_adagents.py— cleanmypy src/adcp/adagents.py— clean (0 errors)pytest tests/test_adagents.py— 125 passed, 0 failedtest_get_properties_by_agent_publisher_propertiesrewritten to assert resolved property objects (previously encoded the buggy selector-passthrough behavior)test_get_properties_by_agent_publisher_domains_fanout—publisher_domains[]compact form fans out correctlytest_get_properties_by_agent_publisher_properties_no_inline— emptyproperties[]returns[]test_get_properties_by_agent_publisher_properties_by_id—selection_type: "by_id"filters correctlyPre-PR review
by_idstr filter, multi-selector deduplication, and missingby_idunit test per blocker findings; one nit surfaced (emptyby_tagpassthrough is permissive; acceptable given schemaminItems: 1upstream)publisher_domains[]schema gap noted (schema cache needs updating from adcp#4827 — tracked separately);Nonedocstring reworded to avoid forward-declared MUST obligationNits (not fixed):
by_tagwith emptyproperty_tagsreturns all domain candidates (permissive); schema enforcesminItems: 1upstream so this path is unreachable on valid input_selector_domainssilently ignores non-listpublisher_domainsvalues (intentional defensive drop)Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
Generated by Claude Code