chore: consolidate AI-agent context into one source; fix all stale claims - #1005
Draft
rahul-mixpanel wants to merge 5 commits into
Draft
chore: consolidate AI-agent context into one source; fix all stale claims#1005rahul-mixpanel wants to merge 5 commits into
rahul-mixpanel wants to merge 5 commits into
Conversation
…aleness
Reduce per-session token cost by making the auto-loaded context a lean,
accurate router instead of duplicated prose that agents must re-verify.
- Merge CLAUDE.md and AGENTS.md into a single canonical AGENTS.md (router
first: context map, config, commands, principles, architecture, release).
CLAUDE.md is now a symlink to AGENTS.md so the two can never drift.
- Fix a pervasive falsehood ("instrumented tests only / no unit tests")
across the codebase map, testing-strategy, Cursor rules, Copilot
instructions, and CI. The SDK actually has 21 JVM unit tests in
analytics/src/test/ plus 18 instrumented tests in analytics/src/androidTest/.
- Correct the codebase map: drop dead references (DecideChecker,
ConnectivityReceiver, ImageStore), move HttpService to util/, and add the
real current files (FeatureFlag*, DeviceIdProvider, AutomaticEvents, etc).
- Fix wrong Gradle module paths in copilot-instructions (:connectedAndroidTest
-> :analytics:connectedAndroidTest).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Verified every claim in the agent docs against the actual source, build config, and CI. Corrections: Fabricated/deleted things removed: - release.sh no longer exists: rewrote the release docs around the real GitHub Actions flow (prepare-release.yml -> release-maven-central.yml, driven by .github/modules.json), with the real credentials (MAVEN_CENTRAL_*/SIGNING_*, not CENTRAL_PORTAL_*). - :analytics:install task does not exist (maven-publish). - mMessages.enqueueMessage() does not exist; snippets now show the real typed-method / mWorker.runMessage() pattern. Wrong architecture claims fixed: - Data flow was documented as a chain (... -> MPDbAdapter -> HttpService). Reality: AnalyticsMessages owns both the DB adapter and the poster, and FeatureFlagManager is a second network path with no SQLite. - "Single background HandlerThread": there are two HandlerThreads plus single-thread executors. - "No external dependencies": lifecycle-process, json-logic-java, gson and mixpanel-android-common are real runtime deps -> "minimal deps" rule. - "Prepared statements": MPDbAdapter is rawQuery-based. - "MixpanelAPI is the ONLY public class": ~24 public types exist. - HTTP timeouts are hardcoded (not configurable); GZIP is opt-in. Coverage/scope fixes: - Documented the :session-replay module family and build-logic/ (absent from all docs despite being published, versioned and CI-gated). - Fixed toolchain facts (Gradle 9.3.1, session-replay compileSdk 35, demo app Java 8) and test frameworks (Mockito, sharedTest source set). - Nested mpmetrics/ and androidTest/ AGENTS.md+CLAUDE.md pairs: merged each into one corrected AGENTS.md with CLAUDE.md as an @AGENTS.md import; removed their "instrumented tests only" directives and invalid `--tests` syntax. - Root CLAUDE.md switched from symlink to @AGENTS.md import (the officially preferred bridge; Windows-safe, allows Claude-specific adds). Kept: :analytics:createDebugCoverageReport (verified real — CI ran it green on Aug 28). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported invalid test-class command now targets an existing instrumented test using the configured runner syntax.
|
| Filename | Overview |
|---|---|
| AGENTS.md | Consolidates root agent guidance and updates repository commands and architecture facts. |
| CLAUDE.md | Becomes the intended one-line import shim for the canonical root guidance. |
| analytics/src/main/java/com/mixpanel/android/mpmetrics/AGENTS.md | Corrects core SDK guidance and now references an existing instrumented test. |
| analytics/src/main/java/com/mixpanel/android/mpmetrics/CLAUDE.md | Imports the directory-local canonical guidance. |
| .claude/context/workflows/release-process.md | Rewrites release documentation around the current GitHub Actions and Central Portal flow. |
Reviews (4): Last reviewed commit: "chore: fix four doc inaccuracies found i..." | Re-trigger Greptile
The instrumented DB tests live in MixpanelBasicTest/PersistentIdentityTest; there is no MPDbAdapterTest. Verified every other test class named in the docs exists (incl. util/HttpServiceTest and session-replay's APICompatibilityTest). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The 'Validate PR title' check run was created by a synchronize event that predates the title fix; reruns reuse that stale payload. A new head SHA makes all checks evaluate against the current title. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Consolidates AI-agent guidance and corrects stale architecture, testing, and release documentation.
Changes:
- Makes
AGENTS.mdcanonical, withCLAUDE.mdbridges. - Documents unit and instrumented test layers.
- Updates architecture, dependencies, and release workflows.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
CLAUDE.md |
Imports canonical guidance. |
AGENTS.md |
Consolidates repository guidance. |
analytics/src/main/java/com/mixpanel/android/mpmetrics/CLAUDE.md |
Imports local guidance. |
analytics/src/main/java/com/mixpanel/android/mpmetrics/AGENTS.md |
Updates core SDK guidance. |
analytics/src/androidTest/CLAUDE.md |
Imports local test guidance. |
analytics/src/androidTest/AGENTS.md |
Revises instrumented-test guidance. |
.github/workflows/copilot-setup-steps.yml |
Corrects test-layer comment. |
.github/instructions/test-generation.instructions.md |
Documents test selection. |
.github/instructions/code-generation.instructions.md |
Corrects message dispatch example. |
.github/copilot-instructions.md |
Corrects test commands. |
.github/copilot-instructions-guide.md |
Updates testing summary. |
.cursor/rules/workflows/adding-features.mdc |
Corrects dispatch workflow. |
.cursor/rules/README.md |
Updates testing principles. |
.cursor/rules/features/testing-patterns.mdc |
Documents both test layers. |
.cursor/rules/always/architecture-principles.mdc |
Corrects network architecture. |
.claude/context/workflows/testing-strategy.md |
Updates test structure. |
.claude/context/workflows/release-process.md |
Rewrites release guidance. |
.claude/context/codebase-map.md |
Updates repository map. |
.claude/context/architecture/system-design.md |
Corrects system architecture. |
Suppressed comments (2)
analytics/src/androidTest/AGENTS.md:67
- These three documented
TestUtilshelpers do not exist. Listing them sends agents toward uncompilable test code; use the actual shared helpers instead (TestUtils.java:24-65,145-166).
- Clean state in `setUp` (TestUtils helpers: `getCleanMixpanelAPI`, `cleanDatabase`,
`getDbAdapter`); clean up in `tearDown`/`finally`.
analytics/src/main/java/com/mixpanel/android/mpmetrics/AGENTS.md:45
- Not every new public API is a queued tracking operation: accessors, configuration, and opt-in/control APIs should not all receive an opt-out guard or an
AnalyticsMessagesmessage. Narrow this recipe so agents do not force unrelated APIs through the tracking path.
**New public API method:** overload for progressive disclosure; validate + opt-out check +
try-catch in `MixpanelAPI`; hand off via an `AnalyticsMessages` typed method backed by a new
message type with an immutable description class; add tests.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- androidTest/AGENTS.md: replace nonexistent TestUtils.createMixpanelApiWithMockedMessages with the real capture idiom from MixpanelBasicTest (MPDbAdapter/AnalyticsMessages overrides + CleanMixpanelAPI), and fix phantom helper names (real API: cleanUpMixpanelData, EmptyPreferences, createMixpanelAPIWithMockHttpService). - mpmetrics/AGENTS.md: scope the opt-out/try-catch rule to tracking/mutating operations (accessors skip it by design; optInTracking must run while opted out). - mpmetrics/AGENTS.md: retry backoff is 100/200 ms before attempts 2-3; there is no 300 ms sleep after the final attempt (in-code comment is stale). - release-process.md: OSSRH URLs are hardcoded in MavenPublishConventionPlugin.kt; RELEASE_REPOSITORY_URL in analytics/gradle.properties is dead config. Co-Authored-By: Claude Opus 4.8 <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.
Summary
Reduces per-session token cost for AI coding agents and fixes widespread factual drift in the agent context files. Two commits:
1. Consolidation (
7c8f67c6)CLAUDE.md+AGENTS.mdinto a single canonical rootAGENTS.md(router-first: context map → config → commands → principles → architecture → release), withCLAUDE.mdbridging to it.src/test/+ 18 instrumented insrc/androidTest/.2. Full-code audit (
a01b11ae) — verified every doc claim against source, build config, and CI:release.sh(deleted after 8.5.1),CENTRAL_PORTAL_*credentials,publish-maven.yml,:analytics:install,mMessages.enqueueMessage(). Release docs rewritten around the real flow (prepare-release.yml→release-maven-central.yml, driven by.github/modules.json,MAVEN_CENTRAL_*/SIGNING_*secrets).AnalyticsMessagesowns bothMPDbAdapterand the HTTP poster, andFeatureFlagManageris a second network path with no SQLite; two HandlerThreads (not one); real runtime deps documented (gson, json-logic-java, lifecycle-process, mixpanel-android-common);MPDbAdapteris rawQuery-based (not prepared statements); ~24 public types (not "only MixpanelAPI").:session-replaymodule family,build-logic/convention plugins, Gradle 9.3.1, Mockito +sharedTest, per-module release registry.mpmetrics/andandroidTest/AGENTS.md+CLAUDE.md pairs into one corrected AGENTS.md each (CLAUDE.md imports via@AGENTS.md), removing their invalid--testssyntax and "do not create unit tests" directive.CLAUDE.mdswitched from symlink to@AGENTS.mdimport (officially preferred bridge; Windows-safe).Net: −1,579 / +479 lines across 18 doc files. No source code changes.
Follow-up
The audit surfaced a code issue tracked separately as SDK-155:
MPDbAdapterbuilds SQL via string concatenation, which the repo's own rules label an injection risk.Validation
file:lineevidence or CI history (e.g.createDebugCoverageReportkept because CI ran it green on Aug 28).grepfor all removed falsehoods returns no hits outside intentional contexts.🤖 Generated with Claude Code