docs(internal): update feature flags docs for cohort preloading in hypercache#52194
docs(internal): update feature flags docs for cohort preloading in hypercache#52194inkeep[bot] wants to merge 2 commits intomasterfrom
Conversation
Updates internal documentation for PR #52023: - Add `cohorts` field to cache payload structure - Add Cohort preloading subsection (BFS, batch, rolling deploy safety) - Update Cohort cache invalidation entry (recalculation-only saves skipped) - Add Cohort signal handlers to signal handlers table
…2023) - Add cohorts field to HyperCache JSON example - Update backwards compatibility section to cover cohorts - Add Cohort data source subsection explaining preloaded vs fallback paths - Rename Cohort caching to Cohort caching (fallback) with context - Update data fetching strategy to reflect preloading behavior - Document flags_cohort_source_total metric
Prompt To Fix All With AIThis is a comment left during a code review.
Path: docs/internal/feature-flags/hypercache-system.md
Line: 144-148
Comment:
**Redundant table structure for `cohorts` field**
The section header is "The `cohorts` field:" and then the sole table row is also `cohorts`. This differs from the `evaluation_metadata` table just above it, where the rows document the *sub-fields* within `evaluation_metadata` (e.g., `dependency_stages`, `flags_with_missing_deps`, `transitive_deps`).
Since `cohorts` is a flat list rather than a nested object, there are no sub-fields to enumerate. The current table just re-states the field name, which may confuse readers who expect the table to describe the structure of the cohort dict objects within the list. Consider replacing the table with inline prose, or documenting the key fields of each cohort dict:
```markdown
The `cohorts` field is a `list[dict] | null` containing the serialized cohort definitions referenced by the team's flags, including transitive cohort-on-cohort dependencies. It is optional and absent in older cache entries. Each dict mirrors the `Cohort` model serialization used by the existing `CohortCacheManager`.
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: docs/internal/feature-flags/flag-evaluation-engine.md
Line: 320-327
Comment:
**"Backwards compatibility" heading removed**
The previous version had `#### Backwards compatibility` as a named subsection, which allowed direct linking (e.g., `#backwards-compatibility`). The updated text keeps the content but demotes it to an unlabelled paragraph. Given that the backwards compatibility guarantees are now more complex (covering both `evaluation_metadata` and `cohorts`), this section arguably deserves its heading more than before. Consider restoring it:
```suggestion
#### Backwards compatibility
The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata` and `cohorts`:
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "docs: update flag evaluation engine docs..." | Re-trigger Greptile |
| The `cohorts` field: | ||
|
|
||
| | Field | Type | Description | | ||
| | --------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `cohorts` | `list[dict]` \| `null` | Serialized cohort definitions referenced by the team's flags, including transitive cohort-on-cohort dependencies. Optional — absent in older cache entries. | |
There was a problem hiding this comment.
Redundant table structure for
cohorts field
The section header is "The cohorts field:" and then the sole table row is also cohorts. This differs from the evaluation_metadata table just above it, where the rows document the sub-fields within evaluation_metadata (e.g., dependency_stages, flags_with_missing_deps, transitive_deps).
Since cohorts is a flat list rather than a nested object, there are no sub-fields to enumerate. The current table just re-states the field name, which may confuse readers who expect the table to describe the structure of the cohort dict objects within the list. Consider replacing the table with inline prose, or documenting the key fields of each cohort dict:
The `cohorts` field is a `list[dict] | null` containing the serialized cohort definitions referenced by the team's flags, including transitive cohort-on-cohort dependencies. It is optional and absent in older cache entries. Each dict mirrors the `Cohort` model serialization used by the existing `CohortCacheManager`.Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/internal/feature-flags/hypercache-system.md
Line: 144-148
Comment:
**Redundant table structure for `cohorts` field**
The section header is "The `cohorts` field:" and then the sole table row is also `cohorts`. This differs from the `evaluation_metadata` table just above it, where the rows document the *sub-fields* within `evaluation_metadata` (e.g., `dependency_stages`, `flags_with_missing_deps`, `transitive_deps`).
Since `cohorts` is a flat list rather than a nested object, there are no sub-fields to enumerate. The current table just re-states the field name, which may confuse readers who expect the table to describe the structure of the cohort dict objects within the list. Consider replacing the table with inline prose, or documenting the key fields of each cohort dict:
```markdown
The `cohorts` field is a `list[dict] | null` containing the serialized cohort definitions referenced by the team's flags, including transitive cohort-on-cohort dependencies. It is optional and absent in older cache entries. Each dict mirrors the `Cohort` model serialization used by the existing `CohortCacheManager`.
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| 4. Track missing dependencies (flags depending on non-existent flags) | ||
| 5. Compute topological evaluation stages using Kahn's algorithm | ||
|
|
||
| #### Backwards compatibility | ||
| The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata` and `cohorts`: | ||
|
|
||
| The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata`: | ||
|
|
||
| - **Old Rust + new cache**: `evaluation_metadata` is an unknown field, ignored. Falls back to petgraph. | ||
| - **New Rust + old cache**: `evaluation_metadata` absent → `None` → falls back to petgraph. | ||
| - **New Rust + new cache**: `evaluation_metadata` present → fast pre-computed path. | ||
| - **Old Rust + new cache**: Unknown fields (`evaluation_metadata`, `cohorts`) are ignored. Falls back to petgraph and `CohortCacheManager`. | ||
| - **New Rust + old cache**: Fields absent → `None` → falls back to petgraph and `CohortCacheManager`. | ||
| - **New Rust + new cache**: `evaluation_metadata` present → fast pre-computed dependency path. `cohorts` present → skip `CohortCacheManager` PG query. |
There was a problem hiding this comment.
"Backwards compatibility" heading removed
The previous version had #### Backwards compatibility as a named subsection, which allowed direct linking (e.g., #backwards-compatibility). The updated text keeps the content but demotes it to an unlabelled paragraph. Given that the backwards compatibility guarantees are now more complex (covering both evaluation_metadata and cohorts), this section arguably deserves its heading more than before. Consider restoring it:
| 4. Track missing dependencies (flags depending on non-existent flags) | |
| 5. Compute topological evaluation stages using Kahn's algorithm | |
| #### Backwards compatibility | |
| The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata` and `cohorts`: | |
| The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata`: | |
| - **Old Rust + new cache**: `evaluation_metadata` is an unknown field, ignored. Falls back to petgraph. | |
| - **New Rust + old cache**: `evaluation_metadata` absent → `None` → falls back to petgraph. | |
| - **New Rust + new cache**: `evaluation_metadata` present → fast pre-computed path. | |
| - **Old Rust + new cache**: Unknown fields (`evaluation_metadata`, `cohorts`) are ignored. Falls back to petgraph and `CohortCacheManager`. | |
| - **New Rust + old cache**: Fields absent → `None` → falls back to petgraph and `CohortCacheManager`. | |
| - **New Rust + new cache**: `evaluation_metadata` present → fast pre-computed dependency path. `cohorts` present → skip `CohortCacheManager` PG query. | |
| #### Backwards compatibility | |
| The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata` and `cohorts`: |
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/internal/feature-flags/flag-evaluation-engine.md
Line: 320-327
Comment:
**"Backwards compatibility" heading removed**
The previous version had `#### Backwards compatibility` as a named subsection, which allowed direct linking (e.g., `#backwards-compatibility`). The updated text keeps the content but demotes it to an unlabelled paragraph. Given that the backwards compatibility guarantees are now more complex (covering both `evaluation_metadata` and `cohorts`), this section arguably deserves its heading more than before. Consider restoring it:
```suggestion
#### Backwards compatibility
The two paths are fully compatible via `#[serde(default)]` on `evaluation_metadata` and `cohorts`:
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Updates internal engineering documentation to reflect the cohort preloading changes from PR #52023.
Changes
docs/internal/feature-flags/hypercache-system.mdcohortsarray fieldcohortsfield in the payload table_get_referenced_cohortsextracts cohort IDs fromgroupsonly (notsuper_groupsor holdouts)_load_cohorts_with_depswith depth limit 20, cycle-safeOption::take()withCohortCacheManagerfallbackNone)cohort_changed_flags_cachesignal handler entries to the signal handlers tabledocs/internal/feature-flags/flag-evaluation-engine.mdcohortsfieldcohortsalongsideevaluation_metadataflags_cohort_source_totalmetricRelated
This PR was created by the Inkeep Content Writer agent, which is maintained by the Docs and Wizard team. Please reach out on Slack for help if needed.