Skip to content

fix(E0): use the same verified-evidence gate for cross-repo learning (stacked on #982) - #986

Merged
hyperpolymath merged 2 commits into
fix/fleet-learning-evidence-20261030from
fix/e0-cross-repo-qualified-after-982
Oct 31, 2026
Merged

hyperpolymath merged 2 commits into
fix/fleet-learning-evidence-20261030from
fix/e0-cross-repo-qualified-after-982

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Stacked E0 consumer, base: PR #982's event-ingestion branch

This PR depends on #982 and event-chain #984. It uses OutcomeTracker.qualified_outcome?/1 from its actual base rather than duplicating the epistemic rule.

  • Apply the same postcondition qualification to cross-repository local confidence, transferred confidence/repo eligibility, cached outcome indexes, and anomaly evidence.
  • Add positive and planted-negative Elixir tests that exclude legacy and scan-failed success records.
  • Preserve unqualified attempts in the original audit log; they do not increase confidence or dispatch maturity.
  • No Python, new external store, vector DB, or multi-user system.

Status: DRAFT / NOT READY

Supersedes #985, which mistakenly targeted main despite depending on the #982-only qualification function. That branch was not a valid standalone integration and will be closed unmerged.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b5caf8c4-b860-4d2c-b2c5-73983c332636
Commits

Reviewing files that changed from the base of the PR and between 8eb0dba and c7b8f15.

Files selected for processing: 2
  • lib/cross_repo_learning.ex
  • test/cross_repo_learning_test.exs
  • 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

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T00:20:41.004272Z c7b8f15 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hyperpolymath
hyperpolymath force-pushed the fix/e0-cross-repo-qualified-after-982 branch from 5d4fa3e to c7b8f15 Compare October 31, 2026 00:18
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review October 31, 2026 00:19
@hyperpolymath
hyperpolymath enabled stacked auto-merge October 31, 2026 00:19
@hyperpolymath
hyperpolymath merged commit c8d8718 into main Oct 31, 2026
83 of 84 checks passed
@hyperpolymath
hyperpolymath deleted the fix/e0-cross-repo-qualified-after-982 branch October 31, 2026 00:20
hyperpolymath added a commit that referenced this pull request Nov 3, 2026
…995) (#998)

## Event-chain position

Addresses [#995](#995)
(blocks E0 in
[#984](#984)). Follow-up
to the [E0 post-merge
audit](#984 (comment)).

## Summary of changes

### `lib/learning_scheduler.ex` — repair `ingest_new_outcomes/1`

The local outcome JSONL reader previously stored `File.stat.size` as the
next offset after parsing with `String.split("\\n", trim: true)` and
silently dropping undecodable records. A producer appending an
incomplete JSON object during poll A would have poll A advance past the
incomplete prefix; poll B would then read only its suffix and the entire
event could be lost.

**After this repair:**

- **Only complete newline-terminated records are acknowledged.**
`String.split("\\n", trim: false)` preserves the incomplete tail; it is
buffered and prepended to the next poll's read so a producer that
finishes between polls produces one complete record, not a suffix
fragment.
- **Offset tracks the last complete newline**, not file size. Incomplete
trailing bytes remain at the old offset for retry.
- **Malformed complete rows are quarantined** with a visible warning
including file and line number, while valid rows after them still
advance.
- **File truncation/rotation detected**: when `size < last_offset`, the
position resets to zero and re-scans.
- **Missing/unreadable files** are logged as warnings, not silently
swallowed. The `:enoent` case for the outcomes directory is explicit.
- **Legacy integer offsets** are normalised via `normalise_position/1`
for backward compatibility with pre-E0 persisted state.
- **Stable event identity** via `local_source_id/2` (file + line ordinal
hash) disambiguates distinct identical attempts while making replay of
the same delivery detectable.

### `.github/workflows/actions.lock` — clusterfuzzlite sub-paths

The lock file previously collapsed
`google/clusterfuzzlite/actions/build_fuzzers@v1` and
`google/clusterfuzzlite/actions/run_fuzzers@v1` to
`google/clusterfuzzlite@v1`. The governance Allowlist Preflight checks
actual action references in workflow files, so it reported these two as
uncovered. Updated the lock entries to list the specific sub-paths used
by `.github/workflows/clusterfuzzlite.yml`.

### `test/learning_scheduler_test.exs` — new fixture tests

Comprehensive E0 replay/restart fixtures:

| Test | Property verified |
|---|---|
| `normalise_position/1` | Legacy integer offsets, new map format,
garbage reset |
| `local_source_id/2` | Determinism, distinct lines/files produce
distinct IDs |
| Two-poll incomplete tail | Poll A credits 2 + buffers incomplete; Poll
B completes and credits 1 more |
| Restart safety | Persisted positions → re-poll yields 0 new; cold
start re-reads |
| Append after poll | Only new record credited |
| Malformed row quarantine | Bad rows skipped; valid rows after them
still counted |
| Non-map JSON quarantine | Array rows quarantined |
| File truncation/rotation | Offset reset, new content read |
| Missing directory / empty dir | Zero outcomes returned |
| Fleet-origin exclusion | `origin=gitbot-fleet` not counted locally |
| Distinct identical attempts | Two physical lines with same payload →
count 2 |
| Empty lines | Blank lines between records not counted |
| Legacy position compat | Integer offset 0 normalised and advanced
correctly |

## Boundaries

- No new Python, no new database, no breaking changes to unrelated
modules.
- Does not bypass CI/allowlist/signature requirements.
- JSONL append-only journal preserved.
- Fleet import logic (the model this repair follows) untouched.

## Still owed for full E0 acceptance

- Executable pinned two-poll + restart tests with actual
signed-commit/merge rule status.
- Current-head ExUnit, format, and CI pass on this branch.
- Remaining #982/#986 review thread resolution.
- Full E0 receipt with exact head SHA after CI verifies this PR.
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