Skip to content

chore(user.js): land the lifecycle stack on master - #327

Merged
netravnen merged 6 commits into
masterfrom
chore/land-lifecycle-stack
Nov 25, 2026
Merged

netravnen merged 6 commits into
masterfrom
chore/land-lifecycle-stack

Conversation

@netravnen

Copy link
Copy Markdown
Contributor

This PR lands the August lifecycle stack on master. These commits were stacked on dev-next (now in master via #322) and never reached master. They are cherry-picked onto master as six commits: the five originals in order, plus a version bump.

Commit From branch
fix(user.js): resolve DP dormant code, extract shared helpers to a lib fix/dp-lifecycle-triage
fix(fp): resolve dormant code and adopt lifecycle markers fix/fp-lifecycle-markers
fix(cp): remove the tautological API-coverage self-check fix/cp-remove-tautological-selfcheck
fix(user.js): apply lifecycle markers to executor-surfaced stragglers fix/lifecycle-marker-stragglers
test(build): enforce @ai specificity (denylist + duplication cap) test/conventions-ai-tags
chore(cp): bump CP Consolidated Tools to 2.0.233 new

Notes

  • Conflicts: the only conflict was the CP @version line. The stack still had 2.0.229, so CP is bumped to 2.0.233, past master's 2.0.232.
  • FP and DP versions: FP moves to 1.1.43 and DP to 1.7.13, as on the stack.
  • New lib: lib/admincom-shared-helpers.js, with its tests.
  • test/conventions-lifecycle-markers is not included. It repeats the same five commits on a copy of dev-next's last commit. Four are identical, and the first is an earlier DP variant without the shared-helpers lib. This PR replaces it.

Testing

  • build_userscripts.py --check and node --check pass on all scripts.
  • node --test reports 599 tests: 598 pass, 1 skipped, 0 fail (27 more than master).
  • The CP name-normalization harness output is identical to master.

After merge

All 7 remaining August branches are then fully in master and can be deleted:

  • the five stack A branches;
  • chore/strip-stock-ai-tags, whose patch matches dev-next's last commit;
  • test/conventions-lifecycle-markers.

Assisted-by: Claude:claude-opus-5-5

Applies the ratified dp-dormant-clusters triage, reworked per review:
instead of deleting DP's reusable dormant code outright, the pieces
with planned cross-script use move to a new shared fragment,
lib/admincom-shared-helpers.js. For now only the DeskPro script
inlines it, alongside admincom-common.js; whether CP and FP include
it too is deliberately deferred until a concrete caller lands there,
so this commit leaves both untouched. Genuinely superseded or
abandoned code is still deleted (git history preserves it), planned
features are marked with the frozen @staged grammar, and the staged
fetcher's latent bugs are fixed and pinned by a hook-driven test in
the same commit.

The new fragment carries both restored-from-deletion helpers and
live DP internals they depend on: formatSpeedLabel and
getTabSessionStorage (both restored and staged; CP keeps its
identical local getTabSessionStorage twin and is the intended adopter
once the fragment is included beyond DP), the editable-region
predicates (EDITABLE_CONTAINER_SELECTOR, isNodeInsideEditableRegion,
and the restored isAnchorInsideEditableRegion alias), the
IPV4_TEST_REGEX/IPV6_TEST_REGEX pair, getBestApiNetDataItem,
resolveEntityLegalName, and fetchAsnNetworkName -- DP's retired
ASN -> network-name resolver reworked for cross-script use with an
injectable fetchJson transport (the default is same-origin
fetchWithRetry, right for CP/FP if they adopt; cross-origin DeskPro
passes its GM-backed pdbFetch), shared "asn"-type cache persistence,
in-flight dedupe, and a transport-failure-is-not-cached rule. Lib
symbols with no caller yet carry @staged wip markers.

Changes:
- lib/admincom-shared-helpers.js: new shared fragment (see above)
- peeringdb-deskpro-tools.src.js: delete the legacy ASN-name cache
  path (fetchAsnNetworkName's old form, asnNameCache, asnNameInFlight,
  getAsnNameCacheStorageKey, normalizeAsnForCache,
  getCachedAsnNameFromStorage, setCachedAsnNameInStorage) and the
  loose orphans (IX_SHORTCUT_ATTR, ACTION_EMOJI_IX, ensureIxShortcut,
  DUMMY_ORG_ID, attr constants, USER_CACHE_TTL_MS); local copies of
  everything now in the lib removed; the duplicate weaker
  IPV4_TOKEN_REGEX/IPV6_TOKEN_REGEX and the never-consumed
  subjectHinted/RN_SUBJECT_HINT_REGEX stay deleted; stage the
  IP-tooltip cluster, the ASN batch-fetch cluster, and classifyError
  (with the fetchNetixlanByIp bug fixes); add the new lib's @include
  marker and export its helpers via test hooks; bump to 1.7.12
- tests/lib-shared-helpers.test.js: new; covers formatSpeedLabel,
  getTabSessionStorage, the editable-region predicates, and
  fetchAsnNetworkName's cache/dedupe/transport contract through the
  injectable fetchJson transport
- tests/dp-netixlan-ip-cache.test.js: new; pins fetchNetixlanByIp's
  shared cache signatures, null-means-miss, and negative caching
- tests/helpers/browser-shim.js: provide Node.ELEMENT_NODE/TEXT_NODE
  constants (vm contexts have JS intrinsics but no DOM globals, so
  isNodeInsideEditableRegion threw before its logic could run)
- tests/dp-renumber-launcher.test.js: drop subjectHinted assertions
- AGENTS.md: document the new fragment (and its DP-only inclusion)
  plus its test file
- peeringdb-deskpro-tools.user.js regenerated; CP and FP are not
  touched by this commit

Security:
- N/A (no new write paths; staged code remains unreachable in
  production until wired up)

Testing:
- Full suite green from user.js/: 585 pass, 0 fail (1 opt-in live
  skip), including 20 new lib-shared-helpers cases
- Non-vacuity: disabling the resolver's memory-cache read turned the
  two cache-counting cases red; restored, green
- fetchNetixlanByIp non-vacuity as before: the old
  `cached !== undefined` miss-check turns its cases red
- build --check clean; node --check clean on all three .user.js

Backwards Compatibility:
- getBestApiNetDataItem, resolveEntityLegalName, the TEST regexes and
  the editable-region check keep their exact behavior -- they only
  moved homes; all existing tests pass unmodified
- classifyError keeps every previously-present key/value per branch;
  collectRenumberCandidates' subjectHinted field is removed (its only
  consumer never read it)
- CP and FP ship no change at all in this commit
- No live user-facing behavior changes

Assisted-by: Claude:claude-opus-5
Assisted-by: Claude:claude-fable-5
Applies what remains of the ratified fp triage now that the write-guard
work has landed on dev-next. An earlier draft of this change staged
FP's exclusion cluster as planned safety code with `@staged wip`
markers; that cluster is now live upstream -- wired into the IX-F
netixlan write paths and shared via lib/admincom-entity-exclusions.js
-- and under the ratified @staged grammar (markers only on
unreferenced symbols) staging no longer applies, so those markers are
dropped here rather than carried. What remains are the orphan
deletions and the tree's first @deprecated adopters under the frozen
grammar.

Changes:
- Delete groupCustomItemsByVisualRow (orphaned by the 7169919 toolbar
  refactor).
- Delete the dead `members` array population in copy-user-roles; the
  admins-only clipboard output is byte-identical.
- Delete FP's unused buildTampermonkeyRequestHeaders copy -- the
  identical body survives in CP and DP, and a hoped-for lib extraction
  is not a planned FP feature.
- Convert LEGACY_API_PAYLOAD_CACHE_STORAGE_PREFIX and
  LEGACY_API_PAYLOAD_TAB_CACHE_STORAGE_PREFIX to the frozen
  `@deprecated — <reason; removal condition>` line-comment form,
  preserving the migrateLegacyApiPayloadCacheKeys() sweep prose.
- Bump FP @Version to 1.1.42 (src + meta); regenerate .user.js.

Testing:
- Full suite green: 585 pass, 0 fail (1 pre-existing skip).
- build --check and node --check on the regenerated .user.js: clean.
- Verified by grep across all five source files + tests/ that zero
  references remain to groupCustomItemsByVisualRow,
  buildTampermonkeyRequestHeaders (FP copy) and the members array.

Backwards Compatibility:
- copy-user-roles output unchanged (admins joined by newline).
- No live user-facing behavior changes; deleted code had no caller.

Assisted-by: Claude:claude-opus-5
Assisted-by: Claude:claude-fable-5
runApiResourceCoverageCheck validated ENTITY_API_RESOURCE_MAP's slugs
against OPENAPI_KNOWN_RESOURCE_SLUGS -- a set built from
ENTITY_API_RESOURCE_MAP itself, so the check could never fire while
reporting green in debug mode. A guard that cannot fire but reports
success is worse than no guard: it manufactures false confidence. A
real coverage check needs an independent source of truth (a fetched
OpenAPI spec); until one exists, no check is honest, and a note on the
map says so. Also removes the dead keeperRowForDelete variable in the
conflict-resolver apply loop, assigned twice and never read.

Changes:
- Delete runApiResourceCoverageCheck, OPENAPI_KNOWN_RESOURCE_SLUGS and
  the runSelfCheck call site.
- Add a note on ENTITY_API_RESOURCE_MAP explaining why there is no
  self-check and what a real one requires.
- Delete the two dead keeperRowForDelete assignments in the IX-F
  conflict-resolver apply loop (the DELETE targets item.doomedRow.id;
  the keeper read-back result was never consumed via this variable).
- Bump CP @Version to 2.0.228 (src + meta); regenerate .user.js.

Security:
- N/A (the removed check never guarded anything -- it was structurally
  unable to fail).

Testing:
- Full suite green: 585 pass, 0 fail (includes the IX-F merge-apply
  suite, which pins the conflict-resolver write path this touches).
- build --check and node --check on the regenerated .user.js: clean.
- Verified by grep that zero references remain to the deleted symbols.

Backwards Compatibility:
- Debug mode no longer logs the meaningless "api resource coverage ok"
  self-check line; no other observable change.

Assisted-by: Claude:claude-opus-5
Resolve the executor-surfaced-decisions ticket (2026-08-20): the wave-1
conformance tests found zero-reference symbols and one @ai duplication
group that no human audit had caught. Per the ratified decisions, the
four orphan helpers are staged rather than deleted, the two dead
documented logging helpers are marked deprecated ahead of their
allowlisted removal, and the triplicated modal-close @ai tag is
rewritten so each site names its own modal and the loop its cancel
protects.

Changes:
- CP CONFLICT_RESOLVE_GATE_COUNT: line-comment "@staged wip" marker
  (gate-count for data-driven conflict-resolver gate reporting;
  verifyConflictGates hardcodes the count in prose today).
- CP addToolbarDropdownAction: "@staged wip" (no multi-item toolbar
  dropdown built yet; wire when the first one lands).
- CP getCopyNetworkFrontendPath: "@staged wip" (per-entity copy-URL
  helper; wire when the copy-link action expands beyond networks).
- DP stripTrailingLinkEmojiTokens: "@staged wip" (anchor-label emoji
  cleanup; wire into hydrateExistingPeeringDbAnchor when label
  rewriting returns).
- lib/admincom-common.js dbgGroup/dbgGroupEnd: "@deprecated" with
  removal condition (documented logging API with no callers; remove
  with the next CONVENTIONS.md doc cycle).
