Skip to content

test(quality): check known cells against live issue state - #4727

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
w2-known-cells-live
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
w2-known-cells-live

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

A strict known cell stays a known failure only while its tracking issue is open. The existing gate (tests/quality/test_known_cells_cite_open_issues.py, from #4584) checks an offline snapshot, known_cell_issue_states.json. That snapshot changes only when someone runs --write, so an issue that closes on GitHub never trips the gate. A train then goes red later, when the fixed cell starts passing. That happened three times on 2026-11-22 (#4685, #4697, #4638).

This PR adds a live mode:

python -m tests.quality.known_cell_issues --check-live
  • It reuses known_cells() and cited_issues() from test(lifecycle): re-ground 21 stale known cells; sign and gate every known cell #4584, with no second discovery.
  • It reads the state of every cited issue in one batched GraphQL request (gh api graphql; GH_TOKEN in CI).
  • It fails with exit 1 and one line per affected cell, for example [x] source:tests/lifecycle/scenarios/test_failure_phase.py:62 cites #4594 (CLOSED): rerun the cell; flip it to required if it now passes (or re-key it to an open issue), then run 'python -m tests.quality.known_cell_issues --write'.
  • An issue that does not exist (gh exits 1 with a per-issue NOT_FOUND, data still returned) is reported as MISSING. Any other GraphQL error (authorization, rate limit), a missing gh or unreadable output exits 2 with could not read issue state.
  • Wiring: a step in .github/actions/lint-chain, the single owner of the lint chain, so both ci.yml's Lint job and the merge-train guard run it. It takes about 13 s locally. Both jobs, and the tier1 callers of ci.yml, grant issues: read and pull-requests: read for the lookup; test_ci_topology.py pins it.

Run against current main (live): all 19 known cells cite 6 open issues, so the gate is green at merge.

Issue and approved scope

Issue: Refs #4565

Human scope-approval comment: #4564 (comment) (Q&L lifecycle-corpus scope; regent ruling 2026-11-22 10:17 to add a live known-cell gate)

Does this PR complete the issue, or what remains? No. It adds one guard to the #4565 burn-down.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • pytest tests/quality/test_known_cells_cite_open_issues.py -k check_live: 4 passed. The tests stub the transport:

    • a closed issue fails, naming its cell, with the remedy, in one batched query;
    • all-open passes;
    • an issue GitHub does not return reports MISSING;
    • an unreadable API exits 2.
  • pytest tests/quality/test_ci_topology.py -k "lint_chain or merge_train or lint": 26 passed.

  • python -m tests.quality.known_cell_issues --check-live on this branch: exit 1. It flags [BUG] A failed install still keeps the deployed files of the failed attempt (lockfile or MCP config write) #4594, as described above.

  • ruff check / ruff format --check (0.15.12): clean.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Base automatically changed from danielmeppiel-ql-w3-red-triage to main November 22, 2026 21:50
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
Takes main's shared Known constants in test_ownership_siblings. Converts test_user_scope's #4744 known to a Known, since credits() now carries Known values (#4727). Refreshes known_cell_issue_states.json.

Co-authored-by: Copilot App <[email protected]>
python -m tests.quality.known_cell_issues --check-live reads the state of every issue a strict known cell cites in one batched GraphQL request and fails naming each cell whose issue is no longer open, with the remedy. The lint chain runs it on every pull request and in the merge-train guard, so a fix that closes an issue cannot leave a stale strict cell behind.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 22:14
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
The known-cell guard (#4727, landed with #4769) reads each strict known cell's tracking from a literal or a module constant. The #3703 G1 bin cells and the #4744 target-change bin cell passed it through a loop variable or an attribute, so the guard saw an empty cite. Both issues are open and both cells still fail as tracked, so they keep their trackers, now named by module constants. known_cell_issue_states refreshed.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Missing issue and pull-request read permissions prevent the live gate from checking cells, while error handling also misclassifies missing issues and transport failures.

3 open issues
What changed in this PR

Adds live GitHub issue-state validation to the known-cell quality gate introduced in #4584, supporting #4565 by detecting stale known failures without waiting for snapshot regeneration.

Changes:

  • Adds --check-live with batched GraphQL lookups and per-cell diagnostics.
  • Runs the live check through the shared lint chain for CI and merge trains.
  • Adds stubbed tests for open, closed, missing, and unreadable issue states.
File Description
tests/​quality/​test_known_cells_cite_open_issues.py Tests live-check outcomes using stubbed transport.
tests/​quality/​known_cell_issues.py Implements live queries, state classification, diagnostics, and command dispatch.
.github/​actions/​lint-chain/​action.yml Adds the authenticated live check to the shared lint chain.

Review effort: Balanced

Comment thread .github/actions/lint-chain/action.yml Resolved
Comment thread tests/quality/known_cell_issues.py Resolved
Comment thread tests/quality/known_cell_issues.py Resolved
- live known-cell gate: issues: read (and pull-requests: read) for the lint job, the train guard and both tier1 callers; topology contracts pin it.
- decode gh's reply before its exit status: a per-issue NOT_FOUND is MISSING (exit 1); any other GraphQL error, a missing gh or unreadable output is exit 2. Subprocess-stub regressions cover each shape.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the live GitHub issue-state check and its CI integration.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Follow-up: #5072 moves this live check out of PR Lint (to train/main pushes plus a scheduled run, fail-closed there) so a GraphQL outage or one closed tracking issue cannot red every open PR. PR Lint keeps the offline snapshot gate.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 4bf3abd into main Nov 23, 2026
95 of 96 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the w2-known-cells-live branch November 23, 2026 17:55
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
…le corpus

Regenerated against main (#4877, #4727, #5071); the #4981 named removals
match the 123 bin cells the filter demotes (two new project gate-matrix
cells: lock and mcp-install under a denied dependency).

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants