Skip to content

Use module identity for Events configuration round trips - #8666

Closed
dpeacock wants to merge 7 commits into
dp-module-transform-contextfrom
dp-events-identity-transform-context
Closed

dpeacock wants to merge 7 commits into
dp-module-transform-contextfrom
dp-events-identity-transform-context

Conversation

@dpeacock

@dpeacock dpeacock commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Complete #8426's Events pull/deploy round trip using module-only object identity while preserving legacy list handles, subscription counts and effective API versions.

WHAT is this pull request doing?

Use the readonly module identity provided by #8674 to reconstruct Events editing handles, normalize them before fetched strict-schema validation, and omit duplicate identity from outgoing object config. Preserve explicit empty-list clearing and effective versions across modules.

This is the Events consumer of #8674; generic types, callers and context tests are reviewed there. The combined production code is unchanged from the previously validated B prototype. Published history is preserved.

Validation

  • Events-only diff: eight files, +949/−123; original transform-test structure preserved and integration scaffolding consolidated.
  • 3,000 app tests passed, 2 skipped; package type-check and lint pass.
  • Real fetched-schema/TOML/manifest/no-op regressions retained. Independent split review found no blockers; generic coverage moved into the prerequisite.

Alternative B remains separate from A and C, not intended to merge alongside them. Writer gates are unchanged; CLI-team agreement, migration continuity and live Core UUID behavior remain outstanding. No public changeset while this remains a prototype.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact

rezaansyed and others added 4 commits September 21, 2026 08:14
…uration

Assisted-By: devx/aa56a38c-289a-416e-8a9a-0de281e4e3e7
…vents configuration

Assisted-By: devx/aa56a38c-289a-416e-8a9a-0de281e4e3e7
…g or environment opt-in

Assisted-By: devx/aa56a38c-289a-416e-8a9a-0de281e4e3e7
Supply minimal readonly module identity to reverse transforms in both
remote reconstruction and local deploy comparison. Events uses outer
object identity without persisting a redundant nested handle, preserves
effective versions and empty lists, and validates normalized configs
against the fetched strict contract before serialization.

This sibling alternative on events-subscription-fanout preserves rollout
gates. Real TOML, manifest, fetched-contract and no-op tests cover the
round trip; the generic context boundary still needs CLI-team approval.
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Sep 25, 2026
Restore the original transform-test structure and apply only necessary
contract changes, so reviewers can see what behavior actually differs.
Consolidate the duplicated parser and empty-list integration scaffolding
while retaining strict fetched-schema, real TOML, manifest and no-op checks.

Production code and the strict schema fixture are unchanged. Independent
coverage review, full app tests, type-check, lint and targeted mutation
checks verify that the important regression guards remain effective.
Pass optional readonly module identity through the existing reverse
transform options in both remote reconstruction and local deploy
comparison. Specifications can use envelope identity without adding
feature-specific branches to generic callers.

Keep this framework capability independent of Events adoption. A synthetic
specification verifies both identity sources and unchanged config output;
existing transforms do not need to consume the new context.
Make the extracted framework capability an ancestor of the Events
prototype, so reviewers can discuss the generic context independently
and review this PR against that prerequisite. Preserve published branch
history rather than force-rewriting the existing draft.

Move generic context coverage into the prerequisite while retaining the
Events round-trip and strict-contract tests here. The combined production
code is unchanged from the previously validated Events prototype.
@dpeacock dpeacock changed the title Prototype Events identity with generic transform context Use module identity for Events configuration round trips Sep 25, 2026
@dpeacock
dpeacock changed the base branch from events-subscription-fanout to dp-module-transform-context September 25, 2026 13:24
@github-actions

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/api.d.ts
@@ -37,21 +37,6 @@ export declare function isTransientNetworkError(error: unknown): boolean;
  * - Permanent: certificate validation failures, misconfigured SSL
  */
 export declare function isNetworkError(error: unknown): boolean;
-/**
- * Checks if an error is an aborted request: a user cancelling the command, the host process
- * cancelling it, or one of the CLI's own request timeouts firing.
- *
- * Not used by the retry logic, because a user-cancelled request must not be retried.
- * `isTransientNetworkError` separately matches the CLI's own timeout message, so timeouts do
- * still retry.
- *
- * The `name` check matches the `AbortError` shape that fetch throws, not cli-kit's own
- * `AbortError`, which leaves `name` as 'Error'.
- *
- * @param error - Error to be checked.
- * @returns A boolean indicating if the request was aborted.
- */
-export declare function isAbortedFetchError(error: unknown): boolean;
 export declare function simpleRequestWithDebugLog<T extends {
     headers: Headers;
     status: number;
packages/cli-kit/dist/public/node/local-storage.d.ts
@@ -48,7 +48,6 @@ export declare class LocalStorage<T extends Record<string, any>> {
      *
      * @param error - The error that occurred.
      * @param operation - The operation that failed.
-     * @param configPath - The local storage configuration file path.
      * @throws AbortError if the error is permission-related.
      * @throws BugError if the error is not permission-related.
      */
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -11,12 +11,6 @@ export declare function isTerminalInteractive(): boolean;
  * @returns The path to the user's home directory.
  */
 export declare function homeDirectory(): string;
-/**
- * Clears the memoized result of isUnitTest so the environment variable is re-read.
- *
- * Only intended for test helpers that temporarily toggle unit-test detection.
- */
-export declare function resetMemoizedIsUnitTest(): void;
 /**
  * Returns true if the CLI is running in debug mode.
  *
packages/cli-kit/dist/public/node/testing/output.d.ts
@@ -8,36 +8,6 @@ interface OutputMock {
     error: () => string;
     clear: () => void;
 }
-interface StandardStreamsMock {
-    stdout: () => string;
-    stderr: () => string;
-    restore: () => void;
-}
-export interface CapturedStandardStreams {
-    stdout: () => string;
-    stderr: () => string;
-}
-/**
- * Runs a callback with process stdout/stderr captured and unit-test output suppression disabled,
- * so tests can assert on what a command actually writes to the standard streams.
- *
- * The callback receives accessors instead of the function returning captured output so that
- * assertions remain possible when the callback throws (for example commands that abort).
- * Streams, console.warn and unit-test detection are restored afterwards.
- * Not safe for concurrent tests.
- *
- * @param run - Callback receiving accessors for the captured stdout and stderr.
- * @returns The value returned by the callback.
- */
-export declare function withCapturedStandardStreams<T>(run: (streams: CapturedStandardStreams) => T | Promise<T>): Promise<T>;
-/**
- * Captures writes to stdout and stderr, including console warnings intercepted by Vitest.
- * Call restore in a finally block. This replaces process globals and must not be used in concurrent tests.
- * Prefer withCapturedStandardStreams, which also disables unit-test output suppression while it runs.
- *
- * @returns Captured output and a function to restore the original writers.
- */
-export declare function mockAndCaptureStandardStreams(): StandardStreamsMock;
 /**
  * Returns a set of functions to get the outputs ocurred during a test run.
  *

@dpeacock
dpeacock force-pushed the dp-module-transform-context branch from 935bbd0 to 54e984d Compare September 25, 2026 16:53
@dpeacock dpeacock closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants