feat(dirty-content-fingerprint): worker shows fingerprint in --version
Worker's hand-rolled OPT_VERSION case now composes via a genuinely separate version_display_buf/xce_compose_version_ex() call, mirroring task 3.2's already-approved controller/scheduler pattern exactly. Both startup-log XCECD_LOG call sites (--peers and no-peers) are left completely untouched, same xce_compose_version() call, same version_buf. Verified independently by review with a real build and live daemon runs in both branches: --version shows <commit>-<fingerprint> matching compile_commands.json, -dirty correctly stripped not doubled; both startup log branches show the old fingerprint-less format unchanged. All three C daemons (controller, scheduler, worker) are now complete. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
fd62e26bce
commit
d3d9522f27
2 changed files with 28 additions and 6 deletions
|
|
@ -18,7 +18,7 @@
|
|||
- _Requirements: 1.1, 1.2, 1.3, 5.1_
|
||||
- _Boundary: Nix packaging_
|
||||
|
||||
- [ ] 3. Core: C daemon --version fingerprint display
|
||||
- [x] 3. Core: C daemon --version fingerprint display
|
||||
- [x] 3.1 Extend the shared version-composition mechanism with an optional fingerprint field, without touching commit_id
|
||||
- New sibling function `xce_compose_version_ex()` added alongside the completely untouched `xce_compose_version()` (zero diff lines in its body or its 3 pre-existing tests); anchors the `-dirty` strip via a true tail-slice `strcmp` (not `strstr`), so it cannot false-match a `-dirty` substring elsewhere; correctly appends `-<fingerprint>` with exactly one dash even when the commit field has no `-dirty` to strip; delegates via a genuine `return xce_compose_version(...)` call (not a re-implementation) when the fingerprint is empty/NULL, structurally guaranteeing byte-identical output, proven by a dedicated equivalence regression test
|
||||
- No `main.c` call sites were touched by this task (grep-confirmed all still call the original, untouched `xce_compose_version()`) -- that's tasks 3.2/3.3's job
|
||||
|
|
@ -33,9 +33,9 @@
|
|||
- _Boundary: controller/main.c, scheduler/main.c, controller/testsuite/test.c_
|
||||
- _Depends: 3.1_
|
||||
|
||||
- [ ] 3.3 (P) Worker: fingerprint in --version, startup log unaffected
|
||||
- Worker's hand-added `--version` case composes with the new `dirty_fingerprint` value; its startup INFO log line's composition call is left unchanged
|
||||
- Observable confirmed live: on a dirty tree, `xcecd --version` shows the fingerprint suffix; both startup log branches remain byte-identical to the original feature's already-shipped format
|
||||
- [x] 3.3 (P) Worker: fingerprint in --version, startup log unaffected
|
||||
- `OPT_VERSION`'s case now composes via a genuinely separate `version_display_buf`/`xce_compose_version_ex()` call, byte-for-byte mirroring task 3.2's already-approved controller/scheduler pattern (independently confirmed by review via direct diff comparison against commit `fd62e26`); both `XCECD_LOG` startup-log call sites (`--peers` and no-`--peers`) left completely untouched, same `xce_compose_version()` call, same `version_buf`
|
||||
- Observable confirmed live (independently re-verified by review, real build + live daemon runs in both branches): `xcecd --version` shows `<commit>-<fingerprint>` matching `compile_commands.json` exactly, `-dirty` correctly stripped not doubled; both startup log branches show the old fingerprint-less `<commit>-dirty` format unchanged
|
||||
- _Requirements: 1.1, 1.2, 1.3, 1.4, 2.1, 3.1, 3.2, 4.1_
|
||||
- _Boundary: worker/main.c_
|
||||
- _Depends: 3.1_
|
||||
|
|
|
|||
|
|
@ -323,6 +323,16 @@ int main(int argc, char* argv[])
|
|||
* read this SAME buffer, never recomputing it independently, so the
|
||||
* two can never disagree (Requirement 2.2). */
|
||||
static char version_buf[128];
|
||||
/* dirty-content-fingerprint task 3.3: SEPARATE buffer/composition, used
|
||||
* ONLY for the --version case below. version_buf above is left
|
||||
* completely untouched -- its own xce_compose_version() call and the
|
||||
* two mutually-exclusive startup INFO log lines reading it (further
|
||||
* down) are unaffected by this feature, per Requirement 3.2. This
|
||||
* divergence (the two call sites now showing different strings) is
|
||||
* deliberate, not an oversight -- mirrors controller/main.c's and
|
||||
* scheduler/src/main.c's identical version_display_buf pattern
|
||||
* (dirty-content-fingerprint task 3.2). */
|
||||
static char version_display_buf[128];
|
||||
xce_cluster_config_t cluster_cfg = {0};
|
||||
int use_ha = 0; /* 1 when --peers given */
|
||||
|
||||
|
|
@ -378,6 +388,15 @@ int main(int argc, char* argv[])
|
|||
* ready by the time the startup INFO log lines run later in main(). */
|
||||
xce_compose_version(version_buf, sizeof(version_buf), "xce v0.0.1-",
|
||||
STR(VERSION_COMMIT_ID), STR(VERSION_BUILD_TIME));
|
||||
/* dirty-content-fingerprint task 3.3: --version-only composition --
|
||||
* appends the dirty_fingerprint suffix (if any) on top of the same
|
||||
* commit/build_time inputs. Do NOT fold this into version_buf above; the
|
||||
* startup INFO log lines must keep showing the original, fingerprint-
|
||||
* less format (Req 3.2). */
|
||||
xce_compose_version_ex(version_display_buf, sizeof(version_display_buf),
|
||||
"xce v0.0.1-", STR(VERSION_COMMIT_ID),
|
||||
STR(VERSION_BUILD_TIME),
|
||||
STR(VERSION_DIRTY_FINGERPRINT));
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "n:l:vh", long_opts, NULL))
|
||||
!= -1) {
|
||||
|
|
@ -402,8 +421,11 @@ int main(int argc, char* argv[])
|
|||
case OPT_VERSION:
|
||||
/* Prints and exits before any other startup work (peer
|
||||
* parsing, check_user(), daemon init, etc.) -- same contract
|
||||
* as controller/scheduler's --version. */
|
||||
printf("%s\n", version_buf);
|
||||
* as controller/scheduler's --version. dirty-content-fingerprint
|
||||
* task 3.3: prints version_display_buf (fingerprint-aware), not
|
||||
* version_buf -- the startup INFO log lines further down keep
|
||||
* reading the original version_buf, untouched. */
|
||||
printf("%s\n", version_display_buf);
|
||||
return 0;
|
||||
case 'h':
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue