fix(user.js): resolve DP dormant code, extract shared helpers to a lib - #308
Draft
netravnen wants to merge 1 commit into
Draft
fix(user.js): resolve DP dormant code, extract shared helpers to a lib#308netravnen wants to merge 1 commit into
netravnen wants to merge 1 commit into
Conversation
netravnen
force-pushed
the
fix/dp-lifecycle-triage
branch
from
August 20, 2026 14:02
43753de to
550ac12
Compare
netravnen
force-pushed
the
fix/dp-lifecycle-triage
branch
2 times, most recently
from
August 20, 2026 20:01
51297e2 to
642194a
Compare
netravnen
force-pushed
the
fix/dp-lifecycle-triage
branch
from
August 20, 2026 20:14
642194a to
c2bcb38
Compare
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
netravnen
force-pushed
the
fix/dp-lifecycle-triage
branch
from
August 20, 2026 20:40
c2bcb38 to
01af1fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(user.js): resolve DP dormant code, extract shared helpers to a lib
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:
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
getTabSessionStorage, the editable-region predicates, and
fetchAsnNetworkName's cache/dedupe/transport contract through the
injectable fetchJson transport
shared cache signatures, null-means-miss, and negative caching
constants (vm contexts have JS intrinsics but no DOM globals, so
isNodeInsideEditableRegion threw before its logic could run)
plus its test file
touched by this commit
Security:
production until wired up)
Testing:
skip), including 20 new lib-shared-helpers cases
two cache-counting cases red; restored, green
cached !== undefinedmiss-check turns its cases redBackwards Compatibility:
the editable-region check keep their exact behavior -- they only
moved homes; all existing tests pass unmodified
collectRenumberCandidates' subjectHinted field is removed (its only
consumer never read it)
Assisted-by: Claude:claude-opus-5
Assisted-by: Claude:claude-fable-5
Stack created with GitHub Stacks CLI • Give Feedback 💬