Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4de7f8d
test(outcome): prepared review is not confirmed delivery
EffortlessSteven Oct 5, 2026
9eb95b3
fix(outcome): finalize publication from current post receipts
EffortlessSteven Oct 5, 2026
9152e85
test(outcome): retain code result in existing gate fixture
EffortlessSteven Oct 5, 2026
d5ad2a6
test(publication): expose interrupted repeat and legacy skip contradi…
EffortlessSteven Oct 5, 2026
3aab7d7
test(truth): retain inconclusive reason independently of prepared del…
EffortlessSteven Oct 5, 2026
cd9124d
fix(publication): preserve independent truth across every post outcome
EffortlessSteven Oct 5, 2026
df5eb76
style(post): preserve surrounding main command separation
EffortlessSteven Oct 5, 2026
faf3ae2
fix(publication): require the frozen target PR for confirmation
EffortlessSteven Oct 5, 2026
5bb3bc2
test(publication): expose native REST review and reply confirmation gaps
EffortlessSteven Oct 5, 2026
cf42922
fix(publication): confirm native grouped reviews and reconciled replies
EffortlessSteven Oct 5, 2026
f86ffb5
test(publication): falsify conflicting heads and incomplete native id…
EffortlessSteven Oct 5, 2026
1ac7590
fix(publication): require consistent native head and complete positiv…
EffortlessSteven Oct 5, 2026
69ff665
test(publication): align native ID contract and document shadow integ…
EffortlessSteven Oct 5, 2026
a1ce3d5
test(publication): falsify invalid source-thread reconciliation on re…
EffortlessSteven Oct 5, 2026
4e920d7
test(publication): falsify duplicate planned and physical reply counts
EffortlessSteven Oct 5, 2026
890c9ce
test(publication): reject physical comment reuse across native delive…
EffortlessSteven Oct 5, 2026
c55c357
fix(publication): admit unique native plans and positive distinct phy…
EffortlessSteven Oct 5, 2026
2eda76f
test(publication): return the created review ID from native CLI API f…
EffortlessSteven Oct 5, 2026
cbccccc
test(post): execute RED controls for uncapped read, HTTP bounds and p…
EffortlessSteven Oct 5, 2026
e9527d2
test(post): restore bounded behavior with falsifying publication cont…
EffortlessSteven Oct 5, 2026
a580f5b
fix(post): keep Read in scope for the bounded adapter
EffortlessSteven Oct 5, 2026
8079f13
test(post): execute RED control for command-level skip persistence
EffortlessSteven Oct 5, 2026
542cbf3
test(post): restore skip persistence with paired command and delivery…
EffortlessSteven Oct 5, 2026
a0476cd
test(post): execute RED for oversized inputs, unknown receipt tuples …
EffortlessSteven Oct 5, 2026
4c872c6
test(post): execute RED for reply collection and review-read error pr…
EffortlessSteven Oct 5, 2026
87e28f8
test(post): restore source with exact boundary, receipt-state and nat…
EffortlessSteven Oct 5, 2026
a1d261f
fix(delivery): reserve publication attempts before remote writes
Oct 13, 2026
bcc008f
test(delivery): check exact reservation schema and API
Oct 14, 2026
c150942
Merge remote-tracking branch 'origin/pr1317' into test/publication-in…
EffortlessSteven Oct 15, 2026
54b0e74
test: compose publication truth and retry reservation candidates
EffortlessSteven Oct 15, 2026
c59e358
test(delivery): qualify partial publication and retry interaction
EffortlessSteven Oct 15, 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
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ outputs:
description: 'What the investigation established (#839): clean, findings, limited, or not_proven. Insufficient evidence never reports clean.'
value: ${{ steps.results.outputs.analysis-result }}
publication-result:
description: 'Whether reviewer-facing value reached the PR surface (#839): posted, not_needed, failed, or not_proven. `posted` means a grouped review payload was prepared for submission; the separate post step fails the job if submission fails.'
description: 'Whether reviewer-facing value reached the PR surface: posted, not_needed, failed, or not_proven. Prepared output is not_proven; posted requires a current-revision GitHub confirmation from the separate post transaction. Tolerated posting failure remains failed.'
value: ${{ steps.results.outputs.publication-result }}
gate-result:
description: 'The truthful check verdict (#839): pass, finding, or not_proven. May be not_proven while gate-conclusion is pass — enforcement still follows gate-conclusion, so an advisory workflow stays non-blocking while the reported result stops claiming a review happened.'
Expand Down
114 changes: 114 additions & 0 deletions docs/POST_PUBLICATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Prepared output and confirmed publication

This is the bounded post-run seam owned by #959 under #926, using the existing
#765 posting transaction. It does not migrate gate enforcement or implement
the complete FinalizedOutcome contract owned by #960.

`run` writes `publication_result: not_proven` when a grouped review is prepared.
Preparation is never proof of delivery. It also retains `code_gate_result`,
computed from the same existing receipt-derived decision before publication
uncertainty. The legacy `conclusion`, code findings, proof accounting and
enforcement policy keep their existing meanings.

When `post` finds a sibling `gate_outcome.json`, it freezes the decision source
and prepared payload hash, then invalidates any old publication confirmation
before a new attempt. A standalone `post` without that artifact keeps its
existing receipt-only behavior. Gate and payload inputs are each bounded to
1 MiB; malformed, oversized or historical decision inputs without a supported
`code_gate_result` fail before posting. The command owns the gate and payload
for the attempt; concurrent replacement, including an ABA payload change, is
outside this bounded seam's qualification.

After persisting the current attempt's existing success/error/skip receipt,
`post` finalizes only publication fields and their dependent reported
`gate_result`/publication reasons. It uses the frozen `code_gate_result` without
recomputing code evidence. Legacy `conclusion`, analysis, deterministic reasons,
proof accounting and all non-publication uncertainty remain unchanged.

| Evidence | publication_result | delivery_result | delivery_attempt |
| --- | --- | --- | --- |
| Prepared only | not_proven | prepared | not_attempted |
| Missing token / preflight failure | failed | failed | blocked |
| Network posting failure | failed | failed | attempted |
| Valid current-revision success | posted | confirmed | attempted |
| All planned comments already delivered and currently reconciled | posted | confirmed | not_attempted |
| Missing, stale or malformed confirmation | not_proven | unknown | unknown or attempted |
| Receipt persistence failure | failed | failed | unknown |
| Authorized skip with no public value needed | not_needed | not_needed | not_attempted |

Confirmation requires the current in-memory success result, valid receipt
preconditions, successful HTTP status, matching repository/PR/payload path,
and a head equal to the frozen validated RevisionRef.reviewed_commit. Grouped
reviews require a positive GitHub review ID and COMMENTED/commented state.
The submitted review ID must match the container created by that transaction.
Every newly delivered or currently reconciled comment has a positive numeric
GitHub ID; a valid final reply ID cannot cover an invalid earlier reply.
The native plan uses the existing transaction's duplicate-identity admission
before reply/retry handling, and one physical comment ID cannot satisfy more
than one planned delivery. Reply source-thread IDs are validated before prior
confirmation can bypass a new post.
The existing transaction attaches current in-memory head confirmation after
native reconciliation and head checks; a grouped REST response without
`commit_id` uses that confirmation. An explicit response commit and any attached
native head confirmation must independently match the frozen head.
Direct replies and already-delivered retries require complete, positive
planned/confirmed comment counts for the same frozen head and PR. A new reply
requires its positive GitHub comment ID; an already-delivered retry records
`not_attempted` for the current post. The finalizer does not read historical
transaction receipts to obtain this proof.

The payload must remain byte identical. A historical gate without the
independent code projection cannot confirm publication. This preserves the
existing revision semantics and the posting transaction's head checks.

The finalizer never scans prior post-result/error files for confirmation. It
records digests of the current receipt's compact serde JSON and the frozen raw
review bytes, plus a bounded machine-readable reason. It never copies arbitrary
transport error text into the gate. Repeating finalization with the same frozen
source/result is byte-idempotent. Changed decision sources are rejected and
changed payloads cannot confirm delivery.

No model call, command execution, network request, credential discovery or
posting retry occurs in finalization. Synthetic Rust fixtures cover success,
missing-token preflight through the actual post command, network failure,
prepared-only output, stale/malformed responses, changed sources, persistence
failure, idempotence and standalone/no-value skip behavior. Existing native
fake-transport tests also execute grouped submission, direct replies and a
reconciled retry through finalization. No real GitHub delivery is claimed. The separate full outcome, artifact-authentication
and operated static-worker qualification remain unproven.

The read-cap control observes how many bytes an oversized reader consumed:
rejecting the input after an unbounded read is insufficient. Receipt controls
exercise HTTP 199/200/299/300 while holding every other confirmation field valid.
Prepared and inconclusive fixtures assert the exact publication and independent
code reasons. The inherited #855 `side_effect:7ed6893b` selector fingerprints a
closing `);` line, so the unchanged selector alone cannot qualify a changed
call body or guard; its current semantics require these source controls and
review. No suppression or enforcement policy is changed by this qualification.
The actual `post` command also covers skipped receipt persistence against the
current gate, including an unwritable receipt when post errors are tolerated.
Native delivery rejection controls assert the exact guard error and include a
valid paired case; malformed prior reply IDs exercise a fresh fake reply rather
than passing because the fake transport runs out of responses.

Oversized gate and review inputs are checked through both preparation and
finalization. These controls require the size-limit error and unchanged gate
bytes, so an unrelated parse error cannot count as the intended rejection.
Schema-v1 unknown or missing statuses and failure stages assert the complete
publication/delivery/attempt/reason tuple, paired with known preflight and
network-stage outcomes. Native grouped, direct and reconciled fixtures assert
the exact confirmation object; a mixed inline/reply plan requires both counts
to be two. These checks reverify the bounded reply-collection target of the
inherited #828 receipt without treating its selector as inventory clearance.
Producer attribution and source-role limitations stay with
[EffortlessMetrics/ripr#1453](https://github.com/EffortlessMetrics/ripr/issues/1453)
and [#1714](https://github.com/EffortlessMetrics/ripr/issues/1714).

The existing Action publication-result output reads the finalized artifact;
tolerated post failure remains visible even when the advisory job succeeds.
The separate #957 shadow publication report still recognizes a narrower set
of response forms and does not qualify native lowercase grouped responses,
direct replies or reconciled retries. Its integration remains with the #957
owners; this seam does not establish one globally coherent packet.
Rollback removes the post finalization hooks, while retaining pre-post
unconfirmed truth; restoring the old prepared-equals-posted claim is invalid.
4 changes: 4 additions & 0 deletions src/gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ pub(crate) struct GateOutcome {
/// masking this separation removes; enforcement still follows
/// `conclusion`, so an advisory workflow stays non-blocking.
pub(crate) gate_result: String,
/// The same receipt-derived result before publication uncertainty. Post
/// finalization uses it without recomputing or changing code enforcement.
pub(crate) code_gate_result: String,
pub(crate) reasons: Vec<GateReason>,
pub(crate) required_proof: GateRequiredProofCounts,
pub(crate) tool_gates: GateToolGateCounts,
Expand Down Expand Up @@ -860,6 +863,7 @@ pub(crate) fn build_gate_outcome(input: GateOutcomeInput<'_>) -> GateOutcome {
analysis_result: truth.analysis_result,
publication_result: truth.publication_result,
gate_result: truth.gate_result,
code_gate_result: truth.code_gate_result,
reasons,
required_proof,
planner_required_proofs,
Expand Down
78 changes: 56 additions & 22 deletions src/gate_truth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
//! (`conclusion`) that answered three different questions at once: did we
//! investigate, did the reviewer receive the result, and does the check go
//! red. A run where every instrument failed and no model lane was usable
//! therefore recorded `conclusion: "pass"` — the gate said "clean" about a
//! therefore recorded `conclusion: "pass"` - the gate said "clean" about a
//! review that never happened.
//!
//! This module derives three independent results next to the legacy
//! `conclusion` (whose meaning and enforcement behavior are unchanged):
//!
//! - `analysis_result`: `clean | findings | limited | not_proven` — what the
//! - `analysis_result`: `clean | findings | limited | not_proven` - what the
//! investigation established;
//! - `publication_result`: `posted | not_needed | failed | not_proven` — whether
//! - `publication_result`: `posted | not_needed | failed | not_proven` - whether
//! reviewer-facing value reached the PR surface;
//! - `gate_result`: `pass | finding | not_proven` — the truthful check verdict.
//! - `gate_result`: `pass | finding | not_proven` - the truthful check verdict.
//!
//! Everything here is a pure function of receipts already in the packet, so
//! the derivation is unit-testable and model output never feeds it.
Expand Down Expand Up @@ -82,6 +82,7 @@ pub(crate) struct GateTruth {
pub(crate) analysis_result: String,
pub(crate) publication_result: String,
pub(crate) gate_result: String,
pub(crate) code_gate_result: String,
pub(crate) sensor_coverage: GateSensorCoverage,
pub(crate) model_coverage: GateModelCoverage,
/// Every reason some part of the run was not proven, each prefixed with a
Expand All @@ -107,8 +108,8 @@ pub(crate) struct GateTruthInput<'a> {
/// Retained planner-required portfolio accounting (#4271). `None` when
/// the run had no readable portfolio artifact; unproven required
/// portfolio tasks push a `required-planner-proof:` reason. This moves
/// only the separated results — never `conclusion`, never a blocking
/// reason — so advisory enforcement posture is unchanged.
/// only the separated results - never `conclusion`, never a blocking
/// reason - so advisory enforcement posture is unchanged.
pub(crate) planner_required_proofs: Option<&'a PlannerRequiredProofAccounting>,
/// The legacy verdict, whose meaning is unchanged: `pass | fail |
/// inconclusive`. `gate_result` corrects it for truth without moving it.
Expand Down Expand Up @@ -168,8 +169,8 @@ pub(crate) fn build_sensor_coverage(
coverage
}

/// Required sensors that ran and demonstrated a failure. These are findings —
/// `gate.rs` raises them as `sensor-finding` reasons under intelligent-ci — and
/// Required sensors that ran and demonstrated a failure. These are findings -
/// `gate.rs` raises them as `sensor-finding` reasons under intelligent-ci - and
/// they stay findings in the reported result even where repo policy left them
/// advisory and raised no gate reason.
pub(crate) fn required_failed_sensor_count(plan: &Plan, issues: &[SensorEvidenceIssue]) -> usize {
Expand Down Expand Up @@ -236,7 +237,7 @@ pub(crate) fn build_model_coverage(
/// - material findings that never reached the PR surface yield `not_proven`,
/// because a finding trapped in artifacts proves nothing to the reviewer;
/// - optional-instrument absence is visible (`limited`) but does not by itself
/// poison an otherwise sufficient run — a wholesale instrument blackout,
/// poison an otherwise sufficient run - a wholesale instrument blackout,
/// where nothing reported at all, does.
pub(crate) fn build_gate_truth(input: GateTruthInput<'_>) -> GateTruth {
let sensor_coverage = build_sensor_coverage(input.plan, input.sensor_issues);
Expand All @@ -252,7 +253,7 @@ pub(crate) fn build_gate_truth(input: GateTruthInput<'_>) -> GateTruth {
input.terminal_state.proof_receipts
));
}
// A required sensor that RAN and demonstrated a failure produced evidence —
// A required sensor that RAN and demonstrated a failure produced evidence -
// it is a finding, and `gate.rs` already raises it as one. Only a required
// sensor that could not report at all leaves a requirement unproven.
let required_unreported = required_unreported_sensor_count(input.plan, input.sensor_issues);
Expand Down Expand Up @@ -341,10 +342,12 @@ pub(crate) fn build_gate_truth(input: GateTruthInput<'_>) -> GateTruth {
};

let publication_result = if input.terminal_state.review_payload_status == "prepared" {
// `run` only prepares the grouped review; `post` submits it and fails
// the job on a submission error, so a prepared payload is the strongest
// publication claim this artifact can make.
"posted"
// Preparation has no GitHub confirmation. The later post transaction
// finalizes publication independently of deterministic enforcement.
not_proven_reasons.push(
"publication: grouped review is prepared but delivery is not confirmed".to_owned(),
);
"not_proven"
} else if input.terminal_state.status == "failed-to-review" {
not_proven_reasons.push(
"publication: the run never reached a reviewable state, so whether a PR review was \
Expand All @@ -366,14 +369,15 @@ pub(crate) fn build_gate_truth(input: GateTruthInput<'_>) -> GateTruth {
};

let publication_unproven = matches!(publication_result, "failed" | "not_proven");
let gate_result = if publication_unproven {
"not_proven"
} else if input.conclusion == "fail" {
let code_gate_result = if input.conclusion == "fail" {
"finding"
} else if analysis_result == "not_proven" {
"not_proven"
} else if input.conclusion == "inconclusive" {
if not_proven_reasons.is_empty() {
if not_proven_reasons
.iter()
.all(|reason| reason.starts_with("publication:"))
{
not_proven_reasons.push(
"gate-conclusion: the recorded conclusion is `inconclusive` (required evidence \
was unavailable)"
Expand All @@ -388,6 +392,11 @@ pub(crate) fn build_gate_truth(input: GateTruthInput<'_>) -> GateTruth {
} else {
"pass"
};
let gate_result = if publication_unproven {
"not_proven"
} else {
code_gate_result
};

if gate_result == "not_proven" && not_proven_reasons.is_empty() {
not_proven_reasons.push(format!(
Expand All @@ -400,6 +409,7 @@ pub(crate) fn build_gate_truth(input: GateTruthInput<'_>) -> GateTruth {
analysis_result: analysis_result.to_owned(),
publication_result: publication_result.to_owned(),
gate_result: gate_result.to_owned(),
code_gate_result: code_gate_result.to_owned(),
sensor_coverage,
model_coverage,
not_proven_reasons,
Expand Down Expand Up @@ -635,7 +645,7 @@ mod tests {
}

#[test]
fn prepared_payload_reports_posted_publication() {
fn prepared_payload_never_reports_confirmed_publication() {
let plan = test_plan(vec![planned_sensor("tokmd", true)]);
let mut terminal_state = test_terminal_state("needs-reviewer-attention");
terminal_state.model_lanes = 2;
Expand All @@ -647,9 +657,33 @@ mod tests {
let truth = truth(&plan, &terminal_state, &[], &[], &[], "pass");

assert_eq!(truth.analysis_result, "findings");
assert_eq!(truth.publication_result, "posted");
assert_eq!(truth.gate_result, "pass");
assert!(truth.not_proven_reasons.is_empty());
assert_eq!(truth.publication_result, "not_proven");
assert_eq!(truth.gate_result, "not_proven");
assert_eq!(truth.code_gate_result, "pass");
assert_eq!(
truth.not_proven_reasons,
["publication: grouped review is prepared but delivery is not confirmed"]
);
}

#[test]
fn prepared_inconclusive_retains_an_independent_code_reason() {
let plan = test_plan(vec![planned_sensor("tokmd", true)]);
let mut terminal_state = test_terminal_state("needs-reviewer-attention");
terminal_state.model_lanes = 2;
terminal_state.usable_model_lanes = 2;
terminal_state.inline_comments = 2;
terminal_state.reviewer_value_present = true;
terminal_state.review_payload_status = "prepared".to_owned();
let truth = truth(&plan, &terminal_state, &[], &[], &[], "inconclusive");
assert_eq!(truth.code_gate_result, "not_proven");
assert_eq!(
truth.not_proven_reasons,
[
"publication: grouped review is prepared but delivery is not confirmed",
"gate-conclusion: the recorded conclusion is `inconclusive` (required evidence was unavailable)",
]
);
}

/// An optional sensor loss is visible without poisoning a run that still
Expand Down
Loading
Loading