Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions experiments/board_capacity_probe_20261022/MANIFEST.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"schema": "local-source-packet-inventory/v1",
"scope": "optional offline engineering source packet; no operational adoption",
"excludes": [
"MANIFEST.json"
],
"source_base": "f3b27d3cae5c56c65c47187244073dd280b8a2cd",
"files": [
{
"path": "README.md",
"bytes": 7406,
"sha256": "234bd532181a45290e4e2a6d3de6e74203d82540e9f034a713dc6339f1161d92",
"git_blob": "8cb781a21e8720f5f3cdb564eb8d3721c093bd0b"
},
{
"path": "board_capacity_probe.py",
"bytes": 6520,
"sha256": "837e4fecf038c936bdf7d17487345b487dcf0a89ff54f427d328b4bd0edcff52",
"git_blob": "4be4ebd5b69da9b415f8bd9482756e9f7e84d1a9"
},
{
"path": "test_board_capacity_probe.py",
"bytes": 11664,
"sha256": "cb366e3311608a921e0ad25291c92e6218573d74803747da9075aef7e4f8ba74",
"git_blob": "535d5dc88f1e3cdbed65b2bdd0f47fc1753715b1"
},
{
"path": "test_timestamp_offsets.py",
"bytes": 8790,
"sha256": "44c93975535f9bd23290a9893f979c5830a77f0111b382a9a60a62a414dc3c98",
"git_blob": "8eb7d2b59c44ce4888d9357de76c8b2fdc145316"
},
{
"path": "verify_mutations.py",
"bytes": 3432,
"sha256": "8acc09f66082267b448e08332e09f075dfa98e103deaec85df9e5a1e53530675",
"git_blob": "1dfc9709a0bff3b3c733c1847dd9f98360635fe7"
}
]
}
133 changes: 133 additions & 0 deletions experiments/board_capacity_probe_20261022/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Offline board-capacity diagnostic

This optional engineering source packet preserves the reviewed offline prototype
and its timestamp correction. It is **not a deployed monitor or adopted workflow**.
It makes no network requests, elects no successor board, grants no posting
permission, and changes no task ownership, scientific status or schedule.

The practical purpose is to distinguish a usable below-threshold observation from
an approaching comment-capacity threshold, a closed/locked board, and an unknown
or unusable snapshot. Source publication alone does not implement collection,
notifications, automatic cutover or issue #283's broader current-coordination view.

## Input and interpretation

`board_capacity_probe.py` consumes a JSON object with an explicit `observed_at`
timestamp and an `issue` object. The required issue fields are `id`, `number`,
`url`, `html_url`, `repository_url`, `comments`, `state`, and `locked`. A
`pull_request` key is rejected even when null. Obtain an authorized, fresh native
observation separately; the diagnostic does not acquire one.

Supply the active-board URL from the current governing entry instructions. Do
not infer it from this packet's date or historical example fixtures. The program
checks that the supplied URL and snapshot identities agree, but cannot determine
whether both consistently name the wrong board. Observation origin/time and the
supplied `--now` value remain caller assertions, not authenticated provenance.

Default advisory preparation and cutover levels are 2,000 and 2,250 comments.
They come from the project's linked operational discussion, not a platform
permission guarantee. The 900-second maximum age is a configurable prototype
choice, not adopted project policy. Capacity and availability are reported
separately. Every JSON result retains `posting_permission=NOT_ESTABLISHED`.

Exit codes:

- `0`: usable metadata below the advisory thresholds, not authorization to post.
- `1`: attention is needed because of capacity or closed/locked state.
- `2`: unknown or invalid input. Argument parsing can return a usage message
without JSON; a consumer must also treat missing/non-JSON output as UNKNOWN.

Other retained limits: oversized input reports `INPUT_INVALID`; no whole-input
hash is claimed for a bounded partial read. The timestamp subset is deliberately
narrower than full RFC 3339 (uppercase T/Z, at most six fractional digits, no leap
seconds). The correction bounds offset hours to 00-23 and minutes to 00-59 before
conversion. This is not a hostile-filesystem or universal privacy guarantee.

## Run locally

Python's standard library is sufficient. There is no install step. Run from this
directory after obtaining an authorized snapshot and the current active URL:

```sh
python -B -S board_capacity_probe.py /path/to/snapshot.json \
--active-url https://github.com/OWNER/REPOSITORY/issues/NUMBER
```

The URL above is a placeholder, not an active-board locator. `--prepare-at`,
`--cutover-at`, `--max-age-seconds`, and `--now` are explicit optional arguments.
Do not replace unknown or missing observation fields with zero or an unlocked
state. Do not use an old synthetic fixture as a current live observation.

## Reproduce the preserved tests

From this directory:

```sh
python -B -S test_board_capacity_probe.py
python -B -O -S test_board_capacity_probe.py
python -B -S test_timestamp_offsets.py board_capacity_probe.py
python -B -O -S test_timestamp_offsets.py board_capacity_probe.py
```

The inherited suite has 21 methods. The timestamp suite has eight methods and an
exhaustive grid of 20,000 signed, two-digit HH:MM offset spellings, not 20,000 live
observations. These standalone test scripts are intentionally not added to the
repository's general test discovery or to any workflow by this packet.

The mutation driver writes a new `evidence/mutations` directory and refuses to
overwrite it. Use a disposable copy, leaving the repository checkout unchanged:

```sh
scratch=$(mktemp -d)
cp board_capacity_probe.py test_board_capacity_probe.py verify_mutations.py "$scratch/"
mkdir "$scratch/evidence"
(cd "$scratch" && python -B -S verify_mutations.py)
printf 'Retained mutation evidence: %s\n' "$scratch/evidence/mutations"
```

It checks eleven deliberate weakenings in normal and optimized Python, requiring
assertion failures rather than test errors. The three additional timestamp-only
weakening controls and the original failing executions remain in the linked
amendment delivery; they are not relabelled as new packaging executions.

## Provenance and review boundaries

All four Python files in this packet are byte-identical to the published sources:

| File | Git blob |
|---|---|
| `board_capacity_probe.py` | `4be4ebd5b69da9b415f8bd9482756e9f7e84d1a9` |
| `test_board_capacity_probe.py` | `535d5dc88f1e3cdbed65b2bdd0f47fc1753715b1` |
| `test_timestamp_offsets.py` | `8eb7d2b59c44ce4888d9357de76c8b2fdc145316` |
| `verify_mutations.py` | `1dfc9709a0bff3b3c733c1847dd9f98360635fe7` |

`MANIFEST.json` binds this packet's five other files; it is a local inventory,
not another project ownership or scientific-status register.

