Skip to content

test(app): add verify hook revocation and race coverage - #97

Merged
riquelmechile merged 2 commits into
mainfrom
feat/learning-verify-work-coverage
Aug 22, 2026
Merged

riquelmechile merged 2 commits into
mainfrom
feat/learning-verify-work-coverage

Conversation

@riquelmechile

Copy link
Copy Markdown
Owner

Linked issue

Closes #89

PR type

  • Bug fix (type:bug)
  • New feature (type:feature)
  • Documentation only (type:docs)
  • Code refactoring (type:refactor)
  • Maintenance / tooling (type:chore)
  • Breaking change (type:breaking-change)

Summary

  • Work unit 3 child W3D2 (FINAL child, stacked-to-main on merged W3D1 feat(app): add atomic learning promotion verify hook #96, 230 ≤ 400 lines): coverage for the atomic verify hook (task 2.6 completion).
  • worker-verify-work-coverage.test.ts: revocation-supersede (a revoked superseding proof makes the appended proof resolve revoked), delegation-missing abort with zero writes, and CAS version-conflict race (a losing CAS never appends a proof and never mutates the work).
  • Closes work unit 3 (tasks 2.1–2.6 all complete). Full gate pnpm check exit 0 — 1583 passed | 6 skipped, 0 new warnings.

Changes

File or area Change
packages/app/test/worker-verify-work-coverage.test.ts Verify-hook coverage: revocation supersede, delegation-missing, version-conflict race (new, 221)
openspec/changes/learning-promotion/tasks.md Task 2.6 checked (work unit 3 complete)
openspec/changes/learning-promotion/apply-progress.md W3C/W3D child evidence and deviations

Verification

  • Focused checks pass: pnpm exec vitest run packages/app/test/worker-verify-work-coverage.test.ts → 3/3
  • The affected runtime scenario was exercised, or is not applicable (test-only child over the in-memory fakes; PG adapter arrives in work unit 4)
  • Full gate: pnpm check GREEN — 1583 passed | 6 skipped, 0 new warnings
  • Native RDD: lineage review-8fbe320a9a60702c (medium, reliability lens) approved with focused+full-gate evidence, no findings; pre-pr gate allow

Contributor checklist

  • The linked issue is open and has status:approved.
  • Exactly one PR type is selected and its matching type:* label is applied.
  • The branch name follows type/lowercase-description.
  • Tests and documentation are updated where behavior changed.
  • Commits use Conventional Commit format and contain no attribution trailers.
  • No secrets or unrelated changes are included.

Work unit 3 child 8 (learning-promotion): revocation supersedes the
appended proof; missing delegation and CAS version-conflict abort with
zero writes. Completes task 2.5 with the full work-unit-3 gate.
@riquelmechile riquelmechile added the type:feature Feature pull request label Aug 22, 2026
@riquelmechile
riquelmechile merged commit d75ccef into main Aug 22, 2026
3 checks passed
@riquelmechile
riquelmechile deleted the feat/learning-verify-work-coverage branch August 22, 2026 03:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5be4137b7

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

- [x] 2.4 RED fake tests: candidate replay/collision/stale/concurrency; authority current/superseded/revoked. (W3A 11/11 candidate; W3B1 8/8 core + W3B2 10/10 coverage.)
- [ ] 2.6 RED+GREEN atomic verifyWork+proof owner (`app/src/worker/verify.ts`): one transaction = `completed→verified` win + proof append (verifier, fresh Delegation, policy); revocation supersede; no partial write.
- [ ] 2.5 `pnpm check` green.
- [x] 2.5 `pnpm check` green. (1582 passed / 6 skipped on the full work-unit-3 stack; 9 pre-existing warnings.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark the completed verify-hook task as done

When this slice lands, the new coverage and apply-progress section declare W3D2 and task 2.6 complete, but the canonical task immediately above remains unchecked. Any tooling or maintainer using tasks.md will therefore continue to treat work unit 3 as incomplete; check off task 2.6 together with this completed full-suite gate.

Useful? React with 👍 / 👎.

Comment on lines +56 to +60
updateIfVersion(_work: Work, _expectedVersion: number, _fencing?: FencingDirective) {
return Promise.resolve({
ok: false as const,
reason: 'version-conflict' as const,
current: completedWork(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the CAS loser expose the competing write

In the version-conflict scenario, the fake returns completedWork(), which is indistinguishable from the snapshot read before the CAS, and it never installs a competing winner in its store. The test therefore still passes if the hook incorrectly returns the stale pre-race work instead of cas.current, and its final state assertion cannot verify that the losing attempt preserves the winner's mutation. Return and store an observably different competing version/state so this race coverage exercises both behaviors.

Useful? React with 👍 / 👎.

Gate (task 2.5): `pnpm check` exit 0 — format ✓ typecheck ✓ build ✓ lint ✓ (9 pre-existing warnings) — test **1582 passed / 6 skipped**.
Deviations (Engram `sdd/learning-promotion/app-seam` + `sdd/learning-promotion/verify-hook`): seam deps = {events, skills, authority, trusted{principalId,actorId}} (design listed only {events,skills}; repository authority resolution requires the extra ports); verify-hook transition identity = (workId, 1) canonical (design left identity free); work-unit 3 split into EIGHT children (W3A/W3B1/W3B2/W3C1/W3C2/W3C3/W3D1/W3D2) because the named sub-boundaries "fakes" and "learning/" each also crossed 400 at apply — no size:exception.
Runtime harness: N/A — app-layer seam + hook over pure in-memory fakes; no PG/daemon/runtime boundary in this work unit.
Rollback: per child — drop the child's files + revert its checkbox/section; all files are new modules with no prior consumers.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the existing worker verifier during rollback

The W3D1 rollback cannot safely “drop the child's files”: packages/app/src/worker/verify.ts already contained verifyEffect before W3D1 and is imported by worker.ts, so deleting that file would remove established worker verification behavior and break its consumers. Document a rollback that reverts only the learning-promotion hook additions and its new tests rather than claiming every affected file is a new, unused module.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature Feature pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Wire promotion evaluation app seam, fakes, and atomic verify hook

1 participant