Test memo: key non-literal native require() sites and importlib imports instead of failing closed
Maintainers usually reply within 1 day
Assessment
This issue has not been assessed yet.
Description
Problem
The test memo (scripts/lib/testMemo.js, PR #12295) has three known constructs it cannot key, each left as a documented residual after the adversarial review because closing it today would cost more than it protects:
- Non-literal native
require()in product modules —server/services/pm2.js:845(require(configPath)),server/services/databasePreflight.js:48,server/services/signalSnapshot.js:65(require(SQLCIPHER_DRIVER_PACKAGE)). The floor key fails closed on them; the recorded key does not, because the Vite module runner never records a nativerequire.pm2.jsis in 224 of 3,100 recorded sets (7%), so failing the recorded key closed on it would un-memoize 7% of the server suite for a path that, under tests, points at a temp ecosystem file or a mock. - Python
importlib.import_module('x')— onlyimport x/from x import/import a, bsibling imports are followed for.pyinputs. import(variable)in the recorded key — fails closed on the floor key only; the recorded set covers whatever was loaded, but a module the run never loaded through such an edge is by construction not in any key (same reasoning asvi.mockwith a factory).
Chosen approach
- (1) Make the two product sites memo-friendly rather than widening the fail-closed rule:
pm2.jsanddatabasePreflight.jsshould resolve the ecosystem file through one anchored constant per call site (join(cwd, ECOSYSTEM_FILE)whereECOSYSTEM_FILEis a module-level literal) so the analyzer can evaluate therequire()argument to a path whencwdisprocess.cwd(), and otherwise treat arequire()whose argument isjoin(<unknown>, <literal>)as a directory-scoped read keyed on the literal basename across the repository (every trackedecosystem.config.cjs).signalSnapshot.js'srequire(SQLCIPHER_DRIVER_PACKAGE)is a bare package name: evaluate arequire()whose argument is a module-level string constant as a bare specifier (package version keyed). - (2) Add
importlib.import_module('<literal>')to the python sibling scan; a non-literalimport_modulefails closed like a non-literal relative import. - (3) Document as the recorded key's one accepted non-literal edge; no code change.
Acceptance
scripts/lib/testMemo.test.jspins: arequire(join(cwd, 'ecosystem.config.cjs'))member keys every trackedecosystem.config.cjs; arequire(CONST)with a bare package constant keys that package's version;importlib.import_module('_pins')keys_pins.py.- Recorded-memoizable server suites do not drop below the current 95.5%.
- Dominant language
- JavaScript
- Stars
- 38
- Forks
- 32
- Avg merge
- 33m
- Merged PRs (30d)
- 988
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from atomantic/PortOS
-
Share the test-Chrome resolver with the client browser tests and ci-warm-test-chrome.shPossibly taken @atomantic claimed this today. Opencode-quality effort:medium in-progress model:light planner:sonnet-5-5 tests
atomantic/PortOS#12315 · 1 assignee ·
Maintainers usually reply within 1 day
-
backup.db.test restore older database schema fails in local pregate DB suitePossibly taken @atomantic claimed this today. Openbug in-progress
atomantic/PortOS#12306 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Follow-up fixes for pregate attestation (post-merge review of #12299)Possibly taken @atomantic claimed this today. Openbug effort:medium in-progress model:medium planner:sonnet-5-5
atomantic/PortOS#12302 · 1 assignee ·
Maintainers usually reply within 1 day
-
Test memo: record the Vitest setup/environment modules instead of hashing their 179-file static closurePossibly taken @atomantic claimed this today. Openeffort:high enhancement in-progress model:heavy plan tests
atomantic/PortOS#12298 · 1 assignee ·
Maintainers usually reply within 1 day
-
Diagnose composition browser Page.enable timeout during document renderingPossibly taken @atomantic claimed this today. Openarea:media bug effort:high in-progress model:heavy plan planner:gpt-6-1-sol tests
atomantic/PortOS#12294 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in atomantic/PortOS
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Spomky-Labs/pwa-bundle#476 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
c1overzz/dsh-bili-scroll#35 ·
Maintainers usually reply within 1 day
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pbakaus/impeccable#1077 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day