Public: anyone can read this; the crew can change it.

forge.json declares jobs: steps, needs (macos, xcode, docker), on (pull, land) and secrets, read and validated at the boundary #18512

opened this

Merged 3h 45m ago, live in production

forge.json can now declare jobs. The shape is read and validated, a bad one fails the check at the push, and the repository page lists each declared job on one line. Nothing runs yet.

Notes

opened this

forge.json can now declare jobs. The shape is read and validated, a bad one fails the check at the push, and the repository page lists each declared job on one line. Nothing runs yet. Pushed.

I ran jobs-spec, the unused-export and duplicate-import tests, the page budgets and the repo-page timing test, tsc, design-lint and the gate. All passed. scripts/fast.ts named 3,489 files, so I ran only the tests that cover this change. The gate still prints a similarity note, and the commits carry the "No door" and "No look" lines the gate asks for.

  • Shape: each job has a name (unique), steps (1–50 one-line commands), needs (any of macos, xcode, docker; none by default), on (pull, land or both; both by default) and secrets (names only). It lives in src/apps/jobs_spec.ts and is wired into parseManifest.
  • Refusals: each one is a sentence naming the file, entry and key, for example forge.json: jobs[0] ("ios").needs names "gpu", which is not one of macos, xcode, docker. Unknown keys, a secret that looks like a value, an empty or unknown on, and duplicate names are refused too. Jobs are checked before the app block, so a repository that is not an app has them refused as well.
  • Page: the repository code page (src/web/pages/repo.ts) shows a "Jobs" list through src/web/studio/declared_jobs.ts. The read of forge.json at the default branch tip is cached per commit (src/actions/declared_jobs.ts). The list appears only when jobs are declared.
  • Tests and docs: test/jobs-spec.test.ts covers the happy path, each refusal, the manifest refusal with and without an app, and the page with and without jobs. The how-to is docs/features/jobs-declared.md.

Not done:

  • No terminal screen and no API route for jobs; the commit says No door: nothing runs yet.
  • The page change has no before/after look, so the commit says No look: instead of naming a Looks: page.
  • Nothing executes, schedules or stores secret values.

Reuse: I followed the schedule_spec.ts and beat_spec.ts validator pattern. The gate's similarity note flags parseJobs as 0.58 like parseSchedules. The two validate different shapes with the same refusal style, so I did not merge them.

Try: commit a forge.json with a jobs list to a public repository and open its page. Each job shows as one line under the file listing.

Closes #18507

4 earlier comments
commented

forge.json can now declare jobs. The shape is read and validated, a bad one fails the check at the push, and the repository page lists each declared job on one line. Nothing runs yet. Pushed.

I ran jobs-spec, the unused-export and duplicate-import tests, the page budgets and the repo-page timing test, tsc, design-lint and the gate. All passed. scripts/fast.ts named 3,489 files, so I ran only the tests that cover this change. The gate still prints a similarity note, and the commits carry the "No door" and "No look" lines the gate asks for.

  • Shape: each job has a name (unique), steps (1–50 one-line commands), needs (any of macos, xcode, docker; none by default), on (pull, land or both; both by default) and secrets (names only). It lives in src/apps/jobs_spec.ts and is wired into parseManifest.
  • Refusals: each one is a sentence naming the file, entry and key, for example forge.json: jobs[0] ("ios").needs names "gpu", which is not one of macos, xcode, docker. Unknown keys, a secret that looks like a value, an empty or unknown on, and duplicate names are refused too. Jobs are checked before the app block, so a repository that is not an app has them refused as well.
  • Page: the repository code page (src/web/pages/repo.ts) shows a "Jobs" list through src/web/studio/declared_jobs.ts. The read of forge.json at the default branch tip is cached per commit (src/actions/declared_jobs.ts). The list appears only when jobs are declared.
  • Tests and docs: test/jobs-spec.test.ts covers the happy path, each refusal, the manifest refusal with and without an app, and the page with and without jobs. The how-to is docs/features/jobs-declared.md.

Not done:

  • No terminal screen and no API route for jobs; the commit says No door: nothing runs yet.
  • The page change has no before/after look, so the commit says No look: instead of naming a Looks: page.
  • Nothing executes, schedules or stores secret values.

Reuse: I followed the schedule_spec.ts and beat_spec.ts validator pattern. The gate's similarity note flags parseJobs as 0.58 like parseSchedules. The two validate different shapes with the same refusal style, so I did not merge them.

Try: commit a forge.json with a jobs list to a public repository and open its page. Each job shows as one line under the file listing.

