D1-44-F3 — isolate Cockpit append descriptors - #47
Conversation
Bounded child repair for D1-44-F3 (CURRENT / P2 / REPAIR_NOW): the Cockpit reader's never-throws contract could be broken when an earlier accepted input getter poisons Object.prototype.get/.set and a non-empty observation list or an invalidFields entry is then appended via the shared prototype-inheriting descriptor. Introduces a Cockpit-local append that null-prototypes its descriptor before Object.defineProperty, used for both the parsed-list and invalidFields insertions. Shared domain helper unchanged; four sibling append() sites remain outside this PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Cockpit reader now uses a local append helper that resists inherited ChangesCockpit append hardening
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR isolates Cockpit descriptor creation to preserve the reader’s never-throws behavior while keeping returned list semantics unchanged; no actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Bounded child repair for the verified finding D1-44-F3 — CURRENT / P2 / REPAIR_NOW / blocking.
Parent
Parent PR #44 (
cockpit/d1-read-model-contract) is a protected integration boundary and is not edited directly. This is a child repair based at exactly:0f70d2977242bc98f4d1a83a66162847392fd08aVerified defect
readCockpitSnapshotpromises never to throw while validating unknown input. The Cockpit reader importedappend()fromsrc/domain/repair-job.ts, which builds an ordinary prototype-inheritingPropertyDescriptorbeforeObject.defineProperty. If an earlier legitimately-read input getter installsObject.prototype.get/.set,ToPropertyDescriptorobserves inherited accessor keys beside ownvalue/writablekeys and throwsTypeError. Two reachable Cockpit paths:readCockpitSnapshot → readCockpitList → append(parsed, parsedElement)(non-empty list)readCockpitSnapshot → append(invalidFields, …)(invalid field recorded)Independently reproduced on the exact parent tree. (D1-46-F1 hardened only
freezeList, whose tests used empty lists, so the append path was uncovered.)Protected never-throws invariant
After an earlier getter mutates
Object.prototype.get/.set: a non-empty accepted list must not throw; recording an invalid field must not throw; clean inputs behave identically; returned lists stay genuine, frozen arrays; JSON round-trip and existing D1-44-F2 / D1-46-F1 protections stay intact.Change (exactly two files)
src/cockpit/read-model.ts— removeappendfrom the../domain/repair-job.jsimport; add a module-private Cockpit-localappend<T>that gives its descriptor a null prototype (via the module's capturedobjectSetPrototypeOf+objectDefineProperty) before defining the indexed property, preserving semanticsvalue/writable:true/enumerable:true/configurable:true. Used for both the parsed-list andinvalidFieldsinsertions. No new export/API.tests/cockpit/read-model-invariants.test.ts— focused D1-44-F3 regressions.The shared domain helper is not modified. The four sibling domain
append()sites (agent-invocation.ts,agent-invocation-report.ts,evidence-freshness.ts,review-ingestion.ts) remain outside this PR as carried obligations.Regression coverage
get / set / get+set poison before a non-empty list append → returns normally; poison before an
invalidFieldsappend → returns normally and reports the expected field; descriptor semantics;Array.isArray+ frozen; clean input unchanged; realm cleanup viafinally.Validation
Full suite 943/943 (18 files), cockpit invariants 31/31, typecheck / lint / build clean,
git diff --checkclean.Independent validation
A fresh independent validator (separate context) inspected the candidate from scratch — confirmed fail-before, pass-after on all poison/invalid-field/descriptor/array/cleanup axes, second-order closure, exact two-file scope, and added hostile variants (non-callable poison, accessor-based poison, poison via a different early field), all passing. Verdict: PASS. No new finding.
Boundaries
No Autoflow / PR #9 changes. No domain-helper modification. Draft only — no Ready authority, no merge authority. Human merge authority preserved.
Summary by CodeRabbit
Bug Fixes
Tests