Skip to content

Phase 7a: automatic re-pull switches - #1949

Merged
neuromechanist merged 8 commits into
feature/issue-1046-epic-upstream-freshnessfrom
feature/issue-1913-phase7a-switches
Oct 25, 2026
Merged

neuromechanist merged 8 commits into
feature/issue-1046-epic-upstream-freshnessfrom
feature/issue-1913-phase7a-switches

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Declares the switches that gate automatic re-pull (ADR 0111) and nothing else. AUTO_REPULL_ENABLED and AUTO_REPULL_MERGE_ENABLED are on only as the exact string "1" and only when ENVIRONMENT is exactly production (no trim, no case folding, unset is not production); the merge switch also needs the first. REPULL_DAILY_OPEN_CAP defaults to 2; a cap is one or two digits up to 20, and a value that is set but unreadable reads 0. One shared reader (readCap) now serves both caps, so Phase 6e's merge cap (default 5, unreadable 0, max 20) uses the same rule with unchanged behavior, and the environment fence of the record calls the same production test. No value is added to any wrangler vars block: the three variables are deliberately absent, which means off, and a test pins that. An administrator route GET /admin/repulls/switches reports the state, registered before GET /repulls/:id. The App's bot login and user id are recorded beside its app id for the later review and merge slices.

Phase 7a of epic #1046, part of #1913 (which stays open until Phase 7 completes). Nothing acts on the switches yet.

What is in it

  • backend/src/services/repull-switches.ts (new), the bindings types, comment blocks in wrangler-sccn.toml (no values), upstream-repull.ts (the cap reader replaced by the shared one).
  • GET /admin/repulls/switches and the route inventory pin; NEMAR_APP_BOT_LOGIN and NEMAR_APP_BOT_USER_ID in branch-protection.ts.
  • ADR 0111 amendment slice for 7a, including what was verified about the App installation (contents, pull requests, actions, administration, checks, workflows and issues write on all repositories) and what stays an owner step (organization rulesets need an admin:org token and must be read before the Worker-merge phase is built).

Test plan

  • Full bun test ran once: 19715 pass, 242 skip, 1 fail (website parity against a stale sibling checkout, untouched by this PR). Typecheck and Biome clean. 14 single-line mutants applied; one survived (widening the cap regex) and was closed with new cases.
  • Phase 6e's merge-claim suite passes with only its import changed.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR1949

Version: 0.10.24-PR1949.97f4083
Commit: 97f4083


🤖 Updated on each push.

Add repull-switches.ts: exact-production test, the open and merge switches (exact "1"; merge needs open), and the one cap reader. The merge cap and the create fence now read through it, unchanged in behavior. The three variables stay absent from every wrangler vars block, pinned by a flag test. Tested: unit cross product, flag test, merge-claim suite.
Add GET /admin/repulls/switches, registered before /repulls/:id, answering what the Worker reads: production, both switches and the open cap. No raw binding value. Pinned in the route inventory (entry and order). Tested: route suite and inventory.
Add NEMAR_APP_BOT_LOGIN and NEMAR_APP_BOT_USER_ID beside NEMAR_APP_ID, measured 2026-10-24. Constants only; later phases read them. Tested: typecheck.
Append the 7a amendment: the switch and cap rules, the measured ruleset and review facts, and the split of the ruleset check (installation permissions read; organization rulesets need an admin:org token and stay an owner step before the Worker's merge). Documentation only.
A three-digit binding with leading zeros ('005') must read unreadable; the max check alone did not catch a widened digit rule. Tested: unit suite, mutation killed.
Move the merge cap reader into repull-switches.ts and report both caps. Tests: newline and tab cap values, every switch mix in the report, an ENVIRONMENT that is truly unset in the route suite. Mutants killed.
The flag test walks the whole parsed wrangler file for the two switches and both caps, and a new test pins the App's bot login and user id. The redundant read-every-block test is removed; the unit suite covers the readers. Mutants killed.
Four variables, one sentence for when the owner adds them, the dashboard remark on the pacing macro, switch wording in bindings, and the ADR's administrator attribution and merge cap line. Documentation only.
@neuromechanist
neuromechanist force-pushed the feature/issue-1913-phase7a-switches branch from 6f94b03 to 97f4083 Compare October 25, 2026 02:50
@neuromechanist
neuromechanist merged commit aa7234d into feature/issue-1046-epic-upstream-freshness Oct 25, 2026
20 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-1913-phase7a-switches branch October 25, 2026 03:07

This branch was previously deployed

1 inactive deployment
npm — 97f40835 Deployed Oct 25, 2026 by neuromechanist via publish #3953
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.

1 participant