commented

The failing test was module-state, which refuses a module-level Map that a function writes to. That was the per-commit cache in src/actions/declared_jobs.ts. I removed the cache, so declaredJobs now reads forge.json from git on every view of the repository page. Nothing is kept in memory.

module-state and jobs-spec pass, tsc is clean, and I've pushed the fix. I didn't re-run the other test files from the first round.

The rest of the pull is unchanged: jobs in forge.json is parsed and validated, and the repository page lists each declared job on one line. Nothing runs yet.

commented

forge.json can now declare jobs, with steps, needs, on and secrets. The forge reads and validates them at the push, and the repository page lists them under a "Jobs" heading. Nothing runs them yet.

The failing check was my own doing. The repository page now times the jobs read as its own phase, jobs, which sits between wave and credit in the Server-Timing header. The timing test in test/repo-timing.test.ts listed the phases without it. The test was wrong, not the code, so I added jobs to its expected list. That test passes locally. I didn't re-run the full suite; the forge's check on this push does that.

I left out running jobs: only declaring, validating and listing them is in this change.

To try it, add a jobs block to a repository's forge.json, push, and open the repository page. Each job shows its step count, when it runs, what it needs and the secret names it asks for.

commented

forge.json can declare jobs (steps, needs, on, secrets). They are checked at the push and listed on the repository page, and the terminal now has its own read-only Jobs screen. Nothing runs them yet. I ran tsc and the tests for the pages, doors, budgets, module state, dead exports and duplicate imports (all pass), but not the full suite. The forge's check does that on push.

Terminal door.

  • src/tui/screens/declared_jobs.ts is a read-only screen with the same rows and wording as the page. It is wired into the palette in workspace.ts as <owner>/<repo> — Jobs.
  • It shows nothing unless the viewer may read the repository.
  • A test in test/jobs-spec.test.ts covers the rows and a private repository.
  • The how-to docs/features/jobs-declared.md now names the screen.

Page.

  • Each job is one dl row: the name, then 1 step · runs on pull and land · needs … · secrets …. The stray leading space is gone, and the wording lives in jobFacts in src/actions/declared_jobs.ts.
  • The section is now class="stack declared-jobs", so it takes the existing section spacing. I added no CSS, and design-lint is clean.

Comment. The header comment in src/actions/declared_jobs.ts is rewrapped.

Cost.

  • The jobs read is one git read on every repository home view. It is rev-parse on the default branch, then a read of the one file forge.json at that commit.
  • It doesn't scan the tree, so it doesn't grow with the repository's size.
  • In the timing test it takes about 0.7 ms.
  • It is timed as its own jobs phase in Server-Timing.

Where I departed from the review. I first put the read check inside declaredJobs. The first-view SQL budget for an app page then went from 59 to 60. The page has already checked access, so it now calls declaredJobs(app, repo) with no second check. The terminal calls jobsFor(app, actor, repo), which checks first.

Not done.

  • The gate warns that parseJobs looks like parseSchedules, and that the new screen's functions resemble appleUsageScreen and dependenciesCommands. That is advice, not a refusal. I kept the code separate because the shapes differ.
  • The page change has no review block. The review steps would be: open a repository whose forge.json declares jobs and look for the "Jobs" section under the app strip; each job should read as 1 step · runs on pull · needs macos, xcode · secrets SIGNING_KEY; a repository with no jobs should show no section.
commented

I couldn't reproduce the two rollout failures, and I haven't found their cause. I pushed a diagnostic only, so the next check may fail the same way.

test/apps-rollout.test.ts passed three runs out of three here. The failures were the startingCount() assertions at lines 254 and about 296. They read 0 where the test expects 1, which means the boot's production deploy run had already settled within about 130 ms. My change doesn't touch that path. It adds parseJobs to src/apps/manifest.ts and the jobs read, none of which feeds startingCount for the test app. The check's log also says it did not re-run the failures alone, because the pull touches src/apps/manifest.ts, which the test imports.

I changed two things:

  • Test: the two startingCount() assertions now print the three most recent deploy runs' state and summary when they fail. A repeat failure will say how the boot run settled so early.
  • Source: bun scripts/gate.ts --fix rewrapped a comment in src/actions/declared_jobs.ts.

The commit says No door: for the terminal and docs rule, because it changes only test diagnostics and comment wrapping.

tsc is clean, and the gate exits 0 but still prints three "one implementation?" similarity notes. Two of them point at the new jobs_spec.ts and declared_jobs.ts screen.

I'm pushing to see whether the rollout test fails again in the check.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs