Skip to content

Read the build commit and source at run time when not compiled in - #402

Merged
winding-lines merged 3 commits into
mainfrom
source-from-env
Nov 12, 2026
Merged

winding-lines merged 3 commits into
mainfrom
source-from-env

Conversation

@winding-lines

Copy link
Copy Markdown
Contributor

For census #153 (cheap fix 2): today every image build passes -D MORCA_COMMIT=<sha>, so each commit changes every program and Mojo's compile cache can never hit. Measured: an unchanged program rebuilds in 7 s against 48 s cold.

  • morca.source: source_repo() and source_commit() fall back to MORCA_SOURCE and MORCA_COMMIT in the environment when the define is empty. A define still wins, and the commit must still be hex. config.mojo already reads the commit the same way for morca register.
  • deploy/project.Dockerfile, morca aws's embedded copy and deploy/Dockerfile: no more -D for the two. They're set with ARG + ENV in the final stage, declared last, so a new commit reruns only that layer.
  • The UI's "not recorded" hint names both ways.
  • tests/versions.sh: the value read from the environment, the define winning over it, and a non-hex value from the environment dropped.

MORCA_DIRTY stays a define. The census drops its own -D flags once this is in a morca release (0.25.1).

🤖 Generated with Claude Code

https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6

…nsus #153)

source_repo() and source_commit() fall back to MORCA_SOURCE and MORCA_COMMIT
in the environment when the -D defines are empty; a define still wins and the
commit must still be hex. The project Dockerfiles (deploy/project.Dockerfile,
morca aws's copy, deploy/Dockerfile) set them with ENV in the final stage
instead of -D, so a new commit no longer changes every program and Mojo's
compile cache can serve a rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
@winding-lines
winding-lines merged commit b475fa0 into main Nov 12, 2026
32 checks passed
@winding-lines
winding-lines deleted the source-from-env branch November 12, 2026 19:24
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