Skip to content

Commit e38258a

Browse files
file-safety spec: wrap the added rows and end the file with a newline so the pinned prettier accepts them
The compile job runs pnpm format:check as its first step (.github/workflows/code-qa.yml:107), and that leg installs the version this head locks - prettier 3.9.10 per pnpm-lock.yaml:7381 - while this machine installs 3.8.4 from the trunk checkout, so the local leg through pnpm is not the leg CI runs. Over the parent blob of this file (a8ea1b4) the pinned 3.9.10 reports "All matched files use Prettier code style!". Over the pushed blob (79c25fe) it flags this file: the rows added last round wrote conditionalIt(...) and expect(safeWriteText(...)) calls on single lines longer than the 120-column print width in .prettierrc.json, and the appended block ended without a final newline. Both are inside the region those rows added; the formatter touched nothing outside it (4 hunks, all between lines 2275 and 2352 of a 2,340-line file). The whole-tree check with 3.9.10 now reports 0 files and exit 0; the leg rerun prints Test Files 2 passed (2) / Tests 100 passed (100); knip still prints 30 lines with exit 1 and check-types still prints 176 error lines with exit 2, neither naming a file this unit touched. The per-file eslint leg still exits 2 without linting anything (the head eslint config imports @eslint/js, which this host never installed), so it is reported as not run.
1 parent 79c25fe commit e38258a

1 file changed

Lines changed: 31 additions & 19 deletions

File tree

‎src/services/file-safety/__tests__/safeWriteText.spec.ts‎

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,22 +2272,30 @@ describe("created root in the extended-length namespace", () => {
22722272
typeof args[3] === "number" ? args[3] : 0,
22732273
)
22742274
})
2275-
conditionalIt("refuses to publish when the created UNC directory resolves under nothing the caller pinned", async () => {
2276-
const pin = _uncScenario(true)
2277-
const promise = safeWriteText(target, "data", {
2278-
platform: "linux",
2279-
expectedAncestorIdentities: pin,
2280-
})
2281-
await expect(promise).rejects.toBeInstanceOf(AncestorReplacedError)
2282-
await expect(promise).rejects.toThrow(/nothing the caller authorized/)
2283-
expect(fs.rename).not.toHaveBeenCalled()
2284-
expect(fs.link).not.toHaveBeenCalled()
2285-
})
2286-
conditionalIt("publishes when the created UNC directory resolves inside the location the caller pinned", async () => {
2287-
const pin = _uncScenario(false)
2288-
await expect(safeWriteText(target, "data", { platform: "linux", expectedAncestorIdentities: pin })).resolves.toBeUndefined()
2289-
expect(fs.rename).toHaveBeenCalledWith(expect.stringContaining("safeWriteText_"), target)
2290-
})
2275+
conditionalIt(
2276+
"refuses to publish when the created UNC directory resolves under nothing the caller pinned",
2277+
async () => {
2278+
const pin = _uncScenario(true)
2279+
const promise = safeWriteText(target, "data", {
2280+
platform: "linux",
2281+
expectedAncestorIdentities: pin,
2282+
})
2283+
await expect(promise).rejects.toBeInstanceOf(AncestorReplacedError)
2284+
await expect(promise).rejects.toThrow(/nothing the caller authorized/)
2285+
expect(fs.rename).not.toHaveBeenCalled()
2286+
expect(fs.link).not.toHaveBeenCalled()
2287+
},
2288+
)
2289+
conditionalIt(
2290+
"publishes when the created UNC directory resolves inside the location the caller pinned",
2291+
async () => {
2292+
const pin = _uncScenario(false)
2293+
await expect(
2294+
safeWriteText(target, "data", { platform: "linux", expectedAncestorIdentities: pin }),
2295+
).resolves.toBeUndefined()
2296+
expect(fs.rename).toHaveBeenCalledWith(expect.stringContaining("safeWriteText_"), target)
2297+
},
2298+
)
22912299
})
22922300

22932301
describe("effective parent validated when mkdir created nothing", () => {
@@ -2329,12 +2337,16 @@ describe("effective parent validated when mkdir created nothing", () => {
23292337
})
23302338
it("publishes when the parent that already existed resolves inside the location the caller pinned", async () => {
23312339
const pin = _scenario(false, true)
2332-
await expect(safeWriteText(target, "data", { platform: "linux", expectedAncestorIdentities: pin })).resolves.toBeUndefined()
2340+
await expect(
2341+
safeWriteText(target, "data", { platform: "linux", expectedAncestorIdentities: pin }),
2342+
).resolves.toBeUndefined()
23332343
expect(fs.rename).toHaveBeenCalledWith(expect.stringContaining("safeWriteText_"), target)
23342344
})
23352345
it("publishes when the parent already existed and the caller pinned no location", async () => {
23362346
const pin = _scenario(true, false)
2337-
await expect(safeWriteText(target, "data", { platform: "linux", expectedAncestorIdentities: pin })).resolves.toBeUndefined()
2347+
await expect(
2348+
safeWriteText(target, "data", { platform: "linux", expectedAncestorIdentities: pin }),
2349+
).resolves.toBeUndefined()
23382350
expect(fs.rename).toHaveBeenCalledWith(expect.stringContaining("safeWriteText_"), target)
23392351
})
2340-
})
2352+
})

0 commit comments

Comments
 (0)