mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
fee688bd051a5bde4e2e8a4d5e0f5d75c7ffe00a
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a636de20dc | fix(backup): persist and manage backup plan tags (#6796) | ||
|
|
ecb39dd7e0 |
fix(backup): paginate backup plan listings (#6714)
* fix(backup): paginate backup plan listings * test(backup): share SDK clients and seed large fixtures locally |
||
|
|
13d0452a20 | fix(backup): paginate ListBackupVaults (#6541) | ||
|
|
6d96849d2a |
fix(backup): resume unfinished jobs after restart (#5721)
* fix(backup): resume unfinished jobs after restart * fix(backup): address recovery review feedback Coordinate recovery-point deletion and completion, increment new-point counts, and validate vault creation identity during recovery. Local focused validation: 92 tests, four additional persistence/restart checks, and Checkstyle. Existing timestamp-granularity and legacy compatibility bounds remain. * fix(backup): simplify recovery identity and deadline tests Address maintainer feedback with the exact independently reviewed local candidate. Focused affected-area checks passed; remote CI and maintainer acceptance remain outstanding. |
||
|
|
65e35adf54 |
feat(backup): add CreateLogicallyAirGappedBackupVault (#6015)
* feat(backup): add CreateLogicallyAirGappedBackupVault
Route PUT /logically-air-gapped-backup-vaults/{name}. The vault shares the
standard vault namespace and ARN shape; DescribeBackupVault reports VaultType
LOGICALLY_AIR_GAPPED_BACKUP_VAULT, VaultState and the retention days. Both
retention values are required, MinRetentionDays >= 7, MaxRetentionDays >= Min.
The vault is locked at creation so the existing retention enforcement applies,
vault-lock put/delete are rejected on it, and ListBackupVaults honours the
vaultType filter.
Closes #4986
* docs(backup): correct the service matrix operation count
* fix(backup): fail a job whose vault was replaced before it completed
A backup job resolved its vault by name at completion. Deleting a
logically air-gapped (or locked) vault while a job was in flight is
allowed, since it holds no recovery point yet; recreating the name as a
standard vault then received the old job's recovery point, which the
unlocked replacement let be deleted inside the original vault's minimum
retention.
Completion now checks, under the vault-name monitor, that the vault
holding the name is the incarnation the job started in. If not, the job
ends FAILED with no recovery point, as it cannot land in a vault that no
longer exists.
* fix(backup): air-gapped vault LockDate at creation; standard vault VaultType BACKUP_VAULT
CreateLogicallyAirGappedBackupVault now sets LockDate to the creation
date, so the vault's lock reads as compliance mode (immutable) rather
than a governance lock with no LockDate. DescribeBackupVault and
ListBackupVaults report VaultType BACKUP_VAULT for standard vaults,
filled at read time so vaults stored with no VaultType are covered.
|
||
|
|
c23641457a |
fix(backup): publish BACKUP_JOB_COMPLETED to the vault's SNS topic (#5623)
* fix(backup): publish BACKUP_JOB_COMPLETED to the vault's SNS topic PutBackupVaultNotifications stored the configuration but job completion never read it, so a subscriber received nothing. When a backup job completes in a vault whose BackupVaultEvents include BACKUP_JOB_COMPLETED, publish one message to the configured SNSTopicArn after the job and recovery point are stored. A failed publish is logged and never undoes the completion. Other events remain stored-only; docs say which. * fix(backup): log the exception when a BACKUP_JOB_COMPLETED publish fails * test(backup): import log-capture classes instead of qualifying them inline * fix(backup): notify only the vault a job started in, not a same-name replacement completeJob looked the vault up by name at completion time, so a job whose vault was deleted and recreated mid-run published BACKUP_JOB_COMPLETED to the replacement vault's topic. Pin the vault's sub-resource key (which carries its creation date) when the job starts and read the notification configuration through it; a deleted vault's configuration goes with it, so nothing is sent. * fix(backup): match AWS's BACKUP_JOB_COMPLETED message and pin vaults by id The published notification now follows AWS's documented "Backup job completed" example: the body ends at the BackupJob ID with no vault name, and the publish carries the EventType, State, AccountId, Id and StartTime message attributes that subscription filter policies match on. Vault sub-resources and in-flight jobs were bound to a vault by its creation second, so a vault deleted and recreated within the same second shared a key with its predecessor and a running job could notify the replacement. Each vault now gets a random FlociVaultId at creation and the sub-resource key uses it; vaults stored before the field existed fall back to the creation date, so their stored configuration is still found. The id is persisted but stripped from DescribeBackupVault and ListBackupVaults responses. * test(backup): spell out the RequestSpecification type instead of var |
||
|
|
6656c8e5df |
feat(backup): configure a vault with an access policy, notifications and a lock (#4412)
* feat(backup): configure a vault — access policy, notifications and vault lock
CreateBackupVault worked, and then every write that configures the vault it
just created was unrouted. PutBackupVaultAccessPolicy, PutBackupVaultNotifications
and PutBackupVaultLockConfiguration all matched no route, so a vault could be
created but never given a policy, a lock or a notification target — which is most
of what a vault is configured for.
The two GET paths already existed as deliberate stubs that always threw
ResourceNotFoundException, on the reasoning that these are "never-configured" in
the emulator. That error contract was right and is kept for the genuinely
unconfigured case; what was missing was any way to configure one.
Adds the three PUTs, the three DELETEs, and real read paths for the two GETs:
PUT|GET|DELETE /backup-vaults/{name}/access-policy
PUT|GET|DELETE /backup-vaults/{name}/notification-configuration
PUT|DELETE /backup-vaults/{name}/vault-lock
Details worth knowing:
- Vault Lock has two modes and the difference is the point of the feature. With
ChangeableForDays the lock is governance mode: LockDate is set that far ahead
and the lock stays removable until then. Without it the lock is compliance
mode, immutable immediately. Modelling only the first would make a compliance
lock look reversible, which is exactly the property a caller sets one to get.
A locked vault also refuses DeleteBackupVault.
- The lock fields live on BackupVault because AWS returns them from
DescribeBackupVault. The access policy and notification configuration do not:
AWS exposes each only through its own Get, so they are held in their own
stores rather than as vault fields, which keeps DescribeBackupVault from
growing members real AWS does not send. Locked is a primitive so it is always
present, matching AWS and letting a client tell "not locked" from "not
modelled".
- BackupVaultEvents outside the documented set are rejected rather than stored.
An emulator that accepts a misspelt event and echoes it back lets a config
real AWS refuses pass a local test.
- Deleting an unset policy or notification configuration is a no-op, so a
Terraform destroy re-run does not fail, and both sub-resources are dropped
with their vault so a recreated vault of the same name does not inherit them.
Reported as #4103, found by running the Gruntwork Terraform corpus against
Floci: four roots in terraform-aws-data-storage fail on this and nothing else.
Tests: 16 new integration cases covering both lock modes, the round-trips, the
rejected event, the idempotent deletes and the recreate-under-the-same-name case.
61 Backup-related tests pass.
* fix(backup): correct the vault lock modes, the delete rule and the event list
Three corrections from review, all of them cases where the first version of this
branch was confidently wrong about AWS.
1. THE TWO LOCK MODES WERE INVERTED. ChangeableForDays PRESENT means compliance
mode — a lock date that far ahead, immutable on and after it. ABSENT means
governance mode — no lock date, removable at any time. The reference says so
directly: "If this parameter is not specified, you can delete Vault Lock from
the vault using DeleteBackupVaultLockConfiguration or change the Vault Lock
configuration using PutBackupVaultLockConfiguration at any time." The previous
revision had it the other way round, which turned AWS's freely removable
governance lock into a permanent one and its vault into an undeletable one.
2. A LOCK NO LONGER BLOCKS DELETING THE VAULT. A lock protects the recovery
points, not the vault shell: AWS deletes an empty vault even under a compliance
lock, and the pre-existing non-empty check is already the case AWS refuses. The
added check could therefore only ever fire where AWS succeeds — and it reached
outside this service, since BackupVaultCfnProvisioner deletes vaults during
stack teardown and tolerates only not-found.
3. THE EVENT LIST WAS 17 OF 30. Missing CONTINUOUS_BACKUP_INTERRUPTED, the three
RECOVERY_POINT_INDEX* values, the three EKS_* values and the six ACCESS_POINT_*
values. Since unknown values are rejected with 400, each missing one failed an
apply that AWS accepts. Rejecting is still right; the data was stale.
The tests asserted the inverted lock behaviour, so the suite could not have caught
any of this. Both modes are now pinned separately and in opposite directions, and
the gaps review named are covered: the cooling-off floor, the retention floors,
reconfiguring a governance lock in place, deleting an empty locked vault, the
object-bodied Policy branch, and the notification store being dropped with its
vault.
66 Backup-related tests pass, including the CloudFormation provisioner suites.
* style: use -- rather than an em dash in added prose
AGENTS.md forbids em dashes in all content and the conformance check flags
them. Five in lines this branch added, across the service, the notifications
model and the docs page. Upstream lines that already carry one are left alone.
* fix(backup): reject a non-integral vault lock retention instead of coercing it
longOrNull used JsonNode.asLong(), which silently accepts anything: 1.5
truncates to 1, true becomes 1, and the string "7" parses to 7. AWS rejects a
non-integral value for a long-typed member, so the emulator was letting a
request AWS refuses succeed against a number the caller never sent, and a
retention floor could be set from it.
Rejects with InvalidParameterValueException instead, matching the existing
shape in KinesisJsonHandler#optionalMaxRecordSize and
TimestreamInfluxDbValidation, which both refuse on !isIntegralNumber().
Found by Greptile on fork PR #16. Covered by a test that drives all three
coercions and requires each to 400.
* style(backup): import ChronoUnit instead of naming it inline
AGENTS.md requires used classes to be imported unless there is a genuine name
collision, and putBackupVaultLockConfiguration spelled
java.time.temporal.ChronoUnit.DAYS in full. There is no ChronoUnit collision in
this file.
Found by Greptile on fork PR #16, in its first review that saw the real 6-file
diff rather than the 132 files a stale base had been handing it.
* fix(backup): reject a retention value too large to represent, and free the order clash
Two follow-ups from review of the previous commit, both of which it got wrong.
THE COERCION CLASS WAS NOT CLOSED. isIntegralNumber() alone still let one
through: 99999999999999999999 IS an integral number, and longValue() truncates
it to 7766279631452241919, which then passed the retention checks as though the
caller had sent it. That is the same silent-acceptance the commit claimed to
fix, one rung up. Now guarded with canConvertToLong() as well, matching
KinesisJsonHandler#optionalMaxRecordSize, which pairs isIntegralNumber() with
canConvertToInt() for exactly this reason.
Proved by weakening the guard and running the ordered class: exactly one
failure, lockRejectsANonIntegralRetention, "Expected status code <400> but was
<204>" -- the vault lock silently set from the truncated number. Running that
test alone is not a valid control here: it 404s on a vault the earlier ordered
tests create, so it fails for the wrong reason and proves nothing.
THE NEW TEST REUSED @Order(136), already held by the retention-floor test.
Harmless in effect, since both only make requests that 400, but their relative
order was unspecified. Moved to the first genuinely free number rather than the
next one along, which was also taken.
* fix(backup): bound every Vault Lock day value at AWS's documented 36,500
AWS: "It must be a number no less than 3 and no greater than 36,500; otherwise,
an error will return." Only the floors were checked, which left two holes from
one root cause.
MinRetentionDays=40000 was accepted here and refused by AWS. That is the shape
this corpus exists to find: a Terraform configuration with changeable_for_days
= 40000 applies locally and fails for real.
Worse, Long.MAX_VALUE is a perfectly good long, so it survived the integral
check added in 5e1bed0ef -- that commit fixed representability, not the
documented range -- and reached Instant.plus(value, DAYS), which throws
ArithmeticException: long overflow. The only ExceptionMapper in the tree handles
AwsException, so it escaped as HTTP 500 rather than the documented 400. Bounding
the value makes the overflow unreachable rather than catching it afterwards.
The three floor checks become one requireDayRange so the range is stated once.
Both tests fail with the ceiling removed, which is the state before this commit:
the 40000 case and the Long.MAX_VALUE case each go from 400 to something else.
* docs(backup): stop the branch contradicting itself, and clear the order clash
Four corrections from review, all to things this branch introduced.
docs/services/backup.md:15 was changed here to "Delete an empty, unlocked
backup vault", which contradicts :132 ("A lock does not stop the vault being
deleted") and the code, where deleteBackupVault deliberately omits a lock check.
The AWS Vault Lock guide is with :132 and the code: the vault itself can be
deleted if it is empty. Line 15 was the wrong one.
BackupVaultCfnProvisioner's javadoc still said AccessPolicy, Notifications and
LockConfiguration "have no counterpart in the emulated vault". They have
counterparts now, which this branch added. The provisioner still ignores all
three, so a template declaring AccessPolicy reports CREATE_COMPLETE with nothing
attached; that is now stated as a gap in the provisioner rather than implied to
be a gap in the service. Wiring them through is separate work.
The lock log line printed "changeable for null day(s)" on a governance lock,
which is the mode where the value is absent by definition. It now names the mode.
The two tests added in the previous commit took @Order(141), which an existing
test already held -- the same clash 5e1bed0ef had to clear once. They move to the
end as 142 and 143, and the file now has no duplicate order. The pre-existing 140
declared between 136 and 137 is left alone: it executes correctly and moving a
method would be churn.
* fix(backup): accept an absent Policy on PutBackupVaultAccessPolicy
The PutBackupVaultAccessPolicy reference documents Policy as "Type: String,
Required: No", and we refused a request without one with HTTP 400. A call real
AWS accepts therefore failed locally, which is the exact divergence class this
branch exists to catch rather than introduce.
What AWS does with an omitted Policy is undetermined: the reference does not say
whether it clears the stored policy or stores an empty one, and we have not
measured it against real AWS. Clearing is the behaviour chosen here, on two
grounds. It leaves the vault carrying exactly the policy the request carried,
rather than silently retaining one the caller did not send, and the end state is
readable back through GetBackupVaultAccessPolicy, so a caller can tell what
happened. Storing an empty string would make that read return a value that is
not a valid policy document.
Present-but-empty stays an InvalidParameterValueException: an empty string is
supplied and unusable, which is a different fault from not supplying one.
The pinning test at Order(111) now asserts the clear, and it reads the policy
back through a separate GET after Order(110) has written one, so it fails if the
omission is refused and also if it is accepted as a no-op. Order(115) keeps the
old empty-document assertion.
* fix(backup): answer a missing notification parameter with MissingParameterValueException
PutBackupVaultNotifications lists MissingParameterValueException, "Indicates
that a required parameter is missing", in its Errors section, and we answered
InvalidParameterValueException for both an absent SNSTopicArn and absent
BackupVaultEvents. An SDK maps __type onto a typed exception, so a caller
catching the error AWS documents for this case never saw it.
Present-but-empty keeps InvalidParameterValueException, which is the deliberate
half of the distinction: "BackupVaultEvents": [] was supplied and is unusable,
which is not the same fault as not supplying it. A blank SNSTopicArn is now
treated the same way, where before it collapsed into the missing case.
The controller has to carry the distinction too: readStringList answers an empty
list for an absent member, so the service could not tell [] from absent. It now
passes null when the member is missing or null.
No new exception class or mapper was needed. AwsException takes the error code
as a string and jsonType() passes through any code not in its Query-to-JSON
remapping table, so MissingParameterValueException surfaces as HTTP 400 with
__type MissingParameterValueException. The test asserts that on the wire rather
than trusting it.
* fix(backup): quote the real Vault Lock day limits, and drop the invented MinRetentionDays ceiling
Two lines of this branch, one in BackupService and one in the test, attributed a
quotation to AWS that the PutBackupVaultLockConfiguration reference does not
contain: "no less than 3 and no greater than 36,500", presented as a single
ceiling covering every day value. The reference states three separate things,
per field:
ChangeableForDays "you must set ChangeableForDays to 3 or greater" and
"The maximum value you can specify is 36,500 days"
MaxRetentionDays "The longest maximum retention period you can specify is
36500 days"
MinRetentionDays "The shortest minimum retention period you can specify is
1 day", and no maximum at all
The fabricated sentence is replaced by those three, attributed to the field each
one belongs to. No claim about AWS appears here that is not read from the
reference; the floor of 1 on MaxRetentionDays is left in place but is no longer
presented as an AWS citation, because the reference does not state one.
MinRetentionDays no longer carries the 36,500 ceiling. The choice was to drop it
rather than keep it labelled as our own inference: applying an undocumented
maximum refuses a value real AWS accepts, which is the same divergence class the
Policy fix two commits back removed, pointing the other way. Nothing else
depends on the bound. Only ChangeableForDays reaches Instant.plus, so the
overflow the ceiling was also protecting against stays unreachable, and the
min-versus-max cross-check still applies when both are supplied.
requireDayRange takes a nullable ceiling, null meaning the reference documents
no maximum. Order(142) now asserts the ceiling on the two fields that have one
and asserts that MinRetentionDays 40000 is accepted and reads back, so the
dropped bound is pinned rather than merely absent.
* test(backup): pin the canConvertToLong guard with a value that wraps into range
The !n.canConvertToLong() half of the integral-number guard was load-bearing and
untested: deleting it left all 58 tests green. Order(140) fed it
99999999999999999999, which longValue() truncates to 7766279631452241919, and
that is above the retention ceiling, so the range check rejected the request
whether or not the guard was there. The test could not see the difference.
The value is now 18446744073709551623, which is 2^64 + 7: longValue() keeps the
low 64 bits and it wraps to 7, comfortably inside the valid range. Nothing
downstream rejects it, so the guard is the only thing standing between the
request and a lock configured from a number the caller never sent.
Verified by deleting !n.canConvertToLong() from the guard and re-running:
lockRejectsANonIntegralRetention fails, 204 where it expects 400. Restored, it
passes. Production code is unchanged apart from comments.
Also drops "#16" from the Greptile attribution in BackupController. On a fork PR
it is a live reference; reaching floci-io/floci it would auto-link to an
unrelated upstream issue. The comment's worked example is updated to the value
the test now uses.
* test(backup): cover the blank SNSTopicArn rejection, which no test reached
|
||
|
|
9e35046647 |
Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml * docs: sync with main and new features * docs: reverting docker-compose.yml |
||
|
|
c2cc053853 | feat(backup): AWS Backup management-plane API (#734) |