Skip to content

todo: separate private types into private.ts - #1740

Merged
sergey-shandar merged 31 commits into
mainfrom
todo/private-types-ts
Aug 27, 2026
Merged

todo: separate private types into private.ts#1740
sergey-shandar merged 31 commits into
mainfrom
todo/private-types-ts

Conversation

@sergey-shandar

Copy link
Copy Markdown
Contributor

Summary

Add a repository-wide TODO for separating private named types into private.ts while preserving the leading _ convention.

The TODO defines the intended source/package boundary:

  • types.ts contains public types;
  • private.ts contains _-prefixed private types used by implementation/proofs;
  • private.ts is type-checked but neither private.ts nor private.d.ts is shipped;
  • shipped generated declarations such as module.f.d.mts must not reference private artifacts.

It also links the existing declaration-leak detection, file-convention, migration, and package-support TODOs.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc1b5f3ad2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
functionalscript 21c444e Commit Preview URL

Branch Preview URL
Aug 27 2026, 06:11 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fbe4f4811b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1154ec6a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: beef545757

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated
Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bddb33754

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18ab3d91a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated
Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ddac53c1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated
Comment thread fjs/todo/separate-private-types.md Outdated

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to address before this lands.

The document proposes eliminating a leak that this repo already decided to tolerate, without saying so. fjs/fsc/README.md:129-150 records the underscore prefix as a deliberate interim convention — "The underscore is an API contract, not declaration-level visibility… renaming or removing a _-prefixed alias is not a breaking change" — and ties the wait to microsoft/TypeScript#46407 for @internal/stripInternal. This proposal argues for physical separation instead, but never cites that rule, the upstream issue, or why physical separation is now preferred over waiting. I checked at the current head 32eec933d: separate-private-types.md contains no mention of fsc/README, 46407, stripInternal or @internal. A reader arriving from fsc/README.md will find two live answers and no way to tell which governs.

The premises themselves hold — I verified them at 3ddac53c1: a file-scope JSDoc @typedef does surface as export type _Name in generated declarations (fjs/crypto/sha2/module.f.d.mts:17-19 yields _V3, _V4, _BaseInit), private types in types.ts do ship (fjs/asn.1/types.d.ts:11 exports _Tag), and the quoted prepack script matches package.json:13 exactly. All citations and relative links resolve, the shape matches its fjs/todo/*.md siblings, Status: open with everything unchecked, and omitting the changelog is correct for a todo/-only PR. Gates at 3ddac53c1: npm test 3470/3470 exit 0, tsc --noEmit exit 0, identical to main.

Note those verifications predate the rewrite in c64c52e19/de513977f/32eec933d, which reworked 232 lines — I have not re-checked the premises against the new text, only the missing reconciliation above.

Copy link
Copy Markdown
Contributor Author

Addressed the review about the existing _ leak-tolerance policy. The TODO now explicitly cites fjs/fsc/README.md, todo/blocked/jsdoc-typedef-strip-internal.md, and microsoft/TypeScript#46407, and explains the transition: the current _-prefixed leaked-declaration convention remains authoritative until this migration is implemented; this TODO intentionally replaces that wait-for-upstream workaround for file-scope implementation-private types with private.ts + package cleanup. The implementation tasks now require updating fjs/fsc/README.md and deleting or narrowing the blocked @internal/stripInternal TODO so the repository does not retain two conflicting strategies.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89e33c10ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The reconciliation closes my finding: the document now cites fjs/fsc/README.md:129-150, says plainly which policy governs today — "That policy remains authoritative until this migration is implemented" — and carries the fix as a real unchecked task (- [ ] Reconcile the implemented convention with the current private-JSDoc policy: update fjs/fsc/README.md …, line 315) echoed in the acceptance criteria, rather than as prose. Verified at 89e33c10e: npm test 3472/3472 exit 0 and tsc --noEmit exit 0, identical to main; the branch's own diff against main is still just fjs/todo/separate-private-types.md; all six links resolve, and microsoft/TypeScript#46407 is indeed open ("Support stripInternal for types in JSDoc").

The "moving a meta constant is a breaking change" rule is correct, and if anything understated: package.json has no exports map and no main, only files globs, so consumers import by literal deep path and there is no subpath indirection that could preserve the old specifier.

One small asymmetry, not worth holding the PR for: the pointer is one-directional. fsc/README.md is untouched and still states the old policy unqualified, so a reader who lands there first gets no hint it is under active reconsideration. Fine while the todo owns the change — a one-line forward reference would close the loop.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0401908595

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8622f5a1cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59c146826b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval still stands. Verified at 8622f5a1c: npm test 3472/3472 exit 0, tsc --noEmit exit 0, branch diff against main still only fjs/todo/separate-private-types.md, no changelog owed, Status: open with 21 unchecked tasks.

Both commitments survive the third rewrite: "That policy remains authoritative until this migration is implemented" at line 251, and the fjs/fsc/README.md update plus deleting-or-narrowing todo/blocked/jsdoc-typedef-strip-internal.md still an unchecked task at lines 276-278.

The widening from .f.mjs to all .mjs is true, and I checked it by emitting rather than reasoning: after purging declarations and running tsc --noEmit false --emitDeclarationOnly, fjs/website/browser-prepare.mjs:28 — a plain .mjs — has a file-scope @typedef … _Module and fjs/website/browser-prepare.d.mts:2 emits export type _Module. Same leak in effects/node/module.mjs (_Socket, _Readable) and effects/node/memory/module.mjs.

One thing worth naming for the record: the meta.f.mjs clarification is forward-looking — no meta.f.mjs exists in the repo yet, so it is a self-consistency fix to the document's earlier "coverage must include it" wording rather than a claim about current behaviour. It contradicts nothing, but it is not empirically checkable today.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a948de0bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01e4309176

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d839d99bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 114fd58b7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread fjs/todo/separate-private-types.md Outdated
private.ts # other implementation-private file-scope types
```

No authored `.mjs` file anywhere in the repository may declare a **file-scope**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move the repository-wide issue to the root tracker

This proposal explicitly governs root-level files such as todo/proof.f.mjs, updates root AGENTS.md, and applies to every authored .mjs, so it is not scoped to the fjs/ tree. todo/README.md reserves the root todo/ for issues spanning unrelated modules, while fjs/todo/ is for cross-cutting concerns within fjs; keeping this file here makes the repository-wide migration undiscoverable at its prescribed owning level. Move it to todo/separate-private-types.md and update its relative links.

AGENTS.md reference: AGENTS.md:L47-L56

Useful? React with 👍 / 👎.

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval still stands. Verified at 114fd58b7: npm test 3472/3472 exit 0, tsc --noEmit exit 0, branch diff still only fjs/todo/separate-private-types.md, no changelog owed, links resolve and shape matches its siblings.

Both commitments survive the fourth rewrite: "That policy remains authoritative until this migration is implemented" at line 325, and the fjs/fsc/README.md update plus deleting-or-narrowing todo/blocked/jsdoc-typedef-strip-internal.md still an unchecked task at lines 356-358.

The repo-wide widening is true and was tested on the category it newly covers, not assumed: emitting declarations for todo/proof.f.mjs — a file outside fjs/ — leaks export type _TemplateType into todo/proof.f.d.mts.

The underscore rule for meta constants does not fork the prefix's meaning: fsc/README.md:143 says "The underscore is an API contract, not declaration-level visibility", and the new meta.f.mjs section uses exactly that sense — private by contract, renaming not breaking.

The @import-as-comment rule holds in the compliant case, and the check that convinced me is the failing one: when the imported private type appears only in a non-public position, TypeScript emits it as a comment and a consumer typechecks clean after deleting private.ts; when it leaks into a public signature, TypeScript synthesizes a real import type that breaks resolution — which is precisely the case the document's own public-declaration-closure rule forbids and its validation task exists to catch. The dependency-order claim checks out too: fjs/effects/types.ts:11-13 imports six step functions from ./module.f.mjs purely for ReturnType<typeof …>, a real reverse edge.

Comment thread fjs/todo/separate-private-types.md
@sergey-shandar
sergey-shandar added this pull request to the merge queue Aug 27, 2026

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawing my approval at this head — the two things it rested on are no longer there. Measured at 21c444e0e; gates are fine (npm test 3477/3477 exit 0, tsc --noEmit exit 0, same as main; branch diff still only this file; no changelog owed).

  1. The "which policy governs today" sentence is gone. "That policy remains authoritative until this migration is implemented" was at line 325 at 114fd58b7; grep -n authoritative across both this document and fjs/fsc/README.md now returns nothing. That sentence was the whole answer to my original finding — without it a reader arriving at fsc/README.md is back to two live policies and no tiebreak.

  2. The reconciliation task is no longer falsifiable. It used to name the file and the action: "Update fjs/fsc/README.md and delete or narrow todo/blocked/jsdoc-typedef-strip-internal.md so they no longer prescribe a conflicting private-JSDoc strategy." It is now a generic checkbox at line 241, "Update root/fjs policy documentation and reconcile the old _ leak policy", with the specifics demoted to prose. A reviewer cannot tell whether that box has been earned.

Restoring both — the authoritative-until sentence, and the task with its file names and the delete-or-narrow action — puts this back where I approved it.

Separately, worth deciding deliberately rather than by drift: 1e69c5ac5 and e785b3b61 turn private.ts and meta/ from convention into "optional tool… use only when useful". The two hard rules survive unweakened — no file-scope @typedef in authored .mjs, and types.ts must not depend on private.ts — so the document is still actionable. But placement is now discretionary, which means a future PR cannot be failed for not using private.ts where it would have helped. If that is the intent, fine; if the point was a convention, the softening undoes it.

The rest checks out: the intra-module chain in 21c444e0e is accurate, the fjs/effects/types.ts:11-13 reverse edge is still present and still true with its task unchecked, all eight links resolve, and Status: open with 15 unchecked tasks.

Merged via the queue into main with commit 4fecc27 Aug 27, 2026
19 checks passed
@sergey-shandar
sergey-shandar deleted the todo/private-types-ts branch August 27, 2026 18:22
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.

2 participants