Skip to content

docs: respect banner expires field#862

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

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

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: small, isolated change to docs banner rendering that only adds a time-based guard and falls back to existing behavior when expires is missing/invalid.

Overview
The docs site banner now supports an optional expires field from banner.json and will skip rendering when the timestamp has passed.

Adds a small isExpired helper (treats missing or invalid dates as not expired) and wires it into initBanner before the local dismissal check.

Reviewed by Cursor Bugbot for commit 326346c. 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

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR adds support for an optional expires (ISO-8601 string) field to the banner JSON schema so that banners are automatically suppressed once their expiry time has passed. The implementation is minimal and correct, with a graceful fallback for missing or unparseable expiry values.

Confidence Score: 5/5

Safe to merge — change is minimal, correct, and purely additive.

The isExpired helper correctly handles all edge cases (undefined, NaN, past, future). No existing behavior is altered when expires is absent. No P0/P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
docs/.vitepress/theme/banner.ts Adds expires?: string to BannerData and an isExpired guard in initBanner; logic is correct and handles undefined, invalid strings, and past/future dates.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[fetch banner.json] --> B{r.ok?}
    B -- No --> Z[no-op]
    B -- Yes --> C{b.enabled?}
    C -- No --> Z
    C -- Yes --> D{isExpired b.expires}
    D -- Yes --> Z
    D -- No --> E{dismissed in localStorage?}
    E -- Yes --> Z
    E -- No --> F[render banner]

    subgraph isExpired
        G{expires defined?} -- No --> H[return false]
        G -- Yes --> I[Date.parse expires]
        I --> J{NaN?}
        J -- Yes --> H
        J -- No --> K{Date.now >= t?}
        K -- Yes --> L[return true]
        K -- No --> H
    end
Loading

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

@jdx jdx enabled auto-merge (squash) April 23, 2026 21:26
@jdx jdx merged commit b809416 into main Apr 23, 2026
22 checks passed
@jdx jdx deleted the claude/banner-expires branch April 23, 2026 21:40
@jdx jdx mentioned this pull request Apr 23, 2026
jdx added a commit that referenced this pull request Apr 24, 2026
### 🐛 Bug Fixes

- **(git)** skip untracked scan when HK_STASH_UNTRACKED=false by
[@jdx](https://github.com/jdx) in
[#861](#861)
- **(run)** add post-commit and pre-rebase subcommands by
[@jdx](https://github.com/jdx) in
[#858](#858)

### 📚 Documentation

- **(install)** recommend global hooks as primary setup path by
[@jdx](https://github.com/jdx) in
[#855](#855)
- add cross-site announcement banner by [@jdx](https://github.com/jdx)
in [#857](#857)
- respect banner expires field by [@jdx](https://github.com/jdx) in
[#862](#862)

### 🔍 Other Changes

- vendor bats test helpers instead of git submodules by
[@jdx](https://github.com/jdx) in
[#859](#859)

### 📦️ Dependency Updates

- bump communique to 1.0.3 by [@jdx](https://github.com/jdx) in
[#863](#863)
- update anthropics/claude-code-action digest to e58dfa5 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#864](#864)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk release bookkeeping only: version numbers, generated
CLI/docs, and lockfile dependency bumps with no runtime logic changes.
> 
> **Overview**
> **Release prep for `v1.44.1`.** Updates `Cargo.toml`/`Cargo.lock`
(including `libc`) and all version references in generated CLI docs
(`docs/cli/*`, `hk.usage.kdl`).
> 
> Refreshes documentation examples to reference the new `v1.44.1` Pkl
package URLs and adds the `1.44.1` entry to `CHANGELOG.md`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d7637d4. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: mise-en-dev <[email protected]>
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