Skip to content

Merge complementary cached article sections - #106

Merged
mjc merged 3 commits into
nntpp-30-negative-availability-ttlfrom
nntpp-31-cache-section-merge
Sep 11, 2026
Merged

mjc merged 3 commits into
nntpp-30-negative-availability-ttlfrom
nntpp-31-cache-section-merge

Conversation

@mjc

@mjc mjc commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • preserve retained HEAD data across successful status updates
  • merge compatible HEAD and BODY sections into a complete ARTICLE payload
  • require matching message identity and article number before combining sections

Branch-added tests

  • A successful status update test verifies a retained HEAD section survives the metadata refresh.
  • A complementary-section test verifies matching HEAD and BODY data becomes an ARTICLE while incompatible identity or number data does not merge.
  • Existing article cache hit, ingest, and response-shape coverage remains green.

Copilot AI lite review requested due to automatic review settings September 5, 2026 21:48
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4a23fb7f-35fe-4baf-a019-ee342f6d97d7

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tier-aware TTL handling during merges/status refreshes and missing negative-case tests leave correctness/operational behavior mismatched with the PR’s stated intent.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR extends the hybrid article cache to retain cached HEAD payloads across successful status-only refreshes, and to merge complementary cached HEAD/BODY sections into a complete ARTICLE entry when compatible.

Changes:

  • Adds HEAD+BODY → ARTICLE merge support during upsert_ingest_for_slot when an existing entry and a new entry contain complementary sections.
  • Adjusts status-only refresh logic so it no longer overwrites retained HEAD payloads.
  • Adds unit tests for retained HEAD survival across status updates and for the happy-path complementary merge.
File summaries
File Description
src/cache/hybrid.rs Attempts an in-place merge of an existing cached section with a newly ingested complementary section before falling back to size/semantic overwrite rules.
src/cache/hybrid_codec.rs Implements section-merge logic on DiskCachedArticle, narrows when status-only refresh overwrites payload, and adds merge/status-refresh tests.
Review details

Suppressed comments (1)

src/cache/hybrid_codec.rs:692

  • record_backend_has_status no longer updates tier unless the payload is Missing/AvailabilityOnly. With the new goal of preserving HEAD across status updates, this means a successful status refresh from a higher-tier backend won't extend the entry's tier-aware TTL, potentially increasing repeat queries against that backend.
        if matches!(
            self.payload,
            CachedPayload::Missing | CachedPayload::AvailabilityOnly
        ) {
            self.status_code = status_code;
            self.payload = CachedPayload::AvailabilityOnly;
            self.tier = tier;
        }
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cache/hybrid_codec.rs
Comment thread src/cache/hybrid_codec.rs
@mjc
mjc force-pushed the nntpp-30-negative-availability-ttl branch from da90e7c to 5f6a4cd Compare September 5, 2026 23:28
@mjc
mjc force-pushed the nntpp-31-cache-section-merge branch from beb575e to 8526697 Compare September 5, 2026 23:28
@mjc
mjc merged commit ebf628a into nntpp-30-negative-availability-ttl Sep 11, 2026
8 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.

2 participants