Repository navigation
fix(cli): a host can name projects whose received files are expected or all received - #8025
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 267 (base branch 267), smooth 94 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
jrusso1020
left a comment
There was a problem hiding this comment.
APPROVE at 89cdc275
- A host-named project with a missing record now reads as unknown (
privateProjectFile.ts:91). Every reader goes throughreadRecord: render, benchmark, preview/studio render, publish, cloud render (via publish staging) andadd. No caller is left on the old record-only check. - Both sides canonicalize with core
realpath(realpathSync.native), the same helper as the record writer. So Windows case, 8.3 names, trailing dots and symlink aliases all match, and the JSON array round-trips paths containing:and;. - Bad JSON throws and aborts render, preview and publish, so it fails closed.
- Nit: a value with leading whitespace, or with relative entries, is dropped silently and reads as unset. Rejecting any non-empty value that yields no absolute path would be stricter.
addwon't start a partial record in place of an expected-but-missing one (:130-131).- Follow-up, not blocking: the expectation is keyed by path and fixed when the process starts. If a folder is renamed and its record deleted, rendering or publishing it in the same run reads it as own until the Desktop side restores the record at run end. Copying has the same window. Carrying folder identity in the env value would close the rename case.
- Locally 127 passed and 1 skipped (128) across
privateProjectFile,receivedRenderandadd. Removing line 91 fails 4 tests. 6 probes passed: symlink in both directions, nested expected project, empty.hyperframes, bad JSON, leading whitespace and rename. - Commits are verified. No version bump or release.
Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: low. Only projects a host names change behaviour, and leaving the variable unset keeps today's behaviour. The Windows lane was still pending at review time.
— Rames
…or all received HYPERFRAMES_RECEIVED_STATE_FILE points at a JSON file a host app keeps, listing project folders (by path, and optionally by device and inode) as "expected" or "all". For an expected project, a missing received-files record counts every file as received and is not started afresh; for an all project, every file counts as received whatever the record lists. A state file that is named but cannot be read counts every file as received. A record lock dated in the future is taken over like a stale one.
89cdc27 to
41e12de
Compare
|
Independent serialized Devbox validation of the paired sources: OSS
This verifies the source contract and local staging behavior, without upload or paid-model execution. It is not a signed-in Desktop walk, Windows validation, or published CLI artifact/pin verification. Those rollout requirements remain separately tracked. |
jrusso1020
left a comment
There was a problem hiding this comment.
APPROVE at e0f62317 (re-stamp; replaces my approval at 89cdc275, since the contract was rewritten)
- The new host contract closes the follow-up from my last review.
- A project the host marks
"all"reads as received from itself, from its subfolders and from any folder that holds it. - An
"expected"project whose record is missing reads as received. - Both still match after a rename or a same-disk move, through
dev/ino.
- A project the host marks
- Probed with the CLI check during a real host run:
- A file copied in mid-run and the person's own
index.htmlboth read as received. Afterwards the copy is recorded and the rest reads as before. - A source that is renamed and stripped of its record reads as received, as does one moved deeper on the same disk.
- A file copied in mid-run and the person's own
- Bad state fails closed. An empty, truncated, wrong-type or bad-entry state file reads every file as received, as do a directory, an unreadable file, a symlink to an unreadable file and a dangling symlink. With the variable unset or empty, behaviour is unchanged.
- The stat/read race is gone. The state file is now read through one handle (
openSync, thenfstatSyncandreadFileSyncon the same descriptor), and CodeQL alert 1371 shows fixed. The path is opened following symlinks, but only someone who can write the host's data folder can point it anywhere. - Locks: a future-dated lock is taken over (
tryRecordLock). - Nits:
- An
"all"project that was renamed and still has its record reads as the person's own when rendered from a parent folder: the walk below reads the record and ignores the state. TreatinghostState(dir) === "all"as unreadable inreadRecordwould close it. - Identity is
dev:inoonly. On ext4, a new folder that reused a gone project's inode read as received. That fails closed, but carrying birth time would avoid it.
- An
- Tests: locally 150 pass and 1 is skipped. Each of 6 mutations fails a test: unreadable state failing open, no expected-missing branch, no
allrecord, no future-lock takeover, no identity match, and no below-overlap. - Commits are verified, and there's no version bump.
Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: low. Only hosts that set the variable see a change, and every bad state reads as received.
— Rames
|
Windows CI on the e0f6231 merge preview failed 5ec4dba makes |
jrusso1020
left a comment
There was a problem hiding this comment.
APPROVE at 5ec4dba4 (re-stamp of e0f62317)
- The delta is one verified commit, two lines in
privateProjectFile.ts.walkStartnow resolves with core'srealpath(realpathSync.native) instead of Node'srealpathSync, matchingregistryRootand the record writer. On Windows, the JSrealpathSynccan return a different form (case, 8.3 short names) from the native call, so a host-state lookup could miss the path the record was written under. - The fallback to
resolve(projectDir)on error is unchanged, and the rest of my review ate0f62317stands.
Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: low. Windows CI was rerunning at review time.
— Rames
|
Windows run 44038818187, checkout Test-only commit 1a682d0 uses core's shared native realpath helper in the three expected-path sites. It retains the refusal, exact record path, warning count and outside-file assertions. Independent serial Devbox verification: 150 passed, 1 platform skip; all normal hooks passed. New Windows CI is required to establish the platform result; no rerun or assertion weakening used. |
jrusso1020
left a comment
There was a problem hiding this comment.
APPROVE at 1a682d08 (re-stamp of 5ec4dba4)
- Test-only, one verified commit. In
receivedRender.test.ts, three expected warning paths now use core'srealpath(realpathSync.native) instead ofrealpathSync, matching what the code under test now prints. On Windows that'srunneradminrather than theRUNNER~1short name. - Assertions are unchanged. The refusal (
allowedfalse), the exactCould not read …line and the warn count are all kept.
Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: none (test only).
— Rames
What
A host app that imports projects can now tell the CLI how to read each project's received-files record. It does this through a state file named by
HYPERFRAMES_RECEIVED_STATE_FILE, and each project is listed with one of two states:"expected": the project must carry.hyperframes/received-files.json. If the file is missing, every file counts as received, and the CLI does not start a new record in its place."all": every file in the project counts as received, whatever the record lists.Separately, a record lock whose mtime is in the future is now treated as stale, the same as a lock older than ten seconds.
Why
Today the CLI reads a missing received-files record as "nothing received" and an unreadable one as "everything received". That default suits projects people make themselves. An app that imports projects and keeps their records knows more than that:
The host keeps this in a file rather than an environment value. That way long-lived child processes see updates, and a long list of projects never goes onto a command line.
A lock dated in the future never became stale, so every writer waited and then failed.
Related work
None.
How
hostStates()opens the named JSON file once, reads its identity and content through that handle, and caches by identity, size and timestamps. The handle is closed even when parsing fails.pathand areceivedstate, plus optionaldev/inothat match the folder after a rename or move on the same disk."all".readRecordtreats an absent record in any named folder as unreadable. Every existing reader inherits this:receivedFiles,receivedRecordStatus, the walks above and below, and record writes, soadddoes not start a fresh record.receivedRecordsadds an unreadable record when an"all"project is the folder being read, one of its subfolders, or a folder that holds it.tryRecordLocktakes over a lock dated more than one second in the future.docs/packages/cli.mdx, next to the section on left-out references.Test plan
privateProjectFile.test.ts("a host's received state file", plus "takes over a lock dated in the future"). They cover: