Skip to content

fix(test-harness): review follow-ups from #151 - #167

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
fix/review-151
Sep 1, 2026
Merged

fix(test-harness): review follow-ups from #151#167
ScriptedAlchemy merged 1 commit into
mainfrom
fix/review-151

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Resolves the five unresolved Codex review threads on #151. All five were verified against current main before changing anything; every one reproduced.

P1 — bind manifests to their own route loaders

resolveTarget read the manifest from options.manifest but pulled the loader from the process-wide registry by route id alone. A renderRoute(id, { manifest: other }) against a project whose route id collides with the registered one executed the registered project's module while reporting the other manifest's provenance — a silent false pass.

Loaders are now bound to the compilation that produced them: registeredRouteLoader(manifest, routeId) resolves only when the registered manifest matches by digest and project root. A mismatch reports the two digests and the recovery rather than falling back to the generic "no loader registered" wiring message.

P1 — distinguish an absent document value from null

toHaveValue compared document.value ?? null against value ?? null, so toHaveValue(null) passed for a document that emitted nothing, and a real null satisfied toHaveValue(undefined). AgentDocument.value is optional, and those are distinct contract states. Absence and presence are now compared before the structural comparison, and undefined asserts absence.

P2 — validate registry versions when reading

The generated setup module assigns the realm global directly, so registerTestRoutes — the only version guard — never ran for it. A worker resolving a different agent-bundle/test accepted an incompatible registry and failed later with a misleading loader or manifest error. The version is now checked where the helpers read the registry. Generated registration is deliberately left as a direct assignment: that file imports nothing but the project's own route modules, and the reader is the side that knows which helpers actually resolved.

P2 — capture progress with a custom reporter

Supplying context.progress replaced the recording reporter outright, so RenderedRoute.progress was always empty — contradicting the documented result contract. The harness now always records and then delegates to the caller's reporter.

P2 — fix the invalid README context example

context: { cwd, operationId } does not typecheck: RenderRouteContext has neither field. Confirmed by compiling the snippet (error TS2353: 'cwd' does not exist in type 'RenderRouteContext'). Replaced with context.invocation and the runtime's observed-value workspace contract, then recompiled clean. The adjacent sentence describing the return value said "ordered render events"; it returns request-scoped progress, so that is corrected alongside the progress fix.

Tests

Four regression tests, each verified red against the unfixed sources and green after:

  • another manifest's route is refused instead of loading the registered module (asserts the loader is never invoked)
  • an incompatible registry assigned directly to the realm global is refused
  • a document with no value is separated from one whose value is null
  • progress is recorded when the caller supplies its own reporter

Plus a positive control that the loader still resolves for the manifest the registry was built from.

Verification

  • rstest.unit.config.ts tests/test-harness-manifest.test.ts — 20 passed
  • pnpm test:route-unit — 11 passed
  • pnpm --filter audiobook-curator test:routes (adoption) — 2 passed
  • pnpm typecheck — clean
  • pnpm lint — 0 errors, 0 warnings

Bind route loaders to the manifest that produced them, so an explicit
manifest cannot silently execute the registered project's module for a
colliding route id and report the other manifest's provenance.

Separate an absent document value from an emitted null in toHaveValue,
record request-scoped progress even when the caller supplies its own
reporter, validate the generated registry version where the helpers read
it, and correct the README's request-context example.
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 293b724

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T18:14:14.399264Z 293b724 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ScriptedAlchemy
ScriptedAlchemy merged commit d8ab71d into main Sep 1, 2026
4 of 9 checks passed

@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: 293b72438b

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

// worker belong to a different compilation. Loading one of them would run
// another project's module under this manifest's provenance, so the miss is
// reported as the mismatch it is rather than as missing wiring.
const mismatched = identity !== undefined && identity.digest !== manifest.digest;

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 Compare the project root when reporting manifest mismatches

When two projects have identical route graphs but different roots—for example, a copied checkout—their digests are intentionally equal. registeredRouteLoader correctly rejects that manifest because it compares both digest and project root, but this condition checks only the digest, so the error incorrectly says no loader was registered and recommends rerunning agentBundleRstest() instead of reporting the cross-project mismatch. Include identity.projectRoot !== manifest.projectRoot in the mismatch test.

Useful? React with 👍 / 👎.

@ScriptedAlchemy
ScriptedAlchemy deleted the fix/review-151 branch September 3, 2026 05:27
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