Skip to content

Record what a resource declared about its lifetime - #196

Merged
koriym merged 2 commits into
bearsunday:1.xfrom
koriym:expiry-policy-log
Aug 19, 2026
Merged

Record what a resource declared about its lifetime#196
koriym merged 2 commits into
bearsunday:1.xfrom
koriym:expiry-policy-log

Conversation

@koriym

@koriym koriym commented Aug 17, 2026

Copy link
Copy Markdown
Member

Closes #186.

#[Cacheable] defaults to expiry: 'never', and Expiry turns that into a finite number - 31536000 in a default install, whatever an application binds otherwise. So an entry meant to live until invalidation logs the same lifetime as a deliberate 1-year TTL, and the reader is left inferring intent from a number whose meaning is a deployment detail.

cache_policy records the declaration where QueryRepository reads it. Exactly one of expiry / expirySecond / expiryAt is non-null - the one the precedence in getExpiryTime() picked - beside the resolvedTtl it produced:

cache_policy uri=app://self/user?id=1 expiry=never resolvedTtl=31536000
save_etag    uri=app://self/user?id=1 requestedTtl=31536000 saved=true
save_value   uri=app://self/user?id=1 requestedTtl=31536000 saved=true

Storage never learns about policies: the repository logs what it already knows, and ResourceStorageInterface is untouched.

Scope

#[Cacheable] only. Donut writes take their lifetime as a putDonut($ro, $ttl, $sMaxAge) argument, which put_donut already records - there is no preset to lose.

Notes

The schema does not enum the presets. A closed set makes the demo-coverage gate demand a demo per value, and demonstrating #[Cacheable]'s vocabulary proves nothing about the cache log; the vocabulary is in the field description instead.

Based on #191 (the test resolves the logger by its qualifier). Merge that first.

A TTL cannot say whether an entry is meant to expire. `#[Cacheable]` defaults to
`expiry: 'never'`, which resolves to a finite number - 31536000 in a default install, and
whatever an application binds `Expiry` to otherwise - so an entry that lives until
invalidation logs exactly like a deliberate 1-year TTL. The reader was left inferring intent
from a number whose meaning is a deployment detail.

`cache_policy` records the declaration instead, where it is read: exactly one of `expiry`,
`expirySecond` or `expiryAt` is non-null, the one the precedence in getExpiryTime() picked,
beside the TTL it resolved to. The schema does not enum the presets: a closed set would make
the demo-coverage gate demand a demo per preset, and demonstrating `#[Cacheable]`'s vocabulary
proves nothing about the cache log.
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e7b22d6-7835-4833-a1fe-e5180b826b1d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a392e21) to head (58980ce).

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x      #196   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       478       483    +5     
===========================================
  Files             93        94    +1     
  Lines           1271      1281   +10     
===========================================
+ Hits            1271      1281   +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Conflicts:
#	docs/reading-the-log.ja.md
#	docs/reading-the-log.md
@koriym
koriym merged commit a08e747 into bearsunday:1.x Aug 19, 2026
20 checks passed
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.

Expiry policy visibility in the semantic log (enhancement)

1 participant