mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 06:51:35 +00:00
* fix(tooling): check changed exports for dead code
* fix(tooling): name mismatched PR wrapper components
* feat(tooling): repin PR review artifacts
* fix(tooling): scope dead-export detection to source files
Matching only the top-level tree let a docs file under src/ carrying `export`
in a code sample set the flag. That mattered because the flag also short-
circuited changedCheckRequiresRemote above its docsOnly guard, so a docs-only
change could be dragged onto the heavy remote route and made to run knip.
Scope detection to the source extensions knip actually reads, and drop the
routing branch entirely: any file that can now trigger detection already
enables a non-docs lane, which the existing final clause routes remotely. The
branch was dead for every real source change and wrong for the docs case.
* refactor(tooling): round-trip the repinned review JSON
Preserving byte-exact formatting required a hand-rolled JSON scanner: string
escape handling, container nesting, and span splicing, for a file that lives in
gitignored .local/ and is only ever read back through JSON.parse.
repin already parses the artifact to validate it, so assign the two identity
fields and re-serialize. JSON.parse/stringify keeps insertion order, which is
the only formatting property worth holding. Drops four helpers.
* fix(tooling): select the dead-export scan by path, not changed lines
Inspecting changed lines for an `export` token has two false negatives that
defeat the purpose. Barrels export through multiline `export { ... }` lists, so
removing a symbol changes a line carrying no `export` token. Worse, the failure
that motivated this scan was an import-only edit: it orphaned a re-export in a
barrel the diff never touched, which no changed-line rule can see.
Select by path instead: any changed production source file under src/,
extensions/, ui/, or packages/. This also removes the merge-base dependency, so
a shallow checkout or unrelated history can no longer silently skip the scan.
Those paths already enable a non-docs lane, so the run already routes remotely
and knip's cost lands on the box already doing the heavy work.
OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 still opts out.
* Revert "feat(tooling): repin PR review artifacts"
The repin subcommand defeats the property the identity pin exists to enforce.
It rewrites the pinned PR number and head SHA while keeping every
recommendation, finding, and Markdown conclusion, so a completed
"READY FOR /prepare-pr" verdict authored against one revision can be relabelled
as covering another and then pass validation. The test added alongside it
restamped PR #7 as PR #42 and asserted validation succeeded, which is exactly
the substitution the fail-closed gate was built to stop.
Re-authoring a review after the head moves is friction on purpose: the code the
verdict describes may no longer be the code being landed. A safe version has to
prove the reviewed content is equivalent across the move, which is a design
decision about what equivalence means, not a convenience wrapper.
Reverts 5d89a704d9 and its follow-up c6304eb539.
* docs(tooling): note why the wrapper diagnostic reads HEAD blobs
Two reviewers independently read the new component comparison as inspecting
committed state while the refusal was triggered by working-tree files. The
uncommitted-wrapper guard above already exits for any staged or unstaged edit to
these three paths, so HEAD matches the working tree by the time this runs. State
the invariant at the site instead of letting a third reader re-derive it.
* fix(tooling): cover jsx in the dead-export source selector
The hand-written extension alternation matched .tsx but not .jsx, so a JSX
source change would skip a scan that knip does apply to it. Use the
`[cm]?[jt]sx?` selector the lint lanes in check-changed.mjs already use, which
covers both and is shorter, and pin the extension coverage in tests.
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
export type ChangedLane =
|
|
| "core"
|
|
| "coreTests"
|
|
| "ui"
|
|
| "extensions"
|
|
| "extensionTests"
|
|
| "scripts"
|
|
| "testRoot"
|
|
| "apps"
|
|
| "docs"
|
|
| "tooling"
|
|
| "liveDockerTooling"
|
|
| "bundledChannelConfigMetadata"
|
|
| "releaseMetadata"
|
|
| "all";
|
|
|
|
export type ChangedLanes = Record<ChangedLane, boolean>;
|
|
|
|
export type ChangedLaneResult = {
|
|
paths: string[];
|
|
lanes: ChangedLanes;
|
|
extensionImpactFromCore: boolean;
|
|
docsOnly: boolean;
|
|
reasons: string[];
|
|
};
|
|
|
|
export type DetectChangedLanesOptions = {
|
|
packageJsonChangeKind?: "liveDockerTooling" | "tooling" | null;
|
|
};
|
|
|
|
export function createEmptyChangedLanes(): ChangedLanes;
|
|
export function isChangedLaneTestPath(changedPath: string): boolean;
|
|
export function detectChangedLanes(
|
|
changedPaths: string[],
|
|
options?: DetectChangedLanesOptions,
|
|
): ChangedLaneResult;
|
|
export function detectChangedLanesForPaths(params: {
|
|
paths: string[];
|
|
base: string;
|
|
head?: string;
|
|
staged?: boolean;
|
|
mergeHeadFirstParent?: boolean;
|
|
}): ChangedLaneResult;
|
|
export function listChangedPathsFromGit(params: {
|
|
base: string;
|
|
head?: string;
|
|
includeWorktree?: boolean;
|
|
cwd?: string;
|
|
mergeHeadFirstParent?: boolean;
|
|
}): string[];
|
|
export function listStagedChangedPaths(cwd?: string): string[];
|
|
export function hasDeadcodeScannedSource(changedPaths: string[]): boolean;
|
|
export function isLiveDockerPackageScriptOnlyChange(before: string, after: string): boolean;
|
|
export function isPackageScriptOnlyChange(before: string, after: string): boolean;
|
|
|
|
export const LIVE_DOCKER_AUTH_SHELL_TARGETS: string[];
|
|
export const RELEASE_METADATA_PATHS: Set<string>;
|