feat(ads): ads read surfaces — routes, CLI, MCP toolkit, doctor (v4.79.0)#696
Open
arberx wants to merge 1 commit into
Open
feat(ads): ads read surfaces — routes, CLI, MCP toolkit, doctor (v4.79.0)#696arberx wants to merge 1 commit into
arberx wants to merge 1 commit into
Conversation
…9.0)
Surfaces half of the OpenAI ads read path (stacked on the ads-sync engine):
- contracts: ads DTOs with derived-metric helpers (adsCtr / adsCpcMicros,
null on zero denominators) + calculation tests
- api-routes: /ads/{connect,connection,status,sync,campaigns,insights,
summary}; connect validates the SDK key upstream via the injected
verifyAdsAccount before any write and stores the credential through the
injected adsCredentialStore (config.yaml, never the DB); summary sums
campaign-level rollups only so ad-group subdivisions are never double
counted; all ops in the OpenAPI spec with typed schemas, SDK regenerated
- canonry: cnry ads connect|disconnect|status|sync|campaigns|insights|
summary (jsonl on collections, money via formatMicros), data-refresh
fans out to ads when connected, server wires the credential store +
verifier + manual-sync callback
- MCP: new 'ads' toolkit (4 read tools + ads-sync trigger); connect/
disconnect classified deferred (credential-bearing); tool counts 110/73
- doctor: ads.auth.connection + ads.data.recent-sync (skipped when not
connected), wired through DoctorContext
- eslint: paid/sponsored vocabulary rule banning paid-vs-organic
conflations (ad mentions, paid citations, …)
- docs: AGENTS key-files + doctor table + schedule examples, docs/mcp.md
toolkit table, skills canonry-cli.md ads section, db-dto-coverage
entries flipped from internal-only to dto
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Surfaces half of the ads read path (PR 3b of
plans/openai-ads-integration.md). Stacked on #695 (engine) → #694 (client) — review bottom-up.POST /ads/connect(validates the SDK key against the upstream ad account via injectedverifyAdsAccountBEFORE any write; credential goes through the injectedadsCredentialStoreinto config.yaml, never the DB),DELETE /ads/connection,GET /ads/status,POST /ads/sync(run row + host callback),GET /ads/campaigns(nested snapshots incl. context hints),GET /ads/insights(derivedctr/cpcMicrosserver-side, null on zero denominators),GET /ads/summary(campaign-level totals only — ad-group rows are subdivisions and never double-counted). All typed in the OpenAPI spec, SDK regenerated.canonry ads connect|disconnect|status|sync|campaigns|insights|summary, jsonl on the collections, money rendered viaformatMicros.adstoolkit — 4 read tools + the ads-sync trigger;connect/disconnectclassifieddeferredwith rationale (credential-bearing). Tool counts move 105→110 (69→73 read).ads.auth.connection+ads.data.recent-sync, both skipped when not connected, so the integration stays invisible for non-ads projects.Tests
TDD per layer: contracts calculation tests (exact micros math from real captured values), 11 route tests (connect validation/idempotency, audit assertions, derived-metric math, summary no-double-counting, level filters), 6 doctor tests, data-refresh + MCP registry/stdio assertions updated. Full suite 4337 green; typecheck and lint clean; codegen drift gate satisfied.
🤖 Generated with Claude Code