Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
🟡 Changes recommended
The helper’s documented generic escape hatch is unusable, and the compile-time behavior lacks regression coverage.
2 open findings
What changed in this PR
This PR improves ActionState feature inference for testing utilities and state extension.
Changes:
- Adds phantom feature tracking with
Envimplication handling. - Introduces
extendActionStateand updates three action entry points. - Updates the generated bundle.
| File | Description |
|---|---|
src/action-common.ts |
Adds feature tracking and state extension types. |
src/init-action.ts |
Uses the state extension helper. |
src/setup-codeql-action.ts |
Uses the state extension helper. |
src/start-proxy-action.ts |
Uses the state extension helper. |
lib/entry-points.js |
Generated bundle; excluded from review by policy. |
Files excluded by content exclusion policy (1)
- lib/entry-points.js
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+117
to
+122
| * `Fs[number]` returns the union of all features in `Fs`. We wrap it in `ImpliedFeatures` | ||
| * so that `Env` is expanded into `Env | ReadOnlyEnv`, allowing functions that expect the | ||
| * `ReadOnlyEnv` feature to be provided with an `ActionState` that has the `Env` feature | ||
| * without requiring this to be made explicit. | ||
| */ | ||
| readonly [stateFeatures]?: (ts: ImpliedFeatures<Fs[number]>) => void; |
mario-campos
approved these changes
Oct 9, 2026
This branch has not been deployed
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.


While working on something else, I noticed that type inference for
ActionStatewas broken in some cases. The problem is that, when given a chance, TypeScript will simplify anActionState<Fs>type as much as possible, which results in a concrete object type that doesn't mentionFs. That causes problems for functions which acceptActionState<Fs>values, but need to know the feature keysFssuch as thecalleefunction fromtesting-utils.ts.Assuming that we have a function
test(action: ActionState<["Logger", "Env"]): boolean, then before this change the result ofcallee(test)would be a value of typeCallableEnvBuilder<[], boolean, readonly (keyof FeatureState)[]>. That's no good sincereadonly (keyof FeatureState)[]satisfies anyStateFeature[]constraint and doesn't tell us which features the function actually needs.The fix here is a bit complex, but fundamentally focuses around adding a property to the result of
ActionStatethat tracksFs. That's straight-forward, but we also need to ensure thatActionStatevalues which provide a superset of the required properties can be passed to functions which don't require all of it. That is accomplished by making the extra property a function and tracking the featuresFsin its parameter to exploit the contravariance of function parameters.Finally, we also need to account for
EnvimplyingReadOnlyEnv. That's addressed by expanding"Env"to"Env" | "ReadOnlyEnv"in the tracked features.Extending
ActionStateobjects is also tricky because in e.g. the existing{ ...action, features }constructions,features: FeatureEnablementand so the"Features"key is not mentioned. TheextendActionStatefunction works around that by using a reverse lookup (implemented inFeatureNameFor) to lookup the feature key for a given object.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Environments:
How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist