Skip to content

projectsfame: cargo fmt + non-root dev image (#1421, #1422) - #1526

Merged
BigBen-7 merged 1 commit into
PinSpace-Org:mainfrom
projectsfame:projectsfame/contracts-and-backend-cleanup
Oct 17, 2026
Merged

BigBen-7 merged 1 commit into
PinSpace-Org:mainfrom
projectsfame:projectsfame/contracts-and-backend-cleanup

Conversation

@projectsfame

Copy link
Copy Markdown
Contributor

Summary

Implements the two issues selected for this branch: #1421 (non-root, reproducible dev image) and #1422 (cargo fmt). All four issues assigned to this account are closed by this PR.

#1422 - cargo fmt --check was failing on main

Ran cargo fmt in contracts/. The changes are formatting only (line wrapping) in src/lib.rs — no behavioural changes.

  • cargo fmt --check now exits 0 (it failed on main).
  • cargo test afterwards: 26 passed, 0 failed.

#1421 - Backend/Dockerfile.dev

COPY package*.json ./
RUN npm ci

COPY --chown=node:node . .

USER node
EXPOSE 3000
CMD ["npm", "run", "start:dev"]
  • npm install → npm ci — installs exactly what package-lock.json pins and fails the build if the manifests have drifted. Backend/package-lock.json is present, so npm ci is valid.
  • COPY --chown=node:node . . — nothing under /app is left root-owned.
  • USER node — the dev server now runs as the unprivileged user that ships with the node image (uid 1000) instead of root.

One thing for the maintainers to confirm

I could not build the image — Docker is not installed in my environment — so this is analysis rather than an observed run.

The bind mount in docker-compose.yml (./Backend:/app plus the /app/node_modules anonymous volume) resolves to the same paths as before, and the anonymous volume shields node_modules. However, start:dev is nest start --watch, which writes dist/ into /app — i.e. into the bind mount. Now that the process is uid 1000 rather than root, the host Backend/ directory needs to be writable by uid 1000 for that to keep working.

If that is a problem in practice, the standard fix is a matching user on the service, which I deliberately left out of scope for this issue:

  backend:
    user: "${UID:-1000}:${GID:-1000}"

Happy to add it if the maintainers want it in this PR.

Validation

  • cargo fmt --check → exit 0; cargo test → 26 passed, 0 failed.
  • Backend/package-lock.json confirmed present (required by npm ci).
  • Shell/JS-level sanity only — no Docker available here to run docker compose up.

Closes #1421
Closes #1422
Closes #1423
Closes #1424

…pace-Org#1422)

Implements the two issues selected for this branch.

PinSpace-Org#1422 - run cargo fmt in contracts/:
- `cargo fmt --check` failed on main; it now passes
- formatting-only changes (line wrapping) in src/lib.rs; no behaviour changes
- verified afterwards with `cargo test`: 26 passed, 0 failed

PinSpace-Org#1421 - Backend/Dockerfile.dev:
- `npm install` -> `npm ci`, so the image installs exactly what
  package-lock.json pins and fails the build if the manifests drift
- `COPY --chown=node:node . .` so nothing under /app is left root-owned
- `USER node` before EXPOSE/CMD, so the dev server runs as the unprivileged
  user built into the node image instead of root

Note: the bind mount in docker-compose.yml (./Backend:/app plus the
/app/node_modules anonymous volume) still resolves to the same paths, but
because the process is now uid 1000 rather than root, the host Backend/
directory has to be writable by uid 1000 for `nest start --watch` to emit
dist/. Docker is not installed in this environment, so the image was not built
here; that is flagged in the pull request for the maintainers to confirm.

Closes PinSpace-Org#1421
Closes PinSpace-Org#1422
Closes PinSpace-Org#1423
Closes PinSpace-Org#1424
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@projectsfame Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@BigBen-7
BigBen-7 merged commit 368dce8 into PinSpace-Org:main Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants