diff --git a/DECISIONS.md b/DECISIONS.md index 21c33ea12..3f03152bd 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -13,3 +13,5 @@ Append-only. Historical source outcomes remain in their original records. | 2026-10-29 16:56 | 1 | C | Began installing the repository-pinned Lean toolchain for fresh build/kernel execution. Historical hosted CI will remain historical evidence. | Yes | Math `formal/lean-toolchain`, `lake-manifest.json` | | 2026-10-29 16:54 | 1 | C | Timestamp correction: the entries labelled 16:55 and 16:56 above used projected times by mistake; both actions had actually completed by the observed clock reading 16:54:09 UTC. The actions and evidence are unchanged. | Yes | UTC clock observation 2026-10-29 16:54:09; append-only correction | | 2026-10-29 16:54 | 1 | C | Direct fast-forward push to main was rejected by repository rule GH013 (PR required and three current status checks required). Use a PR with actual automated checks and autonomous integration; no owner input is needed. Do not bypass the rejection. | Yes | Git push exit 1, remote rule readback | + +| 2026-10-29T21:20:29.131Z | 2 | B | Replaced the public-intake checker's500-file pre-enumeration limit with the documented3000-file API completeness boundary and strengthened exact page cardinalities. Retained50-file public-package admission, all existing checks and85 prior test bodies.97 controls/mode and captured965-file replay passed; independent review retains the pre-existing A-to-B-to-A endpoint race limit. No workflow/context/protection change or mathematical status effect. | Yes | `tools/public_intake_check.py` SHA25627afbbe278183e30ef647211a884a0d0fb2c6cfa674e4f181cca96add350e57e; `tests/test_public_intake.py`; ordinary PR evidence. | diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 6b39918c2..5b8c17cbb 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -107,3 +107,9 @@ are being inventoried against their actual tests and execution coverage. Mission tools must be finished, documented with exact usage and verification, and registered here and in `TOOLING.md` before final admission. Tools are a means to closure, never a reason to open a general infrastructure project. + +## 2026-10-29T21:20:29.131Z — Public-intake enumeration tool + +Existing tool: `tools/public_intake_check.py`. Purpose: complete bounded intake/engineering routing for supported PR sizes. The trusted public-intake checker enumerates up to the documented GitHub API limit of3000 changed files,100 per page. It requires typed integer metadata, exact per-page and aggregate counts, unique validated paths and a matching final PR snapshot. The separate public-package cap remains50 files and all source/artifact admission checks remain unchanged. More than3000 files refuse. Initial/final snapshots do not establish atomicity or exclude an A-to-B-to-A head transition. + +Usage and verification: `python3 -B -S -m unittest discover -s tests -p test_public_intake.py -v` and the same command with `-O`. All85 original test bodies are preserved;97 controls pass in both modes, and the captured965-path input consumes all10 pages plus final readback. Independent review reproduced malformed-page refusal and records the pre-existing endpoint race limit. This is finite engineering qualification, not a Layer A, mathematical, full-regression or CBZ certificate. Maintenance: none beyond deliberate source/contract changes. Hosted execution of this revision must be observed after ordinary PR integration; no workflow or protection change is authorized by this result. diff --git a/STATUS.md b/STATUS.md index 0be46963b..388fcd51e 100644 --- a/STATUS.md +++ b/STATUS.md @@ -59,3 +59,9 @@ The machine catalog at [`meta-framework/registry.json`](https://github.com/d6g8k ## Reading rule When a reviewed child result imports a parent that remains AMEND or open, keep those facts separate. “ACCEPT — scoped” never means “everything upstream and downstream is accepted.” + +## Public-intake tooling: how to verify + +This technical entry leaves the dated scientific snapshot above intact. The trusted public-intake checker enumerates up to the documented GitHub API limit of3000 changed files,100 per page. It requires typed integer metadata, exact per-page and aggregate counts, unique validated paths and a matching final PR snapshot. The separate public-package cap remains50 files and all source/artifact admission checks remain unchanged. More than3000 files refuse. Initial/final snapshots do not establish atomicity or exclude an A-to-B-to-A head transition. + +Run `python3 -B -S -m unittest discover -s tests -p test_public_intake.py -v` and the same command with `-O`. The candidate source SHA256 `27afbbe278183e30ef647211a884a0d0fb2c6cfa674e4f181cca96add350e57e` passed97 tests per mode with no skips, retaining all85 prior methods. The965-file native input replay and independent adverse controls passed. Hosted execution of this revision and full Main regression remain NOT_EVALUATED; no CBZ-0 or scientific promotion is claimed. Governance and the append-only decision ledger record this bounded change. diff --git a/tests/test_public_intake.py b/tests/test_public_intake.py index 628ead7b6..f0cb18f9f 100644 --- a/tests/test_public_intake.py +++ b/tests/test_public_intake.py @@ -341,6 +341,124 @@ def test_complete_pagination_before_maintainer_bypass(self): self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=2'] = [{'filename': 'incoming/hidden/result.md', 'status': 'added'}] self.reject('too many package files') + def install_engineering_pages(self, count=965): + self.pr['head']['repo']['full_name'] = REPO + self.pr['changed_files'] = count + rows = [{'filename': f'docs/page-item-{i}.md', 'status': 'modified', 'sha': 'd'*40} + for i in range(count)] + for page, offset in enumerate(range(0, count, 100), 1): + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page={page}'] = rows[offset:offset+100] + self.api.calls.clear() + return rows + + def test_965_engineering_files_require_all_ten_pages(self): + self.install_engineering_pages() + try: + result = self.run_check() + except ValueError as error: + self.fail(f'Complete 965-file engineering listing was refused: {error}') + self.assertEqual(result['lane'], 'maintainer-engineering') + self.assertEqual(result['scientific_effect'], 'NONE') + self.assertEqual(self.api.calls, [f'/repos/{REPO}/pulls/7'] + [ + f'/repos/{REPO}/pulls/7/files?per_page=100&page={page}' for page in range(1, 11) + ] + [f'/repos/{REPO}/pulls/7']) + + def test_documented_3000_file_ceiling_requires_all_thirty_pages(self): + self.install_engineering_pages(3000) + try: + result = self.run_check() + except ValueError as error: + self.fail(f'Complete 3000-file engineering listing was refused: {error}') + self.assertEqual(result['lane'], 'maintainer-engineering') + self.assertEqual(self.api.calls, [f'/repos/{REPO}/pulls/7'] + [ + f'/repos/{REPO}/pulls/7/files?per_page=100&page={page}' for page in range(1, 31) + ] + [f'/repos/{REPO}/pulls/7']) + + def test_listing_itself_refuses_zero_count(self): + self.api.calls.clear() + with self.assertRaisesRegex(ValueError, 'unsupported changed file count'): + intake.changes(self.api, REPO, 7, 0) + self.assertEqual(self.api.calls, []) + + def test_malformed_or_over_api_ceiling_metadata_refuses_before_listing(self): + for count in [None, True, False, 0, -1, 965.0, '965', [], {}, 3001]: + with self.subTest(count=count): + self.pr['changed_files'] = count + self.api.calls.clear() + self.reject('unsupported changed file count') + self.assertEqual(self.api.calls, [f'/repos/{REPO}/pulls/7']) + + def test_exact_total_cannot_mask_short_or_oversized_intermediate_page(self): + for split in [99, 101]: + with self.subTest(first_page_size=split): + rows = self.install_engineering_pages(200) + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=1'] = rows[:split] + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=2'] = rows[split:] + self.reject('file listing') + + def test_large_listing_refuses_missing_extra_or_malformed_final_page(self): + for final in [[], None, {}, 'not a list', [None]*64, [None]*66]: + with self.subTest(final=type(final).__name__, size=len(final) if hasattr(final, '__len__') else None): + self.install_engineering_pages() + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=10'] = final + self.reject('file listing') + self.assertEqual(self.api.calls[-1], f'/repos/{REPO}/pulls/7/files?per_page=100&page=10') + + def test_large_listing_refuses_cross_page_duplicate(self): + self.install_engineering_pages() + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=10'][-1]['filename'] = 'docs/page-item-0.md' + self.reject('duplicate changed path') + + def test_large_listing_refuses_malformed_last_changed_row(self): + for bad in [None, {}, {'filename': '../hidden'}, {'filename': 'docs/hidden\nname.md'}, + {'filename': 'docs/item.md', 'previous_filename': None}]: + with self.subTest(row=bad): + self.install_engineering_pages() + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=10'][-1] = bad + self.reject('invalid (changed file|changed path|previous path)') + + def test_last_page_incoming_path_or_rename_still_requires_package_checks(self): + for incoming_field in ['filename', 'previous_filename']: + with self.subTest(incoming_field=incoming_field): + self.install_engineering_pages() + last = self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=10'][-1] + last[incoming_field] = 'incoming/late/RESULT.md' + if incoming_field == 'previous_filename': + last['status'] = 'renamed' + self.reject('too many package files') + + def test_large_fork_or_review_label_still_enforces_fifty_file_package_cap(self): + for restricted_by in ['fork', 'label']: + with self.subTest(restricted_by=restricted_by): + self.install_engineering_pages() + self.pr['head']['repo']['full_name'] = 'visitor/main' if restricted_by == 'fork' else REPO + self.pr['labels'] = [{'name': 'results-for-review'}] if restricted_by == 'label' else [] + self.reject('too many package files') + + def test_late_api_failures_cannot_be_maintainer_success(self): + for code in [403, 500, 503]: + with self.subTest(code=code): + self.install_engineering_pages() + self.api.routes[f'/repos/{REPO}/pulls/7/files?per_page=100&page=10'] = urllib.error.HTTPError( + 'https://api.github.com', code, 'unavailable', None, None) + self.reject(f'HTTP Error {code}') + self.assertEqual(self.api.calls[-1], f'/repos/{REPO}/pulls/7/files?per_page=100&page=10') + + def test_large_pr_race_refuses_at_final_snapshot(self): + self.install_engineering_pages() + original_get = self.api.get + reads = 0 + def changing_get(route): + nonlocal reads + result = original_get(route) + if route == f'/repos/{REPO}/pulls/7': + reads += 1 + if reads == 2: + result['changed_files'] = 966 + return result + self.api.get = changing_get + self.reject('PR changed during verification') + def test_pr_race_fails_at_final_readback(self): original_get = self.api.get reads = 0 diff --git a/tools/public_intake_check.py b/tools/public_intake_check.py index b554aad22..6e27cec99 100644 --- a/tools/public_intake_check.py +++ b/tools/public_intake_check.py @@ -20,7 +20,9 @@ import urllib.request import zlib -MAX_FILES = 500 # Below the API's 3000-file ceiling; pagination is mandatory. +# GitHub documents at most 3000 PR files, with at most 100 per page. +# Larger PRs cannot establish completeness through this endpoint and must refuse. +MAX_FILES = 3000 MAX_PACKAGE_FILES = 50 MAX_FILE_BYTES = 262144 MAX_PACKAGE_BYTES = 2097152 @@ -257,10 +259,13 @@ def snapshot(pr, repo): def changes(api, repo, number, count): + integer(count, 1, MAX_FILES, 'unsupported changed file count') rows = [] for page in range(1, (count + 99)//100 + 1): batch = api.get(f'/repos/{repo}/pulls/{number}/files?per_page=100&page={page}') require(isinstance(batch, list), 'file listing unavailable') + require(len(batch) == min(100, count - (page - 1)*100), + 'incomplete or oversized file listing page') rows.extend(batch) require(len(rows) == count, 'incomplete file listing') seen = set()