mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-27 00:10:43 +00:00
Merge remote-tracking branch 'origin/main' into task/169-metal-bc4-bc5
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com> # Conflicts: # CHANGELOG.md
This commit is contained in:
commit
7cc35ffd41
19 files changed
+1105
-46
No files matched your search
@@ -4,6 +4,13 @@ name: Agent task claims
|
||||
# /unblock, /approve-acceptance) and audits the queue hourly. Comment and issue
|
||||
# text is only parsed as data by scripts/agent_queue; it is never executed and
|
||||
# never interpolated into a shell. Not yet run on GitHub.
|
||||
#
|
||||
# Both jobs share one concurrency group, so decisions never race. GitHub keeps
|
||||
# at most one pending run per group and cancels the older pending run when a
|
||||
# newer one queues, so a run does not decide only its own comment: `replay`
|
||||
# decides every command of the last lease_hours that has no bot reply yet,
|
||||
# oldest first. The surviving run, or at the latest the hourly audit, answers
|
||||
# the commands of cancelled runs. Comments that do not start with `/` start no run.
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
@@ -16,7 +23,7 @@ permissions: {}
|
||||
|
||||
jobs:
|
||||
command:
|
||||
if: github.event_name == 'issue_comment' && !github.event.issue.pull_request
|
||||
if: github.event_name == 'issue_comment' && !github.event.issue.pull_request && startsWith(github.event.comment.body, '/')
|
||||
runs-on: ubuntu-24.04-arm
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -36,9 +43,8 @@ jobs:
|
||||
PYTHONPATH: scripts
|
||||
run: |
|
||||
set -eu
|
||||
python3 -m agent_queue event --path "$GITHUB_EVENT_PATH" > "$RUNNER_TEMP/event.json"
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --no-prs > "$RUNNER_TEMP/state.json"
|
||||
python3 -m agent_queue decide --event "$RUNNER_TEMP/event.json" --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/actions.json"
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --no-prs --recent-commands > "$RUNNER_TEMP/state.json"
|
||||
python3 -m agent_queue replay --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/actions.json"
|
||||
python3 -m agent_queue apply --repo "$GH_REPO" --actions "$RUNNER_TEMP/actions.json"
|
||||
|
||||
audit:
|
||||
@@ -54,6 +60,16 @@ jobs:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Decide commands whose runs were cancelled
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
PYTHONPATH: scripts
|
||||
run: |
|
||||
set -eu
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --no-prs --recent-commands > "$RUNNER_TEMP/commands.json"
|
||||
python3 -m agent_queue replay --state "$RUNNER_TEMP/commands.json" > "$RUNNER_TEMP/replay.json"
|
||||
python3 -m agent_queue apply --repo "$GH_REPO" --actions "$RUNNER_TEMP/replay.json"
|
||||
- name: Lapse stale claims, flag invalid tasks, write summary
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
@@ -4,6 +4,11 @@ name: Agent PR checks
|
||||
# ownership, overlap with other open pull requests, and independent
|
||||
# verification. Runs on the base branch only: pull request code is never checked
|
||||
# out or executed; changed files come from the API. Not yet run on GitHub.
|
||||
#
|
||||
# Advisory: problems are reported as a warning and in the run summary, but the
|
||||
# check does not fail until a live smoke test and the migration of existing
|
||||
# issues are done (docs/coordination/agent-tasks.md). Only a comment starting
|
||||
# with /verified starts the verify job; ordinary comments start nothing.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
@@ -43,17 +48,21 @@ jobs:
|
||||
cat "$RUNNER_TEMP/result.json"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
exit "$status"
|
||||
# 1 means problems were found: advisory for now. Anything else is a failure of the check itself.
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "::warning title=Agent PR check (advisory)::problems found; see the run summary"
|
||||
elif [ "$status" -ne 0 ]; then
|
||||
exit "$status"
|
||||
fi
|
||||
|
||||
verify:
|
||||
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
|
||||
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/verified')
|
||||
runs-on: ubuntu-24.04-arm
|
||||
# issues: write posts the reply; actions: write re-runs the check after a recorded verification.
|
||||
# issues: write posts the reply.
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: read
|
||||
actions: write
|
||||
concurrency:
|
||||
group: agent-verify-${{ github.event.issue.number }}
|
||||
cancel-in-progress: false
|
||||
@@ -61,7 +70,7 @@ jobs:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Record verification and re-run the check
|
||||
- name: Record verification and check again
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
@@ -73,6 +82,21 @@ jobs:
|
||||
python3 -m agent_queue gather --repo "$GH_REPO" --pr "$number" > "$RUNNER_TEMP/state.json"
|
||||
python3 -m agent_queue decide --event "$RUNNER_TEMP/event.json" --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/actions.json"
|
||||
python3 -m agent_queue apply --repo "$GH_REPO" --actions "$RUNNER_TEMP/actions.json"
|
||||
sha=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["pr"]["head_sha"])' "$RUNNER_TEMP/state.json")
|
||||
run=$(gh run list --workflow agent-pr-checks.yml --commit "$sha" --event pull_request_target --limit 1 --json databaseId -q '.[0].databaseId // empty')
|
||||
if [ -n "$run" ]; then gh run rerun "$run" || true; fi
|
||||
# Check again only after an accepted verification of the current head: refused, stale,
|
||||
# malformed or unauthorized /verified comments get a reply and nothing else.
|
||||
if ! python3 -m agent_queue should-rerun --actions "$RUNNER_TEMP/actions.json"; then exit 0; fi
|
||||
# pull_request_target runs are recorded against the base branch, not the pull request
|
||||
# head, so the earlier check run cannot be found by head SHA. Evaluate the same check here.
|
||||
status=0
|
||||
python3 -m agent_queue pr-check --state "$RUNNER_TEMP/state.json" > "$RUNNER_TEMP/result.json" || status=$?
|
||||
{
|
||||
echo '## Agent PR check after verification'
|
||||
echo '```json'
|
||||
cat "$RUNNER_TEMP/result.json"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$status" -eq 1 ]; then
|
||||
echo "::warning title=Agent PR check (advisory)::problems found; see the run summary"
|
||||
elif [ "$status" -ne 0 ]; then
|
||||
exit "$status"
|
||||
fi
|
||||
@@ -11,7 +11,14 @@ remains unsupported.
|
||||
|
||||
### Added
|
||||
|
||||
- Added an agent task queue for the cpu, gpu, runtime, shared and qa areas: an *Agent task* issue form with priority and interface fields, a workflow that decides `/claim`, `/release`, `/reassign`, `/progress`, `/blocked`, `/unblock` and `/approve-acceptance` comments one at a time (dependency, cycle and file-overlap checks, 24-hour leases renewed by progress), a pull request check (linked claimed task, file ownership, overlap with other pull requests, independent `/verified <head sha>`), `scripts/agent-queue.sh` and `scripts/agent-sync.sh` (upstream fetch every 12 minutes, task branches in separate worktrees) and a machine-readable queue summary. The rules are standard-library Python in `scripts/agent_queue/` with unit tests in `tests/agent_queue/`; issue text is never executed and acceptance commands need maintainer approval. Only comments that start with a command start a job, so ordinary pull request comments never re-run verification, and only an accepted `/verified <full head sha>` evaluates the check again; and each claim run decides every unanswered command in order, so commands whose pending runs GitHub cancelled are still answered. See `docs/coordination/agent-tasks.md`. Unit tests pass locally; the workflows have not run on GitHub yet, and the pull request check stays advisory (it never blocks a merge) until a live smoke test and the migration of existing issues are done.
|
||||
- Added explicit claim-before-work rules for contributors and coding agents to `AGENTS.md`, `CONTRIBUTING.md` and the pull request template: check for existing claims, claim with `/claim`, keep a 24-hour lease alive with `/progress`, `/release` when stopping, and link the claimed issue. Without the claim workflow, the earliest valid claim comment wins.
|
||||
- Added a CPU decoder for a bounded subset of BC6H (signed and unsigned HDR) in
|
||||
`xenora-texture`: the four single-subset modes (Khronos modes 3, 7, 11 and 15, Microsoft
|
||||
modes 11 to 14), listed in `BC6H_SUPPORTED_MODES`, plus the reserved modes, which decode to
|
||||
zero as specified. The ten two-subset modes are rejected with `Bc6hError::UnsupportedMode`
|
||||
and are not implemented. Tests check hand-derived values and 128 known-answer vectors from a
|
||||
separate clean-room reference decoder.
|
||||
- Added native Metal upload and readback of BC4 and BC5 textures (UNORM and SNORM):
|
||||
`xenora-texture` gains a pitched `BcChannelUpload`, and `NativeCompute::read_bc_channel_upload`
|
||||
sends the original blocks to `BC4_R*` or `BC5_RG*` textures when the device reports BC
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
//! CPU block decoder for a bounded subset of BC6H.
|
||||
//!
|
||||
//! Source (public): Khronos Data Format Specification 1.3, section 20.2
|
||||
//! "BC6H" (Tables 121 and 122, unquantization and final unquantization) and
|
||||
//! section 20.1 (BC7 interpolation, Equation 2 and Table 119); Microsoft,
|
||||
//! "BC6H Format" (Direct3D 11).
|
||||
//!
|
||||
//! Supported: the four single-subset modes, numbered as Khronos numbers
|
||||
//! them (Microsoft's modes 11 to 14 in brackets): 3 (11, 10-bit endpoints),
|
||||
//! 7 (12, 11-bit base, 9-bit deltas), 11 (13, 12-bit base, 8-bit deltas) and
|
||||
//! 15 (14, 16-bit base, 4-bit deltas), for both signed and unsigned data.
|
||||
//! Reserved modes 19, 23, 27 and 31 decode to zero as the specification
|
||||
//! requires. The ten two-subset modes are rejected with
|
||||
//! [`Bc6hError::UnsupportedMode`]; they are not implemented.
|
||||
//!
|
||||
//! Output texels are row-major `[r, g, b]` half-float bit patterns; the
|
||||
//! format's alpha is always 1.0 and is not returned.
|
||||
//!
|
||||
//! Final unquantization follows the Khronos text: a negative interpolated
|
||||
//! value keeps its sign bit even when its magnitude rounds to zero, so -1
|
||||
//! becomes 0x8000 (-0.0). Microsoft's sample code returns 0x0000 there. This
|
||||
//! is an open difference between the two public sources, not a hardware fact.
|
||||
|
||||
/// Khronos mode numbers this decoder implements.
|
||||
pub const BC6H_SUPPORTED_MODES: [u8; 4] = [3, 7, 11, 15];
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum Bc6hError {
|
||||
/// A two-subset mode, identified by its Khronos mode number.
|
||||
UnsupportedMode(u8),
|
||||
}
|
||||
|
||||
/// Returns the block's Khronos mode number: the low two bits when they are
|
||||
/// below two, otherwise the low five bits.
|
||||
pub fn bc6h_mode(block: [u8; 16]) -> u8 {
|
||||
if block[0] & 3 < 2 {
|
||||
block[0] & 3
|
||||
} else {
|
||||
block[0] & 31
|
||||
}
|
||||
}
|
||||
|
||||
/// Decodes an unsigned (UF16) BC6H block.
|
||||
pub fn decode_bc6h_ufloat(block: [u8; 16]) -> Result<[[u16; 3]; 16], Bc6hError> {
|
||||
decode(block, false)
|
||||
}
|
||||
|
||||
/// Decodes a signed (SF16) BC6H block.
|
||||
pub fn decode_bc6h_sfloat(block: [u8; 16]) -> Result<[[u16; 3]; 16], Bc6hError> {
|
||||
decode(block, true)
|
||||
}
|
||||
|
||||
/// Reads the block from its least significant bit upward.
|
||||
struct Bits {
|
||||
bits: u128,
|
||||
offset: u32,
|
||||
}
|
||||
|
||||
impl Bits {
|
||||
fn take(&mut self, count: u32) -> u32 {
|
||||
let value = (self.bits >> self.offset) as u32 & ((1u32 << count) - 1);
|
||||
self.offset += count;
|
||||
value
|
||||
}
|
||||
|
||||
/// `v[high..=low]`, lowest block bit first into bit `low`.
|
||||
fn field(&mut self, target: &mut i32, high: u32, low: u32) {
|
||||
*target |= (self.take(high - low + 1) << low) as i32;
|
||||
}
|
||||
|
||||
/// Table 122's reversed `v[a..b]` with `a < b`: the lowest block bit
|
||||
/// lands in bit `b` and each following bit one position lower.
|
||||
fn reversed(&mut self, target: &mut i32, low: u32, high: u32) {
|
||||
for bit in (low..=high).rev() {
|
||||
*target |= (self.take(1) << bit) as i32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Endpoint bits, delta bits and whether E1 is stored relative to E0.
|
||||
fn single_subset(mode: u8) -> Option<(u32, u32, bool)> {
|
||||
match mode {
|
||||
3 => Some((10, 10, false)),
|
||||
7 => Some((11, 9, true)),
|
||||
11 => Some((12, 8, true)),
|
||||
15 => Some((16, 4, true)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn sign_extend(value: i32, bits: u32) -> i32 {
|
||||
let shift = 32 - bits;
|
||||
(value << shift) >> shift
|
||||
}
|
||||
|
||||
fn unquantize(x: i32, bits: u32, signed: bool) -> i32 {
|
||||
if !signed {
|
||||
if bits >= 15 {
|
||||
x
|
||||
} else if x == 0 {
|
||||
0
|
||||
} else if x == (1 << bits) - 1 {
|
||||
0xffff
|
||||
} else {
|
||||
((x << 15) + 0x4000) >> (bits - 1)
|
||||
}
|
||||
} else if bits >= 16 {
|
||||
x
|
||||
} else {
|
||||
let magnitude = x.abs();
|
||||
let unq = if magnitude == 0 {
|
||||
0
|
||||
} else if magnitude >= (1 << (bits - 1)) - 1 {
|
||||
0x7fff
|
||||
} else {
|
||||
((magnitude << 15) + 0x4000) >> (bits - 1)
|
||||
};
|
||||
if x < 0 { -unq } else { unq }
|
||||
}
|
||||
}
|
||||
|
||||
fn finish(i: i32, signed: bool) -> u16 {
|
||||
if !signed {
|
||||
((i * 31) >> 6) as u16
|
||||
} else if i < 0 {
|
||||
((((-i) * 31) >> 5) | 0x8000) as u16
|
||||
} else {
|
||||
((i * 31) >> 5) as u16
|
||||
}
|
||||
}
|
||||
|
||||
const WEIGHTS: [i32; 16] = [0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64];
|
||||
|
||||
fn decode(block: [u8; 16], signed: bool) -> Result<[[u16; 3]; 16], Bc6hError> {
|
||||
let mode = bc6h_mode(block);
|
||||
if matches!(mode, 19 | 23 | 27 | 31) {
|
||||
return Ok([[0; 3]; 16]);
|
||||
}
|
||||
let (epb, delta, transformed) = single_subset(mode).ok_or(Bc6hError::UnsupportedMode(mode))?;
|
||||
let mut bits = Bits {
|
||||
bits: u128::from_le_bytes(block),
|
||||
offset: 5,
|
||||
};
|
||||
let mut e0 = [0i32; 3];
|
||||
let mut e1 = [0i32; 3];
|
||||
for channel in &mut e0 {
|
||||
bits.field(channel, 9, 0);
|
||||
}
|
||||
for c in 0..3 {
|
||||
match mode {
|
||||
3 => bits.field(&mut e1[c], 9, 0),
|
||||
7 => {
|
||||
bits.field(&mut e1[c], 8, 0);
|
||||
bits.field(&mut e0[c], 10, 10);
|
||||
}
|
||||
11 => {
|
||||
bits.field(&mut e1[c], 7, 0);
|
||||
bits.reversed(&mut e0[c], 10, 11);
|
||||
}
|
||||
_ => {
|
||||
bits.field(&mut e1[c], 3, 0);
|
||||
bits.reversed(&mut e0[c], 10, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
debug_assert_eq!(bits.offset, 65);
|
||||
let mut ends = [[0i32; 3]; 2];
|
||||
for c in 0..3 {
|
||||
let mut a = e0[c];
|
||||
let mut b = e1[c];
|
||||
if signed {
|
||||
a = sign_extend(a, epb);
|
||||
}
|
||||
if transformed || signed {
|
||||
b = sign_extend(b, delta);
|
||||
}
|
||||
if transformed {
|
||||
b = (a + b) & ((1 << epb) - 1);
|
||||
if signed {
|
||||
b = sign_extend(b, epb);
|
||||
}
|
||||
}
|
||||
ends[0][c] = unquantize(a, epb, signed);
|
||||
ends[1][c] = unquantize(b, epb, signed);
|
||||
}
|
||||
let mut texels = [[0u16; 3]; 16];
|
||||
for (texel, out) in texels.iter_mut().enumerate() {
|
||||
// Texel 0 is the anchor: its implicit high index bit is zero.
|
||||
let index = bits.take(if texel == 0 { 3 } else { 4 }) as usize;
|
||||
let w = WEIGHTS[index];
|
||||
for c in 0..3 {
|
||||
let i = ((64 - w) * ends[0][c] + w * ends[1][c] + 32) >> 6;
|
||||
out[c] = finish(i, signed);
|
||||
}
|
||||
}
|
||||
Ok(texels)
|
||||
}
|
||||
@@ -8,11 +8,15 @@
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
mod bc;
|
||||
mod bc6h;
|
||||
pub mod sampler;
|
||||
mod upload;
|
||||
pub use bc::{
|
||||
decode_bc2, decode_bc3, decode_bc4_snorm, decode_bc4_unorm, decode_bc5_snorm, decode_bc5_unorm,
|
||||
};
|
||||
pub use bc6h::{
|
||||
BC6H_SUPPORTED_MODES, Bc6hError, bc6h_mode, decode_bc6h_sfloat, decode_bc6h_ufloat,
|
||||
};
|
||||
pub use sampler::{AddressMode, FilterMode, SamplerDesc, SamplerError, TextureMetadata};
|
||||
pub use upload::{
|
||||
Bc1Subresource, Bc1Upload, Bc1UploadDesc, BcAlphaFormat, BcAlphaUpload, BcAlphaUploadDesc,
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
//! BC6H subset tests.
|
||||
//!
|
||||
//! Hand-worked expectations follow the Khronos Data Format Specification 1.3,
|
||||
//! section 20.2 (Tables 121 and 122, unquantization and final unquantization)
|
||||
//! and the BC7 weight table (Table 119). The known-answer file holds vectors
|
||||
//! produced by a separate clean-room reference decoder, not by this crate.
|
||||
|
||||
use xenora_texture::{
|
||||
BC6H_SUPPORTED_MODES, Bc6hError, bc6h_mode, decode_bc6h_sfloat, decode_bc6h_ufloat,
|
||||
};
|
||||
|
||||
/// Packs fields into a block from bit 0 upward, as Table 122 reads them.
|
||||
#[derive(Default)]
|
||||
struct Writer {
|
||||
bits: u128,
|
||||
offset: u32,
|
||||
}
|
||||
|
||||
impl Writer {
|
||||
fn put(&mut self, value: u64, count: u32) -> &mut Self {
|
||||
self.bits |= u128::from(value & ((1 << count) - 1)) << self.offset;
|
||||
self.offset += count;
|
||||
self
|
||||
}
|
||||
|
||||
/// Table 122's reversed field `v[low..high]`: the first block bit holds
|
||||
/// bit `high` of `value`, the next `high - 1`, down to `low`.
|
||||
fn reversed(&mut self, value: u64, low: u32, high: u32) -> &mut Self {
|
||||
for bit in (low..=high).rev() {
|
||||
self.put(value >> bit, 1);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Writes the 63 index bits: texel 0 is the anchor (3 bits, implicit top
|
||||
/// bit 0), every other texel 4 bits.
|
||||
fn indices(&mut self, indices: [u64; 16]) -> [u8; 16] {
|
||||
assert_eq!(self.offset, 65);
|
||||
assert!(indices[0] < 8);
|
||||
self.put(indices[0], 3);
|
||||
for &index in &indices[1..] {
|
||||
self.put(index, 4);
|
||||
}
|
||||
assert_eq!(self.offset, 128);
|
||||
self.bits.to_le_bytes()
|
||||
}
|
||||
}
|
||||
|
||||
/// Index t for texel t, except the anchor texel 0, which must be below 8.
|
||||
const RAMP: [u64; 16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
||||
|
||||
/// Mode 3 (Microsoft mode 11): 10-bit endpoints stored directly.
|
||||
fn mode3(e0: [u64; 3], e1: [u64; 3], indices: [u64; 16]) -> [u8; 16] {
|
||||
let mut w = Writer::default();
|
||||
w.put(3, 5);
|
||||
for value in e0.into_iter().chain(e1) {
|
||||
w.put(value, 10);
|
||||
}
|
||||
w.indices(indices)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mode3_unsigned_spans_zero_to_the_largest_half() {
|
||||
let block = mode3([0; 3], [1023; 3], RAMP);
|
||||
assert_eq!(bc6h_mode(block), 3);
|
||||
let texels = decode_bc6h_ufloat(block).unwrap();
|
||||
// Endpoint 0 unquantizes to 0 and the all-ones endpoint to 0xffff, which
|
||||
// the final (i * 31) >> 6 maps to 0x7bff, 65504.0.
|
||||
assert_eq!(texels[0], [0; 3]);
|
||||
assert_eq!(texels[15], [0x7bff; 3]);
|
||||
// Index 8 has weight 34: i = (34 * 0xffff + 32) >> 6 = 34815, and
|
||||
// (34815 * 31) >> 6 = 16863 = 0x41df.
|
||||
assert_eq!(texels[8], [0x41df; 3]);
|
||||
// Index 1 has weight 4: i = (4 * 0xffff + 32) >> 6 = 4096, then
|
||||
// (4096 * 31) >> 6 = 1984 = 0x07c0.
|
||||
assert_eq!(texels[1], [0x07c0; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mode3_signed_sign_extends_and_saturates_both_ends() {
|
||||
// 0x201 is -511 in 10 bits; |x| >= 2^9 - 1 unquantizes to -0x7fff, and
|
||||
// the final step gives ((0x7fff * 31) >> 5) | 0x8000 = 0xfbff (-65504.0).
|
||||
// 511 gives 0x7fff -> 0x7bff (65504.0).
|
||||
let block = mode3([0x201, 0x201, 0], [511, 0, 0x201], RAMP);
|
||||
let texels = decode_bc6h_sfloat(block).unwrap();
|
||||
assert_eq!(texels[0], [0xfbff, 0xfbff, 0x0000]);
|
||||
assert_eq!(texels[15], [0x7bff, 0x0000, 0xfbff]);
|
||||
// Index 8 between -0x7fff and 0x7fff: i = (30 * -32767 + 34 * 32767 + 32)
|
||||
// >> 6 = 2048, so (2048 * 31) >> 5 = 1984 = 0x07c0 in red.
|
||||
assert_eq!(texels[8][0], 0x07c0);
|
||||
// Unsigned data reads 0x201 as 513: ((513 << 15) + 0x4000) >> 9 = 32864,
|
||||
// and (32864 * 31) >> 6 = 15918 = 0x3e2e.
|
||||
assert_eq!(decode_bc6h_ufloat(block).unwrap()[0][0], 0x3e2e);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mode7_wraps_the_transformed_endpoint_at_eleven_bits() {
|
||||
// Mode 7 (Microsoft 12): R0[9:0], G0[9:0], B0[9:0], then per channel
|
||||
// R1[8:0] and R0[10]. E0 = 2047 in every channel, delta +1, so
|
||||
// E1 = (2047 + 1) & 0x7ff = 0.
|
||||
let mut w = Writer::default();
|
||||
w.put(7, 5);
|
||||
for _ in 0..3 {
|
||||
w.put(0x3ff, 10);
|
||||
}
|
||||
for _ in 0..3 {
|
||||
w.put(1, 9).put(1, 1);
|
||||
}
|
||||
let block = w.indices(RAMP);
|
||||
let texels = decode_bc6h_ufloat(block).unwrap();
|
||||
assert_eq!(texels[0], [0x7bff; 3]);
|
||||
assert_eq!(texels[15], [0; 3]);
|
||||
// Signed: E0 = 2047 is -1 in 11 bits and the delta +1 makes E1 = 0.
|
||||
// -1 unquantizes to -((1 << 15) + 0x4000) >> 10 = -48, final -(48 * 31 >> 5)
|
||||
// = -46 -> 0x802e.
|
||||
let texels = decode_bc6h_sfloat(block).unwrap();
|
||||
assert_eq!(texels[0], [0x802e; 3]);
|
||||
assert_eq!(texels[15], [0; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mode15_reads_its_reversed_high_bits() {
|
||||
// Mode 15 (Microsoft 14): E0[9:0] per channel, then per channel E1[3:0]
|
||||
// and E0[10..15] reversed. E0 = 0x8000 has only bit 15 set, which is
|
||||
// the first bit of the reversed field. 16-bit endpoints are not
|
||||
// unquantized, so E0 reads (0x8000 * 31) >> 6 = 0x3e00 unsigned.
|
||||
let mut w = Writer::default();
|
||||
w.put(15, 5);
|
||||
for _ in 0..3 {
|
||||
w.put(0, 10);
|
||||
}
|
||||
for _ in 0..3 {
|
||||
w.put(1, 4).reversed(0x8000, 10, 15);
|
||||
}
|
||||
let block = w.indices(RAMP);
|
||||
let texels = decode_bc6h_ufloat(block).unwrap();
|
||||
assert_eq!(texels[0], [0x3e00; 3]);
|
||||
// E1 = 0x8001: (0x8001 * 31) >> 6 = 0x3e00 as well.
|
||||
assert_eq!(texels[15], [0x3e00; 3]);
|
||||
// Swapping the reversed order would place bit 15 at bit 10: E0 = 0x400,
|
||||
// which would read (0x400 * 31) >> 6 = 0x1f0 instead.
|
||||
assert_ne!(texels[0][0], 0x01f0);
|
||||
// Signed: 0x8000 is -32768 and passes through unquantization; the final
|
||||
// step gives ((32768 * 31) >> 5) | 0x8000 = 0xfc00, negative infinity.
|
||||
assert_eq!(decode_bc6h_sfloat(block).unwrap()[0], [0xfc00; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mode11_places_its_two_reversed_bits() {
|
||||
// Mode 11 (Microsoft 13): E1[7:0] then E0[10..11] reversed. E0 = 0x800
|
||||
// (bit 11 only) and delta 0; 12-bit 0x800 = 2048 unquantizes to
|
||||
// ((2048 << 15) + 0x4000) >> 11 = 32776, final (32776 * 31) >> 6 = 15875.
|
||||
let mut w = Writer::default();
|
||||
w.put(11, 5);
|
||||
for _ in 0..3 {
|
||||
w.put(0, 10);
|
||||
}
|
||||
for _ in 0..3 {
|
||||
w.put(0, 8).reversed(0x800, 10, 11);
|
||||
}
|
||||
let block = w.indices([0; 16]);
|
||||
assert_eq!(decode_bc6h_ufloat(block).unwrap()[5], [15875; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reserved_modes_decode_to_zero() {
|
||||
for mode in [19, 23, 27, 31] {
|
||||
let block = [
|
||||
mode, 0xff, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 1, 2, 3, 4, 5, 6,
|
||||
];
|
||||
assert_eq!(bc6h_mode(block), mode);
|
||||
assert_eq!(decode_bc6h_ufloat(block).unwrap(), [[0; 3]; 16]);
|
||||
assert_eq!(decode_bc6h_sfloat(block).unwrap(), [[0; 3]; 16]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_every_two_subset_mode() {
|
||||
let two_subset = [0, 1, 2, 6, 10, 14, 18, 22, 26, 30];
|
||||
for mode in 0..32u8 {
|
||||
let block = [mode, 0xaa, 0x55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
let number = bc6h_mode(block);
|
||||
if two_subset.contains(&number) {
|
||||
assert!(!BC6H_SUPPORTED_MODES.contains(&number));
|
||||
assert_eq!(
|
||||
decode_bc6h_ufloat(block),
|
||||
Err(Bc6hError::UnsupportedMode(number))
|
||||
);
|
||||
assert_eq!(
|
||||
decode_bc6h_sfloat(block),
|
||||
Err(Bc6hError::UnsupportedMode(number))
|
||||
);
|
||||
}
|
||||
}
|
||||
// Two-bit modes: the low bits 0 and 1 select modes 0 and 1 whatever the
|
||||
// next three bits hold.
|
||||
assert_eq!(
|
||||
bc6h_mode([0b11100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
|
||||
0
|
||||
);
|
||||
assert_eq!(
|
||||
bc6h_mode([0b11101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
fn hex16(text: &str) -> u16 {
|
||||
u16::from_str_radix(text, 16).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn matches_independent_known_answers_by_mode() {
|
||||
let text = include_str!("fixtures/bc6h_vectors.txt");
|
||||
let mut per_mode = std::collections::BTreeMap::<u8, usize>::new();
|
||||
for line in text.lines().filter(|line| !line.starts_with('#')) {
|
||||
let fields: Vec<_> = line.split(' ').collect();
|
||||
let hex = fields[2];
|
||||
let block: [u8; 16] =
|
||||
std::array::from_fn(|i| u8::from_str_radix(&hex[2 * i..2 * i + 2], 16).unwrap());
|
||||
let want: Vec<[u16; 3]> = fields[3..]
|
||||
.iter()
|
||||
.map(|t| [0, 1, 2].map(|c| hex16(&t[4 * c..4 * c + 4])))
|
||||
.collect();
|
||||
let got = if fields[1] == "1" {
|
||||
decode_bc6h_sfloat(block)
|
||||
} else {
|
||||
decode_bc6h_ufloat(block)
|
||||
}
|
||||
.unwrap();
|
||||
assert_eq!(got[..], want[..], "vector {line}");
|
||||
*per_mode.entry(bc6h_mode(block)).or_default() += 1;
|
||||
}
|
||||
// 16 vectors (8 unsigned, 8 signed) for each supported and reserved mode.
|
||||
let expected: Vec<_> = [3, 7, 11, 15, 19, 23, 27, 31].map(|m| (m, 16)).into();
|
||||
assert_eq!(per_mode.into_iter().collect::<Vec<_>>(), expected);
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
# BC6H known-answer vectors from an independent clean-room reference decoder (Python, written
|
||||
# from the Microsoft BC6H and Khronos BPTC texts by a separate reviewer; not Xenora's decoder).
|
||||
# Seeded random and extreme-payload blocks for the four single-subset modes and the four
|
||||
# reserved modes. Fields: reference-mode signed block-hex then 16 texels of rrrrggggbbbb half bits.
|
||||
11 0 83ea63de09bae256474d77a3922fc7ec 66c326ab27f8 669f2b222b59 6541558e4b6a 669f2b222b59 662739a53651 662739a53651 66c326ab27f8 65af48294149 66e822342498 65dd42943d11 64ee5f9a5302 66e822342498 662739a53651 65665117480a 65665117480a 65135b234fa2
|
||||
11 0 a38d3e6a3f3c6083660b71f11402542b 20ca1f096214 34512ee0512e 53de487735e2 0d420f3272fa 134414126dc7 3a5433c04bfb 134414126dc7 6d685d2e1fc9 26cc23e95ce1 134414126dc7 1ac71a296747 0d420f3272fa 26cc23e95ce1 2cce28c957ae 53de487735e2 1ac71a296747
|
||||
11 0 23f083505649414fbb1eaf43a6e55411 54e12a335c6b 376936f055a1 28ae3d4f523c 682521de60dc 24253f455131 3bf234fa56ad 5df226475e82 596a283d5d77 4f362ca65b1d 3bf234fa56ad 54e12a335c6b 28ae3d4f523c 596a283d5d77 54e12a335c6b 682521de60dc 682521de60dc
|
||||
11 0 23690f32bae380ea09cf46f44f8cc9b1 4ead02f4389a 65e603b12216 0e7800e876da 203a017965a2 4261028f4486 4ead02f4389a 4ead02f4389a 0e7800e876da 0e7800e876da 4ead02f4389a 203a017965a2 377402364f1e 31fd020a546a 203a017965a2 606f03842762 25b101a56056
|
||||
11 0 439f70784476716762c37b1bc81e24b1 21d42077428e 350f3cdb3352 29b22c143c52 4aea5d1e2202 476b57f424c7 388e4204308d 476b57f424c7 21d42077428e 3c0e472e2dc7 4aea5d1e2202 52c868bb1bc6 21d42077428e 2d31313e398d 263326eb3f17 21d42077428e 476b57f424c7
|
||||
11 0 6350574c754a6d65029add620e20dd6c 4b951a6d4e8f 4dec15215229 34c84e152b6f 37b447752ff0 2dc45df920a0 2dc45df920a0 48a9210d4a0e 3eb937913abe 2ad864991c1f 4dec15215229 4dec15215229 48a9210d4a0e 2dc45df920a0 2dc45df920a0 301b58ad243a 3eb937913abe
|
||||
11 0 03000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
11 0 e3ffffffffffffffffffffffffffffff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff
|
||||
11 1 c395d46c7ced9691f0d4acc885a373f4 2a43670def0b 68812c714699 3acb577bbecb 5fc034ae2d0d 5bdc385821b3 54143fac0aff 4b5347ea8e8b 5bdc385821b3 3eaf53d1b371 4b5347ea8e8b 36e75b25ca25 54143fac0aff 36e75b25ca25 47704b9399e6 3acb577bbecb 68812c714699
|
||||
11 1 43937ad03385b0571e6cdfc6d2eb099e 26c74bb052c6 25993d9f7192 27bb570e39e6 269949865783 28535e172a81 27ea59383529 269949865783 27bb570e39e6 25d340536ba6 27ea59383529 278d54e33ea3 28245bec2f3d 27245005494c 256b3b75764f 28245bec2f3d 27245005494c
|
||||
11 1 83093e199a9a32ed37d2ff5cc8cd8e01 063ab71431ec 063ab71431ec 0a03c3153692 a18146f50121 aa0561f78953 aa0561f78953 9db83af405c7 81569f1228a1 8da307f01987 9db83af405c7 a18146f50121 9db83af405c7 a63c55f684ad 8da307f01987 0ebed2163c61 1287de174107
|
||||
11 1 03983502bd75a0f1cdd1179dc599bb85 84bc28fdba0c b61f375e988f 26b81c56d785 be0539ab9333 8ca32b4ab4b0 26b81c56d785 be0539ab9333 9c712fe4a9f9 0523261dc0bf b61f375e988f 9c712fe4a9f9 9c712fe4a9f9 ae3835119dea ae3835119dea 0523261dc0bf 948a2d97af55
|
||||
11 1 e386b78ba8f59c269062282366aa1efd 0d71a33d10d5 aa3512f911fb 00429666111a 98a201da119e a4590d4411dc 00429666111a 859890b11139 00429666111a 98a201da119e 98a201da119e b1871a1b1222 b1871a1b1222 ca6d325c12a6 07959d8810f4 c31a2b3a127f d049381112c5
|
||||
11 1 c3109d78f27e3cf0872579410fdde78e 1842547b3b7b 0ad461e91fbf 1324599930eb 1ad151ec40c4 084564781a77 0d635f5a2508 1e044eb9475e 15b3570a3633 885b751987df 20934c2b4ca7 82996f570403 82996f570403 0d635f5a2508 85cc728a8296 85cc728a8296 0ad461e91fbf
|
||||
11 1 03000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
11 1 e3ffffffffffffffffffffffffffffff 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d 805d805d805d
|
||||
12 0 4719bf7e97173176f49b3193b40bf322 4c5216233c1a 58e90fe44862 550511d24496 52f512d84294 4b2d16b43afc 4d3c15ae3cff 4d3c15ae3cff 52f512d84294 4e27153a3de3 550511d24496 550511d24496 4a4217283a18 4d3c15ae3cff 58e90fe44862 4c5216233c1a 4c5216233c1a
|
||||
12 0 07e5075c8bf908672b6ebe426d2f4f46 6ad702595c28 6d30018b59d1 633304f763c2 69dc02af5d21 633304f763c2 65bf04186139 6d30018b59d1 6b9f02145b60 642e04a262c8 69dc02af5d21 626b053c6489 6d30018b59d1 626b053c6489 6b9f02145b60 69dc02af5d21 6b9f02145b60
|
||||
12 0 0725049118dd6e2b2d1c3a38a1ab0e3b 4daa5a1e4481 4f295c56431f 4b7756db4689 4f995cfe42b7 4c2b57e645e3 4ecf5bd14372 4cf559134527 4ecf5bd14372 4f995cfe42b7 4c2b57e645e3 4bd157604636 4c2b57e645e3 4aac55ae4745 4ff35d834263 4bd157604636 4ecf5bd14372
|
||||
12 0 878f0383b3b8154de52389f31c1312f4 438b20ed5a86 3841294661f5 42a921955b1c 438b20ed5a86 3d2025ac5ec0 3e0225045e2b 42a921955b1c 375e29ed628a 3a3f27cd60a5 44a7201b59cc 42a921955b1c 44a7201b59cc 438b20ed5a86 44a7201b59cc 41c6223c5bb1 375e29ed628a
|
||||
12 0 2796cdd98ea6c5ea5361ee419c855a8d 0b89761572e8 0ee676cf7237 0b89761572e8 0fe377057202 169c787870a0 169c787870a0 0b89761572e8 0e1b76a37260 14d4781670fe 124277887186 0ee676cf7237 1178775c71af 134077bf7152 0ee676cf7237 159f784170d5 1178775c71af
|
||||
12 0 e7dbdbf2abaa433a0cc366276aed86fd 285359522175 2c88589c1e9b 2a6e58f72008 24485a022434 285359522175 285359522175 27ad596e21e6 2b1358db1f98 259359ca2353 285359522175 23a25a1e24a4 22d35a412530 285359522175 2708598b2256 23a25a1e24a4 222d5a5d25a1
|
||||
12 0 07000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
12 0 e7ffffffffffffffffffffffffffffff 7bf47bf47bf4 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8 7be87be87be8
|
||||
12 1 2790511ac1a5c8da3a085661d5dafcbf 16fee5940e28 1435e69f0f4a 1b84e3e20c4f 0faee8521122 18bbe4ed0d71 16fee5940e28 1113e7cc1091 18bbe4ed0d71 16fee5940e28 22d4e1230954 1ea6e2b40b08 22d4e1230954 216fe1a909e6 25f6dff7080d 25f6dff7080d 200be22f0a77
|
||||
12 1 67453d894c03fb16d40428501029b19e 450eaff74710 4e32b3734afa 46a5b09247be 4344af49464b 4a05b1dc4930 450eaff74710 4344af49464b 4771b0e04815 4344af49464b 440faf9746a2 4ad1b2294987 450eaff74710 440faf9746a2 4c9bb2d84a4c 4f30b3d44b67 4ad1b2294987
|
||||
12 1 87f6bd8a558e4a02b1b7bb756a77c20a 72dbce2aa634 6e0ec6b2a5d9 6fcac965a5fa 6e0ec6b2a5d9 6e0ec6b2a5d9 6e0ec6b2a5d9 70b6cad4a60b 6fcac965a5fa 6e76c754a5e1 7033ca08a602 6fcac965a5fa 6fcac965a5fa 71f0ccbca623 6da5c60fa5d1 6e76c754a5e1 72dbce2aa634
|
||||
12 1 e78483d81d0a717b7cae055d7f7be30d 8490e21d66bd 8600e306689a 90c9e9d67690 8aace5f96ea7 82c4e0fb6469 04c8dc365aa3 8efde8b3743d 82c4e0fb6469 9239eabe786d 8600e306689a 8c1ce6e27083 8600e306689a 001cdf2a60b0 90c9e9d67690 8efde8b3743d 04c8dc365aa3
|
||||
12 1 272e57ad460aaafa44bc46ce904b1597 299c5022674a 26d34d78671f 1afd4225666a 1c61437a667f 23b14a7966ee 26d34d78671f 17db3f266639 1afd4225666a 2cbe53216779 1f83467a66af 1c61437a667f 26d34d78671f 256e4c23670a 2b5a51cc6764 224c492466d9 1f83467a66af
|
||||
12 1 e7a766408e14e948d9dae05c3676bdb1 d0c4e9279685 c657f6628c18 c9a1f2348f62 c657f6628c18 d56ee33c9b2f c4f8f8208ab9 c770f4fd8d31 cfabea8c956c ce4cec49940d d1dce7c3979d ce4cec49940d cd33edae92f4 c657f6628c18 c889f3998e4a d455e4a19a16 c889f3998e4a
|
||||
12 1 07000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
12 1 e7ffffffffffffffffffffffffffffff 803d803d803d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d 804d804d804d
|
||||
13 0 6b31b4dfc2ca480e4ea472e570cb0c28 4b383a680b85 4aae39fa0b59 4aae39fa0b59 4bc33ad60bb1 4a5939b60b3e 4b383a680b85 4ad83a1c0b67 4c783b660beb 49f939690b20 4b383a680b85 4bed3af80bbf 4c183b1a0bcd 4c183b1a0bcd 49f939690b20 4b633a8a0b93 4a5939b60b3e
|
||||
13 0 6b679c16a44d26a504fe8344e4fe6bc4 56ba47ac4e2a 570d47754dd9 54e448e14ff2 54c048f95016 569547c44e4d 55d448434f09 567047dd4e71 567047dd4e71 567047dd4e71 54e448e14ff2 54e448e14ff2 54c048f95016 555c48924f7e 561d48134ec2 567047dd4e71 553748aa4fa2
|
||||
13 0 ab608b9ccb22086871d5aaa82b943a66 176a086e2d00 18ae095a2c52 184c09132c86 19bb0a1f2bc0 193a09c02c06 193a09c02c06 18d9097a2c3a 193a09c02c06 196509e02bef 17cb08b52ccc 182108f42c9d 190409992c23 193a09c02c06 17f608d42cb4 1883093b2c69 1883093b2c69
|
||||
13 0 6ba60019822463ca99808fdb2d43a5b8 08686cbe6442 074b6cfe632f 094f6c8b6520 07826cf26364 05eb6d4d61db 07826cf26364 06d16d1a62ba 06656d326251 06656d326251 08d56ca664ab 089e6cb26476 08686cbe6442 08326ccb640e 07076d0d62ee 07826cf26364 06d16d1a62ba
|
||||
13 0 2b8516af9a0c7e187cb6875e7cdf38ae 3dea6dae0afd 3db56da60b14 3dea6dae0afd 3cd56d850b77 3db56da60b14 3d816d9e0b2b 3c296d6c0bc2 3e2c6db70ae0 3ca06d7d0b8e 3db56da60b14 3bf46d640bda 3c6b6d760ba5 3d816d9e0b2b 3e966dc70ab1 3c296d6c0bc2 3d096d8d0b60
|
||||
13 0 cb052921e4da656ec2d5658533352657 5e946f150fee 60a0701b0f21 5f526f740fa4 60cd70310f10 5f526f740fa4 5f8a6f900f8e 5f526f740fa4 5fe36fbc0f6b 5ef96f480fc7 5ef96f480fc7 5f526f740fa4 5ef96f480fc7 5f8a6f900f8e 5ecc6f310fd8 5fb66fa60f7d 5f526f740fa4
|
||||
13 0 0b000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
13 0 ebffffffffffffffffffffffffffffff 7bfa7bfa7bfa 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4 7bf47bf47bf4
|
||||
13 1 2b0c715b69ee4aef53a67f9dfa8ded8f f6596b0bb3af f72b6c71b43a f7686cdbb464 f83b6e40b4ef f93e6ffbb59d f79a6d2fb485 f8cf6f3db552 f7fd6dd7b4c7 f83b6e40b4ef f93e6ffbb59d f8cf6f3db552 f7cb6d83b4a6 f8cf6f3db552 f90d6fa6b57c f93e6ffbb59d f7cb6d83b4a6
|
||||
13 1 2b1a5a0e55b33017bab63f4e31db8f45 4ccaf393281e 4f66f6992940 4d4af4272855 4f66f6992940 511af89429fd 4bfdf2a527c5 50b3f81d29d0 4c64f31c27f2 4b15f1982760 4bfdf2a527c5 4f66f6992940 5033f7872999 511af89429fd 4e18f51628af 4ccaf393281e 4c64f31c27f2
|
||||
13 1 0bd0b66082241211b9999a5a46bc7f66 24fa145850fc 21cc113251f3 22c1122451a8 22c1122451a8 2239119d51d2 22c1122451a8 2239119d51d2 248e13ec511d 240613665145 24fa145850fc 216010c65214 21cc113251f3 1fff0f68527e 239a12fb5166 240613665145 240613665145
|
||||
13 1 2be0cc4e41fce4957fa4feace520cc83 92e0a428b2b2 92e0a428b2b2 9166a4a3b339 9459a3aeb22b 9648a30db17a 96bca2e7b150 9542a362b1d8 9459a3aeb22b 91daa47db310 9648a30db17a 8f78a544b3eb 907da4efb38d 9542a362b1d8 9542a362b1d8 90f2a4c9b363 9354a402b288
|
||||
13 1 ab9e0f74fab2380f7278f84b656558f3 4d39eadf1327 4f8f878c13e4 4fec07bb1401 4f8f878c13e4 4fec07bb1401 529d7a5514db 511639651460 4e64b9351386 4ec0a9ed13a3 4f3396d413c7 4ec0a9ed13a3 4f3396d413c7 4fec07bb1401 4ec0a9ed13a3 4e08c87d1369 529d7a5514db
|
||||
13 1 cb54a21d4ea20bc7fabf633794dada44 2a87347ecef2 2d803847d395 2d803847d395 2c5336c8d1bf 29fa33cace15 2ae034efcf7c 2b273549cfeb 29fa33cace15 2a413424ce83 2bb535fed0c7 2c0d366ed151 2ce1377cd29c 2c0d366ed151 2ce1377cd29c 2a413424ce83 2a413424ce83
|
||||
13 1 0b000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
13 1 ebffffffffffffffffffffffffffffff 801e801e801e 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026 802680268026
|
||||
14 0 cf9b72f4638f22774cd1b4cb76061a92 3a8a424f3734 3a8b424f3734 3a8b424e3735 3a8a42503734 3a8b424f3734 3a8a42503734 3a8a42503734 3a8a42503734 3a8a424f3734 3a8a424f3734 3a8a424f3734 3a8b424e3735 3a8a42503734 3a8b424e3735 3a8b424f3735 3a8a424f3734
|
||||
14 0 4f2fcdb4011321c629c9322cc3712f9d 312704a50df9 312704a60df9 312704a40df8 312704a30df8 312704a60df9 312704a50df9 312704a30df8 312704a60df9 312704a50df9 312704a30df8 312704a60df9 312704a40df8 312704a20df7 312704a60df9 312704a30df8 312704a40df8
|
||||
14 0 cf610b8e57f3db527a0602bf3801aaaf 31e9573a2895 31e9573a2895 31e9573a2895 31ea573a2894 31ea573a2894 31ea573a2894 31e7573a2896 31e8573a2896 31e9573a2895 31ea573a2894 31ea573a2894 31ea573a2894 31e8573a2895 31e8573a2895 31e7573a2896 31e8573a2895
|
||||
14 0 0ff230463c4a36297b2ffa54d5e7f73c 151a68cf5079 151b68cf5079 151d68cf5079 151a68ce5078 151c68cf5079 151d68cf5079 151a68cf5079 151a68cf5079 151a68cf5079 151c68cf5079 151b68cf5079 151d68cf5079 151b68cf5079 151d68cf5079 151c68cf5079 151a68ce5078
|
||||
14 0 0f851bf05ca784cd51d54cebcc5f0dbb 36531f1a4cc2 36521f1b4cc1 36521f1b4cc1 36511f1c4cc0 36511f1c4cc0 36521f1b4cc1 36511f1c4cc0 36501f1d4cbf 36511f1c4cc0 36511f1c4cc0 36501f1d4cbf 36521f1b4cc1 36511f1c4cc0 36531f1a4cc2 36511f1c4cc0 36511f1c4cc0
|
||||
14 0 6f0820d1556445ac7020163d1f18ce0c 07e0220752c8 07df220652c6 07e0220752c8 07df220652c7 07df220652c6 07e0220752c8 07de220552c4 07df220652c7 07dd220452c4 07e0220752c8 07df220552c6 07e0220752c8 07dd220452c4 07de220552c5 07de220552c5 07e0220752c8
|
||||
14 0 0f000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
14 0 efffffffffffffffffffffffffffffff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff 7bff7bff7bff
|
||||
14 1 af4c414be3c07228605bc7eeb0957b8a f9aede72db68 f9b0de70db68 f9b1de6edb68 f9afde70db68 f9b0de6fdb68 f9b1de6ddb68 f9b2de6cdb68 f9b2de6cdb68 f9aede72db68 f9b1de6edb68 f9afde70db68 f9b0de6edb68 f9b1de6edb68 f9b0de6fdb68 f9b1de6edb68 f9b0de6fdb68
|
||||
14 1 4f6aa14737501798d887942209199542 0719ab5ab2ba 071cab5cb2ba 071aab5ab2ba 071aab5ab2ba 0719ab5ab2ba 071bab5bb2ba 0718ab59b2ba 0718ab59b2ba 071bab5bb2ba 0717ab58b2ba 071bab5bb2ba 0717ab58b2ba 0719ab5ab2ba 071bab5bb2ba 0718ab59b2ba 0719ab5ab2ba
|
||||
14 1 0f0d596fbf57f16ea872a24e726bc203 8b391dbac9e7 8b361db8c9e8 8b3a1dbbc9e6 8b381db9c9e7 8b3a1dbbc9e6 8b361db8c9e8 8b341db6c9e9 8b391dbac9e7 8b3a1dbbc9e6 8b381db9c9e7 8b361db8c9e8 8b381dbac9e7 8b3a1dbbc9e6 8b351db7c9e8 8b3a1dbbc9e7 8b3b1dbcc9e6
|
||||
14 1 6fcc6e37b0d0073e092082fe83f765bd f5cebb3a9b06 f5d0bb399b05 f5d0bb399b05 f5cfbb399b06 f5cfbb399b06 f5cdbb3a9b07 f5cabb3b9b09 f5cabb3b9b09 f5cfbb399b06 f5cdbb3a9b07 f5cdbb3a9b07 f5cabb3b9b09 f5cebb3a9b06 f5cebb3a9b07 f5cbbb3b9b08 f5ccbb3a9b08
|
||||
14 1 0f11cbaac2b462c4e95bc38d350f580b e81eeed51c68 e823eed11c63 e822eed21c64 e81feed41c67 e81eeed51c68 e822eed21c64 e823eed21c63 e820eed31c66 e81feed41c67 e81eeed51c68 e824eed11c62 e81ceed61c6a e820eed31c66 e81feed41c67 e822eed21c64 e81ceed61c6a
|
||||
14 1 cf30ad6326db44472f4aa329cefa56a0 6a1b45221676 6a1a45201677 6a1c45231676 6a1a45211676 6a1a45201677 6a1c45231676 6a1b45231676 6a1a45201677 6a1d45251675 6a1c45241675 6a1c45231676 6a1d45251675 6a1b45211676 6a1a45211676 6a19451f1677 6a1c45231676
|
||||
14 1 0f000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
14 1 efffffffffffffffffffffffffffffff 800080008000 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001 800180018001
|
||||
reserved-10011 0 f351b28e379ef3cc23974fa11ae4df33 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 136d3b2575b7f255ada473da3e079db7 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 738e7213274477d61d1288ffbad50f9d 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 53286139206ef3ad8dceeebe4d8a5e8f 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 b3672b029498bda7a4171ab3067700b2 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 13dee0deed18b2d04c440be48e712020 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 13000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 0 f3ffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 334b9a4d612c8f435384c7d34bdcdf2c 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 731ad86fe0c6571bac7901208b1d6211 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 73c7fe9ff7cf8cfefd1869d16c9286ab 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 733887ce778dea855219e2339f561dab 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 d3a34181b9c6f3c837ac3e662c1c0eb3 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 33e3ef5b9d235bdd1247a95d46ee5749 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 13000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10011 1 f3ffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 b7e1c82e010d600773774898d2f1dd53 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 f7ed84566d20896f394b75c4261f0c01 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 9724d37fd990b9919d90f5de8789a80c 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 7728dbdb91480829c667bcaeff7bc13f 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 17ab206a9b7cd3f895da02b0dc0c85c9 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 b7d5da7364a2528ffa357b90325e8481 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 17000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 0 f7ffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 d7642aa07f2eebb2431a378aef9961c2 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 b77c89a3d43e94836c10e90ab59a6f2c 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 97a43f042a1e8d895de78928890f80d1 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 576df55ec42f850f4040db46b0cfae02 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 7758c6643576e926f533604fa2d1fa39 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 77996f1d78b2075dcfe7bab71ae59cdd 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 17000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-10111 1 f7ffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 bbfbaab673450835f6f954e64b3ef165 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 bb33f23e11b54443763775f6f83fd552 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 fb2d49b386fcadb7509d353a7ecfa604 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 7babfdaef421280052611eb416267772 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 7b2d89d90ceb76c968fcb08a06c393a5 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 dba41c8d2d0b283afd0fe1fb6c6e6cb9 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 1b000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 0 fbffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 3b184617e7dfd7240f702fc183f37a5a 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 7bda84a6f91c1989aad47f10e2be1b39 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 1bf330718d597451452b016d3ac795dc 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 bb6d54956d076d18b1bf809d335e454f 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 1b96d95f746f8a0ef7ad8fc57fb4e2ab 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 7b758dd2449220bd382e73950a393ac2 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 1b000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11011 1 fbffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 df8ff83cf4500003054962a613d93b54 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 5fe853ef0ba6fb775778568e3a33dd9d 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 dffc945c8158f47286ef2d6dca151fb0 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 bf109d944fe398e8d7b4b83d468ea650 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 ff2173b367f78590be5b344185d78d37 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 1ff003040b5bf3b2369db6a47d09a9f0 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 1f000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 0 ffffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 7f970d19eefc041391f19d826eb79422 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 bf20a023685369cd0bbbda81cb11a99c 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 9fe9f522ed3df999af7ec51b14f818a4 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 5fb49d03bd442dc50b8cbaefb59339df 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 bfdd210cc4870122ace8a5ccaff19a97 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 5f92c889004afbd953188d19ef334ae6 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 1f000000000000000000000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
reserved-11111 1 ffffffffffffffffffffffffffffffff 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000
|
||||
@@ -6,7 +6,9 @@ deterministic: the rules live in `scripts/agent_queue/` (standard-library Python
|
||||
model or external service), and GitHub Actions and the shell helpers only call it.
|
||||
|
||||
Status: implemented and unit-tested locally. **Not yet run on GitHub**: the workflows are untested
|
||||
against the real API until the first live run.
|
||||
against the real API until the first live run. Until a live smoke test has passed and existing issues
|
||||
have been migrated into the queue, the pull request check is **advisory**: it reports problems but
|
||||
never blocks a merge, and it must not be made a required check.
|
||||
|
||||
## Areas
|
||||
|
||||
@@ -47,6 +49,12 @@ done
|
||||
prints "claimed".** Refusals name the reason: not `agent:ready`, area not allowed for you, open
|
||||
or missing dependency, dependency cycle, or file overlap with a claimed task (the issue is named).
|
||||
Claims are decided one at a time across the whole repository, so two overlapping claims cannot both win.
|
||||
GitHub keeps at most one waiting run in a concurrency group and cancels it when a newer one
|
||||
queues, so each run decides every command of the last `lease_hours` that has no bot reply yet,
|
||||
oldest first; a comment listed twice is decided once. A command whose own run was cancelled is answered by the run that replaced it, or at
|
||||
the latest by the hourly audit. Each reply carries a marker naming the comment it answers. A
|
||||
command left unanswered for more than `lease_hours` (the workflow did not run) gets a "Not
|
||||
decided" reply instead and must be posted again; one older than twice that is no longer read.
|
||||
4. `scripts/agent-queue.sh start <n>` creates branch `task/<n>-<slug>` from `upstream/main` in a
|
||||
separate worktree `../xenora-task-<n>` (`--here` uses the current clean checkout instead).
|
||||
5. Keep the lease alive with `scripts/agent-queue.sh progress <n> "what changed"`. A claim lapses
|
||||
@@ -54,11 +62,14 @@ done
|
||||
linked pull request. Other people's comments never renew it. A lapsed task returns to the queue.
|
||||
6. Open the pull request with `Closes #<n>` and a DCO sign-off (`git commit -s`).
|
||||
7. A different person (not the author, not the task holder) who is a maintainer or has `qa`
|
||||
comments `/verified <head sha>` after running the acceptance command. A new push changes the
|
||||
comments `/verified <full 40-character head sha>` after running the acceptance command. A new push changes the
|
||||
head and invalidates the verification.
|
||||
|
||||
## Commands (issue comments)
|
||||
|
||||
A command must start the comment. Comments that do not start with `/` (on an issue) or with
|
||||
`/verified` (on a pull request) start no job: GitHub records a skipped run and nothing else happens.
|
||||
|
||||
| Command | Who | Effect |
|
||||
| --- | --- | --- |
|
||||
| `/claim` | allowed for the area | Take a ready task |
|
||||
@@ -67,7 +78,7 @@ done
|
||||
| `/progress <text>` | holder | Renew the lease (text required) |
|
||||
| `/blocked <reason>`, `/unblock` | holder or maintainer | Set or clear `agent:blocked` |
|
||||
| `/approve-acceptance` | maintainer | Authorise the acceptance command as currently written |
|
||||
| `/verified <sha>` (on a pull request) | maintainer or `qa`, not author, not holder | Independent verification of the current head |
|
||||
| `/verified <40-character sha>` (on a pull request) | maintainer or `qa`, not author, not holder | Independent verification of the current head |
|
||||
|
||||
Labels: `area:<x>`, `priority:<critical|high|medium|low>`, `agent:ready|claimed|blocked|invalid|conflict`,
|
||||
`claimed-by:<login>`. An hourly audit lapses stale claims, marks tasks with missing dependencies or
|
||||
@@ -80,7 +91,16 @@ machine-readable summary (counts and lists per area, priority and state).
|
||||
`agent-pr-checks` fails a pull request when: it has no `Closes #N` for a claimed task; the task is held
|
||||
by someone else; it changes files outside the task's patterns; it changes a file that another open
|
||||
pull request also changes; the claim has lapsed without a push; or no eligible `/verified <current
|
||||
head sha>` exists. After a `/verified` comment the check is re-run automatically.
|
||||
head sha>` exists. The SHA must be the full 40 characters and the only argument: a commit with the
|
||||
same short prefix is cheap to make. After an accepted `/verified` (an eligible verifier, the current
|
||||
head) the verify job evaluates the same check again and writes it to its run summary; the earlier
|
||||
check run is not re-run, since `pull_request_target` runs are recorded against the base branch and
|
||||
cannot be found by the pull request head. Refused, stale, malformed or unauthorized `/verified`
|
||||
comments get a reply and nothing else, and other pull request comments start no job.
|
||||
|
||||
The check is advisory for now: a failure is shown as a warning and in the run summary, and the job
|
||||
still succeeds. It becomes blocking (fail on problems, then a required check) only after a live smoke
|
||||
test on GitHub and the migration of existing issues into the queue.
|
||||
|
||||
## Forks and upstream sync
|
||||
|
||||
@@ -104,7 +124,8 @@ sync report that shows upstream touching your files is the signal to re-read the
|
||||
- Acceptance commands are never run automatically. `scripts/agent-queue.sh acceptance <n>` prints
|
||||
one only when a maintainer's `/approve-acceptance` marker (posted by the bot) matches a hash of
|
||||
the current text; editing the issue body invalidates the approval. Read the command before running it.
|
||||
- Markers (grant, approval) count only when posted by the Actions bot, so they cannot be forged in a comment.
|
||||
- Markers (grant, approval, answered command) count only when posted by the Actions bot, so they cannot be forged in a comment.
|
||||
User text that a bot reply echoes (a `/blocked` reason, a login, a file pattern) has its angle brackets and backticks escaped, so a reply cannot carry a marker the user wrote.
|
||||
- Workflows declare empty top-level permissions and grant each job only what it needs; actions are
|
||||
pinned by commit SHA. Pull request checks run on the base branch (`pull_request_target`), never
|
||||
check out or run pull request code and read changed files through the API.
|
||||
@@ -118,4 +139,6 @@ sh -n scripts/agent-queue.sh scripts/agent-sync.sh
|
||||
```
|
||||
|
||||
The tests cover command decisions, overlap, cycles, leases, acceptance hashing, pull request checks,
|
||||
the summary, the CLI and a structural check of the workflow files. They do not exercise GitHub itself.
|
||||
the summary, the CLI, claim concurrency (a model of a concurrency group in which newer runs cancel
|
||||
pending ones, and in-order replay of unanswered commands) and a structural check of the workflow
|
||||
files, including which comments start a run. They do not exercise GitHub itself.
|
||||
@@ -3,12 +3,12 @@
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from . import config as cfgmod
|
||||
from . import ghio
|
||||
from . import lease as L
|
||||
from . import prcheck, queue
|
||||
from . import prcheck, queue, replay
|
||||
from . import tasks as T
|
||||
from . import decide as decide_mod
|
||||
from .decide import decide
|
||||
@@ -35,7 +35,10 @@ def main(argv):
|
||||
p.add_argument("--now", default="", help="UTC time YYYY-MM-DDTHH:MM:SSZ (tests)")
|
||||
sub = p.add_subparsers(dest="cmd", required=True)
|
||||
s = sub.add_parser("gather"); s.add_argument("--repo", required=True); s.add_argument("--no-prs", action="store_true"); s.add_argument("--pr", type=int, default=0)
|
||||
s.add_argument("--recent-commands", action="store_true", help="include comments from the last 2 x lease_hours for replay")
|
||||
s = sub.add_parser("replay"); s.add_argument("--state", required=True)
|
||||
s = sub.add_parser("decide"); s.add_argument("--event", required=True); s.add_argument("--state", required=True)
|
||||
s = sub.add_parser("should-rerun"); s.add_argument("--actions", required=True)
|
||||
s = sub.add_parser("apply"); s.add_argument("--repo", required=True); s.add_argument("--actions", required=True)
|
||||
s = sub.add_parser("audit"); s.add_argument("--state", required=True)
|
||||
s = sub.add_parser("summary"); s.add_argument("--state", required=True); s.add_argument("--text", action="store_true")
|
||||
@@ -65,13 +68,21 @@ def main(argv):
|
||||
v = cfg[a.key]
|
||||
print(v if isinstance(v, (str, int, float)) else json.dumps(v))
|
||||
elif a.cmd == "gather":
|
||||
st = ghio.gather(a.repo, with_prs=not a.no_prs)
|
||||
since = ""
|
||||
if a.recent_commands:
|
||||
since = (_now(a.now) - timedelta(hours=replay.window_hours(cfg))).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
st = ghio.gather(a.repo, with_prs=not a.no_prs, recent_since=since)
|
||||
if a.pr:
|
||||
st["pr"] = ghio.pr_data(a.repo, a.pr)
|
||||
st["pr_comments"] = ghio.comments(a.repo, a.pr)
|
||||
_out(st)
|
||||
elif a.cmd == "decide":
|
||||
_out(decide(_load(a.event), _load(a.state), cfg))
|
||||
elif a.cmd == "replay":
|
||||
_out(replay.replay(_load(a.state), cfg, _now(a.now)))
|
||||
elif a.cmd == "should-rerun":
|
||||
# exit 0 only for an accepted /verified of the current head
|
||||
return 0 if decide_mod.rerun_check(_load(a.actions)) else 1
|
||||
elif a.cmd == "apply":
|
||||
ghio.apply_actions(a.repo, _load(a.actions))
|
||||
elif a.cmd == "audit":
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Comment command decisions. Returns actions as data; the caller applies them."""
|
||||
import re
|
||||
|
||||
from . import config as cfgmod
|
||||
from . import lease as L
|
||||
from . import tasks as T
|
||||
@@ -8,6 +10,12 @@ COMMANDS = ("/claim", "/release", "/reassign", "/progress", "/blocked", "/unbloc
|
||||
"/approve-acceptance", "/verified")
|
||||
|
||||
|
||||
def quote(text):
|
||||
"""User text echoed in a bot reply. Markers count only from the bot, so the reply must not be able
|
||||
to carry one the user wrote: angle brackets are escaped and code spans are closed."""
|
||||
return str(text).replace("&", "&").replace("<", "<").replace(">", ">").replace("`", "'")
|
||||
|
||||
|
||||
def parse_command(body):
|
||||
first = (body or "").strip().split("\n", 1)[0].strip()
|
||||
parts = first.split(None, 1)
|
||||
@@ -16,6 +24,19 @@ def parse_command(body):
|
||||
return parts[0], (parts[1].strip() if len(parts) > 1 else "")
|
||||
|
||||
|
||||
FULL_SHA = re.compile(r"[0-9a-f]{40}")
|
||||
|
||||
|
||||
def verified_sha(body):
|
||||
"""The SHA of a well-formed `/verified <40-hex sha>` first line, else "". A short prefix is
|
||||
refused: a pushed commit with the same short prefix is cheap to make."""
|
||||
cmd, arg = parse_command(body)
|
||||
parts = arg.split()
|
||||
if cmd != "/verified" or len(parts) != 1 or not FULL_SHA.fullmatch(parts[0]):
|
||||
return ""
|
||||
return parts[0]
|
||||
|
||||
|
||||
def _act(issue, add=(), remove=(), comment=""):
|
||||
return {"issue": issue, "add_labels": list(add), "remove_labels": list(remove), "comment": comment}
|
||||
|
||||
@@ -53,7 +74,7 @@ def claim_problem(task, tasks, cfg, actor):
|
||||
continue
|
||||
hit = sets_overlap(task["files"], other["files"])
|
||||
if hit:
|
||||
return "file overlap with claimed task #%d (`%s` vs `%s`)." % (other["number"], hit[0], hit[1])
|
||||
return "file overlap with claimed task #%d (`%s` vs `%s`)." % (other["number"], quote(hit[0]), quote(hit[1]))
|
||||
return ""
|
||||
|
||||
|
||||
@@ -96,9 +117,13 @@ def decide(event, state, cfg):
|
||||
if not target:
|
||||
return _reply(n, "Usage: /reassign <login>")
|
||||
if not cfgmod.may_work_on(cfg, target, task["area"]):
|
||||
return _reply(n, "Reassign refused: %s is not allowed to work on area:%s." % (target, task["area"]))
|
||||
return _reply(n, "Reassign refused: %s is not allowed to work on area:%s." % (quote(target), task["area"]))
|
||||
if not (set(task["labels"]) & {"agent:claimed", "agent:ready"}):
|
||||
return _reply(n, "Reassign refused: the task is neither ready nor claimed.")
|
||||
# A reassignment creates a claim: the same dependency and file-overlap rules apply.
|
||||
problem = claim_problem(dict(task, labels=task["labels"] + ["agent:ready"]), tasks, cfg, target)
|
||||
if problem:
|
||||
return _reply(n, "Reassign refused: %s" % problem)
|
||||
remove = ["agent:ready"] + (["claimed-by:" + holder] if holder else [])
|
||||
return [_act(n, ["agent:claimed", "claimed-by:" + target], remove,
|
||||
"Reassigned to %s by %s. New lease starts now.\n%s" % (target, actor, L.grant_marker(n, target)))]
|
||||
@@ -115,7 +140,7 @@ def decide(event, state, cfg):
|
||||
return _reply(n, "Only the holder or a maintainer can mark a task blocked.")
|
||||
if not arg:
|
||||
return _reply(n, "Usage: /blocked <reason>")
|
||||
return [_act(n, ["agent:blocked"], [], "Blocked by %s: %s" % (actor, arg))]
|
||||
return [_act(n, ["agent:blocked"], [], "Blocked by %s: %s" % (actor, quote(arg)))]
|
||||
|
||||
if cmd == "/unblock":
|
||||
if actor != holder and not maint:
|
||||
@@ -138,7 +163,7 @@ def _verified(event, state, cfg, arg):
|
||||
if event.get("kind") != "pr":
|
||||
return []
|
||||
pr = state.get("pr") or {}
|
||||
sha = arg.split()[0] if arg else ""
|
||||
sha = verified_sha(event.get("body"))
|
||||
head = pr.get("head_sha", "")
|
||||
if actor == pr.get("author"):
|
||||
return _reply(n, "Verification refused: the pull request author cannot verify it.")
|
||||
@@ -148,6 +173,12 @@ def _verified(event, state, cfg, arg):
|
||||
return _reply(n, "Verification refused: %s holds the linked task #%d." % (actor, issue))
|
||||
if not cfgmod.is_verifier(cfg, actor):
|
||||
return _reply(n, "%s may not verify: only maintainers and qa contributors can." % actor)
|
||||
if len(sha) < 7 or not head.startswith(sha):
|
||||
return _reply(n, "Verification refused: `%s` is not the current head %s." % (sha or "(none)", head[:12]))
|
||||
return _reply(n, "Verification of %s recorded for %s." % (head[:12], actor))
|
||||
if not sha or sha != head:
|
||||
return _reply(n, "Verification refused: `%s` is not the full current head %s." % (quote(sha) or "(none)", head))
|
||||
# Only an accepted verification of the current head re-runs the pull request check.
|
||||
return [dict(_act(n, comment="Verification of %s recorded for %s." % (head[:12], actor)), rerun_check=True)]
|
||||
|
||||
|
||||
def rerun_check(actions):
|
||||
"""True when the decided actions record an accepted verification of the current head."""
|
||||
return any(a.get("rerun_check") for a in actions)
|
||||
@@ -27,6 +27,14 @@ def comments(repo, n):
|
||||
return ndjson(gh("api", "repos/%s/issues/%d/comments" % (repo, n), "--paginate", "--jq", jq))
|
||||
|
||||
|
||||
def recent_comments(repo, since):
|
||||
"""Issue and pull request comments updated since `since` (UTC ISO time), oldest first."""
|
||||
jq = ('.[] | {id: .id, user: .user.login, body: .body, created_at: .created_at, '
|
||||
'issue: (.issue_url | split("/") | last | tonumber), pull_request: (.html_url | test("/pull/"))}')
|
||||
return ndjson(gh("api", "repos/%s/issues/comments?sort=created&direction=asc&per_page=100&since=%s" % (repo, since),
|
||||
"--paginate", "--jq", jq))
|
||||
|
||||
|
||||
def open_issues(repo):
|
||||
return json.loads(gh("issue", "list", "-R", repo, "--state", "open", "--limit", "500",
|
||||
"--json", "number,title,body,state,labels"))
|
||||
@@ -46,8 +54,9 @@ def open_prs(repo):
|
||||
return [pr_data(repo, n) for n in nums]
|
||||
|
||||
|
||||
def gather(repo, with_prs=True, with_comments=True):
|
||||
"""State for decide/audit/summary: open tasks plus any dependency issues they name."""
|
||||
def gather(repo, with_prs=True, with_comments=True, recent_since=""):
|
||||
"""State for decide/audit/summary/replay: open tasks plus any dependency issues they name and,
|
||||
with `recent_since`, every comment since then."""
|
||||
from .tasks import parse_task
|
||||
issues = {i["number"]: i for i in open_issues(repo)}
|
||||
for i in list(issues.values()):
|
||||
@@ -60,6 +69,8 @@ def gather(repo, with_prs=True, with_comments=True):
|
||||
if any((l["name"] if isinstance(l, dict) else l) == "agent:claimed" for l in i["labels"])}
|
||||
if with_prs:
|
||||
state["prs"] = open_prs(repo)
|
||||
if recent_since:
|
||||
state["recent_comments"] = recent_comments(repo, recent_since)
|
||||
return state
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from . import config as cfgmod
|
||||
from . import lease as L
|
||||
from .patterns import path_matches, patterns_overlap
|
||||
from .decide import task_index
|
||||
from .decide import task_index, verified_sha
|
||||
|
||||
|
||||
def verified_by(pr, comments, tasks, cfg):
|
||||
@@ -11,11 +11,8 @@ def verified_by(pr, comments, tasks, cfg):
|
||||
head, out = pr.get("head_sha", ""), []
|
||||
holders = {tasks[i]["holder"] for i in L.linked_issues(pr.get("body")) if i in tasks}
|
||||
for c in comments:
|
||||
parts = c["body"].strip().split("\n", 1)[0].split()
|
||||
if len(parts) < 2 or parts[0] != "/verified" or len(parts[1]) < 7:
|
||||
continue
|
||||
who = c["user"]
|
||||
if (head.startswith(parts[1]) and who != pr.get("author") and who not in holders
|
||||
sha, who = verified_sha(c["body"]), c["user"]
|
||||
if (sha and sha == head and who != pr.get("author") and who not in holders
|
||||
and cfgmod.is_verifier(cfg, who) and who not in out):
|
||||
out.append(who)
|
||||
return out
|
||||
@@ -48,5 +45,5 @@ def check_pr(state, cfg, now):
|
||||
problems.append("overlaps open PR #%d on: %s" % (other["number"], ", ".join(shared[:10])))
|
||||
ok_by = verified_by(pr, comments, tasks, cfg)
|
||||
if not ok_by:
|
||||
problems.append("independent verification missing: an eligible verifier must comment `/verified %s`" % pr.get("head_sha", "")[:12])
|
||||
problems.append("independent verification missing: an eligible verifier must comment `/verified %s`" % pr.get("head_sha", ""))
|
||||
return {"pr": pr["number"], "ok": not problems, "problems": problems, "verified_by": ok_by}
|
||||
@@ -3,7 +3,7 @@
|
||||
from . import config as cfgmod
|
||||
from . import lease as L
|
||||
from . import tasks as T
|
||||
from .decide import task_index
|
||||
from .decide import quote, task_index
|
||||
from .patterns import sets_overlap
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ def audit(state, cfg, now):
|
||||
for x, y in ((a, b), (b, a)):
|
||||
if "agent:conflict" not in x["labels"] and x["number"] not in lapsed_nums:
|
||||
actions.append({"issue": x["number"], "add_labels": ["agent:conflict"], "remove_labels": [],
|
||||
"comment": "File overlap with claimed task #%d (`%s` vs `%s`). A maintainer must resolve it." % (y["number"], hit[0], hit[1])})
|
||||
"comment": "File overlap with claimed task #%d (`%s` vs `%s`). A maintainer must resolve it." % (y["number"], quote(hit[0]), quote(hit[1]))})
|
||||
for t in sorted(tasks.values(), key=lambda x: x["number"]):
|
||||
if t["state"] != "OPEN" or "agent:ready" not in t["labels"]:
|
||||
continue
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Decides every unanswered issue command, oldest first.
|
||||
|
||||
Claim runs share one concurrency group. GitHub keeps one run in progress and at most one pending in
|
||||
a group, and a newly queued run cancels the pending one, so the comment that started a cancelled
|
||||
run would never be decided. Each run therefore decides every recent command that has no bot reply
|
||||
yet, in comment order, and applies each decision's labels to its in-memory state so later commands
|
||||
see earlier grants. Every reply carries a marker naming the comment it answers."""
|
||||
import copy
|
||||
import re
|
||||
from datetime import timedelta
|
||||
|
||||
from . import lease as L
|
||||
from .decide import decide, parse_command
|
||||
from .tasks import label_names, parse_time
|
||||
|
||||
DONE = re.compile(r"<!-- agent-queue:done comment=(\d+) -->")
|
||||
|
||||
|
||||
def done_marker(comment_id):
|
||||
return "<!-- agent-queue:done comment=%d -->" % comment_id
|
||||
|
||||
|
||||
def answered(comments, bots=L.BOT):
|
||||
"""Ids of comments a bot reply has answered. Markers from anyone else do not count."""
|
||||
return {int(m) for c in comments if c["user"] in bots for m in DONE.findall(c["body"])}
|
||||
|
||||
|
||||
def _apply(state, action):
|
||||
for i in state["issues"]:
|
||||
if int(i["number"]) == action["issue"]:
|
||||
names = [n for n in label_names(i) if n not in action["remove_labels"]]
|
||||
names += [n for n in action["add_labels"] if n not in names]
|
||||
i["labels"] = [{"name": n} for n in names]
|
||||
|
||||
|
||||
def window_hours(cfg):
|
||||
"""How far back `gather --recent-commands` reads: one lease to decide, one more to expire."""
|
||||
return 2 * cfg["lease_hours"]
|
||||
|
||||
|
||||
def replay(state, cfg, now, bots=L.BOT):
|
||||
"""Actions for every unanswered command in state["recent_comments"]: decided if created within
|
||||
the lease, else answered as expired so that no request goes silently unanswered."""
|
||||
state = copy.deepcopy(state)
|
||||
since = now - timedelta(hours=cfg["lease_hours"])
|
||||
comments = state.get("recent_comments", [])
|
||||
done = answered(comments, bots)
|
||||
out = []
|
||||
for c in sorted(comments, key=lambda c: (parse_time(c["created_at"]), c["id"])):
|
||||
if c.get("pull_request") or c["id"] in done or c["user"] in bots:
|
||||
continue
|
||||
done.add(c["id"]) # a comment listed twice is decided once
|
||||
if parse_time(c["created_at"]) < since:
|
||||
if parse_command(c["body"])[0]:
|
||||
out.append({"issue": c["issue"], "add_labels": [], "remove_labels": [], "comment":
|
||||
"Not decided: no queue run answered this command within %s hours. Post it again if it still applies.\n%s"
|
||||
% (cfg["lease_hours"], done_marker(c["id"]))})
|
||||
continue
|
||||
actions = decide({"kind": "issue", "number": c["issue"], "actor": c["user"], "body": c["body"]}, state, cfg)
|
||||
if not actions:
|
||||
continue
|
||||
actions[-1]["comment"] += "\n" + done_marker(c["id"])
|
||||
for a in actions:
|
||||
_apply(state, a)
|
||||
out.extend(actions)
|
||||
return out
|
||||
@@ -24,6 +24,8 @@ def _lines(text):
|
||||
res = []
|
||||
for line in text.splitlines():
|
||||
line = line.strip()
|
||||
if line.startswith("```"):
|
||||
continue # issue forms wrap `render:` fields in a code fence
|
||||
if line.startswith(("- ", "* ")):
|
||||
line = line[2:].strip()
|
||||
line = line.strip("`").strip()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import unittest
|
||||
|
||||
from helpers import CFG, comment, event, issue, state
|
||||
from agent_queue.decide import decide
|
||||
from agent_queue.decide import decide, quote
|
||||
from agent_queue.lease import GRANT
|
||||
|
||||
|
||||
@@ -116,9 +116,48 @@ class Inert(unittest.TestCase):
|
||||
a = decide(event("gpuer", "/claim " + evil), state(issue(1, files=evil + "\nsrc/gpu/a.rs", acceptance=evil)), CFG)
|
||||
self.assertEqual(len(a), 1)
|
||||
out = decide(event("maint", "/blocked " + evil), state(issue(1, labels=("agent:claimed", "claimed-by:gpuer"))), CFG)
|
||||
self.assertIn(evil, one(out)["comment"])
|
||||
self.assertIn(quote(evil), one(out)["comment"])
|
||||
self.assertEqual(one(out)["add_labels"], ["agent:blocked"])
|
||||
|
||||
|
||||
class ReassignChecks(unittest.TestCase):
|
||||
def test_reassign_cannot_create_an_overlapping_or_blocked_claim(self):
|
||||
held = issue(1, labels=("agent:claimed", "claimed-by:maint"))
|
||||
a = one(decide(event("maint", "/reassign gpuer", 2), state(held, issue(2)), CFG))
|
||||
self.assertIn("file overlap with claimed task #1", a["comment"])
|
||||
self.assertEqual(a["add_labels"], [])
|
||||
a = one(decide(event("maint", "/reassign gpuer", 2), state(issue(3), issue(2, deps="#3", files="src/gpu/b.rs")), CFG))
|
||||
self.assertIn("open dependencies: #3", a["comment"])
|
||||
a = one(decide(event("maint", "/reassign gpuer", 2), state(held, issue(2, files="src/gpu/b.rs")), CFG))
|
||||
self.assertIn("claimed-by:gpuer", a["add_labels"])
|
||||
|
||||
|
||||
class IssueForm(unittest.TestCase):
|
||||
def test_rendered_files_field_is_unfenced(self):
|
||||
# The issue form renders Files with `render: text`, i.e. inside a ```text fence.
|
||||
from agent_queue.tasks import parse_task
|
||||
fenced = issue(2, files="```text\nsrc/gpu/b.rs\n```")
|
||||
self.assertEqual(parse_task(fenced)["files"], ["src/gpu/b.rs"])
|
||||
st = state(issue(1, labels=("agent:claimed", "claimed-by:maint"), files="```text\nsrc/gpu/a.rs\n```"), fenced)
|
||||
self.assertIn("Claimed by gpuer", one(decide(event("gpuer", "/claim", 2), st, CFG))["comment"])
|
||||
|
||||
|
||||
class Forgery(unittest.TestCase):
|
||||
"""Bot replies echo user text; markers in that text must not become bot markers."""
|
||||
|
||||
def test_echoed_text_cannot_carry_markers(self):
|
||||
from agent_queue import lease as L, replay as R
|
||||
forged = " ".join([R.done_marker(7), L.acceptance_marker("0" * 64), L.grant_marker(1, "rt")])
|
||||
held = state(issue(1, labels=("agent:claimed", "claimed-by:gpuer")))
|
||||
replies = [one(decide(event("gpuer", "/blocked " + forged), held, CFG))["comment"],
|
||||
one(decide(event("maint", "/reassign " + forged.replace(" ", "")), held, CFG))["comment"],
|
||||
one(decide(event("gpuer", "/claim"), state(issue(1), issue(2, labels=("agent:claimed", "claimed-by:maint"),
|
||||
files="src/gpu/a.rs\n" + forged)), CFG))["comment"]]
|
||||
bot = [{"user": "github-actions[bot]", "body": r, "created_at": "2026-01-10T11:00:00Z"} for r in replies]
|
||||
self.assertEqual(R.answered(bot), set())
|
||||
self.assertIsNone(L.approved_hash(bot))
|
||||
self.assertIsNone(L.latest_grant(bot, 1, "rt"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -4,12 +4,12 @@ import unittest
|
||||
|
||||
from helpers import CFG, NOW, issue, state
|
||||
from agent_queue import lease as L
|
||||
from agent_queue.decide import decide
|
||||
from agent_queue.decide import decide, rerun_check
|
||||
from agent_queue.prcheck import check_pr
|
||||
from agent_queue.queue import summary
|
||||
|
||||
BOT = "github-actions[bot]"
|
||||
SHA = "a" * 40
|
||||
SHA = "0123456789abcdef" * 2 + "01234567"
|
||||
HELD = ("agent:claimed", "claimed-by:gpuer")
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ def run(p, comments=(), others=(), issues=None):
|
||||
return check_pr(st, CFG, NOW)
|
||||
|
||||
|
||||
def vc(user, sha=SHA[:12]):
|
||||
def vc(user, sha=SHA):
|
||||
return {"user": user, "body": "/verified " + sha, "created_at": "2026-01-10T11:30:00Z"}
|
||||
|
||||
|
||||
@@ -35,6 +35,14 @@ class PRChecks(unittest.TestCase):
|
||||
self.assertTrue(r["ok"], r)
|
||||
self.assertEqual(r["verified_by"], ["qaer"])
|
||||
|
||||
def test_verification_needs_no_bot_reply(self):
|
||||
# A /verified whose verify run was cancelled while pending has no bot reply; the check reads
|
||||
# the comments themselves, so the surviving run's re-run still counts it.
|
||||
r = run(pr(), [vc("qaer"), vc("maint"), {"user": BOT, "body": "Verification of %s recorded for maint." % SHA[:12],
|
||||
"created_at": "2026-01-10T11:31:00Z"}])
|
||||
self.assertTrue(r["ok"], r)
|
||||
self.assertEqual(r["verified_by"], ["qaer", "maint"])
|
||||
|
||||
def test_missing_link(self):
|
||||
r = run(pr(body="no link"), [vc("qaer")])
|
||||
self.assertFalse(r["ok"])
|
||||
@@ -82,7 +90,7 @@ class PRChecks(unittest.TestCase):
|
||||
|
||||
|
||||
class VerifiedCommand(unittest.TestCase):
|
||||
def go(self, actor, sha=SHA[:12], author="gpuer"):
|
||||
def go(self, actor, sha=SHA, author="gpuer"):
|
||||
st = state(issue(1, labels=HELD))
|
||||
st["pr"] = pr(author=author)
|
||||
ev = {"kind": "pr", "number": 10, "actor": actor, "body": "/verified " + sha}
|
||||
@@ -93,7 +101,47 @@ class VerifiedCommand(unittest.TestCase):
|
||||
self.assertIn("author cannot", self.go("gpuer"))
|
||||
self.assertIn("holds the linked task", self.go("gpuer", author="maint"))
|
||||
self.assertIn("may not verify", self.go("rt"))
|
||||
self.assertIn("not the current head", self.go("qaer", sha="1234567"))
|
||||
self.assertIn("not the full current head", self.go("qaer", sha="1234567"))
|
||||
|
||||
|
||||
class VerifiedRerun(unittest.TestCase):
|
||||
"""Only an accepted /verified of the current head may re-run the pull request check (#210)."""
|
||||
|
||||
def rerun(self, actor, text, author="gpuer"):
|
||||
st = state(issue(1, labels=HELD))
|
||||
st["pr"] = pr(author=author)
|
||||
return rerun_check(decide({"kind": "pr", "number": 10, "actor": actor, "body": text}, st, CFG))
|
||||
|
||||
def test_accepted_current_head_reruns(self):
|
||||
self.assertTrue(self.rerun("qaer", "/verified " + SHA))
|
||||
self.assertTrue(self.rerun("maint", "/verified " + SHA + "\nran the acceptance command"))
|
||||
|
||||
def test_ordinary_comments_do_not_rerun(self):
|
||||
for text in ("looks good", "LGTM /verified " + SHA, "", "thanks\n/verified " + SHA):
|
||||
self.assertFalse(self.rerun("qaer", text), text)
|
||||
|
||||
def test_malformed_do_not_rerun(self):
|
||||
for text in ("/verified", "/verified abc", "/verified" + SHA, "/verified " + SHA[:12], "/verified " + SHA[:6],
|
||||
"/Verified " + SHA, "/verified " + SHA.upper(), "/verified " + SHA + " " + SHA, "/verified " + SHA + "0"):
|
||||
self.assertFalse(self.rerun("qaer", text), text)
|
||||
|
||||
def test_stale_and_unknown_heads_do_not_rerun(self):
|
||||
self.assertFalse(self.rerun("qaer", "/verified " + "b" * 40))
|
||||
# Same 12-character prefix, different commit: a short prefix is cheap to collide.
|
||||
self.assertFalse(self.rerun("qaer", "/verified " + SHA[:12] + "f" * 28))
|
||||
|
||||
def test_unauthorized_do_not_rerun(self):
|
||||
self.assertFalse(self.rerun("gpuer", "/verified " + SHA)) # author
|
||||
self.assertFalse(self.rerun("gpuer", "/verified " + SHA, author="maint")) # task holder
|
||||
self.assertFalse(self.rerun("rt", "/verified " + SHA)) # not a verifier
|
||||
self.assertFalse(self.rerun("stranger", "/verified " + SHA))
|
||||
|
||||
def test_rerun_agrees_with_the_check(self):
|
||||
# Whatever re-runs the check must also be counted by it, and the other way round.
|
||||
for actor in ("qaer", "maint", "gpuer", "rt"):
|
||||
for sha in (SHA, SHA[:12], "b" * 40):
|
||||
counted = actor in run(pr(), [vc(actor, sha)])["verified_by"]
|
||||
self.assertEqual(self.rerun(actor, "/verified " + sha), counted, (actor, sha))
|
||||
|
||||
|
||||
class Summary(unittest.TestCase):
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Claim concurrency: one group, pending runs cancelled by newer ones, replay of unanswered commands."""
|
||||
import copy
|
||||
import unittest
|
||||
|
||||
from helpers import CFG, NOW, issue, state
|
||||
from agent_queue import replay as R
|
||||
from agent_queue.decide import decide
|
||||
from agent_queue.lease import GRANT
|
||||
|
||||
BOT = "github-actions[bot]"
|
||||
|
||||
|
||||
def cmd(cid, user, text, n, at="2026-01-10T11:00:00Z", pr=False):
|
||||
return {"id": cid, "user": user, "body": text, "created_at": at, "issue": n, "pull_request": pr}
|
||||
|
||||
|
||||
def queue_state(comments):
|
||||
# #1 and #2 share src/gpu/a.rs; #3 is independent.
|
||||
return state(issue(1), issue(2), issue(3, files="src/gpu/b.rs"), recent_comments=comments)
|
||||
|
||||
|
||||
def granted(actions):
|
||||
return sorted((int(m.group(1)), m.group(2)) for a in actions for m in [GRANT.search(a["comment"])] if m)
|
||||
|
||||
|
||||
def simulate(posted, run_once):
|
||||
"""GitHub concurrency group with cancel-in-progress: false. Each comment queues a run; while a
|
||||
run is in progress one run may wait, and a newly queued run cancels the waiting one. Here every
|
||||
comment arrives while the first run is still in progress. Returns the posted bot replies."""
|
||||
st = queue_state([])
|
||||
issues = st["issues"]
|
||||
timeline, replies = [], []
|
||||
in_progress, pending = posted[0], None
|
||||
for c in posted[1:]:
|
||||
pending = c # an older pending run, if any, is cancelled here
|
||||
for trigger, visible in ((in_progress, posted[:1]), (pending, posted)):
|
||||
if trigger is None:
|
||||
continue
|
||||
view = {"issues": issues, "prs": [], "task_comments": {},
|
||||
"recent_comments": visible + timeline}
|
||||
actions = run_once(trigger, view)
|
||||
for a in actions:
|
||||
R._apply(st, a)
|
||||
timeline.append({"id": 10_000 + len(timeline), "user": BOT, "body": a["comment"],
|
||||
"created_at": "2026-01-10T11:30:00Z", "issue": a["issue"], "pull_request": False})
|
||||
replies.extend(actions)
|
||||
return replies
|
||||
|
||||
|
||||
def event_only(trigger, view):
|
||||
"""The previous design: a run decides only the comment that started it."""
|
||||
return decide({"kind": "issue", "number": trigger["issue"], "actor": trigger["user"], "body": trigger["body"]},
|
||||
view, CFG)
|
||||
|
||||
|
||||
def with_replay(trigger, view):
|
||||
return R.replay(view, CFG, NOW)
|
||||
|
||||
|
||||
POSTED = [
|
||||
cmd(1, "maint", "/claim", 3, "2026-01-10T11:00:00Z"),
|
||||
cmd(2, "gpuer", "/claim", 1, "2026-01-10T11:00:01Z"),
|
||||
cmd(3, "maint", "/claim", 2, "2026-01-10T11:00:02Z"), # overlaps #1 on src/gpu/a.rs
|
||||
cmd(4, "gpuer", "/progress parser done", 1, "2026-01-10T11:00:03Z"),
|
||||
]
|
||||
|
||||
|
||||
class PendingCancellation(unittest.TestCase):
|
||||
def test_deciding_only_the_trigger_loses_cancelled_commands(self):
|
||||
# Runs 2 and 3 are cancelled while pending: gpuer's claim on #1 is never answered.
|
||||
self.assertEqual(granted(simulate(POSTED, event_only)), [(3, "maint")])
|
||||
|
||||
def test_replay_answers_every_command_of_cancelled_runs(self):
|
||||
replies = simulate(POSTED, with_replay)
|
||||
self.assertEqual(granted(replies), [(1, "gpuer"), (3, "maint")])
|
||||
refused = [a for a in replies if a["issue"] == 2]
|
||||
self.assertEqual(len(refused), 1)
|
||||
self.assertIn("file overlap with claimed task #1", refused[0]["comment"])
|
||||
answered = R.answered([{"user": BOT, "body": a["comment"]} for a in replies])
|
||||
self.assertEqual(answered, {1, 2, 3, 4})
|
||||
|
||||
|
||||
class Replay(unittest.TestCase):
|
||||
def run_replay(self, comments, st=None):
|
||||
return R.replay(st or queue_state(comments), CFG, NOW)
|
||||
|
||||
def test_overlapping_claims_in_one_run_are_decided_in_order(self):
|
||||
actions = self.run_replay([cmd(8, "maint", "/claim", 2, "2026-01-10T11:00:05Z"),
|
||||
cmd(7, "gpuer", "/claim", 1, "2026-01-10T11:00:05Z")])
|
||||
# Same second: the lower comment id is first.
|
||||
self.assertEqual(granted(actions), [(1, "gpuer")])
|
||||
self.assertIn("file overlap with claimed task #1", actions[1]["comment"])
|
||||
self.assertIn(R.done_marker(8), actions[1]["comment"])
|
||||
|
||||
def test_out_of_order_listing_is_decided_in_comment_order(self):
|
||||
# Listed newest first: the earlier claim on the shared file still wins.
|
||||
actions = self.run_replay([cmd(9, "maint", "/claim", 2, "2026-01-10T11:00:09Z"),
|
||||
cmd(5, "gpuer", "/claim", 1, "2026-01-10T11:00:01Z")])
|
||||
self.assertEqual(granted(actions), [(1, "gpuer")])
|
||||
self.assertEqual([a["issue"] for a in actions], [1, 2])
|
||||
|
||||
def test_duplicate_events_are_decided_once(self):
|
||||
c = cmd(5, "gpuer", "/claim", 1)
|
||||
actions = self.run_replay([c, dict(c), cmd(6, "maint", "/claim", 2, "2026-01-10T11:00:02Z")])
|
||||
self.assertEqual(granted(actions), [(1, "gpuer")])
|
||||
self.assertEqual(sum(R.done_marker(5) in a["comment"] for a in actions), 1)
|
||||
|
||||
def test_no_burst_order_grants_overlapping_claims(self):
|
||||
# Every arrival order of a burst of claims on #1 and #2 (shared file) grants exactly one of them.
|
||||
import itertools
|
||||
burst = [cmd(1, "gpuer", "/claim", 1), cmd(2, "maint", "/claim", 2), cmd(3, "maint", "/claim", 1),
|
||||
cmd(4, "gpuer", "/claim", 2), cmd(5, "maint", "/claim", 3)]
|
||||
for order in itertools.permutations(range(5)):
|
||||
comments = [dict(burst[i], created_at="2026-01-10T11:00:%02dZ" % k) for k, i in enumerate(order)]
|
||||
g = granted(self.run_replay(comments))
|
||||
self.assertEqual(len([x for x in g if x[0] in (1, 2)]), 1, (order, g))
|
||||
self.assertIn((3, "maint"), g)
|
||||
|
||||
def test_answered_commands_are_not_decided_again(self):
|
||||
first = self.run_replay([cmd(1, "gpuer", "/claim", 1)])
|
||||
st = queue_state([cmd(1, "gpuer", "/claim", 1),
|
||||
{"id": 2, "user": BOT, "body": first[0]["comment"], "created_at": "2026-01-10T11:01:00Z",
|
||||
"issue": 1, "pull_request": False}])
|
||||
for a in first:
|
||||
R._apply(st, a)
|
||||
self.assertEqual(R.replay(st, CFG, NOW), [])
|
||||
|
||||
def test_done_markers_count_only_from_the_bot(self):
|
||||
forged = {"id": 2, "user": "rt", "body": R.done_marker(1), "created_at": "2026-01-10T11:01:00Z",
|
||||
"issue": 1, "pull_request": False}
|
||||
self.assertEqual(granted(self.run_replay([cmd(1, "gpuer", "/claim", 1), forged])), [(1, "gpuer")])
|
||||
|
||||
def test_ordinary_pr_and_old_comments_start_nothing(self):
|
||||
self.assertEqual(self.run_replay([
|
||||
cmd(1, "gpuer", "looks good to me", 1),
|
||||
cmd(2, "gpuer", "/claim", 1, pr=True),
|
||||
cmd(3, "maint", "/verified abcdef1", 1),
|
||||
]), [])
|
||||
|
||||
def test_commands_older_than_the_lease_are_answered_as_expired(self):
|
||||
actions = self.run_replay([cmd(4, "gpuer", "/claim", 1, "2026-01-09T11:00:00Z"),
|
||||
cmd(5, "gpuer", "just a remark", 1, "2026-01-09T11:00:00Z")])
|
||||
self.assertEqual(len(actions), 1)
|
||||
self.assertEqual((actions[0]["issue"], actions[0]["add_labels"]), (1, []))
|
||||
self.assertIn("Not decided", actions[0]["comment"])
|
||||
self.assertIn(R.done_marker(4), actions[0]["comment"])
|
||||
self.assertEqual(R.window_hours(CFG), 48)
|
||||
|
||||
def test_state_is_not_modified(self):
|
||||
st = queue_state([cmd(1, "gpuer", "/claim", 1)])
|
||||
before = copy.deepcopy(st)
|
||||
self.assertEqual(len(R.replay(st, CFG, NOW)), 1)
|
||||
self.assertEqual(st, before)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -63,6 +63,60 @@ class Workflows(unittest.TestCase):
|
||||
self.assertNotRegex(text, r"github\.event\.pull_request\.head|ref:\s*\$\{\{")
|
||||
self.assertIn("pull_request_target", text)
|
||||
|
||||
def job(self, name, job):
|
||||
"""Text of one job block: from ` <job>:` to the next two-space-indented key."""
|
||||
m = re.search(r"(?ms)^ %s:\n(.*?)(?=^ \S|\Z)" % re.escape(job), self.read(name))
|
||||
self.assertIsNotNone(m, "%s: job %s" % (name, job))
|
||||
return m.group(1)
|
||||
|
||||
def job_if(self, name, job):
|
||||
return re.search(r"(?m)^ if: (.*)$", self.job(name, job)).group(1)
|
||||
|
||||
def test_only_command_comments_start_runs(self):
|
||||
# Ordinary comments must not start a claim run or a verification re-run.
|
||||
self.assertIn("startsWith(github.event.comment.body, '/verified')", self.job_if("agent-pr-checks.yml", "verify"))
|
||||
self.assertIn("startsWith(github.event.comment.body, '/')", self.job_if("agent-claims.yml", "command"))
|
||||
self.assertNotIn("issue_comment", self.job_if("agent-pr-checks.yml", "check"))
|
||||
|
||||
def test_claim_jobs_share_one_group_and_replay(self):
|
||||
for job in ("command", "audit"):
|
||||
text = self.job("agent-claims.yml", job)
|
||||
self.assertRegex(text, r"group: agent-queue\n\s+cancel-in-progress: false", job)
|
||||
# Pending runs can be cancelled by newer ones, so every run replays unanswered commands.
|
||||
self.assertIn("agent_queue replay", text, job)
|
||||
self.assertIn("--recent-commands", text, job)
|
||||
self.assertNotIn("agent_queue decide", self.job("agent-claims.yml", "command"))
|
||||
|
||||
def test_rerun_needs_an_accepted_verification(self):
|
||||
text = self.job("agent-pr-checks.yml", "verify")
|
||||
self.assertIn('if ! python3 -m agent_queue should-rerun --actions "$RUNNER_TEMP/actions.json"; then exit 0; fi', text)
|
||||
self.assertLess(text.index("agent_queue should-rerun"), text.index("agent_queue pr-check"))
|
||||
# The check is evaluated in this job: pull_request_target runs cannot be found by head SHA.
|
||||
self.assertNotIn("gh run", text)
|
||||
self.assertNotIn("actions: write", text)
|
||||
self.assertIn("::warning title=Agent PR check (advisory)::", text)
|
||||
|
||||
def test_should_rerun_exit_codes(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p = os.path.join(d, "a.json")
|
||||
for actions, code in (([], 1), ([{"issue": 4, "add_labels": [], "remove_labels": [], "comment": "refused"}], 1),
|
||||
([{"issue": 4, "add_labels": [], "remove_labels": [], "comment": "ok", "rerun_check": True}], 0)):
|
||||
dump(actions, p)
|
||||
self.assertEqual(Cli.run_cli(self, "should-rerun", "--actions", p).returncode, code, actions)
|
||||
|
||||
def test_verify_runs_one_at_a_time_per_pull_request(self):
|
||||
text = self.job("agent-pr-checks.yml", "verify")
|
||||
self.assertRegex(text, r"group: agent-verify-\$\{\{ github\.event\.issue\.number \}\}\n\s+cancel-in-progress: false")
|
||||
|
||||
def test_pr_check_is_advisory(self):
|
||||
# Exit status 1 (problems found) only warns until the live smoke test and issue migration.
|
||||
text = self.job("agent-pr-checks.yml", "check")
|
||||
found = re.search(r'if \[ "\$status" -eq 1 \]; then\n(.*?)\n\s+elif \[ "\$status" -ne 0 \]; then\n\s+exit "\$status"', text, re.S)
|
||||
self.assertIsNotNone(found, text)
|
||||
self.assertIn("::warning title=Agent PR check (advisory)::", found.group(1))
|
||||
self.assertNotIn("exit", found.group(1))
|
||||
self.assertEqual(text.count("exit "), 1)
|
||||
|
||||
def test_actions_pinned_by_sha(self):
|
||||
for name in QUEUE_WORKFLOWS:
|
||||
for use in re.findall(r"uses:\s*(\S+)", self.read(name)):
|
||||
|
||||
Reference in new issue
Block a user