Skip to content

docs: seed Golden Context - #277

Draft
ethan ozelius (ethan-ozelius-contentful) wants to merge 7 commits into
masterfrom
docs/seed-golden-context
Draft

docs: seed Golden Context#277
ethan ozelius (ethan-ozelius-contentful) wants to merge 7 commits into
masterfrom
docs/seed-golden-context

Conversation

@ethan-ozelius-contentful

@ethan-ozelius-contentful ethan ozelius (ethan-ozelius-contentful) commented May 5, 2026

Copy link
Copy Markdown

Summary

  • Seeded Golden Context documentation for contentful.rb
  • Generated from codebase analysis, git archaeology (initial commit through v2.19), and Glean research (Confluence Ruby SDK release guide + org context)

Artifacts Created

  • README.md — appended agent section
  • ARCHITECTURE.md — internal structure, mermaid context diagram, data flow, domain concepts, configuration reference, operational knowledge
  • CONTRIBUTING.md — full dev setup, commands, testing, release process (replaced minimal stub)
  • docs/ADRs/ — 5 architecture decision records (v2.0 hierarchy, camelCase option, http gem, CI migration, taxonomy endpoints)
  • docs/specs/ — scaffolded directory for active implementation specs
  • AGENTS.md — agent-facing routing table with sharp edges and invariants
  • .bito.yaml + .bito/guidelines/ — Bito review configuration (3 guideline files)

Newcomer Simulation Score

Run /newcomer-simulation after merging to score this PR. Target: ≥80% of onboarding questions answered. Failures indicate gaps to address in follow-up PRs.

Flagged Items (require human action)

  • No .ruby-version file — CI tests Ruby 3.2–3.4 via devcontainer, but there's no .ruby-version pinning for engineers who develop natively without Docker. Recommend adding .ruby-version with 3.4 (latest tested version).
  • ARCHITECTURE.md → Monitoring and Incident Playbook sections left as [NEEDS TEAM INPUT] stubs — this is a client library with no server-side infra, so these sections are minimal by nature.
  • No .npmrc / packageManager — N/A (Ruby gem, not Node)

ADRs Generated

  • 001 — v2.0 Resource Hierarchy Refactor (2017): BaseResource → FieldsResource → Entry/Asset hierarchy, removed legacy classes, added include depth cap
  • 002use_camel_case Client Option (2017): opt-in camelCase accessor support for isomorphic apps
  • 003http gem as HTTP Client (2021): chosen for gzip/proxy/instrumentation support over net/http and Faraday
  • 004 — CI Migration Travis → CircleCI → GitHub Actions Devcontainer (2022–2026): CI environment now exactly matches local dev via devcontainer
  • 005 — Taxonomy Endpoints v2.18 (2025): TaxonomyConcept + TaxonomyConceptScheme added for SKOS-style hierarchical tagging

Coverage Before / After

  • Before: 2/8 canonical artifacts present (README, CONTRIBUTING stub)
  • After: 8/8 canonical artifacts present

Generated with Claude Code

Summary by Bito

Seeded Golden Context documentation for contentful.rb, adding comprehensive repository documentation including architecture guides, contributing guidelines, agent instructions, and historical decision records to improve developer experience and AI agent understanding.

Detailed Changes
  • Added comprehensive architecture documentation in ARCHITECTURE.md covering system context, internal structure, data flow, domain concepts, configuration reference, and operational knowledge
  • Created AGENTS.md as a routing guide for AI agents with sharp edges, invariants, integration points, and build quality instructions
  • Added 5 architecture decision records documenting key historical choices including v2.0 resource hierarchy, camelCase option, HTTP client selection, CI migration, and taxonomy endpoints
  • Updated CONTRIBUTING.md with detailed development setup, testing workflows, code style conventions, and release process instructions
  • Added Bito configuration files for automated code review with domain invariants and repository-specific guidelines

@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
Added Bito AI code review configuration with domain invariants, repository boundaries, and review posture guidelines.
Documentation - Core Repository Documentation
Added comprehensive repository documentation including agent guide, architecture overview, contributing guidelines, and updated README.
Documentation - Architecture Decision Records
Added 5 architecture decision records documenting key historical decisions including resource hierarchy refactor, camelCase option, HTTP client choice, CI migration, and taxonomy endpoints.
Documentation - Specifications Directory Setup
Created specifications directory structure for active implementation specs.

@bito-code-review

Copy link
Copy Markdown

Impact Analysis by Bito

