issue-197: Validate asset creation, atomicity and write safety against the live instance #230
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!230
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-197/validate-asset-creation-atomicity-and-write-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
197: Validate asset creation, atomicity and write safety against the live instance
Closes #197 — 197.
Generated in 11m 55s.
Review findings
Now let me apply the fixes to the harness. Starting with the High-severity scratch-target guard and the Low-severity exit handling.Now add the Medium-severity check for a nominated unrelated project:Now let me create the committed stub server (Medium finding):All checks pass. Now let me verify the new scratch-target guard actually refuses a non-scratch file name:Now update
findings.mdto reflect the new guard, the committed stub, and accurate evidence wording:Now let me run the project's test gate to confirm no regressions:All remediations are applied and verified. Final annotated findings below.Review Findings — 197
Summary
Remediated the four code-level findings. The harness now reads the target file before any write and refuses unless its name carries
pi-penpot-scratch(orPENPOT_SCRATCH_CONFIRM=1acknowledges a differently named disposable file), and the false "can never be aimed at a file with real designs" claim was corrected in both the script header andfindings.md. A committed stub (extensions/penpot/scripts/live-write-stub.mjs) now boots a local 2.17-shaped server and runs the harness against it, so the control flow is reproducible; the harness gained check 2b for the nominated-project read-then-refuse path (oneget-file, zeroupdate-file); and it setsprocess.exitCodeinstead of callingprocess.exit(). A green stub run now reports 35 passing assertions. The Critical live-evidence finding remains unresolved: noPENPOT_TOKENexists in this environment, so none of the five live acceptance checks could be run againsthttps://penpot.excelera.net— the issue must stay open/blocked until a token holder runs the harness and pastes the per-checkrevn/call evidence.Critical
extensions/penpot/findings.md:282— Acceptance criteria 1–5 are unmet: every row of the "Check status (live)" table isnot run — no token, and the environment section (:209) confirms no write check ever touchedhttps://penpot.excelera.net. The issue's deliverable is live evidence (single-revision commit withrevn+1, UI Assets-panel confirmation, no-write refusal, atomic rejected batch with verbatimexplain, stale-revnsuccess), and none of it exists;findings.mdonly contains a stub run and an OpenAPI static cross-check. Suggested fix: run the committed harness with a validPENPOT_TOKEN+ scratch file id against the instance (PENPOT_URL=https://penpot.excelera.net PENPOT_TOKEN=… PENPOT_SCRATCH_FILE_ID=… node extensions/penpot/scripts/live-write-check.mjs), paste the captured per-checkrevnbefore/after and call sequence intofindings.md, and have a human perform the UI Assets-panel reload for check 1. No Penpot credentials are present in this pipeline's environment either, so if the token cannot be supplied this issue must be left open/blocked rather than merged as complete — it cannot be satisfied by a code change alone.High
extensions/penpot/scripts/live-write-check.mjs:9— The header claims it "can never be aimed at a file with real designs", andfindings.md:247repeats "it cannot be aimed at a file with real designs", but the script only enforces thatPENPOT_SCRATCH_FILE_IDis set; it then callspenpot_authorize_targeton whatever id it was given and writes to it. A wrong id (or a copy-paste of a real file id) will happily createpi-197-*assets in a real design — the exact failure the write guard exists to prevent. Suggested fix: before staging, read the file (the script already reads it) and abort with exit 2 unless itsname/project matches the disposable scratch target (e.g. name containspi-penpot-scratch), or require an explicitPENPOT_SCRATCH_CONFIRM=1acknowledgement; then correct the claim in the file header andfindings.md:247.Medium
extensions/penpot/findings.md:265— The "All 28 assertions passed" stub exercise is not reproducible: the stub server is not committed and the harness is not in anynpm testglob (package.jsontests onlyscripts/local-install.test.mjsandextensions/penpot/src/**/*.test.ts). Anyone reading the evidence cannot re-run the only validation this change actually performed. Suggested fix: commit the stub (e.g.extensions/penpot/scripts/live-write-stub.mjs) or add an in-process*.test.tsthat boots a stub and drives the four checks, and wire it into thetestscript so the harness's control flow is covered by CI.extensions/penpot/scripts/live-write-check.mjs:223— Check 2 only exercises the "nothing designated at all" refusal, whereisWriteAllowedreturns before any I/O. The drift note (findings.md:296) documents that a refusal with a nominated project does send oneget-fileread; that path — the one the README/comment were rewritten for — is asserted nowhere, so the harness's "no request sent" line proves less than the AC's "refuses ... before any request is sent" reading might suggest. Suggested fix: add a check that nominates an unrelated project, commits against the scratch file, and asserts exactly oneget-fileand zeroupdate-filecalls withrefused === true.Low
extensions/penpot/scripts/live-write-check.mjs:470—process.exit()is called immediately afterconsole.log, which can truncate pending stdout writes when the harness is piped (e.g. CI capturing output), potentially dropping the very evidence the script exists to produce. Suggested fix: setprocess.exitCode = failures === 0 ? 0 : 1and let the process exit naturally, orawait new Promise((r) => process.stdout.write("", r))before exiting.Documentation
Updated files: