Skip to content

[GAP] Add Session::background_job_count jobs-count face (Refs #863) - #2869

Merged
caomengxuan666 merged 2 commits into
masterfrom
gap-jobs-face
Nov 6, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
gap-jobs-face

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

[GAP] Add Session::background_job_count jobs-count face

Count-only Session face for the host BackgroundJobs prompt segment
(rubash#2859, GAP queue; ruling niubash#863 comment 6675261066): the
number of job-table entries with background == true and state in
{Running, Stopped} after the cleanup_dead_jobs liveness pass —
exactly the set bare jobs lists (GNU builtins/jobs.def:83
list_all_jobs, jobs.c:2254-2257). A ^Z-stopped foreground job counts
(the stop path flips it to background = true); process-substitution
children are not table entries and never count; a completed job never
counts.

  • Q-A count-only; Q-B rule (a) verified against GNU 5.3.20 first
    (P-J1 probe, 5/5: two bg Running list 2, ^Z-stopped fg lists 1,
    reaped / disowned / killed list 0); Q-C &mut self +
    cleanup_dead_jobs at read time, mirroring the listing path; Q-D
    JobCandidate stays engine-internal.
  • Executor::background_job_count in src/executor/public_accessors.rs,
    Session::background_job_count in src/api/session.rs.
  • 6 consumer pins (issue2859_* in src/api/consumer_tests.rs):
    one/two Running, reaped (+ repeated reads, no flicker), disowned,
    Stopped (+ CONT back to Running), procsub child never counts.
  • Ledger §6 + §2.3 rows staged 0 (GAP-13 pattern); §6 279 → 281.
    The host adoption (niu prompt segment reading through this face
    instead of NIU_BACKGROUND_JOBS) follows in a niubash PR.

Verification (lane): pins 6/6; full lib branch 1136/0/3 vs base
1130/0/3; session_api stem 19/19; ledger checker 281/281 +
self-test + --niu rc=0.

本 PR 删除了什么

Nothing. Pure addition (+170 lines): the new face, its pins, and its
ledger rows. No function, file, or behavior removed; JobCandidate
deliberately untouched.

Net: +170/−0 across 4 files.

Refs #863, rubash#2859.

caomengxuan666 and others added 2 commits November 6, 2026 04:50
Count-only Session face for the host BackgroundJobs prompt segment
(rubash#2859, GAP queue; ruling #863 comment 6675261066): the number
of job-table entries with background == true and state in {Running,
Stopped} after the cleanup_dead_jobs liveness pass — exactly the set
bare `jobs` lists (GNU builtins/jobs.def:83 list_all_jobs,
jobs.c:2254-2257). A ^Z-stopped foreground job counts (the stop path
flips it to background = true); process-substitution children are not
table entries and never count; a completed job never counts.

Q-A count-only; Q-B rule (a) verified against GNU 5.3.20 first (P-J1
probe, 5/5: two bg Running list 2, ^Z-stopped fg lists 1, reaped /
disowned / killed list 0); Q-C &mut self + cleanup_dead_jobs at read
time, mirroring the listing path; Q-D JobCandidate stays
engine-internal.

6 consumer pins (issue2859_*): one/two Running, reaped (+ repeated
reads, no flicker), disowned, Stopped (+ CONT back to Running),
procsub child never counts. Ledger §6 + §2.3 rows staged 0 (GAP-13
pattern); §6 279 -> 281.

Refs #863, rubash#2859.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 6, 2026 05:13
@caomengxuan666
caomengxuan666 merged commit 1827773 into master Nov 6, 2026
10 of 11 checks passed
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.

1 participant