foundation capa

foundation-refresh-policy

Provider-agnostic override -> full-scan -> incremental -> bootstrap sync-strategy decision logic

Provider-agnostic override -> full-scan -> incremental -> bootstrap sync-strategy decision logic

Tierfoundation
Roleunclassified (baselined)
Pathcrates/foundation/refresh-policy
Edition2021
Targetsfoundation_refresh_policy
Public items6 across 2 modules
Tests7

What it is for

# foundation-refresh-policy

Provider-agnostic sync-strategy decision logic: given the current state (an explicit override, a full-scan flag, and any stored cursor), decides whether the next sync should use a caller-pinned override, a full scan, resume incrementally from a cursor, or bootstrap with a default window.

Lifted (decision logic only) from rust-gmail-manager/src/services/sync_service.rs's build_sync_query — see CHANGELOG.md for the Gate 4.5 provenance note and README.md for the full design rationale.

Scope boundary: this crate does no I/O, no provider-specific fetching, and no worker/scheduling loop. It answers one question — which SyncStrategy applies next — and nothing else. The worker loop that acts on the decision lives in operations-mail-sync (sprint 3.45 crate 10).

Capabilities

policy (other)

RefreshPolicy — the override -> full scan -> incremental -> bootstrap

Item
pub const DEFAULT_BOOTSTRAP_WINDOW_DAYS: i64

RefreshPolicy

RefreshPolicy — the override -> full scan -> incremental -> bootstrap

Item
pub struct RefreshPolicy
RefreshPolicy :: fn default() -> Self
RefreshPolicy :: fn with_bootstrap_window(bootstrap_window : chrono::Duration) -> Self
RefreshPolicy :: fn decide(& self, override_filter : Option <& str>, full : bool, cursor : Option <& Cursor>,) -> SyncStrategy

SyncStrategy

The decision output: which strategy the next sync should use.

Item
pub enum SyncStrategy

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

foundation_refresh_policy

flowchart TD
  n_foundation_refresh_policy["foundation_refresh_policy"]
  n_foundation_refresh_policy --> n_policy["policy"]
  n_foundation_refresh_policy --> n_strategy["strategy"]

Public surface

`policy`

ItemWhat it is
pub const DEFAULT_BOOTSTRAP_WINDOW_DAYS: i64The default bootstrap window when no policy-specific override is given: 30 days, matching the source's newer_than:30d Gmail-query fallback (rust-gmail-manager/src/services/sync_service.rs).
pub struct RefreshPolicyA sync-strategy decision policy: given the current state (an explicit override, a full-scan flag, and any stored cursor), decides which SyncStrategy the next sync run should use
RefreshPolicy :: fn default() -> Self
RefreshPolicy :: fn with_bootstrap_window(bootstrap_window : chrono::Duration) -> SelfA policy with a caller-chosen bootstrap window instead of the 30-day default.
RefreshPolicy :: fn decide(& self, override_filter : Option <& str>, full : bool, cursor : Option <& Cursor>,) -> SyncStrategyDecide the next sync strategy

`strategy`

ItemWhat it is
pub enum SyncStrategyWhat the next sync run should do, per the override -> full scan -> incremental -> bootstrap precedence chain in crate::RefreshPolicy::decide

Re-exports. Exported here, defined elsewhere.

ExportDefined in
SyncStrategystrategy::SyncStrategy
{RefreshPolicy,DEFAULT_BOOTSTRAP_WINDOW_DAYS}policy::{RefreshPolicy,DEFAULT_BOOTSTRAP_WINDOW_DAYS}

Boundary

Depends on no other workspace tier.

Shares tier foundation with 27 other crates: foundation-audit-log, foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, … (27 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)foundation
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/foundation/refresh-policy
Vocabulary in force (lexicon)current

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-mail-message`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
serde_json^1noalways

Build. None.

Depended on by. 2 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_operations_mail_sync["operations-mail-sync"] -->|uses| SELF
  n_tools_mail_manager["tools-mail-manager"] -->|uses| SELF
  SELF["foundation-refresh-policy"]
  SELF -->|runtime| n_foundation_mail_message["foundation-mail-message"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libfoundation_refresh_policy`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

2 workspace crates depend on this one: operations-mail-sync, tools-mail-manager.

Verification

KindCount
Unit tests7
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
policy203
strategy101

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc56
Public modules with a //! block22
pie showData
    title Public items with rustdoc
    "Documented" : 5
    "No rustdoc detected" : 1

Metrics

MetricValue
Rust source files3
Source lines212
Code lines124
Public API items6
Public modules2
Tests7
Examples0
Cargo features0
Direct runtime dependencies3
Workspace reverse dependencies2
pie showData
    title Public API by kind
    "constant" : 1
    "enum" : 1
    "method" : 3
    "struct" : 1
pie showData
    title Rust source composition
    "Code" : 124
    "Blank or comment" : 88

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las foundation · Manual