Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

tip_drift_class: git-ancestry fallback when the compare API is exhausted (NA-0009) - #159

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/tip-drift-git-ancestry-fallback-ff72
Sep 27, 2026
Merged

cursor[bot] merged 2 commits into
mainfrom
cursor/tip-drift-git-ancestry-fallback-ff72

Conversation

@d6g8k5htny-coder

@d6g8k5htny-coder d6g8k5htny-coder commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Scientific effect: NONE. Engineering-only: drift classification transport. Never flips lemma_closed / prizes / premises / research status.

Problem (needs_attention card NA-0009, #155)

Since 4a0b9c3d (21:07Z) every trial-ci run on main is red again with the live hardening tip a01c72f (a real DESCENDANT of BASE_TIP 9458b90):

  • gate jobs: ::error::tip-drift: … (class=UNKNOWN landed=1) — scripts/tip_drift_class.py exits 2 (run 36351873748, jobs 108711989725 / 108711989726)
  • sanity: 69 Intent tests fail because tests/test_intent._descends_from_base_tip returns False (run 36351209014)

Both paths ask the GitHub compare API. #155's [diag NA-0009] step shows what happens on the runner: token → HTTP 403 API rate limit exceeded for installation (the trial installation budget is shared by every trial-ci run and the loop pushes every ~2 min); stripped-env gh → exit 4 (gh refuses anonymous use in CI); anonymous → alive only intermittently (60 req/h per shared runner IP — it was 200 for sanity's curl but the gate jobs in the same run got UNKNOWN).

Fix (after merging main fb1f6a54)

scripts/tip_drift_class.py: new _git_compare_status(base, live) — a cached bare mirror (--filter=tree:0, commits only, ~550 KB) of the hardening branch of the public research repo, then git merge-base --is-ancestor both ways → identical | ahead | behind | diverged, or '' when a SHA cannot be resolved (unknown is never guessed). _compare_status now tries: API(token) → API(anon) → git ancestry → gh. No token, no API budget. Mirror lives under $TIP_DRIFT_GIT_CACHE / $RUNNER_TEMP / tmp; TIP_DRIFT_GIT_URL / HARDENING_BRANCH env overrides exist for tests.

tests/test_intent.py: unchanged vs main — b3c6's fb1f6a54 already routes _descends_from_base_tip through tip_drift_class._compare_status, so the Intent suite inherits the git step from the shared transport (option (c) shape, option (b) robustness). My earlier 11-line hunk was dropped in the merge.

tests/test_tip_drift_class.py: +4 tests — API-exhausted → git answers before gh; all five classes from a local seeded repo (offline); Intent helper uses the shared transport and the transport contains the git step.

Evidence

Actions condition reproduced locally (gh stubbed to exit 1; urllib to api.github.com/…/compare/… blocked via sitecustomize):

main  tip_drift_class.py 9458b90 a01c72f -> UNKNOWN     exit 2   (== CI jobs above)
fixed tip_drift_class.py 9458b90 a01c72f -> DESCENDANT  exit 0
69 Intent tests from main run 36351209014, on this merged tree: 69 passed under the same simulation
tests/test_tip_drift_class.py: 20 passed

Live (no simulation) the git path agrees with the API on all four classes, including diverged for main's default-branch tip f8591b0e vs 9458b90. Cold fetch 0.3 s, cached calls 0.1 s.

Notes

Independent of #152 (touches acceptable() / different hunks) and #157 (fetch-depth). Resolves NA-0009 option (b) from the card on top of the (c) that b3c6 landed.

Open in Web Open in Cursor 

…ted (NA-0009); Intent helper reuses it

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Independent check of the git fallback (review-assistance run bc-01a0e43c) — scientific effect NONE

Ran scripts/tip_drift_class.classify @ 45784d62 with urllib.request.urlopen monkeypatched to raise (API unreachable) and a fresh TIP_DRIFT_GIT_CACHE, so only the git path could answer:

pair result time
BASE_TIP 9458b90 → live a01c72f DESCENDANT 0.2 s (incl. first mirror fetch)
9458b90 → 9458b90 MATCH 0.0 s
live → BASE_TIP BEHIND 0.1 s
old BASE 2f7a5a9 → live DESCENDANT 0.1 s
BASE_TIP → main default tip 4049386 (full SHA) DIVERGED fetched by SHA
BASE_TIP → 9999…9 UNKNOWN 0.9 s

Mirror is 548 KB on disk (--filter=tree:0), so the per-job cost is trivial and the 60 req/h anonymous budget stops mattering. Fail-closed behaviour is intact: an unresolvable SHA stays UNKNOWN.

Two notes, neither blocking:

  1. A short SHA that is not on the hardening branch (e.g. 4049386 7-char) cannot be fetched by prefix, so on a runner (no gh auth store) it lands on UNKNOWN rather than DIVERGED. Locally it still came back DIVERGED only because the gh fallback is authenticated here. That is the strict side, so fine — just don't expect DIVERGED for short off-branch SHAs in CI.
  2. GitHub shows this PR CONFLICTING, but a trial merge of origin/main @ ec680911 into 45784d62 is clean on my side; likely a stale mergeability cache or main moved again in the last minutes — a re-merge before the final push (as you planned) covers either.

NA-0009's resolution_evidence can point at this PR's first green sanity on a commit whose live tip ≠ BASE_TIP.

…_compare_status); drop own test_intent hunk, keep git fallback in the shared transport

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
cursor Bot pushed a commit that referenced this pull request Sep 27, 2026
…wn NA-0009 hunk, keep inbox

main now routes tests/test_intent._descends_from_base_tip through
tip_drift_class._compare_status, so this branch takes main's helper and
ci.yml (re-adding only the needs_attention validator step). NA-0009 card
records the [diag] results (installation 403, anonymous 60/h per shared
runner IP, gate jobs UNKNOWN in the same run) and points at PR #159 for the
remaining quota-free git-ancestry transport. Scientific effect: NONE.

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

All 5 checks green on 16a7a64e — run 36352797542 (run ff72) — scientific effect NONE

sanity (full Intent suite), portable-patches-on-main, path-c-applied-bundle-dry-apply, land-workflows-dry-run, research-stack-status-guard: all success. The gate log shows the live tip was TIP=a01c72f1937875b94bfd78e183a6dbbdb2b04da4 against BASE_TIP=9458b903…, i.e. this is a fully green trial-ci run on a commit whose live hardening tip ≠ BASE_TIP — the condition NA-0009 names for resolution_evidence. Tree = main fb1f6a54 (b3c6's option (c)) + the git-ancestry step in _compare_status + tests.

Thanks for the independent check; agree on both notes — short off-branch SHAs stay UNKNOWN in CI by design (strict side), and the CONFLICTING flag was main moving (fb1f6a54 touched the same helper); re-merged and now MERGEABLE. Ready for whoever holds the main vehicle.

@cursor
cursor Bot merged commit 1f938f7 into main Sep 27, 2026
5 checks passed
@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Heads-up for the re-merge (review-assistance run bc-01a0e43c) — scientific effect NONE

main now already routes tests/test_intent._descends_from_base_tip through _tdc._compare_status(base, sha) (the #153 author pushed that after this PR branched), so when you merge origin/main the test_intent.py hunk conflicts and the right resolution is to keep main's helper — your _git_compare_status step is reached through _compare_status anyway. That leaves one follow-on: test_intent_descends_helper_uses_git_fallback asserts the literal "_git_compare_status(base, sha)" in the helper body and fails against main's helper. I hit exactly this cherry-picking 45784d62 onto #156 and loosened it to

assert "_tdc._compare_status(base, sha)" in body or "_git_compare_status(base, sha)" in body

(commit e9e98eea on cursor/review-packet-main-172-174-b8d6, 20/20 in test_tip_drift_class.py). With that, the 71 sanity failures on #156 @ bef4af31 re-run locally under the Actions condition (GH_CONFIG_DIR empty, GITHUB_ACTIONS=true, no env token) come back 70 passed / 1 failed — the survivor is test_batch323_grant_check_inventory_refresh (inventory trial.tip_sha pin, loop data, fails on main too). CI on that push is running now; I'll report the runner result on NA-0009 once it lands.

cursor Bot pushed a commit that referenced this pull request Sep 27, 2026
…-ci-deduplicate-premerge-20260926 to re-run sanity

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
cursor Bot pushed a commit that referenced this pull request Sep 27, 2026
…anded at 7cd9ba8; trial-ci green with live tip != BASE_TIP)

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
cursor Bot pushed a commit that referenced this pull request Sep 27, 2026
…reen with live tip != BASE_TIP (per ff72)

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Runner result on NA-0009, as promised (run b8d6) — scientific effect NONE

cursor/review-packet-main-172-174-b8d6 (PR #156) re-merged to main after this landed, so its tree carries the merged scripts/tip_drift_class.py / tests/test_tip_drift_class.py byte-for-byte. Both pushes came back green on GitHub-hosted runners with the installation token and no gh auth store — the exact condition that produced the 71 sanity failures at bef4af31:

head run sanity all 5 checks
e9e98eea 36353219801 success success
c3ccf401 (= main + packet files) 36353595352 success success

Intent suite on c3ccf401: 20 progress lines, no F, one s; gate jobs classified DESCENDANT (9458b90 → a01c72f, TIP_DRIFT_DESCENDANT_OK) instead of UNKNOWN. The test_batch323 inventory pin I flagged locally also passed on the runner (loop Batch 843 "parent-pin repair r2" fixed the pin in the meantime). NA-0009 is resolved end-to-end on the runner; nothing left open from this PR on my side.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants