Skip to content

Expose build diagnostics through buildWithOutcome - #128

Open
mike-north wants to merge 46 commits into
mainfrom
fix/build-validation-outcome
Open

mike-north wants to merge 46 commits into
mainfrom
fix/build-validation-outcome

Conversation

@mike-north

@mike-north mike-north commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

buildWithOutcome(path, options?) returns per-plugin build results and standalone validation, including artifact freshness and the published-surface check. For regular files, directories, and symlinks to them, a passing outcome matches origin/main running build() followed by validate(). Byte comparisons use the same generator version. When freshness regeneration fails, legacy validate() removes only the temporary bundle directory it created. The public API adds buildWithOutcome, BuildOutcome, and BuildFreshnessIoFinding.

Repository reads

  • The reader calls the same Node filesystem operations as build and validation. A denied aipm.repo.ts lookup keeps its ERR_ACCESS_DENIED rejection. Registry generation writes the destination without a presence check. Bundle generation keeps native file copies. When a bundle copy fails, any exception from the diagnostic source read produces a finding at the source path. Destination errors still reject with the original copy error. Temporary Gemini and Kiro bundle generation cleans up partial output if it throws.
  • A read exception produces a hard freshness-io finding naming the lookup path. These findings carry no plugin field and make a returned outcome fail. The reader preserves the native results of presence checks and missing optional inputs. Node can report absence for dangling or inaccessible entries. Repeated failures at the same path and error code produce one finding. An operation on a shared parent reports that lookup. Child lookups report their own paths. Sibling findings after a read failure are best effort. With failFast: true, the outcome rethrows the original build or validation error, preserving its prototype, message, and cause. Recorded diagnostics are attached as error.findings.
  • Outcome validation checks the resolved default of a present config. Config load and schema failures produce hard freshness-io findings naming the config path and prevent a passing outcome. The defaults for an absent repo config are unchanged. Node’s filesystem exports and Jiti retain their existing behavior.

Core lint

  • Core production lint passes exactly the parsed core TypeScript project’s file list to ESLint. A separate ESLint invocation in pnpm check covers core tests and test support with the existing rules, including cross-target import isolation. pnpm check fails if the resolved program reaches a package-owned file outside that list. The fixture rejects an import-only declaration, explicitly includes it, and compares the linted file paths with the parsed project paths.
  • Repository contents, listings, presence checks, and stats carry reader brands. Repo and workspace config presence helpers return the reader’s presence result. Build and validation modules unwrap them through reader accessors and can pass text to helpers for positions, hashing, and generator versions.
  • Outside the reader, ESLint blocks imports, re-exports, and requires of fs, fs/promises, node:fs, node:fs/promises, module, and node:module, including type imports. Dynamic imports and requires use string literal specifiers. The rule forbids aliases of require and the names getBuiltinModule and loadEnvFile, including as identifiers, keys, string literals, and template literals. Reader factories and pipeline entry points have designated callers. Core production code uses @typescript-eslint/consistent-type-assertions with assertionStyle: 'never', which allows as const.

The reader’s scope excludes the config module and its imports, reads Jiti performs for them, subprocess reads, and special filesystem entries. The lint contract covers the listed rules. Deliberate circumvention through other APIs, type-level tricks, and brand forgery are outside its scope. Parsed documents, converted hooks, validated config, registry entries, artifacts, ownership records, and evidence passed between internal functions are outside reader provenance.

Verification

  • Compiled parity compares the thrown prototype, message, and cause against origin/main for a Claude manifest directory and a plugin config with an invalid version. It checks the reported freshness-io findings separately.
  • The lint fixtures verify the parsed production file list and require diagnostics in a core target test and a test-support file. The fail-fast and lint regressions fail against b962d03.
  • The cleanup fixture invokes the compiled freshness regeneration and repo-root bundling helpers with a malformed Gemini bundle. It observes creation of both temporary directories, checks the EISDIR destinations, and verifies both scratch directories are empty after rejection. Removing freshness cleanup from the compiled helper causes the fixture to fail.
  • The source-archive fixture verifies that CI fails when the compiled baseline is missing.
  • For 266835a, pnpm install --frozen-lockfile, pnpm build, pnpm check, pnpm test, and the standalone compiled parity suite passed with CI unset and with CI=1. Both modes used pnpm 10.30.3, Node 24.22.3, template b6aca5a, separate temporary directories, an unset CODEX_HOME, and disabled Nx caching.
  • Each full run passed 1,503 core tests and 107 CLI tests, with two Cursor shim tests skipped. All 151 standalone compiled tests passed in each mode against a separate build of origin/main at a2bf182.

@mike-north mike-north changed the title Return validation diagnostics from builds Expose build diagnostics through buildWithOutcome Nov 26, 2026
Recompute expected repo-root artifacts during CLI reporting. Retain structural findings and readable bundle drift when validation encounters filesystem errors.
Keep manifest lookup paths intact, check filesystem imports from the public build outcome, and attribute temporary root bundle diagnostics to their declaring plugin.
Observe the source read during Jiti config imports and require the compiled main baseline in CI.
Require repository inputs at parsers and transformers and keep config evaluation failures in build outcomes.
Resolve readable symlink components for freshness findings and register bundle owners from declared targets. Use TypeScript ESLint to reject assertions in core.
Keep one discovered name per plugin directory, refresh bundle ownership after cleanup, and pass branded copy presence to the Kiro bundler. Apply the repository reader rules to all core TypeScript sources and check the restricted built-in modules directly.
Keep generated artifacts and registries out of plugin attribution. Align repository reader lint with the core project, use cached source for skill references, and compare bundle buffers directly.
Carry failFast into standalone validation and report filesystem errors by the path read. Remove plugin lookup from freshness findings, select lint files from the core TypeScript project, and exercise both freshness severities.
Pass TypeScript project files to ESLint and resolve reader entry points with native paths. Deduplicate freshness findings by lookup path, align the architecture example with the public type, and typecheck test sources during pnpm check.
Include the lookup path in freshness findings and retain the stat error for symlink targets. Brand optional stats, text, and resolved paths until the caller uses the reader accessor.

Resolve pipeline entry imports against the importing file.
Keep TypeScript project files visible to ESLint and fail on skipped-file warnings. Compare bundle files with reader bytes on both sides and clarify the Cursor converter and Claude artifact serializer.
Keep the config validators internal and check the Claude registry description through both core build APIs and the CLI. Document when artifact bytes match across builds.
Lint explicit core project files and verify returned validation across target inputs. Let local workspace checks run from source archives.
Keep native rejection fields and report failed bundle source reads. Preserve config presence through discovery, use the core project file list for lint, and clean up failed temporary bundles.

This branch has not been deployed

No deployments
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