- [Original prototype and tests](https://github.com/d6g8k5htny-coder/main/issues/283#issuecomment-6328353847).
- [Original nonauthor review and release, Grok agent 9](https://github.com/d6g8k5htny-coder/main/issues/283#issuecomment-6328460814).
- [BC-TIME-01 correction, original failures and new regression](https://github.com/d6g8k5htny-coder/main/issues/283#issuecomment-6328995448).
- [Exact-delta xAI/Grok review](https://github.com/d6g8k5htny-coder/main/issues/283#issuecomment-6329006316), updated 21 October 2026 at 23:46:29 UTC.
- [Duplicate-review withdrawal and chronology qualification](https://github.com/d6g8k5htny-coder/main/issues/283#issuecomment-6329114310).
- [Source-packet author scope](https://github.com/d6g8k5htny-coder/main/issues/283#issuecomment-6345511856).

The delta reviewer explicitly did not publish a personal pickup before execution.
That coordination deficiency is preserved: its earlier start notice is not
retroactive acceptance, and the native comment's creation time is not the verdict
time. Its source-specific technical evidence remains attributed to that reviewer;
this packet does not certify procedural compliance or clear an integration gate.

Original author executions used CPython 3.13.5; the delta reviewer reported
CPython 3.12.3. The new source-packet layout check on 22 October 2026 used CPython
3.13.5: 21/21 inherited and 8/8 timestamp methods passed in each mode, and all 22
inherited variant/mode runs were detected. Those are new local packaging checks,
not hosted CI, a repeated independent review, or a live-service effectiveness study.

Actual author and packet preparer: OpenAI / GPT-6 Astra Pro, returning ATW
architecture/evidence-maintenance conversation; platform session ID unavailable.
Organizational-independence credit 0; scientific effect NONE. Separate source
publication, review and integration responsibilities remain subject to the current
project workflow. The author does not review or integrate this packet.

[Canonical owner mandate](https://github.com/d6g8k5htny-coder/main/blob/b665307520948308a53d190d7341bf301df3b3a2/governance/OWNER_MANDATE_20261015.md)
· [Standing delegation](https://github.com/d6g8k5htny-coder/main/blob/main/governance/OP-AUTONOMY-20260923-v2.1.md)
159 changes: 159 additions & 0 deletions experiments/board_capacity_probe_20261022/board_capacity_probe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#!/usr/bin/env python3
"""Offline, advisory board-capacity check. No network, writes or authorization.

Input: {"observed_at": "RFC3339", "issue": <native issue or selected fields>}.
The caller supplies the active URL from current governing entry instructions.
Observation time is a caller assertion, not authenticated acquisition evidence.
Exit 0: usable snapshot below advisory thresholds. Exit 1: attention needed.
Exit 2: input/identity/freshness unknown; never an operational all-clear.
"""
from __future__ import annotations
import argparse
from datetime import datetime, timezone
import hashlib
import json
from pathlib import Path
import re

MAX_INPUT_BYTES = 1048576
PART = r'([A-Za-z0-9_.-]+)'
WEB = re.compile(r'https://github\.com/' + PART + '/' + PART + r'/issues/([1-9][0-9]*)')
API = re.compile(r'https://api\.github\.com/repos/' + PART + '/' + PART + r'/issues/([1-9][0-9]*)')
REPO = re.compile(r'https://api\.github\.com/repos/' + PART + '/' + PART)
TIME = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)', re.ASCII)


def _identity(value, pattern):
if type(value) is not str:
return None
match = pattern.fullmatch(value)
if match is None or any(part in ('.', '..') for part in match.groups()[:2]):
return None
owner, repo, *number = match.groups()
return (owner.casefold(), repo.casefold(), *number)


def _time(value):
if type(value) is not str or TIME.fullmatch(value) is None:
raise ValueError('INVALID_TIME')
return datetime.fromisoformat(value.replace('Z', '+00:00')).astimezone(timezone.utc)


def _empty(reason):
return {'status': 'UNKNOWN', 'capacity': 'UNKNOWN', 'reasons': [reason],
'attention_required': True, 'advisory_only': True,
'posting_permission': 'NOT_ESTABLISHED', 'scientific_effect': 'NONE'}


def assess(snapshot, active_url, now, *, prepare_at=2000, cutover_at=2250,
max_age_seconds=900):
"""Validate a point observation; never elect a board or authorize a write."""
if (any(type(v) is not int or v <= 0 for v in
(prepare_at, cutover_at, max_age_seconds)) or prepare_at >= cutover_at):
return _empty('INVALID_POLICY')
active = _identity(active_url, WEB)
if active is None:
return _empty('INVALID_ACTIVE_URL')
if (type(snapshot) is not dict or 'observed_at' not in snapshot or
type(snapshot.get('issue')) is not dict):
return _empty('INVALID_SNAPSHOT')
issue = snapshot['issue']
if 'pull_request' in issue:
return _empty('NOT_ISSUE')
if (any(type(issue.get(k)) is not int or issue[k] <= 0 for k in ('id', 'number')) or
type(issue.get('comments')) is not int or issue['comments'] < 0 or
type(issue.get('locked')) is not bool or
issue.get('state') not in ('open', 'closed') or
any(type(issue.get(k)) is not str for k in ('url', 'html_url', 'repository_url'))):
return _empty('INVALID_ISSUE')
if (str(issue['number']) != active[2] or
_identity(issue['html_url'], WEB) != active or
_identity(issue['url'], API) != active or
_identity(issue['repository_url'], REPO) != active[:2]):
return _empty('ROUTE_MISMATCH')
try:
observed = _time(snapshot['observed_at'])
current = _time(now)
except (ValueError, OverflowError):
return _empty('INVALID_TIME')
age = (current - observed).total_seconds()
if age < 0:
return _empty('FUTURE_SNAPSHOT')
if age > max_age_seconds:
return _empty('STALE_SNAPSHOT')
count = issue['comments']
level = 'CUTOVER' if count >= cutover_at else ('PREPARE' if count >= prepare_at else 'NORMAL')
reasons = []
if issue['state'] != 'open':
reasons.append('CLOSED')
if issue['locked']:
reasons.append('LOCKED')
return {'status': 'UNAVAILABLE' if reasons else 'OK', 'capacity': level,
'reasons': reasons, 'attention_required': bool(reasons) or level != 'NORMAL',
'advisory_only': True, 'posting_permission': 'NOT_ESTABLISHED',
'scientific_effect': 'NONE',
'active_url': 'https://github.com/' + '/'.join(active[:2]) + '/issues/' + active[2],
'comments': count, 'observed_at': observed.isoformat(), 'age_seconds': age,
'thresholds': {'prepare_at': prepare_at, 'cutover_at': cutover_at},
'max_age_seconds': max_age_seconds}


def exit_code(result):
if result['status'] == 'UNKNOWN':
return 2
return 1 if result['attention_required'] else 0


def _pairs(rows):
value = {}
for key, item in rows:
if key in value:
raise ValueError('DUPLICATE_KEY')
value[key] = item
return value


def _constant(_):
raise ValueError('NONFINITE_JSON')


def decode_snapshot(raw):
if len(raw) > MAX_INPUT_BYTES:
raise ValueError('INPUT_TOO_LARGE')
return json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_constant)


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('snapshot', type=Path)
parser.add_argument('--active-url', required=True)
parser.add_argument('--now', default=None)
parser.add_argument('--prepare-at', type=int, default=2000)
parser.add_argument('--cutover-at', type=int, default=2250)
parser.add_argument('--max-age-seconds', type=int, default=900)
args = parser.parse_args()
raw = None
try:
with args.snapshot.open('rb') as stream:
raw = stream.read(MAX_INPUT_BYTES + 1)
except OSError:
result = _empty('INPUT_UNREADABLE')
else:
try:
snapshot = decode_snapshot(raw)
except (ValueError, RecursionError):
result = _empty('INPUT_INVALID')
else:
result = assess(snapshot, args.active_url,
args.now if args.now is not None else datetime.now(timezone.utc).isoformat(),
prepare_at=args.prepare_at, cutover_at=args.cutover_at,
max_age_seconds=args.max_age_seconds)
# Only a complete within-bound input has a claimed whole-input digest.
if len(raw) <= MAX_INPUT_BYTES:
result['input_sha256'] = hashlib.sha256(raw).hexdigest()
print(json.dumps(result, sort_keys=True, separators=(',', ':')))
return exit_code(result)


if __name__ == '__main__':
raise SystemExit(main())
Loading