Skip to content

SOW-0161: source-timestamp index counts the captured entry population once - #19

Open
ktsaou wants to merge 21 commits into
sow-0156/header-auditfrom
sow-0161/source-posting
Open

ktsaou wants to merge 21 commits into
sow-0156/header-auditfrom
sow-0161/source-posting

Conversation

@ktsaou

@ktsaou ktsaou commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Stacked on #18. Merge order: #13 → #14 → #15 → #16 → #17 → #18 → this. Completes SOW-0161 (.agents/sow/done/SOW-0161-20261017-file-indexer-source-posting-membership.md).

Decisions for review (agent-chosen, pending your review)

  1. Membership rule: the source-timestamp histogram uses the same rule the field-bitmap path already used.
    • Postings past the captured tail are ignored.
    • A posting the global entry array doesn't contain fails indexing (MissingOffset) on a stable file.
    • On a live file (online, or active file name) such a posting is dropped.
  2. Live tolerance in the bitmap path: the field-bitmap path now also drops these postings on live files instead of failing.
    • Reason: the Rust writer links an entry into the DATA arrays before it increments n_entries.
    • In that window a live reader legitimately sees DATA postings for an entry the global array doesn't count yet.
  3. Repeated source field: an entry with the source field twice keeps its earliest timestamp and counts once.
  4. No CACHE_VERSION bump: cached indexes differ only for corrupt files or files with repeated source fields, and a bump would reindex every cached file.

Go has no equivalent surface: journal-index is Rust-only, and the Go explorer builds no posting-based histogram.

Reproduced before the fix (regular and compact)

  • Rows published after the captured tail: counted (16 for 14).
  • Source posting naming a non-ENTRY object: accepted (15 records for 14 entries).
  • Repeated source value: double-counted (5 for 4).
  • Link-before-count live window: extra entry counted.

Validation

  • journal-index/tests/source_postings.rs: 5 new tests. All fail on the old code and pass on the new.
  • cargo test --workspace: 46 suites pass.
  • Cost: one comparison per posting and one counter per global entry. The member set is built only on a mismatch.

Summary by cubic

Fixes the source-timestamp histogram so it counts the captured ENTRY population once per entry, sharing the field-bitmap path's membership rule.

  • Postings past the captured tail and postings naming no entry of the global array are dropped on every file, stable or live, in both the source and requested-field paths; live writers link DATA before counting an entry, and pre-v0.9.0 SDK writers could close a file with the links of a failed append.
  • An entry with the source field more than once keeps its earliest timestamp and counts once.
  • CACHE_VERSION bumps to 5, so every cached file reindexes once after upgrade.
  • Validation: 4 tests in source_postings.rs reproduce the old behavior on live and stable files and pass on the fix; cargo test --workspace passes 46 suites.

Written for commit 0e2f707. Summary will update on new commits.

View guided diff Turn on auto-fix

The file indexer counted source postings published after its captured tail,
counted an entry once per repeated source value, and accepted postings that
name no entry. Stable files with such postings now fail indexing; live files
drop them, because writers link DATA postings before counting the entry.
The field-bitmap path tolerates the same live window.
@coderabbitai

coderabbitai Bot commented Nov 1, 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b005f7de-1af7-4023-bcde-978d049f0284

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codacy-production

codacy-production Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 115 complexity · 11 duplication

Metric Results
Complexity 115
Duplication 11

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot 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.

Pull Request Overview

✅ No blocking issues noticed

No blocking findings were identified. The supplied review agents reported no code-level, requirement-alignment, or quality issues.

Test suggestions

  • Postings added after the captured tail are excluded.
  • Invalid stable-file source postings are rejected.
  • Invalid/live-race source postings are dropped without failure.
  • Live bitmap indexing tolerates an entry linked before global counting.
  • Repeated source fields count once and retain the earliest timestamp.
  • Behavior works for both regular and compact journal layouts.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread SOW-status.md Resolved
ktsaou added 19 commits November 1, 2026 20:49
The SOW-0161 change alters what the indexer computes, so cached indexes
must miss once. Records generation 5 and its reindex impact in product scope.
Files written by SDK releases before v0.9.0 can carry DATA links to an
uncounted entry after a failed append; rejecting them made such archived
files unindexable.

This branch has not been deployed

No deployments
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