Interaction Diagram
sequenceDiagram
participant Dev as Developer
participant PR as Pull Request
participant Bito as Bito Review Tool
participant Yaml as .bito.yaml<br/>🟩 Added | ●●● High
participant Guide as Custom Guidelines<br/>🟩 Added | ●●● High
Dev->>PR: Submit pull request with code changes
PR->>Bito: Trigger automated review process
Bito->>Yaml: Read review configuration
Yaml-->>Bito: Return enabled features (comprehensive mode, sequence diagrams)
Bito->>Guide: Load custom guidelines from paths
Guide-->>Bito: Provide review posture and domain invariants
Bito->>Bito: Apply guidelines to analyze changes
Bito->>PR: Generate review comments and suggestions
PR-->>Dev: Display feedback in pull request
Note over Yaml, Guide: Configuration enables structured review workflow
Note over Bito: Review tool uses added config for enhanced analysis
Loading

This MR adds automated code review configuration to the contentful.rb repository, introducing .bito.yaml with enabled features like comprehensive suggestions and sequence diagrams, along with custom guidelines for review posture, domain invariants, and repo boundaries. These changes enhance the development workflow by providing structured guidance during pull request reviews without altering runtime SDK behavior. No direct upstream or downstream code impacts detected in the repository analysis.

Code Paths Analyzed

Impact:
This PR is documentation-only — adds comprehensive project context files (.bito.yaml, AGENTS.md, ARCHITECTURE.md, CONTRIBUTING.md updates, README.md update, and 5 ADRs in docs/ADRs/). No code changes, no API surface modifications, no breaking changes.

Flow:
N/A — no runtime code paths affected. Documentation describes existing architecture: Client → Request → HTTP → Response → ResourceBuilder → typed resources (Entry, Asset, ContentType, etc.).

Direct Changes (Diff Files):
• .bito.yaml [1-17] — New Bito AI configuration file for PR review automation
• .bito/guidelines/domain-invariants.txt [1-34] — New file documenting critical SDK invariants (read-only, snake_case default, resource registration, include resolution depth, etc.)
• .bito/guidelines/repo-truth-and-boundaries.txt [1-9] — New file defining review posture — use README, ARCHITECTURE, AGENTS, ADRs as authoritative context
• .bito/guidelines/review-posture.txt [1-8] — New file defining tech lead review expectations for public-facing gem
• AGENTS.md [1-56] — New comprehensive guide for AI agents — quick reference, sharp edges, key conventions, integration points
• ARCHITECTURE.md [1-194] — New architecture documentation — system context, internal structure, data flow, domain concepts, dependencies, configuration, operational knowledge
• CONTRIBUTING.md [1-169] — Major rewrite — expanded prerequisites, dev container workflow, native setup, commands reference, testing, style, commit conventions, branch strategy, release process, CI/CD, sensitive files
• README.md [775-780] — Minor addition — 'For AI Agents' section linking to AGENTS.md
• docs/ADRs/2017-01-19-v2-resource-hierarchy.md [1-40] — New ADR documenting v2.0 resource hierarchy refactor (BaseResource, FieldsResource, Entry, Asset)
• docs/ADRs/2017-10-12-use-camel-case-option.md [1-29] — New ADR documenting use_camel_case client option decision
• docs/ADRs/2021-11-23-http-gem-as-http-client.md [1-29] — New ADR documenting http gem selection as HTTP client
• docs/ADRs/2022-02-11-ci-migration-github-actions.md [1-27] — New ADR documenting CI migration from Travis → CircleCI → GitHub Actions (devcontainer)
• docs/ADRs/2025-07-24-taxonomy-endpoints.md [1-28] — New ADR documenting Taxonomy endpoints support (v2.18)
• docs/ADRs/README.md [1-11] — New ADR index file
• docs/specs/README.md [1-7] — New specs directory placeholder

Repository Impact:
Developer onboarding: New AGENTS.md, ARCHITECTURE.md, and expanded CONTRIBUTING.md significantly reduce ramp-up time for new contributors and AI agents
Code review process: .bito.yaml and .bito/guidelines/ establish automated review context — reviewers (human or AI) now have domain invariants and review posture documented
Historical decision transparency: 5 ADRs capture key architectural decisions (v2 hierarchy, camelCase option, http gem, CI migration, taxonomy) that were previously only in git history/CHANGELOG

Cross-Repository Dependencies:
None.

Database/Caching Impact:
• None

API Contract Violations:
None.

Infrastructure Dependencies:
None.

Additional Insights:
Documentation accuracy verification: Documentation was generated by 'seed-golden-context' tool (see <!-- Generated by seed-golden-context --> comments). Reviewers should verify it matches actual code — e.g., confirm ResourceBuilder::DEFAULT_RESOURCE_MAPPING and BUILDABLES are correctly described, confirm Bundler 2.3.26 is still pinned in devcontainer, confirm master branch is still default

Testing Recommendations

Frontend Impact:
• No issues detected — documentation-only change

Service Integration:
• No issues detected — documentation-only change

Data Serialization:
• No issues detected — documentation-only change

Privacy Compliance:
• No issues detected — documentation-only change

Backward Compatibility:
• No issues detected — documentation-only change

OAuth Functionality:
• None

Cross-Service Communication:
• No issues detected — documentation-only change

Reliability Testing:
• None

Additional Insights:
• Verify generated documentation accuracy: Check that AGENTS.md 'Sharp Edges' match actual code behavior (e.g., reuse_entries + caching incompatibility, ContentTypeCache global scope)
• Verify ADR dates and commit references (e.g., 5592c5b, 73388a8) exist in git history
• Verify .bito.yaml exclude_files pattern 'Gemfile.lock' is correct for this repo
• Consider adding a CI check that fails if documentation becomes stale (e.g., verify ADR commit SHAs still exist)

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Agent Run #9a610f

Actionable Suggestions - 4
  • CONTRIBUTING.md - 1
  • AGENTS.md - 2
  • docs/ADRs/2017-10-12-use-camel-case-option.md - 1
    • Inconsistent Module Capitalization · Line 19-19
Additional Suggestions - 1
  • ARCHITECTURE.md - 1
    • Config defaults mismatch · Line 152-153
      The configuration table incorrectly states defaults for `logger` (should be `false`, not `nil`) and `log_level` (no default value exists in code; it uses the provided logger's level if set). This could mislead users expecting these defaults. Update to match the actual implementation in `lib/contentful/client.rb`.
Review Details
  • Files reviewed - 15 · Commit Range: 7448550..a3c9461
    • .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/2017-01-19-v2-resource-hierarchy.md
    • docs/ADRs/2017-10-12-use-camel-case-option.md
    • docs/ADRs/2021-11-23-http-gem-as-http-client.md
    • docs/ADRs/2022-02-11-ci-migration-github-actions.md
    • docs/ADRs/2025-07-24-taxonomy-endpoints.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
- **Key rules:** `Encoding` is disabled; `Metrics/ClassLength` max is 280; `Metrics/ParameterLists` max is 6
- **Key style:** `Style/SignalException` uses semantic style (`raise` vs `fail`)
- **Field accessor naming:** All field accessors use `snake_case` by default. The `use_camel_case: true` client option exists for isomorphic apps — don't assume either style in library internals
- **Frozen string literals:** `# frozen_string_literal: true` at top of each `lib/` file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Documentation Inaccuracy

The documentation claims frozen_string_literal is present at the top of each lib/ file, but only 4 out of 31 lib/contentful/*.rb files have it (verified via file count). This may confuse contributors about style expectations. Update the doc to match code or enforce the convention.

Code Review Run #9a610f


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

  • Yes, avoid them

Comment thread AGENTS.md
- **`reuse_entries: true` is incompatible with caching.** Rails.cache and similar caching layers can cause marshal/stack errors when this option is enabled. Do not enable both.
- **No environment variables.** The library reads no `ENV` vars. All configuration is passed via `Contentful::Client.new(...)`.
- **`ContentTypeCache` is global and mutable.** `ContentTypeCache.cache_get/set` is keyed by `space_id:content_type_id`. In multi-tenant or multi-space apps, cache collisions are possible if two spaces share content type IDs.
- **Bundler version is pinned.** CI and devcontainer use Bundler `2.3.26`. Use `bundle _2.3.26_ install` — `bundle install` alone may use a different version.

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 CI Bundler version

The CI config (.circleci/local-config.yml) installs Bundler 1.10.6, not 2.3.26 as stated. Devcontainer does use 2.3.26, but the claim about CI is inaccurate.

Code Review Run #9a610f


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

  • Yes, avoid them

Comment thread AGENTS.md
- **Branch strategy:** `master` + feature branches; open PRs to `master`
- **Test location:** `spec/` — mirrors `lib/contentful/` one spec file per source file
- **Ruby style:** `snake_case` methods and variables, `frozen_string_literal: true` on all `lib/` files
- **HTTP mocking:** VCR + WebMock — never make live API calls in tests

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 frozen_string_literal claim

Not all lib/ files have frozen_string_literal: true; only 4 out of 31 do. The statement 'on all lib/ files' is incorrect.

Code Review Run #9a610f


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

  • Yes, avoid them


- All field accessor methods use `camelCase` (e.g., `entry.myField` instead of `entry.my_field`)
- All `sys` and `fields` hash keys are `camelCase` symbols
- The `support.rb` `snakify` utility accepts the `use_camel_case` flag and short-circuits accordingly

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent Module Capitalization

Inconsistent capitalization of the Support module reference in the ADR. Line 19 refers to "support.rb" (lowercase), but line 28 uses "Support.snakify" (capital). This could confuse readers about the correct module name. Change "support.rb" to "Support" for consistency.

Code suggestion
Check the AI-generated fix before applying
Suggested change
- The `support.rb` `snakify` utility accepts the `use_camel_case` flag and short-circuits accordingly
The `Support` `snakify` utility accepts the `use_camel_case` flag and short-circuits accordingly

Code Review Run #9a610f


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.

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