Skip to content

docs: respect banner expires field#9334

Merged
jdx merged 1 commit intomainfrom
claude/banner
Apr 23, 2026
Merged

docs: respect banner expires field#9334
jdx merged 1 commit intomainfrom
claude/banner

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 23, 2026

Summary

  • Honors the new optional expires (ISO-8601) field in jdx.dev/banner.json
  • Banner is hidden once Date.now() >= Date.parse(expires)
  • No-op when expires is absent (preserves existing behavior)
  • Requires jdx/blog#65 to populate the field

Test plan

  • Set an expires in the past → banner hidden
  • Set an expires in the future → banner shown
  • No expires field → banner shown as before

🤖 Generated with Claude Code


Note

Low Risk
Low risk: adds a simple client-side guard to hide expired announcements; behavior is unchanged when expires is absent or invalid.

Overview
The docs site announcement banner now supports an optional expires timestamp from banner.json and will not render once the timestamp has passed.

This introduces an isExpired helper (tolerant of missing/invalid dates) and extends BannerData with an expires field, preserving existing behavior for banners without expiration.

Reviewed by Cursor Bugbot for commit 528d46b. Bugbot is set up for automated code reviews on this repo. Configure here.

The banner.json endpoint now includes an optional ISO-8601 `expires`
timestamp so announcements can auto-hide without a code change.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR adds optional expiry support to the site banner by honoring an expires ISO-8601 field from the remote banner.json. The implementation is minimal and correct — the isExpired helper guards against missing or malformed values, and the check is cleanly inserted before the render path.

Confidence Score: 5/5

Safe to merge — change is a small, well-guarded additive feature with no breaking behavior.

The implementation is minimal and handles all edge cases: absent expires is a no-op, an invalid/NaN date defaults to showing the banner, and the comparison operator is correct per the stated semantics. No existing behavior is broken.

No files require special attention.

Important Files Changed

Filename Overview
docs/.vitepress/theme/banner.ts Adds optional expires field to BannerData and an isExpired() guard that safely handles missing or unparseable values; logic and ordering look correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[initBanner called] --> B[fetch banner.json]
    B --> C{r.ok?}
    C -- No --> Z[return null]
    C -- Yes --> D[parse JSON as BannerData]
    D --> E{b exists AND b.enabled?}
    E -- No --> Z
    E -- Yes --> F{isExpired b.expires?}
    F -- Yes: Date.now >= Date.parse expires --> Z[return, hide banner]
    F -- No: no expires or future date --> G{localStorage === b.id?}
    G -- Yes: already dismissed --> Z
    G -- No --> H[render banner]
Loading

Reviews (1): Last reviewed commit: "docs: respect banner expires field" | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.19 x -- echo 21.6 ± 0.3 20.9 23.4 1.00
mise x -- echo 22.2 ± 0.3 21.5 23.5 1.03 ± 0.02

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.19 env 21.4 ± 0.7 20.4 26.0 1.00
mise env 21.7 ± 0.4 21.0 26.2 1.02 ± 0.04

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.19 hook-env 21.9 ± 0.3 21.3 23.5 1.00
mise hook-env 22.5 ± 0.3 21.6 23.9 1.02 ± 0.02

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.19 ls 20.1 ± 0.3 19.4 21.6 1.00
mise ls 20.9 ± 0.4 20.1 23.0 1.04 ± 0.02

xtasks/test/perf

Command mise-2026.4.19 mise Variance
install (cached) 162ms 166ms -2%
ls (cached) 76ms 78ms -2%
bin-paths (cached) 80ms 81ms -1%
task-ls (cached) 797ms 809ms -1%

@jdx jdx merged commit a8ecd71 into main Apr 23, 2026
39 checks passed
@jdx jdx deleted the claude/banner branch April 23, 2026 21:30
mise-en-dev added a commit that referenced this pull request Apr 24, 2026
### 🐛 Bug Fixes

- **(config)** resolve relative path: tool versions against config root
by @jdx in [#9320](#9320)
- **(lock)** resolve @latest and prune poisoned lockfile entries by @jdx
in [#9321](#9321)
- fix - be able to work with regex in attestation check by @monotek in
[#9327](#9327)

### 🚜 Refactor

- **(aqua)** bake aqua registry from merged yaml by @risu729 in
[#9043](#9043)

### 📚 Documentation

- add cross-site announcement banner by @jdx in
[#9326](#9326)
- keep banner height in sync via ResizeObserver by @jdx in
[#9330](#9330)
- respect banner expires field by @jdx in
[#9334](#9334)

### 📦️ Dependency Updates

- bump communique to 1.0.2 by @jdx in
[#9313](#9313)
- bump communique to 1.0.3 by @jdx in
[#9332](#9332)
- update actions/setup-node digest to 48b55a0 by @renovate[bot] in
[#9339](#9339)
- update ghcr.io/jdx/mise:alpine docker digest to a92efa5 by
@renovate[bot] in [#9340](#9340)
- update ghcr.io/jdx/mise:rpm docker digest to 5c24f69 by @renovate[bot]
in [#9343](#9343)
- update rust docker digest to e4f09e8 by @renovate[bot] in
[#9345](#9345)
- update rui314/setup-mold digest to 9c9c13b by @renovate[bot] in
[#9344](#9344)
- update ghcr.io/jdx/mise:deb docker digest to a3afe3e by @renovate[bot]
in [#9342](#9342)
- update ghcr.io/jdx/mise:copr docker digest to 4098d5a by
@renovate[bot] in [#9341](#9341)
- update taiki-e/install-action digest to 74e87cb by @renovate[bot] in
[#9346](#9346)

### Chore

- **(ci)** remove cargo-vendor install from ppa publish by @jdx in
[#9312](#9312)
- **(release)** publish snap to stable channel by @jdx in
[#9318](#9318)
- remove FUNDING.yml in favor of jdx/.github default by @jdx in
[#9331](#9331)

## 📦 Aqua Registry

Updated [aqua-registry](https://github.com/aquaproj/aqua-registry):
[v4.492.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.492.0)
->
[v4.498.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.498.0).

Included aqua-registry releases:

-
[v4.493.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.493.0)
-
[v4.494.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.494.0)
-
[v4.494.1](https://github.com/aquaproj/aqua-registry/releases/tag/v4.494.1)
-
[v4.495.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.495.0)
-
[v4.496.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.496.0)
-
[v4.497.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.497.0)
-
[v4.498.0](https://github.com/aquaproj/aqua-registry/releases/tag/v4.498.0)
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