Skip to content

feat(oci): add floci oci command group for the Floci OCI emulator - #15

Merged
hectorvent merged 2 commits into
mainfrom
feat/oci-support
Jul 29, 2026
Merged

feat(oci): add floci oci command group for the Floci OCI emulator#15
hectorvent merged 2 commits into
mainfrom
feat/oci-support

Conversation

@hectorvent

Copy link
Copy Markdown
Contributor

Summary

Adds floci oci — full lifecycle support for the Floci OCI (Oracle Cloud) emulator, the fourth product tree alongside AWS, GCP, and Azure. Includes the OCI-only floci oci setup (the OCI CLI/SDKs require a config file + signing key, unlike the other clouds' env-var-only auth), endpoint env exports for the OCI CLI / ocilocal / Terraform, and a FlociHttpClient fix to parse floci-oci's map-shaped health services field. Verified end-to-end against a running floci-oci container: oci os ns get, bucket/object round-trip, and eval $(floci oci env) as the single connect step.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

Product trees affected

  • AWS (root tree) — shared wiring only (FlociCli, default-product, FlociHttpClient)
  • GCP (commands/gcp/) — shared wiring only
  • Azure (commands/az/) — shared wiring only
  • N/A

Adds a new commands/oci/ tree (template predates it).

Checklist

  • mvn test passes locally (37 tests)
  • New or updated tests added (OciSetupCommandTest — key/config creation, idempotency, append-without-clobber, custom profile name)
  • CHANGELOG.md entry added under [Unreleased]
  • README.md updated (OCI quick start, command tables, global flags, env/setup docs, CI recipe)
  • Native binary verified (mvn package -Pnative) — RSA keygen + all oci commands smoke-tested in the native image
  • Commit messages / PR title follow Conventional Commits

Adds the fourth product tree targeting floci-oci (port 4599, container
floci-oci, control prefix /_floci-oci, FLOCI_OCI_* env overrides):
start/stop/restart/status/logs/wait/version/services/doctor/env/config
plus stub snapshot commands, mirroring the GCP/Azure trees.

- 'floci oci env' exports OCI_CLI_ENDPOINT, FLOCI_OCI_ENDPOINT, and
  TF_VAR_CLIENT_HOST_OVERRIDES for the OCI CLI, the ocilocal wrapper,
  and the oracle/oci Terraform provider; also OCI_CLI_PROFILE=FLOCI
  when that profile exists.
- 'floci oci setup' generates an RSA-2048 API signing key with a real
  computed fingerprint and writes a throwaway [FLOCI] profile to
  ~/.oci/config (idempotent, never touches existing profiles) — the
  OCI CLI/SDKs refuse to run without them.
- FlociHttpClient now accepts both health 'services' shapes: the array
  reported by AWS/GCP/Azure servers and the {name: status} object
  reported by floci-oci.
- 'floci config default-product oci' routes bare commands to the tree.
Comment thread src/main/java/io/floci/cli/commands/oci/OciEnvCommand.java Outdated
Comment thread src/main/java/io/floci/cli/commands/oci/OciServicesCommand.java Outdated
Comment thread src/main/java/io/floci/cli/commands/oci/OciEnvCommand.java
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown

Greptile Summary

Follow-up review of the OCI command-group PR after the author addressed prior findings.

  • Single-quotes and per-shell escapes floci oci env export values (bash/fish/PowerShell) with unit coverage for hostile metacharacters.
  • floci oci services uses resolvedEndpoint so non-default host ports match status/wait/env.
  • floci oci env exports OCI_CLI_PROFILE from detectSetupProfile (key_file marker), skipping DEFAULT; tests cover custom and FLOCI preference.

Confidence Score: 5/5

Safe to merge; prior env injection, services port resolution, and custom-profile env export issues are fixed and no remaining blockers were found.

No blocking failure remains after the fix commit for shell-safe env exports, services endpoint resolution, and setup-profile detection.

Important Files Changed

Filename Overview
src/main/java/io/floci/cli/commands/oci/OciEnvCommand.java Shell-safe single-quoted exports and setup-profile detection for OCI_CLI_PROFILE; prior eval-injection and hardcoded FLOCI issues resolved.
src/main/java/io/floci/cli/commands/oci/OciServicesCommand.java Uses resolvedEndpoint before FlociHttpClient so custom start ports work without --endpoint.
src/main/java/io/floci/cli/commands/oci/OciSetupCommand.java Adds detectSetupProfile via key_file marker with FLOCI preference; supports env profile export for custom --profile-name.
src/test/java/io/floci/cli/unit/OciEnvFormatTest.java Pins bash/fish/PowerShell quoting against hostile endpoint-style values.
src/test/java/io/floci/cli/unit/OciSetupCommandTest.java Covers detectSetupProfile for custom names, FLOCI preference, and foreign key_file ignore.

Reviews (2): Last reviewed commit: "fix(oci): address review findings on env..." | Re-trigger Greptile

- Single-quote 'oci env' exports with per-shell escaping (bash/fish/
  PowerShell) so endpoint values containing shell metacharacters cannot
  inject commands through the documented 'eval $(floci oci env)' flow.
- 'oci services' resolves the endpoint from the container port mapping
  like status/wait/env, so a container started with --port <n> is found
  without passing --endpoint.
- 'oci env' exports OCI_CLI_PROFILE for whichever profile 'oci setup'
  wrote (detected via its key_file marker) instead of only the
  hardcoded FLOCI name; DEFAULT is skipped as the CLI uses it
  implicitly.
@hectorvent

Copy link
Copy Markdown
Contributor Author

Addressed all three review findings in 5d731a0:

  • Shell escaping (P1): oci env exports are now single-quoted with per-shell escaping (POSIX '\'' splice, fish \\/\', PowerShell '') — no interpolation of $, backticks, or quotes is possible through the documented eval $(floci oci env) flow. Pinned by OciEnvFormatTest, including a hostile-value case.
  • Services port auto-detection (P1): oci services now resolves the endpoint from the container's port mapping via resolvedEndpoint, matching status/wait/env. Verified live: container started with --port 4640, floci oci services with no --endpoint lists all 7 services. (The same raw-endpoint quirk exists in the AWS/GCP/Azure services commands — fixing those tree-wide is queued for the upcoming tree-unification PR rather than piling unrelated tree edits into this one.)
  • Custom profile name (P2): oci env now detects whichever profile oci setup wrote — sections are matched by their key_file pointing at the setup-generated key, preferring FLOCI, skipping DEFAULT (the CLI selects it implicitly). Covered in OciSetupCommandTest.

All 43 tests pass; eval $(floci oci env) round-trip re-verified against a live emulator.

@hectorvent
hectorvent merged commit 0a65de2 into main Jul 29, 2026
3 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