Skip to content

fix: bound TypeScript runner discovery (clean replacement for #2003)#2017

Open
Serhan-Asad wants to merge 20 commits into
mainfrom
recovery/pr2003-narrow-port-20260713
Open

fix: bound TypeScript runner discovery (clean replacement for #2003)#2017
Serhan-Asad wants to merge 20 commits into
mainfrom
recovery/pr2003-narrow-port-20260713

Conversation

@Serhan-Asad

@Serhan-Asad Serhan-Asad commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Clean, narrow replacement for #2003. This preserves the runner-discovery behavior needed downstream while removing the accumulated review-loop history.

  • Finds Jest, Vitest, and Playwright configs for deeply nested TypeScript suites without crossing repository or independent-package boundaries.
  • Proves ancestor workspace membership with bounded, fail-closed, provider-specific glob matching.
  • Requires every crossed lexical package boundary to have a contained, readable, bounded JSON-object package.json; dangling, looping, escaping, unreadable, malformed, scalar, and array leaves fail closed.
  • Matches npm's leading-dot and node_modules workspace exclusions while preserving explicit-dot declarations.
  • Preserves valid npm/Yarn or Lerna membership proof when a different colocated provider declaration is invalid; without positive valid proof, invalid declarations still fail closed.
  • Keeps an existing pnpm workspace declaration authoritative, including invalid-data fail-closed behavior.
  • Runs Jest paths literally with --runTestsByPath and returns the required runner cwd.
  • Rejects runner-config symlinks whose resolved target is outside the repository.
  • Keeps the PDD prompts, exact composite fingerprints, dependency catalog, verification profiles, and protected transition synchronized.

Exact-head verification

Candidate: da1d9d9ed2d463f7d9111fb9d356c0ac0092e278

  • tests/test_get_test_command.py + tests/test_agentic_langtest.py: 174 passed.
  • Verification-profile + rollout-policy suites: 25 passed.
  • Public invalid-leaf regressions cover matching npm, Lerna, and authoritative pnpm declarations with dangling, looping, escaping, unreadable, malformed, scalar, and array package manifests; valid leaves and mixed-provider independence remain covered.
  • Pylint on every changed production Python module: 10.00/10; py_compile, JSON parsing, CSV/hash validation, and git diff --check passed.
  • Immutable base-to-head validator (501de70a...da1d9d9ed...): 466/466, coverage 1.0, zero manifest-invalid, zero unaccounted, and zero profile-invalid reasons.
  • Architecture/include validation: zero mismatches; architecture.json and .pddrc remain byte-unchanged because no module boundary, filepath, public interface, generation path, or context routing changed.
  • Exact get_test_command fingerprints have zero mismatches. Composite prompt hash: bcae32a7...; code hash: cb7cc0b6...; test/test-files hash: 5f0755e1.... Raw prompt requirement: CONTRACT-SHA256:25b37c67...; whole verification-policy hash: eaa6cba1....
  • project_dependencies.csv now matches the exact context/agentic_langtest_example.py bytes (cc55d0a5...), exports, imports, and current behavior.
  • Shim-free public-boundary pdd_cloud E2E at fixture commit a2d69793...: 339/339 passed across six suites (39 + 21 + 239 + 5 + 18 + 17). Every lookup used cwd=frontend and Jest --runTestsByPath; all six workaround shims were restored, zero disabled shims remained, and the fixture stayed clean.

A fresh independent GPT-5.6-sol HIGH review is being run against this exact immutable candidate. No merge or auto-merge has been initiated by the author.

Merge guidance

Please merge this replacement instead of #2003 only after the exact-head independent review is clean. Manager approval and merge remain required.

@Serhan-Asad Serhan-Asad requested a review from gltanaka July 13, 2026 20:32
@Serhan-Asad Serhan-Asad self-assigned this Jul 13, 2026
@Serhan-Asad

Copy link
Copy Markdown
Collaborator Author

Exact-head end-to-end evidence — real downstream runner boundary

Validated PR head c4c23d47bafb1439fdf5b55f9b9032034d00f8ab against the actual six migrated Next.js suites from promptdriven/pdd_cloud#3251 at a2d69793eb5c05f5d03db0bf7a149edbfe2ebe6c.

Workflow exercised

For each real .tsx suite, I called #2017's public get_test_command_for_file(...) production boundary, then executed the returned TestCommand.command from the returned TestCommand.cwd. This is the same resolver/command object consumed by PDD's fix and E2E/bug orchestrators. Jest itself was real; no fake runner and no hand-authored replacement command were used.

Representative exact dynamic-route command returned by #2017:

cwd=/private/tmp/pdd-cloud-3251-e2e/frontend/src/app/admin/hackathon/events/[eventId]/__tests__
npx jest --no-coverage --runTestsByPath '/private/tmp/pdd-cloud-3251-e2e/frontend/src/app/admin/hackathon/events/[eventId]/__tests__/test_page.tsx'

Result

Real downstream suite Result
admin/crm/actions/__tests__/test_page.tsx 39/39
admin/hackathon/__tests__/test_page.tsx 21/21
admin/hackathon/events/[eventId]/__tests__/test_page.tsx 239/239
events/[slug]/__tests__/test_page.tsx 5/5
hackathon/[eventId]/__tests__/test_page.tsx 18/18
hackathon/[eventId]/team/__tests__/test_page.tsx 17/17
Total 6/6 suites, 339/339 tests, exit 0

This directly proves the original production failure is closed: deeply nested suites reach the correct runner/cwd, bracketed route segments remain literal through --runTestsByPath, and all returned commands execute successfully.

Greg's prior review surface / negative mold

The exact current head also passes:

  • tests/test_get_test_command.py: 90 passed
  • verification-profile + rollout-policy suites: 19 passed
  • combined exact-head local run: 109 passed
  • pylint pdd/get_test_command.py: 10.00/10
  • py_compile, JSON parsing, and git diff --check: clean

The 90-test module includes public-boundary regressions for the previously requested pnpm exclusion and brace semantics, ordered re-inclusion, independent-package/repository/worktree containment, malformed/oversized declaration fail-closed behavior, in/out-of-root config symlinks, Jest/Vitest/Playwright path semantics, hostile shell paths, and bounded matcher work.

Prompt / fingerprint / architecture / governance integrity

  • raw prompt: 3525d273e684633ff2f84daec3fb92a1fc5a3bd80a08076a372aa4ac275fa6e4
  • composite prompt fingerprint: 0a109f1fb5d657165f35354df04beacfa44312bcd2d179ae040aa137a21ff81a
  • code: 8a57d577f8cac083a2534f0d27120ab2cb30991bc0820a2407d6bba9cfb780fc
  • tests: b53c81e3aa7bb00414cbc6d9efe9c204a87f0b0e091551ee379fd9f408ef15f0
  • current-base profile: 92a006d31417892681e032678e9885a10802db3825b967a66e4d34361cb25f89
  • final profile: 632d509e34c463fdea2efc1e1e86084b2fd2429be9361a1b8190328d733ee54a

The rotation is now one direct current-main transition from requirement ef559f... / policy 92a006... to requirement 3525d2... / policy 632d50.... architecture.json already maps get_test_command_python.prompt to pdd/get_test_command.py and the unchanged public API, so no architecture edit is required.

No merge or auto-merge was initiated.

@gltanaka gltanaka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review verdict: changes requested

This fix is needed. Current main still stops TypeScript runner discovery after five parents and invokes Jest without literal-path mode, so deeply nested Next.js suites can fall back to npx tsx, use the wrong cwd, or fail to match bracketed dynamic-route paths. The deep walk, returned runner cwd, --runTestsByPath, and path quoting in this PR solve that real pdd_cloud failure.

I cannot approve head c4c23d47b because two correctness/governance issues remain:

  1. npm workspace exclusions can cross an independent-package boundarypdd/get_test_command.py:180-214. The implementation applies every provider declaration as one universal last-concrete-match rule. That is not npm workspace behavior. With workspaces: ["packages/**", "!packages/*"] and a leaf package at packages/deep/app, npm 11.9 @npmcli/map-workspaces returns no workspace, while _declared_workspace_membership(("packages", "deep", "app"), ...) returns True. Detection can therefore cross that leaf package's own package.json and select the repository-root Jest config, violating the independent-package boundary. Please add an npm-parity regression and either implement the provider semantics faithfully or fail closed where parity is not supported; do not apply pnpm semantics as a universal npm/Yarn/pnpm rule.

  2. The protected verification-profile transition is invalid.pdd/verification-profile-rotations.json. Auto-heal correctly collapsed the metadata to a direct base-to-head row and refreshed its hashes, but current enforcement never reads requirement_rotations. Running the repository's real build_unit_manifest(base=501de70a3, head=c4c23d47b) plus load_verification_profiles still yields coverage 0.997854 and these failures: candidate rotation policy absent; protected threshold-human-attestation obligation changed; protected requirement removed; profile incomplete. Please make the actual base-to-head validation reach coverage 1.0 with zero invalid reasons using an enforced transition mechanism, and add a regression that exercises this real transition rather than only writing metadata that no validator consumes.

The prompt exists and reflects the new behavior. The existing architecture.json entry remains accurate because the public interface and architectural dependencies did not change. Fingerprint, code, example, test, and include hashes are current. As a follow-up quality improvement, the prompt should move the security/boundary behavior toward stable R<n> contracts and reduce private-helper/implementation prescriptions, consistent with the prompting guide.

Finally, this rewritten head has no posted exact-head downstream E2E transcript. The 339/339 evidence belongs to superseded #2003 implementations. After the boundary/profile fixes, please run the representative deeply nested bracketed suite through the real PDD execution boundary using the returned command and cwd (preferably all six cited pdd_cloud suites), and post the exact head, command/workflow, cwd, exit status, and test counts. This is reasonable and feasible because the same harness was already exercised for #2003.

Independent validation:

  • focused runner suite: 90 passed
  • verification-profile and rollout-policy suites: 19 passed
  • production pylint: 10.00/10
  • compile, JSON parse, and git diff --check: passed
  • npm parity probe: failed as described above
  • protected base-to-head profile validation: failed as described above

@Serhan-Asad

Copy link
Copy Markdown
Collaborator Author

Exact-head protected-transition and downstream-boundary evidence

Validated PR head c2dba25d65d611397a3c7456451a68ee2672c822 against protected base 501de70a3520bebf88d991acf705737eddd7ebe3 and the six retained real suites from promptdriven/pdd_cloud#3251 at fixture commit a2d69793eb5c05f5d03db0bf7a149edbfe2ebe6c.

Protected transition

The real immutable build_unit_manifest(base, head) / load_verification_profiles(...) gate now reports:

  • 3,027 tracked candidates; 466/466 expected managed units
  • zero manifest-invalid reasons and zero unaccounted tracked paths
  • 466/466 complete verification profiles, coverage 1.0, zero profile-invalid reasons

The seven metadata files that lacked ownership preauthorization in the protected base are no longer tracked. test_pr_transition_has_complete_protected_inventory_and_profiles exercises the exact base-to-current-HEAD transition, names all seven paths, and requires the zero-invalid/full-coverage result.

Real downstream execution boundary

For every suite below, current-head get_test_command_for_file(...) produced the shown TestCommand(command, cwd), and that exact command was executed from that exact cwd with real Jest:

Suite Returned cwd Returned command Result
frontend/src/app/admin/crm/actions/__tests__/test_page.tsx .../admin/crm/actions/__tests__ npx jest --no-coverage --runTestsByPath /private/tmp/pdd-cloud-pr2017-c2dba25/frontend/src/app/admin/crm/actions/__tests__/test_page.tsx 39/39, exit 0
frontend/src/app/admin/hackathon/__tests__/test_page.tsx .../admin/hackathon/__tests__ npx jest --no-coverage --runTestsByPath /private/tmp/pdd-cloud-pr2017-c2dba25/frontend/src/app/admin/hackathon/__tests__/test_page.tsx 21/21, exit 0
frontend/src/app/admin/hackathon/events/[eventId]/__tests__/test_page.tsx .../admin/hackathon/events/[eventId]/__tests__ npx jest --no-coverage --runTestsByPath '/private/tmp/pdd-cloud-pr2017-c2dba25/frontend/src/app/admin/hackathon/events/[eventId]/__tests__/test_page.tsx' 239/239, exit 0
frontend/src/app/events/[slug]/__tests__/test_page.tsx .../events/[slug]/__tests__ npx jest --no-coverage --runTestsByPath '/private/tmp/pdd-cloud-pr2017-c2dba25/frontend/src/app/events/[slug]/__tests__/test_page.tsx' 5/5, exit 0
frontend/src/app/hackathon/[eventId]/__tests__/test_page.tsx .../hackathon/[eventId]/__tests__ npx jest --no-coverage --runTestsByPath '/private/tmp/pdd-cloud-pr2017-c2dba25/frontend/src/app/hackathon/[eventId]/__tests__/test_page.tsx' 18/18, exit 0
frontend/src/app/hackathon/[eventId]/team/__tests__/test_page.tsx .../hackathon/[eventId]/team/__tests__ npx jest --no-coverage --runTestsByPath '/private/tmp/pdd-cloud-pr2017-c2dba25/frontend/src/app/hackathon/[eventId]/team/__tests__/test_page.tsx' 17/17, exit 0

Total: 6/6 suites, 339/339 tests, every command exit 0. The fixture was an isolated detached checkout at the exact fixture SHA and remained Git-clean. Its only dependency shim was ignored frontend/node_modules -> /Users/serhanasad/Desktop/SF/pdd_cloud/frontend/node_modules.

Current-head validation and PDD integrity

  • Six relevant PDD suites: 491 passed, no skips/failures (294.54s)
  • Pylint for pdd/get_test_command.py plus the rollout-policy regression: 10.00/10
  • py_compile, three protected JSON parses, and git diff --check: clean
  • Raw prompt hashes: get-test-command b1dfeb586db9616f8fb2e40cb81a7bf6e07172c546cbb573d6eef28a7c49fc85; agentic-langtest de5c90406fdca19da87c17d66142eec9786d1bdb6ccfc225dbe9acd35da37f4c; fix-error-loop 0e37a6681480d6848e2f5742c15b1619f6167bc4bc6b2f4a4ffbededa233f855
  • Recursive preprocessing was run twice per prompt with identical output, no unresolved includes. Expanded SHA-256: get-test-command 432c9b4ba13b203d785b5fa782fe4a7428f0f3131a1abcd6497875c09ae4a33c; agentic-langtest a8384e939b7559d32dbfd6598da019e1f3b42e7800ef9611196225af9fd34cf4; fix-error-loop ba61d2452de708b15692d4e3344f7209a35fd7ac43b23c6ac1896304073fc995.

No merge or auto-merge was initiated.

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.

2 participants