Skip to content

Create listing only for single exported code ref from source module#4293

Open
tintinthong wants to merge 2 commits intomainfrom
more-than-one-spec-created-for-code-ref
Open

Create listing only for single exported code ref from source module#4293
tintinthong wants to merge 2 commits intomainfrom
more-than-one-spec-created-for-code-ref

Conversation

@tintinthong
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Preview deployments

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the host’s listing creation workflow so spec generation for the primary source module targets a single exported codeRef (module + export name), rather than generating specs for every export in that module.

Changes:

  • Pass the resolved codeRef through to linkSpecs() during listing creation background work.
  • Update linkSpecs() to call CreateSpecCommand with { codeRef } for the main module, and { module } for dependency modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +298 to +303
// For the main module, use the specific codeRef (with export name) so
// only the listed export gets a spec, not every export in the file.
const input =
module === moduleUrl
? { codeRef, targetRealm, autoGenerateReadme: true }
: { module, targetRealm, autoGenerateReadme: true };
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The module === moduleUrl check is brittle because _dependencies results can include executable extensions (e.g. .gts canonical URLs), while codeRef.module/moduleUrl is often extensionless. In that case this loop may create (1) a single spec via codeRef for the extensionless URL and (2) multiple specs via { module } for the .gts URL that points at the same source file, defeating the goal of “only the listed export gets a spec”. Consider normalizing both module and moduleUrl (e.g. trimming executable extensions) before comparison/deduplication, and ensure the main-module variant always uses the codeRef path regardless of extension form.

Copilot uses AI. Check for mistakes.
Comment on lines 296 to +304
const specResults = await Promise.all(
sanitizedModules.map((module) =>
createSpecCommand
.execute({ module, targetRealm, autoGenerateReadme: true })
.catch((e) => {
console.warn('Failed to create spec(s) for', module, e);
return undefined;
}),
),
sanitizedModules.map((module) => {
// For the main module, use the specific codeRef (with export name) so
// only the listed export gets a spec, not every export in the file.
const input =
module === moduleUrl
? { codeRef, targetRealm, autoGenerateReadme: true }
: { module, targetRealm, autoGenerateReadme: true };
return createSpecCommand.execute(input).catch((e: unknown) => {
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This change alters listing creation so the main module’s spec generation is driven by a specific codeRef (single-export) instead of { module } (all exports). Since the repo already has integration coverage for create-specs (including single-export behavior), it would be good to add an integration test for listing-create (or the linkSpecs path) that asserts only one spec is produced for the primary module when multiple exports exist.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Host Test Results

    1 files  ±    0      1 suites  ±0   4h 29m 27s ⏱️ + 2h 14m 38s
2 091 tests  -     4  2 075 ✅  -     5  15 💤 ± 0  0 ❌ ±0  1 🔥 +1 
4 155 runs  +2 060  4 121 ✅ +2 041  30 💤 +15  2 ❌ +2  2 🔥 +2 

For more details on these errors, see this check.

Results for commit 00b4e7f. ± Comparison against base commit 7b7f1ed.

This pull request removes 5 and adds 1 tests. Note that renamed tests count towards both.
Chrome ‑ Unit | query field schema: dereferencing containsMany paths requires numeric indexes
Chrome ‑ Unit | query field schema: dereferencing relationship fields is allowed during validation
Chrome ‑ Unit | query field schema: linksTo and linksToMany queries are preserved when defined inside FieldDefs
Chrome ‑ Unit | query field schema: referencing a missing field in a query raises a descriptive error
Chrome ‑ Unit | query field schema: referencing nested fields validates each segment
Chrome ‑ error

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Realm Server Test Results

  1 files  ±0    1 suites  ±0   11m 53s ⏱️ -34s
828 tests ±0  828 ✅ ±0  0 💤 ±0  0 ❌ ±0 
899 runs  ±0  899 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 00b4e7f. ± Comparison against base commit 7b7f1ed.

♻️ This comment has been updated with latest results.

@tintinthong tintinthong force-pushed the more-than-one-spec-created-for-code-ref branch from 138f481 to 5a37144 Compare April 2, 2026 08:11
@tintinthong tintinthong requested a review from a team April 2, 2026 08:26
@lucaslyl lucaslyl self-requested a review April 2, 2026 09:30
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.

3 participants