diff --git a/docs/research/ceiling-task-startup.md b/docs/research/ceiling-task-startup.md new file mode 100644 index 0000000000..2cfeb6a575 --- /dev/null +++ b/docs/research/ceiling-task-startup.md @@ -0,0 +1,122 @@ +# Executable startup for the four historical ceiling cards + +The current task picker now gives four cards an ordered route: current selected +metadata orientation, then the existing authenticated historical ceiling replay. +This closes Open next question 2 of +[PR #5359](https://github.com/CrocSwap/integer-mult-bounds/pull/5359)'s +[package](../../research/historical-complex-ceiling-replay/README.md), using +Ali Romman's [PR #5378](https://github.com/CrocSwap/integer-mult-bounds/pull/5378) +CLI boundary. It changes no mathematical result or selected frontier. + +At canonical main `32890bc5de034ab8fc93ac88ead7279a6a416d04`, priority revision 7, +all four cards emit `python3 -B research/complex-local-word-ceiling/verify.py`. +With its inputs materialized, that command raises `KeyError: 'complex_profile'` +at `verify.py:38`: the selected #5413 certificate uses the productive-helper +schema. The current selected metadata baseline passes and reports +`605457647/200000000000`. This reproduces the already credited mismatch; it is +not a newly discovered mathematical defect. + +## Route and evidence boundary + +```sh +python3 -B scripts/choose_current_research_task.py --task complex-rank-shape-decoder +python3 -B scripts/research_selected_baseline.py +python3 -B scripts/research_package.py --package research/historical-complex-ceiling-replay +``` + +`first_step` describes the current selected baseline, expecting +`PASS_RESEARCH_BASELINE_BINDINGS_ONLY`. `follow_up_steps` describes the historical +registered replay, expecting `PASS_REGISTERED_RESEARCH_PACKAGE`. The latter +executes the unchanged #1094 checker and its #1042 comparison in normal and +optimized modes. Its ceiling is a historical positive control. Applying its +ceiling or lever budget to a changed current supplier still requires an +applicable, source-bound complete cost law. + +The same route applies to `complex-new-helper-inventory`, `centre-path-sharing` +and `coverage-law-change`. Only the exact original command matches. A variant +with extra flags or a different script remains unchanged. The original +`catalog_first_step` retains all four fields verbatim; task, method, scope key, +selection seed and acceptance gate remain unchanged. Historical picker output, +catalogue bytes, package `original_card` receipts and scientific inputs remain +unchanged. + +Before modifying any suggestion, the resolver validates the current baseline, +registered runner, historical manifest and historical verifier references with +the existing catalogue-file check. A missing/deleted file or an omitted staged +replacement fails. Exact HEAD-matching sparse omissions remain admissible and +are named for materialization. This is reference validation only: follow the +baseline sparse diagnosis and historical replay README for the complete input +closure and shallow-checkout provenance fetches. + +## Task, overlap and compatibility + +The verifier-engineering draw used nonce `c15fe091c7821f358c79b35e885e7a0d`. +The selected `portable-replay` suggestion is explicitly changed from its +environment/artifact question to the concrete startup handoff above. The bounded +success test is executable emitted commands with retained historical evidence +and rejection controls; no speedup or new supplier cost is claimed. +[Canonical claim and handoff](https://github.com/CrocSwap/integer-mult-bounds/discussions/4458#discussioncomment-19174048). + +The entry overlap snapshot at 2026-10-25 06:11–06:12 UTC covered 378 open PRs, +4,790 Discussion records and all 7,402 tracked in-scope notes, with complete +reported pagination and inventory. Exact-command and ceiling/first-step searches +found the motivating handoff and completed predecessors. This is text coverage, +not proof of novelty or a search of arbitrary diffs and unpublished work. +Before submission, canonical main was fetched unchanged. The 06:20–06:21 UTC +refresh covered 378 open PRs, 4,797 Discussion records and the same complete +local inventory, with no warnings or new competing scope in these searches. + +All 6,922 tracked top-level `research/*/SOURCES.json` and `VERIFY.json` files +were parsed and their raw working bytes compared to their HEAD Git blob IDs. +No JSON string value names `scripts/choose_current_research_task.py`, +`tests/test_research_current_assignment.py` or +`docs/research/selected-baseline.md`. The historical picker, catalogue and +frozen packages are not edited. Nested manifests, archives, code imports and +undeclared reads are outside this compatibility inventory. +The committed-object snippet in [the compatibility note](task-startup-compatibility.md#reproduce-the-inventory) +reproduces the pin/input counts with `BASE` set to the commit above and `TARGETS` +set to these three paths. The broader JSON-string scan also checks other fields. + +## Verification + +The focused controls run with Python 3.12 and Git: + +```sh +python3 -W error -B -m unittest discover -s tests -p test_research_current_assignment.py -v +python3 -O -W error -B -m unittest discover -s tests -p test_research_current_assignment.py -v +``` + +The extended tests first rejected the old resolver: the historical route and +retained card were absent, missing replay references were accepted, and sparse +references were not reported. The controls also cover exact-command matching, +all-or-nothing updates across mixed cards, missing files, ordinary deletion, +staged replacement, sparse omission and unchanged legacy help/error output. + +On native Windows 11 build 26300 / CPython 3.12.0, all ten focused tests pass in +normal and optimized mode. The 65 adjacent assignment, coordination, baseline +and onboarding tests also pass (UTF-8 mode enabled for that existing suite). +All four emitted routes were compared and their two distinct commands executed, +using the installed Python interpreter in place of Windows' `python3` alias. +Current selected metadata binding passes. The historical registered command +passes both modes, retaining the original four controls, all 18 input +corruption/omission cases and all three scientific-data rejections. The existing +historical replay, its hashes and the live selected record retain their bytes. + +The contribution PR records the final Linux check, committed-diff replay plan +and raw committed-byte comparison. +No full selected cold replay, current cost-law derivation, full-history provenance +audit, independent human review or proof-kernel acceptance is claimed. + +## Open next questions + +The current supplier's applicable cost law remains a separate research task. +Start from the selected certificate and its reviewed complete paid, productive, +compiler and outer ledger; the historical ceiling is not a substitute. Other +named scientific cards still need their own source and applicability checks; +this exact-command rule does not migrate arbitrary historical scientific work. + +Credit Douglas Colkitt and the retained picker, source-checker and ceiling +contributors; Ali Romman for #5378; Mihir Srivastava for #4463/#4906/#5359; and +the #1094/#1042 construction and audit lineage retained by the historical replay. +Prepared for Mihir Srivastava with substantial OpenAI Codex assistance, one agent. +Apache-2.0. Evidence is author-checked tooling, not scientific approval. diff --git a/docs/research/selected-baseline.md b/docs/research/selected-baseline.md index ee6c992bf2..d38bd4e509 100644 --- a/docs/research/selected-baseline.md +++ b/docs/research/selected-baseline.md @@ -92,11 +92,37 @@ The current task-picker CLI, `scripts/choose_current_research_task.py`, resolves Each affected suggestion retains its complete original entry in `catalog_first_step` and explains the change in `first_step_resolution`. Only the command changes. The inspection text, scope, task, method, scope key -and acceptance gate stay the same. Other scientific first-step commands are -not changed. The CLI checks that the current helper exists, or is an exact +and acceptance gate stay the same for these generic cards. +The CLI checks that the current helper exists, or is an exact HEAD file omitted by a sparse checkout, before it emits the resolved command. A sparse result names the missing helper for materialization. +Four cards instead name `research/complex-local-word-ceiling/verify.py`: +`complex-rank-shape-decoder`, `complex-new-helper-inventory`, +`centre-path-sharing` and `coverage-law-change`. Their current `first_step` +is the selected baseline above, with its own expected status and inspection +instructions. Run the emitted `follow_up_steps` afterward, in order. For these +cards the single follow-up is: + +```sh +python3 -B scripts/research_package.py --package research/historical-complex-ceiling-replay +``` + +It expects `PASS_REGISTERED_RESEARCH_PACKAGE` and checks the historical #1094 +ceiling against #1042. That ceiling and its lever budgets do not bound the +current supplier without a new source-bound cost law. The complete original +command, expectation, inspection text and scope remain in `catalog_first_step`. +The task, method, scope key and acceptance gate remain unchanged. Other scientific +commands, including variants with extra flags, are not reinterpreted. + +All route references are validated before any suggestion changes. Missing or +deleted runner, replay manifest or verifier files fail; exact HEAD-matching +sparse omissions appear in `omitted_current_first_step_paths`. Materialize the +selected closure and the historical package's declared inputs before executing +them. The CLI validates entry references, not the full replay dependency closure +or source authenticity. See [the four-card routing evidence](ceiling-task-startup.md) +for the reproduced failure, compatibility inventory and bounded checks. + The historical `scripts/choose_research_task.py`, catalogue bytes, `select()` result and package `TASK.json` original-card receipts remain exact. The current entry point runs the historical CLI with unchanged arguments and resolves its @@ -109,15 +135,17 @@ copy the resolved command into an old package or repin its frozen inputs. runtime consumers of the catalogue and requested this receipt-preserving migration. [PR5359](https://github.com/CrocSwap/integer-mult-bounds/pull/5359) provides the separate authenticated historical complex-ceiling replay. -That scientific command is outside this generic-baseline resolution rule. +The four-card route uses that unchanged replay as its historical positive control. The displayed scientific starting points still need a current overlap and scope check. Command resolution is not a strategic reassessment or scientific -acceptance. Tests cover all 16 generic cards, unchanged other cards, exact -command matching, missing/deleted/sparse helpers and actual CLI output. +acceptance. Tests cover all 16 generic cards and four historical-ceiling cards, +unchanged other cards, exact command matching, missing/deleted/sparse references, +staged reference drift and actual CLI output. Run them with `python3 -B -m unittest discover -s tests -p test_research_current_assignment.py`. Current CLI resolution and these controls: Ali Romman with substantial OpenAI -Codex assistance; Apache-2.0. +Codex assistance. Four-card historical routing and additional controls: Mihir +Srivastava with substantial OpenAI Codex assistance; Apache-2.0. ## Open next questions diff --git a/scripts/choose_current_research_task.py b/scripts/choose_current_research_task.py index 9836d57d46..0402d37f4f 100644 --- a/scripts/choose_current_research_task.py +++ b/scripts/choose_current_research_task.py @@ -2,6 +2,7 @@ """Show current first steps and preserve the frozen task-picker output. Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +Historical-ceiling routing: Mihir Srivastava with OpenAI Codex assistance. Arguments and selection are delegated to the historical picker CLI. """ import json @@ -16,19 +17,63 @@ def resolve_current_first_steps(result, root): - """Resolve generic orientation at the CLI boundary; keep the source card.""" + """Resolve known startup routes at the CLI boundary; keep the source card.""" old = ["python3", "-B", "scripts/research_baseline.py"] + ceiling = ["python3", "-B", "research/complex-local-word-ceiling/verify.py"] current = "scripts/research_selected_baseline.py" cards = [card for card in result["suggestions"] - if card["first_step"]["command"] == old] + if card["first_step"]["command"] in (old, ceiling)] if not cards: return [] - omitted = check_catalog_files(root, [ + required = [ (current, "missing current first-step script: " + current), - ]) + ] + package = "research/historical-complex-ceiling-replay" + runner = "scripts/research_package.py" + if any(card["first_step"]["command"] == ceiling for card in cards): + required += [(name, "missing historical first-step reference: " + name) + for name in (runner, package + "/VERIFY.json", package + "/verify.py")] + # Validate the whole route before changing any suggestion. These are entry + # references only; the registered replay authenticates its own input closure. + omitted = check_catalog_files(root, required) for card in cards: original = card["first_step"] card["catalog_first_step"] = original + if original["command"] == ceiling: + card["first_step"] = { + "command": ["python3", "-B", current], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": ( + "Read the current selected certificate, review and reproduction " + "command; then run follow_up_steps in order." + ), + "scope": ( + "Current selected source bindings and metadata orientation only; " + "not a cold replay or a current packing ceiling." + ), + } + card["follow_up_steps"] = [{ + "command": ["python3", "-B", runner, "--package", package], + "expected": "PASS_REGISTERED_RESEARCH_PACKAGE", + "inspect": ( + "Read the authenticated #1094 ceiling and the historical replay " + "README. Derive a source-bound cost law for a changed current " + "supplier before applying any historical ceiling or lever budget." + ), + "scope": ( + "Historical #1094 positive control with #1042 comparison; " + "not a bound on the current supplier." + ), + }] + card["first_step_resolution"] = ( + "Run current selected orientation first, then the authenticated " + "historical positive control in follow_up_steps. catalog_first_step " + "is the exact frozen card entry. The task and acceptance gate are " + "unchanged; the historical planning budget needs a new applicability " + "argument for the current construction. Materialize each route's " + "inputs before execution; reference validation is not source authentication." + ) + continue card["first_step"] = {**original, "command": ["python3", "-B", current]} card["first_step_resolution"] = ( "The current CLI uses the selected-certificate baseline for generic " diff --git a/tests/test_research_current_assignment.py b/tests/test_research_current_assignment.py index 49f7c86969..860f6b9b9e 100644 --- a/tests/test_research_current_assignment.py +++ b/tests/test_research_current_assignment.py @@ -21,6 +21,7 @@ class CurrentResearchAssignmentTests(unittest.TestCase): def test_every_frozen_card_and_other_fields_stay_exact(self): before = copy.deepcopy(CATALOG) resolved = 0 + historical = 0 for track in CATALOG["tracks"]: for task in track["tasks"]: result = legacy["select"](CATALOG, "a1" * 16, task_id=task["id"]) @@ -34,8 +35,28 @@ def test_every_frozen_card_and_other_fields_stay_exact(self): ["python3", "-B", "scripts/research_selected_baseline.py"]) self.assertTrue(card.pop("first_step_resolution")) card["first_step"] = card.pop("catalog_first_step") + elif task["first_step"]["command"] == [ + "python3", "-B", "research/complex-local-word-ceiling/verify.py"]: + historical += 1 + self.assertEqual(card["catalog_first_step"], task["first_step"]) + self.assertEqual(card["first_step"]["command"], + ["python3", "-B", "scripts/research_selected_baseline.py"]) + self.assertEqual(card["first_step"]["expected"], + "PASS_RESEARCH_BASELINE_BINDINGS_ONLY") + follow_up, = card.pop("follow_up_steps") + self.assertEqual(follow_up["command"], [ + "python3", "-B", "scripts/research_package.py", "--package", + "research/historical-complex-ceiling-replay"]) + self.assertEqual(follow_up["expected"], + "PASS_REGISTERED_RESEARCH_PACKAGE") + self.assertIn("#1094", follow_up["scope"]) + self.assertIn("current supplier", follow_up["scope"]) + self.assertNotIn("run levers.py", card["first_step"]["inspect"]) + self.assertTrue(card.pop("first_step_resolution")) + card["first_step"] = card.pop("catalog_first_step") self.assertEqual(result, original) self.assertEqual(resolved, 16) + self.assertEqual(historical, 4) self.assertEqual(CATALOG, before) def test_only_exact_generic_command_is_resolved(self): @@ -53,6 +74,43 @@ def test_missing_current_helper_does_not_change_receipt(self): current.resolve_current_first_steps(result, Path(directory)) self.assertEqual(result, original) + def test_nonexact_scientific_commands_are_not_reinterpreted(self): + for command in ( + ["python3", "-B", "research/complex-local-word-ceiling/verify.py", "--write"], + ["python3", "-B", "research/complex-local-word-ceiling/levers.py"], + ["python3", "-O", "-B", "research/complex-local-word-ceiling/verify.py"], + ): + with self.subTest(command=command): + result = copy.deepcopy(legacy["select"]( + CATALOG, "0" * 32, task_id="centre-path-sharing")) + result["suggestions"][0]["first_step"]["command"] = command + original = copy.deepcopy(result) + self.assertEqual(current.resolve_current_first_steps(result, ROOT), []) + self.assertEqual(result, original) + + def test_missing_historical_reference_leaves_all_cards_unchanged(self): + required = [ + "scripts/research_selected_baseline.py", "scripts/research_package.py", + "research/historical-complex-ceiling-replay/VERIFY.json", + "research/historical-complex-ceiling-replay/verify.py", + ] + for absent in required: + with self.subTest(absent=absent), tempfile.TemporaryDirectory() as directory: + root = Path(directory) + for name in required: + if name != absent: + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text("fixture\n") + result = legacy["select"](CATALOG, "0" * 32, task_id="portable-replay") + result["suggestions"] += legacy["select"]( + CATALOG, "0" * 32, task_id="centre-path-sharing")["suggestions"] + original = copy.deepcopy(result) + with self.assertRaises(ValueError) as raised: + current.resolve_current_first_steps(result, root) + self.assertIn(absent, str(raised.exception)) + self.assertEqual(result, original) + def cli(self, script, args): return subprocess.run([sys.executable, "-B", str(script), *args], cwd=ROOT, capture_output=True, text=True, encoding="utf-8") @@ -80,6 +138,65 @@ def test_help_and_error_preserve_child_status_and_output(self): self.assertEqual(output.returncode, code) self.assertEqual((output.stdout, output.stderr), (original.stdout, original.stderr)) + def test_cli_distinguishes_current_orientation_from_historical_control(self): + args = ["--seed", "0" * 32, "--task", "complex-new-helper-inventory"] + original = self.cli(LEGACY, args) + output = self.cli(ROOT / "scripts/choose_current_research_task.py", args) + self.assertEqual(original.returncode, 0, original.stderr) + self.assertEqual(output.returncode, 0, output.stderr) + old, new = json.loads(original.stdout), json.loads(output.stdout) + card = new["suggestions"][0] + self.assertEqual(card["first_step"]["command"][2], "scripts/research_selected_baseline.py") + self.assertEqual(card["first_step"]["expected"], "PASS_RESEARCH_BASELINE_BINDINGS_ONLY") + follow_up, = card.pop("follow_up_steps") + self.assertEqual(follow_up["command"][-1], "research/historical-complex-ceiling-replay") + self.assertIn("historical", follow_up["scope"].lower()) + self.assertIn("cost law", follow_up["inspect"]) + self.assertTrue(card.pop("first_step_resolution")) + card["first_step"] = card.pop("catalog_first_step") + self.assertEqual(new, old) + self.assertEqual(self.cli(LEGACY, args).stdout, original.stdout) + + def test_sparse_historical_references_require_unchanged_head_entries(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + required = [ + "scripts/research_selected_baseline.py", "scripts/research_package.py", + "research/historical-complex-ceiling-replay/VERIFY.json", + "research/historical-complex-ceiling-replay/verify.py", + ] + for name in required: + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text("fixture\n") + def git(*args): + subprocess.run(["git", *args], cwd=root, check=True, capture_output=True) + git("init", "-q"); git("add", ".") + git("-c", "user.name=Fixture", "-c", "user.email=fixture@example.invalid", + "-c", "core.hooksPath=/dev/null", "commit", "-qm", "references") + omitted = required[1:] + git("update-index", "--skip-worktree", *omitted) + for name in omitted: + (root / name).unlink() + result = legacy["select"](CATALOG, "0" * 32, task_id="coverage-law-change") + self.assertEqual(current.resolve_current_first_steps(result, root), sorted(omitted)) + # Ordinary deletion must not acquire the deliberate-sparse exemption. + changed = omitted[-1] + git("update-index", "--no-skip-worktree", changed) + result = legacy["select"](CATALOG, "0" * 32, task_id="coverage-law-change") + original = copy.deepcopy(result) + with self.assertRaises(ValueError): + current.resolve_current_first_steps(result, root) + self.assertEqual(result, original) + # Nor may a staged replacement masquerade as the original HEAD input. + (root / changed).write_text("replacement\n") + git("add", changed) + git("update-index", "--skip-worktree", changed) + (root / changed).unlink() + with self.assertRaises(ValueError): + current.resolve_current_first_steps(result, root) + self.assertEqual(result, original) + def test_sparse_helper_is_allowed_but_deletion_is_rejected(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory)