fix(scripts): resolve repo root in strict-types generator after scripts/repo move#668
Closed
John-David Dalton (jdalton) wants to merge 1 commit into
Closed
fix(scripts): resolve repo root in strict-types generator after scripts/repo move#668John-David Dalton (jdalton) wants to merge 1 commit into
John-David Dalton (jdalton) wants to merge 1 commit into
Conversation
…fter scripts/repo move getRootPath() walked up a fixed single level, which resolved the repo root correctly when scripts lived one level deep but broke after the fleet migration moved them into scripts/repo/ (and scripts/utils/). The strict-types generator then looked for openapi.json under scripts/ and could not run. Walk up to the nearest package.json-bearing ancestor instead, mirroring resolveRepoRoot() in scripts/fleet/paths.mts. Depth-independent, so it stays correct across future directory moves and fixes every sibling script under scripts/repo/ that shares this helper.
Collaborator
Author
|
Closing — this patched a repo-local getRootPath in a non-segmented scripts/utils/ dir, which is the wrong boundary. Reworking correctly: repo-root resolution should use the existing @socketsecurity/lib path helpers (findUpSync / findPackageJson / walkUp) instead of a per-repo copy, and scripts/utils/ should be eliminated (scripts belong in scripts/fleet or scripts/repo per the root-scripts-are-segregated rule). A replacement PR will follow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
getRootPath()inscripts/utils/path-helpers.mtswalked up a fixed single directory level. That resolved the repo root correctly when the scripts lived one level deep, but the fleet migration moved them intoscripts/repo/(andscripts/utils/), so the strict-types generator then looked foropenapi.jsonunderscripts/and could not run.Fix
Walk up to the nearest
package.json-bearing ancestor instead of a fixed depth, mirroringresolveRepoRoot()inscripts/fleet/paths.mts. This is depth-independent, so it stays correct across future directory moves and fixes every sibling script underscripts/repo/that shares this helper.Context
Found while landing PR #667 (the org-list/plan type fixes): the strict-types generator is auto-generated from
openapi.json, but it could not be run straight because of this path bug — the fix there had to be validated by pointing the generator at the spec's expected path manually. This makes the generator runnable from its real location again.Verification
Scoped to the one helper (+25/-2). CI runs typecheck, lint, and the generated-types-are-current check.