Skip to content

Commit cdb3cb4

Browse files
committed
Merge remote-tracking branch 'origin/master' into mb/ReduceReuse♻
2 parents 5f8c6a3 + 5416edb commit cdb3cb4

File tree

399 files changed

+9073
-4719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

399 files changed

+9073
-4719
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CODEOWNERS @JuliaLang/github-actions
44

55
/.github/workflows/rerun_failed.yml @DilumAluthge
66
/.github/workflows/statuses.yml @DilumAluthge
7+
/.github/workflows/PrAssignee.yml @LilithHafner @DilumAluthge
78
/base/special/ @oscardssmith
89
/base/sort.jl @LilithHafner
910
/test/sorting.jl @LilithHafner

.github/workflows/PrAssignee.yml

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
name: PR Assignee
2+
on:
3+
# Important security note: Do NOT use `actions/checkout`
4+
# or any other method for checking out the pull request's source code.
5+
# This is because the pull request's source code is untrusted, but the
6+
# GITHUB_TOKEN has write permissions (because of the `on: pull_request_target` event).
7+
#
8+
# Quoting from the GitHub Docs:
9+
# > For workflows that are triggered by the pull_request_target event, the GITHUB_TOKEN is granted
10+
# > read/write repository permission unless the permissions key is specified and the workflow can access secrets,
11+
# > even when it is triggered from a fork.
12+
# >
13+
# > Although the workflow runs in the context of the base of the pull request,
14+
# > you should make sure that you do not check out, build, or run untrusted code from the pull request with this event.
15+
#
16+
# Source: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
17+
#
18+
# See also: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
19+
pull_request_target:
20+
types: [opened, reopened, ready_for_review]
21+
22+
# Permissions for the `GITHUB_TOKEN`:
23+
permissions:
24+
pull-requests: write # Needed in order to assign a user as the PR assignee
25+
26+
jobs:
27+
pr-assignee:
28+
runs-on: ubuntu-latest
29+
if: ${{ github.event.pull_request.draft != true }}
30+
steps:
31+
# Important security note: As discussed above, do NOT use `actions/checkout`
32+
# or any other method for checking out the pull request's source code.
33+
# This is because the pull request's source code is untrusted, but the
34+
# GITHUB_TOKEN has write permissions (because of the `on: pull_request_target` event).
35+
- name: Add Assignee
36+
# We pin all third-party actions to a full length commit SHA
37+
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions
38+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
39+
with:
40+
retries: 5 # retry GitHub API requests up to 5 times, with exponential backoff
41+
retry-exempt-status-codes: 404
42+
# Don't retry 404 because we will hit a 404 when the PR author is a committer.
43+
# This 404 is normal and expected.
44+
# Do retry 400 and other 4xx errors because github sometimes (erroneously)
45+
# returns a 4xx error code due to server errors.
46+
script: |
47+
const oldPrAssignees = context.payload.pull_request.assignees
48+
.map(obj => obj.login)
49+
console.log('oldPrAssignees: ', oldPrAssignees);
50+
const prAuthor = context.payload.pull_request.user.login;
51+
52+
// Check if the PR is opened by a collaborator on the repo, aka someone with write (commit) permissions or higher.
53+
const relevantPerms = [
54+
// 'triage', // Uncomment this line if you don't want PRs from triagers to get auto-assignees.
55+
'push',
56+
'maintain',
57+
'admin',
58+
]
59+
const allCollaboratorsNestedPromises = relevantPerms.map(
60+
(perm) => github.paginate(
61+
// We use the `/repos/{owner}/{repo}/collaborators` endpoint to avoid needing org scope permissions:
62+
'/repos/{owner}/{repo}/collaborators',
63+
{
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
per_page: 100,
67+
permission: perm,
68+
},
69+
(response) => response.data.map((collaboratorInfo) => collaboratorInfo.login),
70+
)
71+
)
72+
const allCollaboratorsNested = await Promise.all(allCollaboratorsNestedPromises);
73+
const allCollaboratorsFlattened = allCollaboratorsNested.flat();
74+
75+
// Skip BumpStdlibs.jl PRs
76+
allCollaboratorsFlattened.push('DilumAluthgeBot');
77+
// Skip Dependabot PRs
78+
allCollaboratorsFlattened.push('dependabot');
79+
80+
const isCollaborator = allCollaboratorsFlattened.includes(prAuthor);
81+
82+
console.log('prAuthor: ', prAuthor);
83+
console.log('isCollaborator: ', isCollaborator);
84+
85+
// Load the list of assignable reviewers from the JuliaLang/pr-assignment repo at:
86+
// https://github.com/JuliaLang/pr-assignment/blob/main/users.txt
87+
//
88+
// NOTE to JuliaLang committers: If you want to be assigned to new PRs, please add your
89+
// GitHub username to that file.
90+
91+
// Load file contents
92+
const { data: fileContentsObj } = await github.rest.repos.getContent({
93+
owner: 'JuliaLang',
94+
repo: 'pr-assignment',
95+
path: 'users.txt',
96+
ref: 'main',
97+
});
98+
99+
const fileContentsBufferObj = Buffer.from(fileContentsObj.content, "base64");
100+
const fileContentsText = fileContentsBufferObj.toString("utf8");
101+
102+
// Find lines that match the following regex, and extract the usernames:
103+
const regex = /^@([a-zA-Z0-9\-]+)(\s*?)?(#[\S]*?)?$/;
104+
const assigneeCandidates = fileContentsText
105+
.split('\n')
106+
.map(line => line.trim())
107+
.map(line => line.match(regex))
108+
.filter(match => match !== null)
109+
.map(match => match[1]);
110+
111+
console.log('assigneeCandidates: ', assigneeCandidates);
112+
if (assigneeCandidates.length < 1) {
113+
const msg = 'ERROR: Could not find any assigneeCandidates';
114+
console.error(msg);
115+
throw new Error(msg);
116+
}
117+
118+
if (oldPrAssignees.length >= 1) {
119+
console.log('Skipping this PR, because it already has at least one assignee');
120+
return;
121+
}
122+
123+
124+
const RUNNER_DEBUG_original = process.env.RUNNER_DEBUG;
125+
console.log('RUNNER_DEBUG_original: ', RUNNER_DEBUG_original);
126+
if (RUNNER_DEBUG_original === undefined) {
127+
var thisIsActionsRunnerDebugMode = false;
128+
} else {
129+
const RUNNER_DEBUG_trimmed = RUNNER_DEBUG_original.trim().toLowerCase()
130+
if (RUNNER_DEBUG_trimmed.length < 1) {
131+
var thisIsActionsRunnerDebugMode = false;
132+
} else {
133+
var thisIsActionsRunnerDebugMode = (RUNNER_DEBUG_trimmed == 'true') || (RUNNER_DEBUG_trimmed == '1');
134+
}
135+
}
136+
console.log('thisIsActionsRunnerDebugMode: ', thisIsActionsRunnerDebugMode);
137+
138+
if (isCollaborator == true) {
139+
140+
if (thisIsActionsRunnerDebugMode) {
141+
// The PR author is a committer
142+
// But thisIsActionsRunnerDebugMode is true, so we proceed to still run the rest of the script
143+
console.log('PR is authored by JuliaLang committer, but thisIsActionsRunnerDebugMode is true, so we will still run the rest of the script: ', prAuthor);
144+
} else {
145+
// The PR author is a committer, so we skip assigning them
146+
console.log('Skipping PR authored by JuliaLang committer: ', prAuthor);
147+
console.log('Note: If you want to run the full script (even though the PR author is a committer), simply re-run this job with Actions debug logging enabled');
148+
return;
149+
}
150+
}
151+
152+
var weDidEncounterError = false;
153+
154+
// Assign random committer
155+
const selectedAssignee = assigneeCandidates[Math.floor(Math.random()*assigneeCandidates.length)]
156+
console.log('selectedAssignee: ', selectedAssignee);
157+
console.log(`Attempting to assign @${selectedAssignee} to this PR...`);
158+
await github.rest.issues.addAssignees({
159+
owner: context.repo.owner,
160+
repo: context.repo.repo,
161+
issue_number: context.payload.pull_request.number,
162+
assignees: selectedAssignee,
163+
});
164+
165+
// The following is commented out because the label only makes sense in the presence of a larger state machine
166+
// // Add the "pr review" label
167+
// const prReviewLabel = 'status: waiting for PR reviewer';
168+
// console.log('Attempting to add prReviewLabel to this PR...');
169+
// await github.rest.issues.addLabels({
170+
// owner: context.repo.owner,
171+
// repo: context.repo.repo,
172+
// issue_number: context.payload.pull_request.number,
173+
// labels: [prReviewLabel],
174+
// });
175+
176+
// Now get the updated PR info, and see if we were successful:
177+
const updatedPrData = await github.rest.pulls.get({
178+
owner: context.repo.owner,
179+
repo: context.repo.repo,
180+
pull_number: context.payload.pull_request.number,
181+
});
182+
const newPrAssignees = updatedPrData
183+
.data
184+
.assignees
185+
.map(element => element.login)
186+
console.log('newPrAssignees: ', newPrAssignees);
187+
if (newPrAssignees.includes(selectedAssignee)) {
188+
console.log(`Successfully assigned @${selectedAssignee}`);
189+
} else {
190+
weDidEncounterError = true;
191+
console.log(`ERROR: Failed to assign @${selectedAssignee}`);
192+
}
193+
// const newPrLabels = updatedPrData
194+
// .data
195+
// .labels
196+
// .map(element => element.name)
197+
// console.log('newPrLabels: ', newPrLabels);
198+
// if (newPrLabels.includes(prReviewLabel)) {
199+
// console.log('Successfully added prReviewLabel');
200+
// } else {
201+
// weDidEncounterError = true;
202+
// console.log('ERROR: Failed to add add prReviewLabel');
203+
// }
204+
205+
// Exit with error if any problems were encountered earlier
206+
if (weDidEncounterError) {
207+
const msg = 'ERROR: Encountered at least one problem while running the script';
208+
console.error(msg);
209+
throw new Error(msg);
210+
}

.github/workflows/Typos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
timeout-minutes: 5
1212
steps:
1313
- name: Checkout the JuliaLang/julia repository
14-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
14+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515
with:
1616
persist-credentials: false
1717
- name: Check spelling with typos

.github/workflows/Whitespace.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
timeout-minutes: 2
1616
steps:
1717
- name: Checkout the JuliaLang/julia repository
18-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
with:
2020
persist-credentials: false
21-
- uses: julia-actions/setup-julia@9b79636afcfb07ab02c256cede01fe2db6ba808c # v2.6.0
21+
- uses: julia-actions/setup-julia@5c9647d97b78a5debe5164e9eec09d653d29bd71 # v2.6.1
2222
with:
2323
version: '1'
2424
- name: Check whitespace

.github/workflows/cffconvert.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Check out a copy of the repository
26-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
with:
2828
persist-credentials: false
2929

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
/usr-staging
1010
/Make.user
1111
/julia-*
12+
/deps/jlutilities/depot
1213
/source-dist.tmp
1314
/source-dist.tmp1
1415
/test/results_*.json
1516
/test/results_*.dat
17+
/test/deps
1618

1719
*.expmap
1820
*.exe

AGENTS.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Information for AI agents
2+
3+
## Module Organization
4+
- `base/` - Core standard library (loaded at startup)
5+
- `stdlib/` - Standard library packages (can be loaded independently)
6+
- `Compiler/` - Julia compiler as a separate module (can be swapped)
7+
- `src/` - C/C++ runtime and LLVM codegen
8+
- `cli/` - Command-line interface and loader
9+
- `doc/` - Documentation and User Manual
10+
11+
## Running Julia
12+
13+
You should have a recent binary copy of julia in your `$HOME/.juliaup/bin` directory.
14+
You may use this julia executable for validation.
15+
If a built version of Julia exists in the current source tree (at `usr/bin/julia`),
16+
prefer that version.
17+
Note that any changes you make to the source code after the binary is built
18+
will not be reflected, unless you use `Revise`.
19+
20+
## For all changes
21+
22+
1. Run `make check-whitespace` before creating the PR to make sure you're not committing any whitespace errors.
23+
24+
## Building Julia
25+
26+
If you made changes to the runtime (any files in `src/`), you will need to rebuild
27+
julia. Run `make -j` to rebuild julia. This process may take up to 10 minutes
28+
depending on your changes.
29+
30+
## Using Revise
31+
32+
If you have made changes to files included in the system image (base/ or stdlib/),
33+
and need to run code with these changes included, you can use `Revise`.
34+
To do so, run `using Revise; Revise.track(Base)` (or Revise.track with the stdlib you modified).
35+
The test system supports doing this automatically (see below).
36+
37+
## Specific instructions for particular changes
38+
39+
### Doctests
40+
41+
#### Writing doctests
42+
43+
If you are asked to write new doctests, first review `doc/src/devdocs/contributing/jldoctests.md`
44+
for best practices.
45+
46+
#### Verifying doctests
47+
If you have changed any `jldoctest` code blocks you should take
48+
the following steps to verify your work:
49+
- Review `doc/src/devdocs/contributing/jldoctests.md`. In particular, determine
50+
if any of the changed doctests require filters, labels or setup code.
51+
- Run the doctests to verify that your change works:
52+
- To run doctest with the pre-built juliaup: `make -C doc doctest=true revise=true JULIA_EXECUTABLE=$HOME/.juliaup/bin/julia`
53+
- To run doctest with in-trr julia (preferred): `make -C doc doctest=true revise=true`. Do not pass any other options.
54+
- IMPORTANT: The doctests may take up to 15 minutes. Do NOT terminate the doctests before completion. Do NOT use a timeout for doctests.
55+
- If you are ChatGPT, you may have to increase yield_timeout_ms.
56+
57+
Follow these steps for EVERY change you make in a doctest.
58+
59+
### Test changes
60+
61+
If you have changed a test (e.g. `foo`), you should run `make test-revise-foo` for the
62+
corresponding test to ensure that the test is still passing with your changes.
63+
- If you are adding a new test, add it to an existing test file. Do not create a new test file unless explicitly instructed.
64+
- Write one comment at the top of the test to explain what is being tested.
65+
Otherwise keep comments minimal.
66+
- Use the environment variable `JULIA_TEST_FAILFAST=1` to make tests fail fast.
67+
68+
### External dependencies
69+
70+
When modifying external dependencies (patches in `deps/patches/` or version updates in `deps/`):
71+
72+
1. Always test builds with `USE_BINARYBUILDER=0` to ensure source builds work correctly
73+
2. For patches to external libraries:
74+
- Verify the patch applies cleanly by running the extraction and patch steps
75+
- Test the full build of the dependency: `make -C deps USE_BINARYBUILDER=0 compile-<depname>`
76+
- Prefer using the full upstream commit in `git am` format (e.g., `git format-patch`) which includes proper commit metadata
77+
3. When updating dependency versions, ensure all associated patches still apply
78+
79+
### Writing code
80+
After writing code, look up the docstring for each function you used. If there
81+
are recommendations or additional considerations that apply to these functions,
82+
make sure to take them into account.
83+
84+
#### Specific instructions
85+
- Do not `ccall` runtime C functions directly if there are existing wrappers for the function.
86+
- Do not explicitly add a module prefix if the code you're adding is in the same module. E.g. do not use `Base.` for code in Base unless required.
87+
88+
## Commit message formatting
89+
90+
When writing commit messages, follow the format "component: Brief summary" for
91+
the title. In the body of the commit message, provide a brief prose summary
92+
of the purpose of the changes made. Do not specifically mention added tests, comments,
93+
documentation, etc., unless this is the main purpose of the change. Do not mention
94+
the test plan, unless it differs from what you were instructed to do in AGENTS.md.
95+
If your change fixes one or more issues, use the syntax "Fixes #" at the end of the commit message, but do not include it in the title.
96+
97+
When referencing external GitHub PRs or issues, use proper GitHub interlinking format (e.g., `owner/repo#123` for PRs/issues).
98+
When fixing CI failures, include the link to the specific CI failure in the commit message.
99+
100+
When creating pull requests, if the pull request consists of one commit only,
101+
use the body of the commit for the body of the pull request. If there are multiple
102+
commits in the pull request, follow the same guidelines for the pull request
103+
as for the commit body.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)