Skip to content

C1-RJ-F1 — isolate repair-job append descriptors - #50

Merged
LogicDuke merged 1 commit into
mainfrom
repair/c1-repair-job-descriptor-isolation
Aug 23, 2026
Merged

C1-RJ-F1 — isolate repair-job append descriptors#50
LogicDuke merged 1 commit into
mainfrom
repair/c1-repair-job-descriptor-isolation

Conversation

@LogicDuke

@LogicDuke LogicDuke commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Finding

  • Finding: C1-RJ-F1
  • Subsystem: C1 — Repair Job Authority
  • Classification: CURRENT
  • Severity: P2
  • Disposition: REPAIR_NOW

Affected base

  • main SHA: 8cfe1f191699fd30226b811c4743777cc2d099fc
  • tree: e3b8c4716a554f055262316ce111efa70691444d

Verified impact

  • Totality / reliability failure on an authority path.
  • Fail-stop, NOT fail-open. No demonstrated authority escalation.

append<T>() handed an ordinary Object.prototype-inheriting PropertyDescriptor
literal to the captured Object.defineProperty. With Object.prototype.get
and/or .set present, ToPropertyDescriptor walks the prototype chain, observes
the inherited accessor keys beside the descriptor's own value/writable keys,
and throws TypeError: Invalid property descriptor…, breaking the module's
documented never-throws / fail-closed / total contract.

Verified reachable paths

  • repair-job readList valid-input path (authorizedPaths / authorizedCommandClasses).
  • repair-job invalidFields refusal-reporting path.
  • issueExecutionPermit ALLOW_ONCE consumer (imports append from repair-job.ts).

Reproduced BEFORE (throws) under: ambient get, ambient set, get+set, mid-evaluation
get, mid-evaluation set, and the execution-permit consumer. Confirmed AFTER: every
path returns normally, never throwing.

Fix

Capture Object.setPrototypeOf at module load beside the existing Object
intrinsics; give the descriptor a null prototype before the captured
Object.defineProperty consumes it.

Scope

  • Production scope: src/domain/repair-job.ts only.
  • Test scope: tests/domain/repair-job-invariants.test.ts (added), tests/domain/execution-permit.test.ts (consumer regression).

Guarantees

  • Exported append API preserved (name + signature unchanged).
  • execution-permit.ts production file unchanged — the one repair-job change closes the consumer.
  • Sibling descriptor-family sites (agent-invocation.ts, agent-invocation-report.ts, review-ingestion.ts) untouched — separate carried obligations.
  • Public API change: NONE.
  • Dependency change: NONE.
  • Authority-model change: NONE (permit identity/authority stable, no widening; out-of-scope ops still refused with null permit under poison).
  • Fail-before reproduced; pass-after confirmed.
  • Fresh independent validation: PASS.
  • Second-order closure: PASS.
  • PR Cockpit D2 — evidence freshness projection #49 remains merged/untouched. Cockpit D1/D2 untouched. PR PR 007 — Autoflow State Machine: commit-bound, pure orchestration state #9 untouched.
  • No Ready authority. No merge authority. Human merge authority preserved.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when processing repair-job data in environments with modified object properties.
    • Preserved array element ordering and property behavior during repair-job updates.
    • Ensured execution permits continue to issue, authorize, and reject operations correctly under unusual object-property conditions.
  • Tests

    • Added comprehensive coverage for repair-job updates and execution permits.
    • Added validation for cleanup, error handling, descriptor behavior, and prototype restoration.

Finding C1-RJ-F1 (C1 Repair Job Authority, P2, REPAIR_NOW).

The exported append<T>() helper handed an ordinary Object.prototype-
inheriting PropertyDescriptor literal to the captured Object.defineProperty.
When a hostile getter or Proxy trap installs Object.prototype.get and/or .set,
ToPropertyDescriptor walks the prototype chain, observes the inherited accessor
keys beside the descriptor's own value/writable keys, rejects the mixed
descriptor, and throws TypeError -- breaking the module's documented never-
throws / fail-closed / total contract on every append path: the validated-list
path (readList over authorizedPaths / authorizedCommandClasses), the
invalidFields refusal-reporting path, and the imported permit-id builder that
issueExecutionPermit uses at the ALLOW_ONCE mint. This is a totality/reliability
failure (fail-stop, not fail-open); no authority escalation.

Capture Object.setPrototypeOf at module load beside the existing Object
intrinsics and give the descriptor a null prototype before the captured
Object.defineProperty consumes it. Descriptor flags, index semantics, element
order, invalidFields ordering, refusal semantics, permit identity/authority, the
exported append signature, and the public API are all unchanged. The single
change also closes the execution-permit consumer with no edit to that file.

Regression tests cover ambient get / set / get+set, mid-evaluation poison, the
validated-list and invalidFields paths, direct append descriptor semantics,
element ordering, realm restoration through a throwing body, and the
issueExecutionPermit consumer. Sibling descriptor-family sites remain separate
carried obligations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 007be0ae-1d40-4db8-a177-748f88e70474

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfe1f1 and 9e2d4b2.

📒 Files selected for processing (3)
  • src/domain/repair-job.ts
  • tests/domain/execution-permit.test.ts
  • tests/domain/repair-job-invariants.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The repair-job append path now avoids inherited accessor interference by using a null-prototype descriptor. Tests cover poisoned prototypes during repair-job evaluation and permit issuance, including ordering, descriptors, authorization, and cleanup.

Changes

Prototype Poisoning Hardening

Layer / File(s) Summary
Repair-job append hardening and invariants
src/domain/repair-job.ts, tests/domain/repair-job-invariants.test.ts
append now uses a null-prototype property descriptor. Tests verify snapshots, invalid-field ordering, element descriptors, append ordering, mid-evaluation poisoning, and exception cleanup.
Execution-permit poisoning coverage
tests/domain/execution-permit.test.ts
Tests verify unchanged authorized permits, rejected unauthorized requests, and restoration of poisoned prototype properties.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 9e2d4

This change isolates repair-job property descriptors and adds regression coverage without changing the public API or authority model; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

I’m a rabbit guarding fields with care,
Null-prototype descriptors clear the air.
Poisoned getters hop away,
Permits keep their shape each day.
Tests restore the prototype there.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: isolating descriptors used by repair-job append.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch repair/c1-repair-job-descriptor-isolation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LogicDuke
LogicDuke marked this pull request as ready for review August 23, 2026 19:33
@LogicDuke

Copy link
Copy Markdown
Owner Author

@codex review

@LogicDuke

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 9e2d4b26fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@LogicDuke
LogicDuke merged commit 50bb632 into main Aug 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant