Skip to content

docs: seed Golden Context#210

Merged
Tyler Pina (tylerpina) merged 3 commits into
masterfrom
docs/seed-golden-context
May 12, 2026
Merged

docs: seed Golden Context#210
Tyler Pina (tylerpina) merged 3 commits into
masterfrom
docs/seed-golden-context

Conversation

@tylerpina
Copy link
Copy Markdown
Contributor

@tylerpina Tyler Pina (tylerpina) commented May 11, 2026

Summary

Adds the full Golden Context artifact set to contentful-management.java so that agents and new contributors can orient quickly without a human tour guide.

Coverage: Before → After

Artifact Before After
README.md Exists (good user-facing content, no agent section) Enriched with agent/contributor context table
ARCHITECTURE.md Missing Created
AGENTS.md Missing Created
CONTRIBUTING.md Minimal (dev container + PR stub) Enriched with testing, checkstyle, commits, branching, release process, CI table
docs/ADRs/ Missing 7 ADRs + index README
docs/specs/ Missing Scaffolded with .gitkeep + README
.bito.yaml Missing Created
.bito/guidelines/ Missing 3 guideline files (review-posture, repo-truth-and-boundaries, domain-invariants)

Artifacts Created

  • ARCHITECTURE.md — full doc: overview, system context (Mermaid), internal directory table, module/service pattern, data flow, key dependencies table, configuration table, integration points, environment scoping rules
  • AGENTS.md — quick reference table, 9 sharp edges/invariants, key conventions, build commands
  • CONTRIBUTING.md — appended: testing section, checkstyle, commit convention, branch strategy, release process, CI/CD table
  • README.md — appended: Agent & Contributor Context section with links to all Golden Context docs
  • .bito.yaml — Bito review config pointing to 3 guideline files
  • .bito/guidelines/review-posture.txt — tech-lead review posture for a published Java SDK
  • .bito/guidelines/repo-truth-and-boundaries.txt — doc-first review rules, ADR update triggers, public API scrutiny
  • .bito/guidelines/domain-invariants.txt — 9 domain invariants (environment scoping, Java 8 target, Gson registration, rich text hierarchy, callback defaults, etc.)
  • docs/ADRs/README.md — ADR index with template instructions
  • docs/specs/README.md + .gitkeep — specs directory scaffold

ADRs Generated

ADR Decision Source
0001 Module-per-resource architecture Code analysis: Module*/Service* pattern in src/
0002 Retrofit2 as HTTP client Git history: Retrofit 1→2 upgrade; pom.xml deps
0003 RxJava2 for async call pattern Git history: RxJava 1→2; CMACallback pattern in source
0004 Java 8 minimum target + Android compatibility pom.xml java.version pin; android optional dep; git: "ignore jdk>8 due to android"
0005 Kotlin for tests, Java for production pom.xml: kotlin-maven-plugin test-compile only; src layout
0006 Devcontainer as single source of truth for dev and CI PR #209 (DX-822); ci.yml; devcontainer.json/Dockerfile
0007 Maven Central publishing via Sonatype Central Portal pom.xml: central-publishing-maven-plugin, maven-release-plugin, maven-gpg-plugin

Redaction Pass (Public Repo)

One mention of "CMA credentials" in ARCHITECTURE.md — this is documentation-appropriate context for E2E test setup, not an actual credential. No redactions applied.

Flagged Items

  • kotlin-stdlib in compile scope: ADR-0005 notes this means Kotlin stdlib ships with the jar. This is a known trade-off but worth revisiting if jar size becomes a concern.
  • RichText node type inconsistency (GitHub issue Inconsistent Rich Text Embedding Types Between Contentful Management API and Java SDK #202): The open issue about inconsistent nodeType deserialization between the API and SDK is not addressed by this PR. Flagged for follow-up.
  • E2E test credentials: src/test/kotlin/.../e2e/ tests require CONTENTFUL_ACCESS_TOKEN and CONTENTFUL_SPACE_ID env vars. There is no documented CI secret setup for these — they may only be runnable locally or with specific credentials. Worth documenting or gating explicitly.
  • checkstyle.xml is present but the verify phase is not part of the standard ./mvnw -B test CI commandtest phase runs before verify. Checkstyle only runs during verify. CI currently uses test. This means checkstyle is not enforced in CI as documented. Consider updating ci.yml to use ./mvnw -B verify or adding a separate checkstyle step.

Generated by

seed-golden-context pipeline — 2026-05-11

Summary by Bito

This pull request adds the full Golden Context artifact set to contentful-management.java, enabling agents and new contributors to orient quickly. It creates comprehensive documentation including architectural overviews, agent guidelines, ADRs, review guidelines, and enhances existing guides with additional context.

Detailed Changes
  • Adds ARCHITECTURE.md with system context, module/service patterns, data flow, dependencies, and integration points.
  • Creates AGENTS.md as a quick reference guide with sharp edges, invariants, conventions, and build commands.
  • Enhances CONTRIBUTING.md with testing procedures, checkstyle rules, commit conventions, branch strategy, release process, and CI table.
  • Appends Agent & Contributor Context section to README.md with links to all documentation.
  • Establishes .bito.yaml configuration and three custom guidelines for review posture, repo boundaries, and domain invariants.

Adds ARCHITECTURE.md, AGENTS.md, 7 ADRs, .bito config, docs/specs/ scaffold,
and enriches CONTRIBUTING.md and README.md with agent-visible context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted Summary
Documentation - Bito Configuration and Guidelines
Adds Bito AI review configuration and custom guidelines for domain invariants, repo boundaries, and review posture.
Documentation - Agent Guide
Creates a quick reference guide for agents with sharp edges, invariants, conventions, and build commands.
Documentation - Architecture Documentation
Adds comprehensive architectural overview including system context, module patterns, data flow, dependencies, and integration points.
Documentation - Contributing Guide Enhancement
Enhances the contributing guide with testing, checkstyle, commit conventions, branch strategy, release process, and CI/CD details.
Documentation - README Enhancement
Appends an Agent & Contributor Context section with links to all Golden Context documentation.
Documentation - Architecture Decision Records
Creates 7 ADRs documenting key architectural decisions and an index with template instructions.
Documentation - Specs Directory Scaffold
Initializes the specs directory with a README and .gitkeep for future implementation specs.

@bito-code-review
Copy link
Copy Markdown

Functional Validation by Bito

SourceRequirement / Code AreaStatusNotes
DX-822Create reproducible development environment for contentful-management.java✅ MetRequirement already implemented in existing code with .devcontainer/ providing reproducible development environment as documented in ARCHITECTURE.md and AGENTS.md.
.bito.yaml, domain-invariants.txt, repo-truth-and-boundaries.txt, review-posture.txtAdded Bito AI reviewer configuration and custom guidelines for code review posture, domain invariants, and repository boundaries.⭕ Out of ScopeAdded Bito AI reviewer configuration and custom guidelines for code review posture, domain invariants, and repository boundaries.
AGENTS.md, ARCHITECTURE.md, CONTRIBUTING.mdAdded comprehensive repository documentation including agent guide, architecture overview, and updated contributing guidelines.⭕ Out of ScopeAdded comprehensive repository documentation including agent guide, architecture overview, and updated contributing guidelines.
0001-module-per-resource-architecture.md, 0002-retrofit2-as-http-client.md, 0003-rxjava2-async-pattern.md, 0004-java8-android-compatibility.md, 0005-kotlin-for-tests-java-for-production.md, 0006-devcontainer-for-ci-parity.md, 0007-maven-central-publishing.md, README.mdAdded architecture decision records documenting key technical decisions for the SDK.⭕ Out of ScopeAdded architecture decision records documenting key technical decisions for the SDK.
README.mdAdded specs directory structure for documenting active and planned work.⭕ Out of ScopeAdded specs directory structure for documenting active and planned work.

@bito-code-review
Copy link
Copy Markdown

Impact Analysis by Bito

Interaction Diagram
sequenceDiagram
participant Dev as Developer
participant PR as GitHub PR
participant BitoAI as Bito AI
participant Config as .bito.yaml<br/>🟩 Added | ●●● High
participant Guidelines as Review Guidelines<br/>🟩 Added | ●●○ Medium
participant SeqGen as Sequence Diagram Generator
Dev->>PR: Create PR with changes
PR->>BitoAI: Trigger automated review
BitoAI->>Config: Load Bito configuration
Config->>BitoAI: Enable sequence diagrams
BitoAI->>Guidelines: Load custom guidelines
Guidelines->>BitoAI: Provide domain invariants and review rules
BitoAI->>SeqGen: Request sequence diagram generation
SeqGen->>BitoAI: Return generated diagram
BitoAI->>PR: Post review with diagram
PR->>Dev: Display enhanced review feedback
Note over Config: Configuration enables AI-assisted reviews<br/>with sequence diagrams for code diffs
Loading

This MR adds Bito AI configuration files to enable sequence diagram generation and custom review guidelines for the contentful-management.java repository. The configuration activates comprehensive suggestions, sequence diagrams, and custom guidelines for PR reviews. The domain invariants guideline documents critical architectural rules for the SDK, including data transformation layers (Gson type adapters), external integrations (Retrofit services), and communication layers (HTTP contracts). This enhances the review process by providing visual sequence diagrams for code changes, improving developer understanding of system flows.

Code Paths Analyzed

Impact:
This PR adds comprehensive project documentation (AGENTS.md, ARCHITECTURE.md, ADRs, Bito guidelines) without modifying any production code. No functional impact.

Flow:
Documentation-only changes: new markdown files added to provide context for agents, contributors, and automated review systems.

Direct Changes (Diff Files):
• .bito.yaml [1-25] — New Bito configuration file for automated code review settings
• .bito/guidelines/domain-invariants.txt [1-51] — New domain invariants documentation for reviewers
• .bito/guidelines/repo-truth-and-boundaries.txt [1-68] — New guidelines for repository context and boundaries
• .bito/guidelines/review-posture.txt [1-85] — New review posture guidelines for PR reviews
• AGENTS.md [1-150] — New agent guide with sharp edges, invariants, and quick reference
• ARCHITECTURE.md [1-266] — New architecture documentation covering system context, internal structure, module pattern, data flow, and dependencies
• CONTRIBUTING.md [30-340] — Extended with testing, code style, commit convention, branch strategy, release process, and CI/CD sections
• README.md [332-364] — Added Agent & Contributor Context section linking to new documentation
• docs/ADRs/0001-module-per-resource-architecture.md [1-406] — New ADR documenting module-per-resource architecture decision
• docs/ADRs/0002-retrofit2-as-http-client.md [1-446] — New ADR documenting Retrofit2 as HTTP client decision
• docs/ADRs/0003-rxjava2-async-pattern.md [1-486] — New ADR documenting RxJava2 async pattern decision
• docs/ADRs/0004-java8-android-compatibility.md [1-523] — New ADR documenting Java 8 minimum target and Android compatibility
• docs/ADRs/0005-kotlin-for-tests-java-for-production.md [1-559] — New ADR documenting Kotlin for tests, Java for production decision
• docs/ADRs/0006-devcontainer-for-ci-parity.md [1-595] — New ADR documenting devcontainer as single source of truth
• docs/ADRs/0007-maven-central-publishing.md [1-631] — New ADR documenting Maven Central publishing decision
• docs/ADRs/README.md [1-661] — New ADR index and README
• docs/specs/README.md [1-679] — New specs directory README for implementation specs

Repository Impact:
Documentation and contributor onboarding: New comprehensive documentation improves discoverability of architectural decisions, coding standards, and review guidelines for contributors and automated agents.

Cross-Repository Dependencies:
None.

Database/Caching Impact:
• None

API Contract Violations:
None.

Infrastructure Dependencies:
None.

Additional Insights:
Automated code review: The .bito.yaml and .bito/guidelines/ files enable enhanced automated review with domain-specific invariants and review posture rules.

Testing Recommendations

Frontend Impact:
• No issues detected

Service Integration:
• No issues detected

Data Serialization:
• No issues detected

Privacy Compliance:
• No issues detected

Backward Compatibility:
• No issues detected

OAuth Functionality:
• None

Cross-Service Communication:
• No issues detected

Reliability Testing:
• None

Additional Insights:
• Verify that all new markdown files render correctly in GitHub/GitLab
• Confirm that relative links between documentation files resolve properly
• Ensure .bito.yaml syntax is valid for the Bito platform

Analysis based on known dependency patterns and edges. Actual impact may vary.

Copy link
Copy Markdown

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #97a6fb

Actionable Suggestions - 4
  • CONTRIBUTING.md - 1
  • docs/ADRs/0005-kotlin-for-tests-java-for-production.md - 1
  • .bito/guidelines/domain-invariants.txt - 1
    • Inaccurate module scoping list · Line 3-3
  • AGENTS.md - 1
    • Incomplete Invariants Documentation · Line 18-28
Review Details
  • Files reviewed - 17 · Commit Range: e8d2a1d..e8d2a1d
    • .bito.yaml
    • .bito/guidelines/domain-invariants.txt
    • .bito/guidelines/repo-truth-and-boundaries.txt
    • .bito/guidelines/review-posture.txt
    • AGENTS.md
    • ARCHITECTURE.md
    • CONTRIBUTING.md
    • README.md
    • docs/ADRs/0001-module-per-resource-architecture.md
    • docs/ADRs/0002-retrofit2-as-http-client.md
    • docs/ADRs/0003-rxjava2-async-pattern.md
    • docs/ADRs/0004-java8-android-compatibility.md
    • docs/ADRs/0005-kotlin-for-tests-java-for-production.md
    • docs/ADRs/0006-devcontainer-for-ci-parity.md
    • docs/ADRs/0007-maven-central-publishing.md
    • docs/ADRs/README.md
    • docs/specs/README.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread CONTRIBUTING.md Outdated

- **Enables:** Concise, readable tests with Kotlin assertions; no Kotlin dependency burden on pure-Java SDK consumers.
- **Requires:** `kotlin-stdlib` in compile scope (minimal); `kotlin-maven-plugin` configured for test-compile phase.
- **Sharp edge:** Do not add Kotlin files under `src/main/java/`. The Maven build does not compile Kotlin there, and it would silently be excluded.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incorrect Build Behavior Claim

The ADR incorrectly states that the Maven build 'does not compile Kotlin' in src/main/java/, but pom.xml shows kotlin-maven-plugin's compile phase includes src/main/java in sourceDirs, meaning Kotlin files would be compiled if present. This could mislead developers about build behavior. Update the sharp edge to reflect the actual configuration while maintaining the no-Kotlin-in-main decision.

Code Review Run #97a6fb


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment thread .bito/guidelines/domain-invariants.txt Outdated
@@ -0,0 +1,21 @@
Critical domain invariants for contentful-management.java. Violations of these rules will cause runtime failures, silent data loss, or consumer-facing breakage.

1. ENVIRONMENT SCOPING: The modules apiKeys, environments, roles, spaceMemberships, uiExtensions, uploads, and webhooks do NOT support non-master environments. If a module that extends AbsModule operates in a space-only context, it must call throwIfEnvironmentIdIsSet() in its constructor or before any operation. Failing to do this causes CMANotWithEnvironmentsException at runtime.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inaccurate module scoping list

The listed modules 'environments' and 'uiExtensions' actually support environment-scoped operations (e.g., ModuleUiExtensions.fetchAll(spaceId, environmentId)) and do not throw CMANotWithEnvironmentsException when environmentId is configured, unlike apiKeys, roles, spaceMemberships, uploads, and webhooks. This discrepancy could mislead developers into avoiding valid API usage.

Code Review Run #97a6fb


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment thread AGENTS.md Outdated
Comment on lines +18 to +28
## Sharp Edges & Invariants

- **Never call environment-scoped operations on the wrong modules.** The modules `apiKeys`, `environments`, `roles`, `spaceMemberships`, `uiExtensions`, `uploads`, and `webhooks` throw `CMANotWithEnvironmentsException` if the client is configured with a non-`master` `environmentId`. Always use a separate client (no `environmentId`) for those modules.
- **Java 8 is the minimum target — do not use Java 9+ APIs in production code.** The Android dependency (`com.google.android:android`) is marked `optional` but must remain compilable on API 21+. Tests may use newer JVM features.
- **Do not add new runtime dependencies without an ADR.** The dependency footprint is deliberately small to keep Android app size predictable.
- **Every Module must extend `AbsModule<T>`.** The base class handles argument validation, executor injection, and space/environment ID pre-configuration. Never bypass it.
- **Custom Gson adapters must be registered in `CMAClient`.** The Gson instance is built once in `CMAClient` and shared across all modules. New model types with non-trivial wire formats need a type adapter registered there.
- **RichText hierarchy rules are enforced by the API** — the SDK models them but does not validate at write time. Violating the hierarchy (Document in Document, Link outside Paragraph, etc.) will produce a 422 from the CMA. See `ARCHITECTURE.md` for the full rule set.
- **The `CMACallback.onFailure()` default implementation is empty.** Code that needs to handle failures must override it explicitly. This is a common source of silently dropped errors.
- **Test files are Kotlin; production code is Java.** Keep this split. Do not introduce Kotlin into `src/main/java/`.
- **Checkstyle is enforced on every build (`./mvnw verify`).** Violations fail CI. The config is in `checkstyle.xml` at the repo root.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incomplete Invariants Documentation

AGENTS.md omits critical invariants documented in .bito/guidelines/domain-invariants.txt, such as public API stability rules and sensitive logging constraints. Since AGENTS.md is the authoritative guide for sharp edges, it should include all invariants to prevent violations.

Code Review Run #97a6fb


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@bito-code-review
Copy link
Copy Markdown

✅ Review Settings Overridden

Status: Overridden Successfully

Guidelines:

  • Accepted:

    • General : Review Posture, Domain Invariants
  • Rejected: Repo Truth And Alignment (parse error)

Note: Extra guidelines beyond 3 general purpose guidelines and 1 language specific guideline per language are not processed. Guidelines are fetched from the source branch.

- CONTRIBUTING.md: CI uses `./mvnw -B verify` for checkstyle, not `./mvnw -B test`
- AGENTS.md: relabel build commands so `./mvnw -B test` is NOT described as "full verification"; `./mvnw -B verify` is the full check
- ADR-0005: correct kotlin-stdlib framing from "internal use" to "transitive runtime dependency for consumers", with Android jar-size callout
bito-code-review[bot]
bito-code-review Bot previously approved these changes May 12, 2026
@tylerpina Tyler Pina (tylerpina) marked this pull request as ready for review May 12, 2026 17:22
@tylerpina Tyler Pina (tylerpina) requested a review from a team as a code owner May 12, 2026 17:22
- Fix module list in domain-invariants.txt: remove environments/uiExtensions (they support environment scope), add previewApiKeys (verified by grep)
- Fix ADR 0005 sharp edge: Kotlin plugin does scan src/main/java in sourceDirs; clarify that .kt files must not be added there
- Fix CONTRIBUTING.md: CI runs ./mvnw -B test, not verify — checkstyle is not enforced in CI
- Fix README.md: convert Agent & Contributor Context heading from === underline style to ## to match rest of file
- Add missing AGENTS.md invariants: public API stability rules and sensitive logging constraint
- Correct AGENTS.md checkstyle note: violations do not fail CI (CI skips verify)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tylerpina Tyler Pina (tylerpina) merged commit 99507cb into master May 12, 2026
9 checks passed
@tylerpina Tyler Pina (tylerpina) deleted the docs/seed-golden-context branch May 12, 2026 17:30
@bito-code-review
Copy link
Copy Markdown

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

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.

1 participant