Repository navigation
profiles bind: place candidates in their Chrome profile directories, bind by directory where names collide (#21 step 2) - #45
Conversation
… directory where names collide cua profiles bind now maps each live Chrome backend's extension instance id to its profile directory itself: copies of each profile's OpenAI extension store under $CUA_HOME/staging, read with the installed runtime's classic-level, removed afterwards. The registered directory's own store decides the automatic bind before the step 1 name rule; an unreadable Local State degrades to unplaced candidates with the Full Disk Access note. Adds --dry-run.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…dable Local State one note Review fixes for PR #45: fs/promises cp copied a store directory that is itself a symlink as a link, so the LOCK removal and the open acted on the live store through it; it now dereferences. A refused Local State read printed two notes (labels, directories); it is now one, ending with the Full Disk Access fix. Two minor mapping gaps are logged in tech-debt-tracker.md.
|
Independent review (Opus; the medium-rung reviewer could not run because its gateway returned 503 twice). One blocking finding, now fixed in 7932d72. A store directory that was itself a symlink got opened and rewritten in place: A cosmetic finding is also fixed: an unreadable Local State now gives one note instead of two. Two minor gaps are logged in tech-debt-tracker.md:
The reviewer found the automatic rule stricter than step 1's in every ambiguous case, cleanup sound on every path, degradation never failing bind, and |
Issue #21, step 2. Step 1 (vendor labels beside candidates, automatic bind on a unique name) is #27.
What
cua profiles bind <key>now shows, beside each live Google Chrome backend, the Chrome profile directory it belongs to and that directory's display name, computed by cua in the CLI process. It no longer depends only on the vendor's label. Interactive listing and--json(chromeProfile: {directory, name, thisProfile}, null when no store places the candidate;directoryMap: {status, reason?, readError?, unreadableStores?}).src/profiles/directory-map.mjs, the vendor's method from spike Spike: does Full Disk Access let the vendor's profile enrichment label backends (profileName)? #8). The profile list comes fromLocal Stateprofile.info_cache. For each profile with aLocal Extension Settings/<id>store, cua copies the store withfs/promisescpinto a privatemkdtempunder$CUA_HOME/stagingand removes the copy'sLOCK. It opens the copy with the installed release's ownclassic-level, loaded by absolute path fromruntime.paths.moduleDir, and readsextensionInstanceId. It checks every id the pin'snativeHost.extensionIdsallows. Copies are removed infinally. Copies older than 10 minutes that a killed run left behind are swept on the next run. Chrome's directory is only read.Local Statecan't be read (chrome_data_unreadablewith its code), every candidate shows asprofile directory unknown, bind prints a note with the Full Disk Access fix, and the step 1 rule applies. An unreadable or corrupt store makes the mappingpartial. A missingclassic-levelor staging failure makes itunavailable. None of these fails the command.src/profiles/bind.mjs):by: "directory"). This holds even when display names collide and even when the vendor label disagrees.directory_backend_not_live).several_directory_backends,instance_in_several_directories).by: "name"). Even then it never binds a backend that the mapping places in another directory (labelled_backend_other_directory).other_profile_directory). A pick placed in the registered directory is accepted even if its label conflicts.--dry-run(new): makes and prints the same decision ("would bind ...",dryRun: true) without recording anything. I added it so the live check could run against the realCUA_HOMEwithout touchingprofiles.json.cpSyncabort below. README'sprofiles bindsection is rewritten.Why
Display names collide on the mini ("직장" and "l1ngual.com" each appear twice). The registry binds directories, so the directory is the identifier that settles it.
Left unchanged (flagged, not changed)
profiles_listand readiness are unchanged. The mapping could splitbinding_staleinto two cases: the bound id is still this directory's (its host is asleep, so wake it), or this directory's store now records another id (so rebind). Readiness also runs insidecua serve, though, and that process may not have Full Disk Access. I'd take that up as a separate ticket.Surprise
fs.cpSync(..., {recursive: true})on a mode-000 source directory aborts the whole Node process (Node 22.23.2:libc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error ... Permission denied). It does not throw. The mapping therefore usesfs/promisescp, which rejects withEACCES. The chmod-000 test caught it.How verified
npm test: 501 tests, 501 pass, 0 fail, 0 skipped (488 before this change).classic-leveland keeps it open while the mapping runs, the way Chrome holds its live store.test/profiles-directory-map.test.mjs:LOCKincluded).partialwithEACCES.Local Stategivesunavailable/chrome_data_unreadable.Local Stateand a missingclassic-levelare eachunavailable.partial, with the copies removed.test/profiles.test.mjs: the rule cases (directory beats name, not live, other directory, instance in several directories, explicit refusal and acceptance).test/profiles-commands.test.mjs: bind end to end with a name collision,--dry-runrecording nothing, an unreadableLocal State, and a mapper that throws.test/serve-cli.test.mjs: the CLI against a fake installed release with a realclassic-levellinked in. Covers the human rows,--json,--dry-run, and the Full Disk Access note.classic-levelfrom the installed runtime in the defaultCUA_HOME, or else from/Applications/ChatGPT.app. They skip (with that reason) on a machine with neither.Live read-only check (first Mac, real
CUA_HOME, real Chrome running, terminal with Full Disk Access)node bin/cua.mjs profiles bind <key> --dry-run [--json], with instance ids truncated to 8 characters. Display names are redacted here because this repo is public; in the real output the vendor label and cua's directory name agreed for both backends.--jsonsummaries:personal(Default):ok: true, dryRun: true, how: automatic, by: directory, extensionInstanceId: 94c9fc71,directoryMap.status: complete; candidates41f3ec26 → Profile 11 (thisProfile: false)and94c9fc71 → Default (thisProfile: true, likelyMatch).school(Profile 6):pick_required, reason: directory_backend_not_live, staleBinding: af96e8b8,directoryMap.status: complete. Profile 6's store records an instance that is not live now, so nothing would be bound and the label rule is not consulted.work(Profile 8): refused before any listing,profile_not_ready(the extension is not installed in Profile 8).shasum profiles.jsonwas identical before and after all runs, and$CUA_HOME/stagingwas empty afterwards. Nothing was bound, created or changed, and Chrome was not touched.Not verified: the mini, where names actually collide. The collision case is covered by fixtures only.