Skip to content

Accept a conditional tty variable in build.sh; track build-local.sh - #101

Draft
rob-metalinkage wants to merge 4 commits into
masterfrom
local-build-scripts
Draft

rob-metalinkage wants to merge 4 commits into
masterfrom
local-build-scripts

Conversation

@rob-metalinkage

@rob-metalinkage rob-metalinkage commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Local builds imported through url-mappings are rebased onto the mapped URL. A local build (build.sh) is stamped with the viewer base URL http://localhost:9090/register/. Every local build shares it, and nothing serves it during a build. When a downstream register imported such a build through a url-mapping, it followed links to localhost:9090 and failed. http_interceptor.load_content now rewrites that build's baseURL (read from <checkout>/build-local/register.json) to the mapped URL in files served from a mapped checkout's build-local/. Each upstream is rebased onto its own mapping, so chains of local builds don't collide. Files outside build-local/, builds already stamped with the mapped URL, and mappings to export directories are left alone. New tests in tests/test_http_interceptor_rebase.py.
  • ensure_build_script_interactive accepts a conditional tty variable. A docker run argument like ${TTY} / $TTY now counts as -it when build.sh assigns -it to that variable. Before, the check only recognised a literal -it/-i -t, so it would rewrite the template's new form (Only request a tty when attached to one; document local upstream builds bblocks-template#13) to docker run -it ${TTY}. That brings back the "input device is not a TTY" failure for agents, CI and scripts.
  • Remote URLs without .git are now recognised. get_github_repo only matched remotes ending in .git. A checkout cloned as https://github.com/org/repo therefore got no autodetected base URL, silently. A build with an empty --base-url, then produced a register.json with no baseURL. The .git suffix and a trailing slash are now optional, and the unescaped www/. in the pattern is fixed. New tests in tests/test_github_repo.py.
  • README has a new section, "Developing against a local build of an imported register":
    • Upstream: plain ./build.sh. Its build-local/ stays usable in the upstream's own viewer.
    • Downstream: one url-mappings entry from the upstream's base URL to the mounted checkout. This works because the loader already probes <url>/build-local/register.json whenever mappings are active.
    • Every register in between has to be rebuilt as well.
  • CLAUDE.md describes the new detection.
  • Tests: tests/test_template_sync.py covers literal -it, -i/--tty pairs, ${TTY}/$TTY/"${TTY}", a variable not set to -it, and both outcomes of ensure_build_script_interactive.

Testing

  • Full suite inside the bblocks-postprocess:latest image venv, with pytest and pytest-mock installed: 203 passed. That includes the 7 new test_template_sync.py tests, the 13 new test_github_repo.py tests and the 5 new test_http_interceptor_rebase.py tests.
  • End to end, with this branch's ogc/ mounted over the image's /src/ogc: 3d-csdm-common built with plain build.sh (baseURL http://localhost:9090/register/), then 3d-csdm-profile-icsm built against it with the single mapping https://surroundaustralia.github.io/3d-csdm-common/ → the common checkout. Result: exit 0, 4/4 blocks pass. With only register.json rebased, the same build failed fetching http://localhost:9090/register/build-local/annotated/... from common's annotated schemas, which is why the rewrite is in the interceptor.
  • ensure_build_script_interactive leaves the new template build.sh unchanged, along with four real downstream copies, one of which has a MSYS_NO_PATHCONV=1 prefix.

The template (opengeospatial/bblocks-template#13) now inlines the test as docker run $([ -t 0 ] && [ -t 1 ] && echo -it ) ..., so already-released images accept it as a literal -it. The variable detection here covers the ${TTY} form, which some repos already use.

Merge before the template PR.

🤖 Generated with Claude Code

- ensure_build_script_interactive: a docker run argument such as ${TTY}
  counts as -it when build.sh assigns -it to that variable (bblocks-template's
  TTY=$([ -t 0 ] && [ -t 1 ] && echo -it)), instead of rewriting it to
  `docker run -it ${TTY}`, which breaks non-interactive callers again
- tracked_template_files.txt: add build-local.sh (skipped until it exists
  in bblocks-template)
- README: developing against a local build of an imported register (single
  base-URL mapping + build-local/register.json probe), build.sh wrappers
- tests for the -it detection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rob-metalinkage and others added 3 commits October 23, 2026 13:42
get_github_repo required the remote URL to end in `.git`, so a checkout
cloned as `https://github.com/org/repo` (no suffix) silently got no
autodetected base URL / GitHub base URL - and a build run with an empty
--base-url (e.g. bblocks-template's build-local.sh) produced a register
with no baseURL. Make the suffix (and a trailing slash) optional, fix the
unescaped `www` / `.` in the pattern, and add tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A local build (build.sh) is stamped with the viewer base URL
http://localhost:9090/register/, shared by every local build and not served
during a build. A register importing such a build through a url-mapping then
followed links to localhost and failed. The workaround, building the upstream
with its public base URL (build-local.sh), broke the upstream's own viewer.

Files served from a mapped checkout's build-local/ now have that build's
baseURL rewritten to the mapped URL, so one mapping (public URL -> checkout)
resolves everything, and the same build still works in the viewer.
build-local.sh is no longer needed and is dropped from the tracked template
files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rob-metalinkage
rob-metalinkage marked this pull request as draft October 23, 2026 05:58
rob-metalinkage added a commit to opengeospatial/bblocks-template that referenced this pull request Oct 23, 2026
… output

The postprocessor now rewrites a mapped upstream's local viewer URLs onto the
mapped URL (opengeospatial/bblocks-postprocess#101), so an upstream no longer
needs a separate build with its public base URL, which broke its own viewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rob-metalinkage added a commit to rob-metalinkage/ogc-llm-skills that referenced this pull request Oct 23, 2026
Drop build-local.sh. The postprocessor now rewrites a mapped upstream's
local viewer URLs onto the mapped URL (opengeospatial/bblocks-postprocess#101),
so upstreams no longer need a public-base-URL build, which broke their own
viewer. Document the workaround for older images, and the empty-mount failure
when the terminal is not in the real checkout (e.g. a Docker Desktop
bind-mount copy), which breaks relative .volumes paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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