- CP: the three identical "@ai Preserve the cancelSignal write and the
  resolveClosed() call." tags on modal close() handlers rewritten
  modal-specifically (IXLAN renumber / IX-F member audit / conflict
  resolver), each naming the apply/merge/delete loop its cancelSignal
  write aborts. Each rewritten tag is unique and passes the litmus.
- Version bumps (lib change inlines into all three scripts): CP
  2.0.228 -> 2.0.229, DP 1.7.12 -> 1.7.13, FP 1.1.42 -> 1.1.43, in
  both .src.js and .meta.js; .user.js regenerated.

Security:
- N/A

Testing:
- python user.js/scripts/build_userscripts.py && --check: green.
- node --check on all three generated .user.js: green.
- cd user.js && node --test: 585 pass, 1 skipped, 0 fail.

Backwards Compatibility:
- Comment-only and version-header changes; no behavior change.

Assisted-by: Claude:claude-opus-5
Make the ratified @ai anti-boilerplate rules (wayfinder ticket
ai-enforcement-parameters, 2026-08-20) machine-checked so stock tags
cannot be reintroduced. The insight that makes this enforceable without
defining "boilerplate": boilerplate is, by definition, repeated -- so
an exact-duplication cap plus a denylist of the historical stock
phrases covers the space with no similarity scoring.

Changes:
- tests/conventions-ai-tags.test.js: pure node:test + fs conformance
  test over all six source fragments (three .src.js plus
  lib/admincom-common.js, lib/cp-name-normalization.js,
  lib/admincom-entity-exclusions.js). Three assertions: the seven
  historical stock phrases are denylisted exactly; identical
  normalized @ai text may appear at most 2 times repo-wide (permits
  one deliberate twin pair, blocks templates); tag prose must carry
  at least 30 characters of substance.
- docs/CONVENTIONS.md "Documentation convention": rewritten to the
  ratified rule -- an @ai tag states one invariant specific to that
  function that a plausible diff could silently violate, with the
  litmus sentence ("If the sentence could be pasted onto a different
  function unchanged and still read true, it is not an @ai tag");
  drops the stock-phrase examples and the "900+ occurrences" text.

Security:
- N/A

Testing:
- Non-vacuity proven: temporarily re-adding the stock tag "Keep
  behavior stable and prefer minimal, localized edits." to
  lib/admincom-common.js turned the denylist assertion red with the
  exact file:line, then the file was restored and the suite went
  green again.
- The one existing exact-duplicate pair (DP's two "Preserve menu
  command registration behavior." tags) sits at the N=2 cap and
  passes by design.
- python user.js/scripts/build_userscripts.py && --check: green.
- node --check on all three generated .user.js: green.
- cd user.js && node --test: 569 pass, 1 skipped, 0 fail
  (565 baseline + 4 new).

Backwards Compatibility:
- Test and docs only; no script behavior change.

Assisted-by: Claude:claude-opus-5
The lifecycle stack carried over from fix/dp-lifecycle-triage through
test/conventions-ai-tags changes the CP source but still had the old
2.0.229 header. Bump past master's 2.0.232 so installs pick it up.

Changes:
- Bump the CP @Version in the .src.js and .meta.js to 2.0.233.
- Regenerate the CP .user.js.

Security:
- N/A

Testing:
- build_userscripts.py --check and node --check pass.
- node --test in user.js: 599 tests, 598 pass, 1 skipped, 0 fail.

Backwards Compatibility:
- N/A

Assisted-by: Claude:claude-opus-5-5
@netravnen netravnen added llm-built userscript Tampermonkey/Greasemonkey userscript changes labels Nov 25, 2026
@netravnen
netravnen merged commit 0a28906 into master Nov 25, 2026
2 checks passed
@netravnen
netravnen deleted the chore/land-lifecycle-stack branch November 25, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-built userscript Tampermonkey/Greasemonkey userscript changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant