Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9915fac
feat(review): construct restricted non-authorising evidence envelopes…
hyperpolymath Nov 23, 2026
565583d
test(review): cover deterministic restricted envelopes and trust-boun…
hyperpolymath Nov 23, 2026
ca8b8e3
docs(readme): count evidence-envelope source module
hyperpolymath Nov 23, 2026
be23287
test(ci): run review-evidence regression in existing Elixir gate
hyperpolymath Nov 23, 2026
6d4231e
docs(review): specify restricted canonical evidence boundary and diff…
hyperpolymath Nov 23, 2026
2958991
fix(review): use unambiguous test assertion and explicit reduction re…
hyperpolymath Nov 23, 2026
0915072
fix(review): use unambiguous test assertion and explicit reduction re…
hyperpolymath Nov 23, 2026
6d0f0dc
style(review): apply isolated Elixir formatter output to S-03
hyperpolymath Nov 23, 2026
7fc7132
style(review): apply isolated Elixir formatter output to S-03
hyperpolymath Nov 23, 2026
17ba718
fix(review): reject dot repository components before empty-envelope a…
hyperpolymath Nov 23, 2026
6df2866
test(review): reject empty-envelope dot component repository names
hyperpolymath Nov 23, 2026
0bfb719
test(review): generate strict positive and negative I-JSON/JCS differ…
hyperpolymath Nov 23, 2026
b077684
ci(review): pin authoritative ijson-jcs source revision for byte diff…
hyperpolymath Nov 23, 2026
392afc1
test(review): add fail-closed pinned I-JSON/JCS differential and fram…
hyperpolymath Nov 23, 2026
cfe607a
ci(review): require pinned JCS differential in mandatory Hypatia CI gate
hyperpolymath Nov 23, 2026
d7efad5
fix(ci): build pinned JCS source outside enclosing Hypatia Cargo work…
hyperpolymath Nov 23, 2026
1a765cc
fix(ci): consume canonicaliser help without RE011 quiet-grep SIGPIPE
hyperpolymath Nov 23, 2026
61f969a
feat(review): read-only pre-commit.ci check-run admission (S-04) (#1226)
hyperpolymath Nov 23, 2026
704bc3f
Merge remote-tracking branch 'origin/feat/review-observation-admissio…
claude Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/review-evidence-ijson-jcs.pin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1735d68768920f6f59667c9ba2c84769d8d45336
63 changes: 62 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ jobs:
test/workflow_test.exs \
test/review_observation_test.exs \
test/review_github_collector_test.exs \
test/review_evidence_test.exs \
test/review_check_run_collector_test.exs \
test/egress_decision_mirror_test.exs \
test/deed_test.exs \
test/kyaml_test.exs \
Expand Down Expand Up @@ -582,6 +584,64 @@ jobs:
- name: Hold Hypatia.Kyaml to the YAML test suite
run: YAML_TEST_SUITE=.yts mix test --only yaml_test_suite

# ============================================================================
# S-03 review evidence: separately pinned I-JSON/JCS differential
# ============================================================================
# A restricted ASCII/no-number E0 encoder is only canonical for that subset.
# This gate requires the authoritative parser's strict positive/negative
# tests, library-vs-estate LF distinction and JSONL framing; no silent skip.
review-evidence-jcs:
name: Review evidence JCS differential (pinned)
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout Hypatia
uses: actions/checkout@v7.0.1
with:
persist-credentials: false

- name: Checkout source-pinned I-JSON/JCS
uses: actions/checkout@v7.0.1
with:
repository: hyperpolymath/ijson-jcs
ref: 1735d68768920f6f59667c9ba2c84769d8d45336
path: .ijson-jcs
persist-credentials: false

- name: Setup source-compatible Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: '1.99.1'

- name: Setup Elixir/OTP
uses: erlef/setup-beam@v1.24.1
with:
elixir-version: '1.19.4'
otp-version: '27.3.4.19'

- name: Fetch Elixir dependencies
run: mix deps.get

- name: Compile review admission and evidence encoder
run: mix compile --warnings-as-errors

# Cargo treats a nested Rust package as part of Hypatia's workspace.
# Copy the already checked-out, pinned Git tree to a temporary sibling:
# no edits to either Cargo.toml, Cargo.lock, or the source checkout.
- name: Isolate pinned canonicaliser from Hypatia Cargo workspace
run: cp -a .ijson-jcs "$RUNNER_TEMP/ijson-jcs-review-source"

- name: Compile JCS binary from exactly pinned source and lockfile
run: cargo build --release --locked --manifest-path "$RUNNER_TEMP/ijson-jcs-review-source/Cargo.toml" --bin ijson-jcs

- name: Differential and failure-mode checks
env:
HYPATIA_IJSON_JCS_SOURCE: ${{ runner.temp }}/ijson-jcs-review-source
HYPATIA_IJSON_JCS_BIN: ${{ runner.temp }}/ijson-jcs-review-source/target/release/ijson-jcs
run: bash scripts/check-review-evidence-ijson-jcs.sh

# ============================================================================
# Combined Status Check
# ============================================================================
Expand All @@ -602,6 +662,7 @@ jobs:
- elixir-compile
- elixir-format
- kyaml-conformance
- review-evidence-jcs
if: always()
steps:
- name: Check all jobs status
Expand All @@ -610,7 +671,7 @@ jobs:
run: |
set -euo pipefail
mandatory=(rust-check rust-fmt rust-test rust-test-coverage detect-haskell
k9iser-validate elixir-compile elixir-format kyaml-conformance)
k9iser-validate elixir-compile elixir-format kyaml-conformance review-evidence-jcs)
for job in "${mandatory[@]}"; do
result=$(jq -r --arg job "$job" '.[$job].result // "missing"' <<< "$NEEDS_JSON")
if [[ "$result" != success ]]; then
Expand Down
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PatternRegistry ──> TriangleRouter ──> FleetDispatcher ──> DispatchM

[cols="1,3"]
|===
| `lib/` | 176 Elixir source files — pipeline, rules, VCL, neural, safety, web, merge orchestration
| `lib/` | 179 Elixir source files — pipeline, rules, VCL, neural, safety, web, merge orchestration
| `lib/rules/` | 44 source files: rule modules and their helpers; see link:docs/rules/catalogue.adoc[the catalogue]
| `lib/neural/` | 8 networks + blackboard, coordinator, persistence, rebalancer
| `lib/vcl/` | VCL query layer over verisim-data: parser, file executor, cache, federation
Expand Down Expand Up @@ -153,7 +153,7 @@ hypatia help
----

Mix tasks cover the operational surface — `mix hypatia.rsr_score`, `mix hypatia.recipe_health`,
`mix hypatia.watch`, `mix hypatia.triage_issues` and sixteen more. See the
`mix hypatia.watch`, `mix hypatia.triage_issues` and seventeen more. See the
https://github.com/hyperpolymath/hypatia/wiki/Operations[Operations wiki page].

Running the supervision tree also serves an HTML dashboard, an SSE event stream, a Prometheus
Expand Down
113 changes: 113 additions & 0 deletions docs/design/2026-11-23-review-check-run-intake.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
= S-04: GitHub Checks API intake for pre-commit.ci
:date: 2026-11-23
:toc:

== Purpose

This implements a *read-only, external-check assertion* boundary for
pre-commit.ci and deliberately remains separate from review comments.
The parent is https://github.com/hyperpolymath/hypatia/pull/1220[#1220].
This adapter **does not** trigger pre-commit.ci, rerun jobs, autofix,
post a comment, approve a merge, or authorise Bayesian learning.

For an operational, read-only inspection of one PR, run:

----
mix hypatia.review_check_collect --repo stuff-of-awe/awesome-zig --pr 20
----

The command reports exact source IDs and native statuses only. It neither
writes receipts nor runs the hooks. A missing check is explicitly
"NOT OBSERVED", not success, compliance or a checked installation.

The upstream ReviewObservation.admit/2 already permits provider
pre-commit.ci with scope hooks. The new collector emits those observations
through a distinct GitHub native Check Runs API intake.

== Verified provider identity

The authenticated GitHub Get App endpoint
(https://docs.github.com/en/rest/apps/apps[GitHub Apps REST]) returned
numeric app ID 68672 for slug pre-commit-ci on 2026-11-23.

Matching is conjunctive:

* native check.app.id exactly 68672;
* native check.app.slug exactly pre-commit-ci;
* native check.name exactly pre-commit.ci - pr;
* native check.head_sha equals the current PR head after full validation.

An arbitrary repository workflow merely named pre-commit.ci - pr
is **not** the provider. An unknown app, renamed run, absent check,
or checks not executed on that commit is unknown, never an inferred pass.

Only the strict native state and conclusion vocabulary is preserved.
The API-reported source event ID has prefix github:check_run: and the
positive native check-run ID. The source locator is the validated GitHub
PR permalink: the external details_url is untrusted and intentionally
not forwarded as evidence.

== Retrieval and consistency

The adapter reads the PR via GitHub REST, checks its number, base repo
and 40-hex head, then retrieves every check-run page using
per_page=100 and filter=all, re-reads the inventory, and validates
the head again.

The API total_count is reconciled with retrieved count; incomplete
pagination, duplicate IDs, invalid record shapes, API failures,
full final pages at budget, shifted inventories and moved PR heads
all fail closed.

No GitHub API can supply an atomic cross-endpoint PR/check-run
snapshot. Repeated agreement is observation, not a transaction.

The default is five 100-item pages and an absolute budget of ten;
no cursor is silently ignored. Even a zero-item response has
coverage_verdict=not_established and provider_observed=false.
This describes *observed* check runs, not installation state.

== Admitted verdicts

A completed pre-commit.ci check with conclusion success is a
**provider-reported success**, not independent evidence that every
hook ran or that the repository is defect-free. The native conclusion
is carried separately as check_conclusion.

The review-observation representation uses has_findings=nil for
all check conclusions because GitHub's Checks API status alone
contains no structured hook finding count. The provider's
completed status does not become a clean review; finding_signal
remains unknown and qualification unqualified.

Failure/neutral/skipped/cancelled/timed_out/action_required and
startup_failure outcomes are likewise preserved as bounded
external assertions without inventing underlying defects.
All admitted records have learning_eligible=false and
merge_approval=false.

This adapter is not yet merged into the S-03 JSON evidence envelope.
A future versioned envelope union will need its own strict
check-run schema and pinned JCS differential fixtures. It must
not replace the existing permitted S-03 fields or broaden
the E0 learning receipt as a shortcut.

== Live availability and tests

A GET-only reconnaissance of five pilot PR heads across four estate
organisations plus Hypatia #1220 found **no matching pre-commit.ci
check run** as of this check. That is evidence of absence of matching
check-run events *on those heads*, not proof that the provider is
uninstalled or that checks passed.

test/review_check_run_collector_test.exs contains injected API
fixtures for native app-name spoofing, successful/failed/running
and skipped conclusions, incomplete and shifting pagination,
duplicate or invalid check-run IDs, malformed subjects,
stale/moved heads and absent providers.

A real positive end-to-end provider check will be required before
classifying this adapter as operationally verified beyond
negative-source cases. Do not generate paid reviews or cause
autofix commits merely to populate a test.
132 changes: 132 additions & 0 deletions docs/design/2026-11-23-review-evidence-envelope.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
= S-03: restricted review-evidence envelope
:author: Jonathan D.A. Jewell
:date: 2026-11-23
:toc:

== Purpose

This is a *separate stage* after external-source admission in
https://github.com/hyperpolymath/hypatia/pull/1216[PR #1216]. It adds an
in-memory, deterministic **evidence envelope**, not an E0 learning receipt
and not a replacement for external code/security review. Programme
https://github.com/hyperpolymath/hypatia/issues/1217[#1217] tracks the
corresponding S-03 work.

The upstream collector has the following limited promise:

----
GitHub REST -> repeated observation -> unqualified admission -> envelope
----

Two reads of a paginated REST inventory cannot provide database snapshot
isolation. A stable read is an observation of repeated agreement, not a
cryptographic or transactional guarantee.

== Profile and byte contract

Hypatia.ReviewEvidence.build/2 only accepts a complete, versioned
collector map with source github_rest_via_gh, provenance
github_api_observed, coverage bot_comment_and_review_submissions_only,
and collection mode repeated_stable_observation. The caller must provide
a **full lowercase 40-hex collector source revision**. This is a label,
not proof of deployment or attestation of source integrity.

Every admitted observation is reconstructed and revalidated through
Hypatia.ReviewObservation.admit/2. An extra authority-bearing field,
unrecognised source event, changed subject, forged verdict, duplicate
source-event ID, missing content or contradictory assessment fails the
whole envelope. Only an allowlisted set of evidence fields survives.
No free-text bot content, patches, model instructions or credentials
are copied into the envelope.

Hypatia.ReviewEvidence.canonical/2 delegates byte generation to the
*existing* E0 Hypatia.Receipt.encode/1, but in its restricted
**ASCII/no-JSON-numbers** profile. It returns separately:

* library_bytes: deterministic encoded JSON with **no final LF**;
* file_record_bytes: those bytes followed by **exactly one LF**;
* library_sha256: SHA-256 of the **library bytes only**.

Counters and PR numbers are decimal strings in this profile.
The result is explicitly qualified as
requires_ijson_jcs_differential: output has NOT yet been checked
against the authoritative pinned Rust hyperpolymath/ijson-jcs
implementation. A digest cannot establish producer identity, successful
reviewer execution, a genuine finding or eligibility for learning.

This stage has **no disk writer, append-only ledger or signature**.
No JSONL file is created and no E0 Receipt.write/3 learning operation is
called. The E0 receipt chain remains separate.

== Fail-closed semantics

[cols="2,3",options="header"]
|===
|Case |Outcome

|Root map contains unexpected keys, or unsupported collection source
|Error; no envelope

|Malformed revision, PR number, head SHA, or count
|Error; no envelope

|Wrong subject/ref, manipulated review approval or qualification
|Error; no envelope

|Unrecognised observation fields or fake provider completion
|Error; no envelope

|Two events claim the same source ID
|Error; no envelope

|Non-ASCII field in envelope
|Restricted encoder error; no canonical bytes

|A valid envelope has zero admitted observations
|Allowed, but coverage_verdict=not_established: **never clean**

|A known inline finding, provider-run status unknown
|Preserve the assertion with provider_run_status=unknown

|A historical review against a non-current head
|Retain stale_head; no fresh clean inference
|===

== Canonical profile dependencies and remaining qualification

Canonical routing is defined by
https://github.com/metadatastician/standards/blob/main/3-practice/DATA-FORMAT-ROUTING.adoc[estate format routing].
The authoritative ijson-jcs repository implements I-JSON (RFC 7493)
plus JCS (RFC 8785). Its canon command emits library bytes without LF;
check --profile estate-file checks exactly one final LF on disk; and
check-jsonl checks records separately.

Before persistent bytes or hashes are relied upon across machines, a
separate **pinned differential gate** must compare this restricted
encoder's bytes with ijson-jcs canon for positive, negative and
boundary fixtures. If the binary is missing, its revision unpinned,
or the bytes disagree, fail closed. Do not use plain Jason.encode!
or jq -cS as a general JCS validator outside this restricted profile.
There is no approved kyq executable gate inferred from passing JavaScript
conformance tests.

The later persistence stage must make both file/record transaction order
and concurrency/deduplication rules explicit; do not simply append a
second JSONL receipt on retry. JSON-LD dataset canonicalisation is
distinct and out of scope. DEED, K9 and coordination documents retain
their separate ANBF/grammar authorities.

== Verification

test/review_evidence_test.exs covers stable ordering and byte hashes,
empty-but-not-clean collections, stale historical commits, duplicate
event IDs, forged approval/learning fields, unexpected inputs,
mismatched subjects, malformed provenance and non-ASCII values.
It is added to the existing Elixir CI regression set.

This branch is stacked on #1216 and must remain draft. The base PR's
unrelated Rust dependency-security blocker is
https://github.com/hyperpolymath/hypatia/issues/1219[#1219].
Do not weaken or bypass it, and do not merge either branch on the
strength of a passing restricted-envelope test alone.
Loading
Loading