Repository navigation
Add PHP jump controls from PR 57 and reconcile capability contracts - #63
Conversation
Port PHP jump-adjacency controls from PR #57 with sibling-branch and goto-label negatives. Correct provenance limits, stale capability metadata and four-format estate toolchain scope. Validation: 220 tests, 46 e2e checks, fmt, clippy -D warnings; six mutation controls killed. Full reconciliation and the corrected initial mutant control are documented.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed. 📝 Summary
Merge Risk:
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a12f3287a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,4 @@ | |||
| (compound_statement (return_statement) @jump . (_) @next) | |||
There was a problem hiding this comment.
Match top-level PHP return sequences
When a PHP file contains top-level code such as return; work();, both statements are children of the program node, so this pattern never produces a candidate because it only matches compound_statement. Top-level return is valid PHP and terminates the current file, making the following statement unreachable; therefore the newly advertised PHP support silently misses file-scope cases. Add an equivalent program-level pattern while retaining the label guard.
Useful? React with 👍 / 👎.
| (compound_statement (return_statement) @jump . (_) @next) | ||
| (compound_statement (break_statement) @jump . (_) @next) | ||
| (compound_statement (continue_statement) @jump . (_) @next) | ||
| (compound_statement (expression_statement (throw_expression)) @jump . (_) @next) |
There was a problem hiding this comment.
Recognize unconditionally wrapped PHP throws
When an unconditional throw is parenthesized, as in (throw new RuntimeException()); work();, the expression_statement contains a parenthesized_expression rather than a direct throw_expression, so this query emits no finding even though work() cannot execute. The same gap affects other unconditional expression wrappers such as $x = throw new RuntimeException();; extend the match through unconditional wrappers while preserving the negative control for conditional forms such as $x && throw ....
Useful? React with 👍 / 👎.
| @@ -0,0 +1,4 @@ | |||
| (compound_statement (return_statement) @jump . (_) @next) | |||
There was a problem hiding this comment.
Exempt compile-time declarations in namespace blocks
When a braced namespace contains return; function f() {}, its body is a compound_statement, so this pattern reports the function declaration as unreachable. PHP registers namespace-level function and class declarations during compilation even when their text follows the return, so the declaration still has an observable effect and the emitted “can never run” warning is false; filter compile-time declarations when this compound statement belongs to a namespace.
Useful? React with 👍 / 👎.
…am prompts * `docs/CI-CD.adoc` — the contract this repository's CI holds itself to: what runs, what is required, what each gate may assume, and the failure modes this repository actually suffered. The invisible ones are the point: a workflow that calls a reusable under an owner the Actions allowlist does not admit dies at startup with no job and no check run, and `gh pr checks` shows nothing, because a rejected run produces no check run. * `docs/PR57-RECONCILIATION.adoc` — the final disposition. PR #57 branched before #58, #61 and #63 and was never rebased, so merging it forward as a branch would DELETE main's reconciled work, not merely conflict with it. The reconciliation above stands, and the reasons are now sharper: PR #57's generic `empty-php-function` rule is not a merge conflict but a CONTRADICTION of #63's contract, because main's `php-empty-security-function` negative corpus asserts that an empty non-security function produces no finding and PR #57's rule fires on it. The narrower rule that would be correct — empty ANONYMOUS callables, which PR #57's callback fixture covers and no existing rule does — is specified, and needs a compiler in hand. The six SonarCloud diagnostics that remain on main's fixtures are handled by the fixture-aware gate added in the previous commit, and the rule keys come from the analyser's source rather than from memory. * `docs/handoffs/upstream-prompts.adoc` — seven ready-to-paste prompts for the repositories that have to change for this work to be complete. The first is the merge blocker this repository could not fix alone: the estate's canonical Actions allowlist admits `hyperpolymath/*` and does not list `metadatastician/*`, so a caller that spells the transferred owner is refused at startup and the required context is never emitted. The others are the KYAML step-6 precondition, the canonical-bytes contract for reports that cross a trust boundary, the squabbler's consumer-side permission story, the `proven-bench` document contract for non-Idris harnesses, the panic-attack interop for a Rust producer, and the vocabulary for "structurally valid but not conformant" in DEED/K9. * `docs/handoffs/format-toolchain/05-pons-asinorum.md` — the standing prompt for this repository, with a status update: what is done, what is deliberately not done, and why. The library-level ijson-jcs adoption is explicitly still open, because it needs `Cargo.lock` regenerated against a git dependency. * `CHANGELOG.adoc` — the user-visible half of all of the above. Co-authored-by: arena-agent <[email protected]>
…D on the estate's own tools (#64) ## Summary This pull request unblocks this repository and rebuilds its CI/CD on the estate's own tools. The headline: **the required secret-scan check had never been emitted.** The `Secret-Scan-Floor` ruleset requires the context `scan / gitleaks`, and every run of the scanner died at *startup* with no job, no log and **no check run at all**. `gh pr checks` showed nothing — because a rejected run produces no check run — so every pull request here has been permanently unmergeable, with no red square anywhere to explain why. The cause is a single word in one `uses:` line, and it is described below. Everything else here follows from the same principle: a gate that cannot look must not report a pass, and a gate that has never been deliberately tripped is not a gate. ### The merge blocker: the shared reusable's owner spelling The shared secret scanner lives in `standards`, which was **transferred** to the `metadatastician` organisation. GitHub's REST API follows the old name — `GET /repos/hyperpolymath/standards` answers `full_name: metadatastician/standards` — but the **Actions resolver does not**. A `uses:` reference under the old owner no longer resolves to a repository, so the call is refused before any job starts. Measured here, on the same pinned commit, with the same job key and the same grants: | `uses:` | What happens | |---|---| | `hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@<sha>` | **No job starts.** The run is attributed to the workflow *file* (`.github/workflows/secret-scanner.yml`), not to the workflow. Conclusion `failure`, zero jobs, no log. `gh pr checks` shows nothing. | | `metadatastician/standards/.github/workflows/secret-scanner-reusable.yml@<sha>` | The workflow starts, the reusable's jobs run, and the check is published under the context the ruleset requires. | The run that carries the file's name does not even look like the workflow it is, so this is very easy to miss: the only way to see it is `gh run list --json conclusion`. > **Correction to an earlier diagnosis.** This pull request's first > description attributed the failure to the estate's Actions allowlist > admitting only `hyperpolymath/*`. That was measured and it is **not** > the mechanism: the allowlist is a separate document, and the failure is > in the repository transfer, which the allowlist does not participate in. > The measurement above is what settles it — the same commit, the same > job key and the same grants, differing only in the owner spelling. The > allowlist *is* out of date, and it is asked about upstream in prompt 1, > but it is not what broke this repository. Two further failure modes lose the same context the same way, and all three are now written down at the call site in `.github/workflows/secret-scanner.yml` and in `docs/CI-CD.adoc`: a stale pin to a reusable revision that asks for more permission than the caller grants (`startup_failure`, no job), and `secrets: inherit` against a reusable that declares no secrets (also CWE-250). ### The estate audit, called rather than copied `main-estate-audit.yml` pinned cicd-suite `3bbdf75`, the single-job 26-step audit. It still ran, so nothing was red — it was simply a stale audit that could never report a gate that had been fixed or added upstream. It now pins `bf7dd95`, whose reusable reports the audit as five components (governance, hygiene, manifests, languages, advisory), so a failing gate no longer hides the other 25 behind one red square. `track-estate-audit.yml` is added from the estate's template: weekly, it moves every cicd-suite pin to HEAD and opens a pull request whose own gate runs are the check. This repository has no `AUTOMATION_TOKEN` yet, so the run *reports* the drift and says the bump was skipped — rather than failing every Monday for a secret it does not have, or claiming to have opened a pull request it did not open. The 27 composite actions under `.github/actions/` are deleted. Nothing referenced them, and two of them (`prat-check`, `semantic-audit-check`) were stubs that could not fail — the worst kind of gate, because it looks like coverage. The throwaway probe workflows go with them; their own header said to remove them with the branch that introduced them. ### The format policy, enforced as closed inventories `ijson-jcs` (the estate's JSON standard, D306) and KYAML (the estate's YAML dialect, D280/D307) are now enforced, using the estate's own tools at pinned, sha256-verified commits. They are enforced as **closed inventories** rather than as scans. The estate's own JSON gate reports every non-canonical file and exits `0`, which is right for an estate where most repositories have not converted — a report is information, not assurance. But a repository that has made a decision about each of its files should hold that decision, and a file added without a decision is exactly how a policy decays. So: * `ci/yaml-ratchet.kyaml` accounts for **every** `.yml`, `.yaml` and `.kyaml` file. A file is either `converted` — and then its bytes must be exactly what `yq -p yaml -o kyaml` produces — or `excluded`, with a stated reason. A YAML file in neither fails the build. * `ci/json-ratchet.kyaml` accounts for **every** `.json` and `.jsonl` file. Every one must be valid I-JSON (RFC 7493); the declared subset must also be byte-identical to its RFC 8785 form. Every file is **named**: a glob would let a file that nobody decided anything about pass without a decision, which is the failure the inventory exists to prevent. Estate-owned configuration added here is written as `.kyaml` with KYAML content. Workflows are deliberately **not** converted: step 6 of YAML-POLICY §5 (`standards#1025`) has not started anywhere in the estate, and converting one repository's workflows ahead of that step would break the bot that updates them. The exclusion and its reason are recorded. ### The testing framework, ported from `proven-tests-and-benches` `tests/proven/ledger.kyaml` gives every suite a provenance tier and places it in the estate's 18-category × 14-aspect taxonomy lattice. The framework's load-bearing property is preserved exactly: **a cell is occupied only by a suite that actually ran and passed.** The declared ledger says what is claimed; the executed results say what is covered; the two are compared and the gate fails when they disagree. * *Actually-Proven* requires a machine-checked proof artefact registered in the ledger. This repository has none, so the tier is unreachable and the gate **fails** such a claim rather than accepting it. * *Provisionally-Proven* requires the suite to have run and passed, and requires a recorded reason. * *Unproven* is a declared gap: no coverage, not a failure, but it must say why. The inventory is closed: a new test that nobody classified fails the gate, because an unclassified test is a test whose evidence nobody has read. `tests/DASHBOARD.adoc` is the declared map, re-rendered and compared on every run; the derived map is written to `build/proven-report.json` and published in the job summary. `benches/pons_bench.sh` writes a `proven-bench` JSON v1 document — the format the framework's own regression checker reads — with a frozen workload set and a predicate on every iteration. The framework's harness is vendored byte-for-byte at a pinned revision with a digest check against upstream. The regression *comparison* is recorded as an Unproven gap rather than a passing gate: a baseline is cut from the last ten CI runs on main, and this repository has not had ten. The framework's own checker says so rather than inventing a baseline. ### The CI/CD squabbler, and the fixture-aware Sonar gate `hyperpolymath/cicd-squabbler` is the estate's CI/CD fighter, whose invariant is proved in SPARK: green means a required check actually ran and passed. It belongs here for one specific reason — the failure above is exactly the class it exists for. The installation blocks; the diagnostic reports, because `squabble fetch` needs Administration:read, which `GITHUB_TOKEN` does not hold. It says plainly that the check did not run rather than pretending it did. The token it uses is a **fresh GitHub App installation token, minted per run**, with a long-lived secret and then `github.token` as fallbacks; which one was used is reported. `docs/PR57-RECONCILIATION.adoc` recorded the SonarCloud fixture gate as outstanding: *"Expected fixture diagnostics need exact rule/path, reason, owner and expiry; they are not false-positive waivers. ... No broad fixture exclusion ... is introduced here."* It is now implemented: `ci/sonar-fixture-diagnostics.kyaml` declares each waived diagnostic with an exact rule key, an exact path, a reason, an owner and an expiry; `sonar-project.properties` carries the matching criteria and contains **no** `fixtures/**` pattern, so the corpus is still analysed and a *new* diagnostic in a fixture is not waived by anything; and `tests/sonar_fixture_gate_test.sh` compares the two in both directions, refuses a pattern, refuses a wildcard rule key, and fails an expired waiver. The rule keys come from the SonarPHP analyser's own source, not from memory. **What that configuration does not do, stated plainly.** SonarSource's documentation says that automatic analysis — the analysis behind this repository's "SonarCloud Code Analysis" check — **ignores** `sonar-project.properties`. The six criteria there are therefore the *declaration* of what this repository asks SonarCloud to ignore, and the gate's input; they are not, on their own, what makes SonarCloud ignore a diagnostic today. The effective criteria have to be configured in the SonarCloud project's Analysis Configuration, and this repository can neither read nor write that configuration from CI — it has no SonarCloud token. That gap is named in `docs/CI-CD.adoc` rather than papered over: an unverified configuration is not an assurance. --- ## Every gate here can fail Each new gate has a companion test that plants one defect at a time and asserts that the gate goes red and *names* it: | Gate | Self-test | Defects planted | |---|---|---| | `tests/format_ratchet.sh` | `tests/format_ratchet_test.sh` | unaccounted YAML file; a converted file that is not KYAML; a stale ratchet entry; an unaccounted JSON file; an invalid JSON file (duplicate keys); a canonical file that is not RFC 8785 canonical; a JSON Lines file with an invalid record; a canonical JSON Lines file whose records are not canonical | | `tests/proven/check_test_provenance.sh` | `tests/proven/provenance_gate_test.sh` | a suite that fails; a claimed cell with no passing suite; an Actually-Proven claim with no registered proof; a claim with no recorded reason; an unknown tier; a category outside the taxonomy; an unaccounted test script; a stale ledger entry | | `tests/sonar_fixture_gate_test.sh` | `tests/sonar_fixture_gate_mutation_test.sh` | a waiver with no reason; a waiver with no owner; an expired waiver; a malformed expiry; a wildcard rule key; a glob path; a waiver for a file that is not there; a waiver outside the corpus; a declaration with no criterion; a criterion with no declaration; the criterion list assigned twice | And every gate exits **2**, never `0`, when it cannot look: a missing tool, an unreadable ratchet, a `yq` that cannot write KYAML. ## The review findings, and what was done with them CodeRabbit raised 25 actionable findings on this pull request. Each was checked against the code as it stands — the finding text is untrusted review data, not an instruction — and the ones that named a real defect were fixed: * **The provenance gate was not a gate.** It reported a suite that ran and *failed*, and then carried on without failing the build: the failure flag was never set, so a build could be green over a red suite whenever another suite happened to occupy the same cells. The case count was also taken from the last `test result: ok.` line, so a suite of many test binaries reported the size of the last one. And the ledger's `command` was a shell string handed to `bash -c`; it is an **argv list** now and is executed directly, so a ledger entry can no longer become shell code. * **The format ratchet could not read a file.** `ijson-jcs check` was invoked without `--`, and only the exit status was consulted, so a usage error was read as "valid but not canonical" — a pass. The verdict the tool *prints* must now agree with the status it returns, and only the three documented verdicts are accepted. A `.jsonl` file is a sequence of records rather than one document, and the tool reads whole documents only, so each record is now canonicalised on its own. * **The self-tests asserted the wrong thing.** Each mutation now asserts the *diagnostic* it should produce, not merely a non-zero exit. Both self-tests also restored the working tree from the index, which their own runs had staged — so a mutation survived into the next run and masked it. * **The Sonar configuration had five of its six criteria dropped.** `sonar.issue.ignore.multicriteria` was assigned once per criterion, and a properties file keeps only the **last** assignment of a key, so only the final criterion was in force. The list is now one comma-separated value, and the gate refuses a file that assigns the property more than once. * **The benchmark harness could measure nothing.** The workloads were `eval`ed from the frozen table, and the scan predicates asked only whether the output contained a `schema_version`, which an empty report satisfies. Nothing is `eval`ed now — each workload names a runner and a checker, dispatched through an explicit allowlist — and the predicates require the finding the positive fixture must produce. * **The squabble workflow interpolated the pull request number into a `run:` block**, which is shell *source*. The number now comes through the environment and is checked to be a number. Three findings were deliberately **not** actioned, with the reason: * Two defects in the *vendored* benchmark scripts (`check-bench-regression.sh`, `compute-bench-baseline.sh`). Patching them here would make the local copy stop being the upstream copy, which the digest check exists to prevent. They are reported upstream in prompt 8. * The YAMLlint "truthy value" note on the `on:` key. Every workflow in the estate uses `on:`, and it is YAML 1.1's spelling for the boolean `true`; the finding is a linter-configuration difference, not a defect in this repository's files. ## Verification Run locally with `yq`, `jq` and `ijson-jcs` on `PATH`: ``` bash tests/format_ratchet.sh # OK: 18 YAML files, 104 JSON files, 0 invalid bash tests/format_ratchet_test.sh # OK: all 8 planted defects caught bash tests/proven/provenance_gate_test.sh # OK: all 8 planted defects caught bash tests/sonar_fixture_gate_test.sh # OK: 6 waivers, 6 criteria bash tests/sonar_fixture_gate_mutation_test.sh # OK: all 11 planted defects caught bash tests/proven/render_dashboard.sh /tmp/d && cmp /tmp/d tests/DASHBOARD.adoc ``` The estate's own code-hygiene gate passes on this tree, every workflow and KYAML file parses, every `.kyaml` file is byte-exactly what `yq -p yaml -o kyaml` produces, and every shell script passes `bash -n`. ## What is deliberately not done, and why * **PR #57's generic `empty-php-function` rule.** It is not a merge conflict; it is a contradiction of #63's reconciled contract. Main's `php-empty-security-function` negative corpus asserts that an empty *non-security* function produces no finding, and PR #57's rule fires on it. The narrower rule that would be correct — empty **anonymous** callables, which PR #57's callback fixture covers and no existing rule does — is specified in `docs/PR57-RECONCILIATION.adoc` and needs a compiler in hand to land, because it changes the registered rule set, the catalogue and the golden corpus. * **The library-level `ijson-jcs` adoption** the standing handoff prompt describes. It needs `Cargo.lock` regenerated against a git dependency, which cannot be done here without a Rust toolchain. The *tool*-level adoption is done. * **Benchmark baselines.** Cut from ten CI runs on main; there are not ten yet, and the framework's checker refuses to invent one. * **A machine-checked proof artefact.** Pons has none. The Actually-Proven tier is therefore unreachable, and the gate enforces that rather than accepting the claim. * **The SonarCloud project's own configuration.** Named above, and in `docs/CI-CD.adoc`. It cannot be written from this repository. ## Upstream Eight ready-to-paste prompts for the repositories that have to change for this to be complete are in `docs/handoffs/upstream-prompts.adoc`. The first is the estate-wide breakage this repository could not fix alone: every live caller that still spells the transferred owner — in `standards` itself, `cicd-suite`, `rsr-template-repo` and `cicd-squabbler` — is refused at startup, and the required context is never emitted. ## Notes for the reviewer * The commits are independently reviewable, in dependency order. The first is the merge blocker; the rest build on it. * `docs/CI-CD.adoc` is the contract this repository now holds itself to. * `docs/PR57-RECONCILIATION.adoc` has a new "Final disposition" section. * Nothing in `fixtures/` was edited, and no existing rule, report shape or golden file was changed. The only Rust-adjacent change is to CI. --------- Co-authored-by: arena-agent <[email protected]>




PHP source now participates in the existing unreachable-after-jump rule. Direct sibling guards prevent nested conditional false positives; standalone throw uses its statement wrapper, comments are skipped, and goto labels are withheld. Ports #57's return/throw fixtures and adds conditional-throw, label and finally controls.
Corrects stale capability counts and planning metadata, documents unknown target dirty state and report-validation memory limits, and clarifies kyq's intended KYAML/I-JSON-JCS/DEED/K9 estate scope. Legacy metadata is explicitly not a completed DEED/K9 migration.
Validation: 220 Rust tests, 46 e2e checks, fmt and clippy with warnings denied. Six mutation controls killed; the initial surviving top-level label control was corrected and rerun. docs/PR57-RECONCILIATION.adoc records the evidence and remaining differences. The signed head exactly matches the tested local tree.
Remote Rust CI, estate audit, secret scanning, Semgrep and GitGuardian pass. SonarCloud remains failed with eight annotations, all on retained PHP fixture sources: deliberate unreachable/goto/return shapes, exception-class advice and the original fail_if name. No scanner implementation annotation was reported. These diagnostics remain visible; no broad fixture exclusions, deleted failing cases, false-positive relabelling or coverage suppression was introduced. The external fixture-aware quality policy is still outstanding.
#57 stays open and conflicted. Its generic empty-callable rule remains outstanding. Portfolio/fuzz measurements from prior commits are preserved without claiming a new rerun.